diff --git a/.idea/assetWizardSettings.xml b/.idea/assetWizardSettings.xml index db2e44189e..bff4400c8d 100644 --- a/.idea/assetWizardSettings.xml +++ b/.idea/assetWizardSettings.xml @@ -338,9 +338,10 @@ diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 3cd2840aee..d535e845d0 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -11,6 +11,6 @@ - + \ No newline at end of file diff --git a/.idea/deploymentTargetSelector.xml b/.idea/deploymentTargetSelector.xml index 9d4a8bee21..f1bd8d2224 100644 --- a/.idea/deploymentTargetSelector.xml +++ b/.idea/deploymentTargetSelector.xml @@ -4,6 +4,14 @@ diff --git a/.idea/gradle.xml b/.idea/gradle.xml index 46f865404b..0dc03d0440 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,6 +4,7 @@ - + + - + diff --git a/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.iml b/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.iml index 6a34b2cf70..5a182c0d2b 100644 --- a/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.iml +++ b/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.iml @@ -3,8 +3,8 @@ - @@ -13,20 +13,18 @@ - + - + \ No newline at end of file diff --git a/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.main.iml b/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.main.iml index 23dfd33271..d15e4b917a 100644 --- a/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.main.iml +++ b/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.main.iml @@ -7,14 +7,12 @@ - + @@ -22,17 +20,17 @@ - + - + diff --git a/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.unitTest.iml b/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.unitTest.iml index e8ad1d8af7..90badbd6c8 100644 --- a/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.unitTest.iml +++ b/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.unitTest.iml @@ -7,20 +7,18 @@ - + - + diff --git a/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.androidTest.iml b/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.androidTest.iml index b73cdd45ae..e5276910c3 100644 --- a/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.androidTest.iml +++ b/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.androidTest.iml @@ -7,24 +7,23 @@ - + + - + diff --git a/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.iml b/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.iml index 9c1d73bbc6..575643e7d6 100644 --- a/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.iml +++ b/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.iml @@ -3,8 +3,8 @@ - @@ -13,20 +13,18 @@ - + - + \ No newline at end of file diff --git a/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.main.iml b/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.main.iml index 37225ab9f9..1a8c797476 100644 --- a/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.main.iml +++ b/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.main.iml @@ -7,14 +7,12 @@ - + @@ -22,16 +20,16 @@ - + - + \ No newline at end of file diff --git a/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.unitTest.iml b/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.unitTest.iml index 9c2d708559..97eba29f0e 100644 --- a/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.unitTest.iml +++ b/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.unitTest.iml @@ -7,20 +7,18 @@ - + - + diff --git a/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.androidTest.iml b/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.androidTest.iml index 5afafd6ebe..e522657c2f 100644 --- a/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.androidTest.iml +++ b/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.androidTest.iml @@ -7,24 +7,23 @@ - + + - + diff --git a/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.iml b/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.iml index 7c4c9ceae7..f0ea5f2d81 100644 --- a/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.iml +++ b/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.iml @@ -3,8 +3,8 @@ - @@ -13,20 +13,18 @@ - + - + \ No newline at end of file diff --git a/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.main.iml b/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.main.iml index 4cd4dfe872..149caf9c34 100644 --- a/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.main.iml +++ b/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.main.iml @@ -7,14 +7,12 @@ - + @@ -22,16 +20,16 @@ - + - + diff --git a/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.unitTest.iml b/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.unitTest.iml index ca4b424b42..d489f11371 100644 --- a/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.unitTest.iml +++ b/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.unitTest.iml @@ -7,20 +7,18 @@ - + - + diff --git a/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.androidTest.iml b/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.androidTest.iml index 6537ec4b7b..02668f337e 100644 --- a/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.androidTest.iml +++ b/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.androidTest.iml @@ -7,24 +7,23 @@ - + + - + diff --git a/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.iml b/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.iml index c95787c395..c61b4abda6 100644 --- a/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.iml +++ b/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.iml @@ -3,8 +3,8 @@ - @@ -13,20 +13,18 @@ - + - + \ No newline at end of file diff --git a/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.main.iml b/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.main.iml index d429291aa9..35eccf973c 100644 --- a/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.main.iml +++ b/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.main.iml @@ -7,14 +7,12 @@ - + @@ -22,16 +20,16 @@ - + - + diff --git a/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.unitTest.iml b/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.unitTest.iml index 850378a7c9..7b4a262590 100644 --- a/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.unitTest.iml +++ b/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.unitTest.iml @@ -7,20 +7,18 @@ - + - + diff --git a/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.androidTest.iml b/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.androidTest.iml index f1bfb5f898..40752d2bbb 100644 --- a/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.androidTest.iml +++ b/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.androidTest.iml @@ -7,24 +7,23 @@ - + + - + diff --git a/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.iml b/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.iml index 511e475291..f8ffd11508 100644 --- a/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.iml +++ b/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.iml @@ -3,8 +3,8 @@ - @@ -13,20 +13,18 @@ - + - + \ No newline at end of file diff --git a/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.main.iml b/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.main.iml index ff3047a24b..6129a42aef 100644 --- a/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.main.iml +++ b/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.main.iml @@ -7,14 +7,12 @@ - + @@ -22,10 +20,10 @@ - + @@ -33,7 +31,7 @@ - + diff --git a/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.unitTest.iml b/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.unitTest.iml index 4ced854b74..5d62166ea9 100644 --- a/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.unitTest.iml +++ b/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.unitTest.iml @@ -7,20 +7,18 @@ - + - + diff --git a/.idea/modules/common/PhoneProfilesPlus.common.androidTest.iml b/.idea/modules/common/PhoneProfilesPlus.common.androidTest.iml index 327a004fda..9f7c2b406d 100644 --- a/.idea/modules/common/PhoneProfilesPlus.common.androidTest.iml +++ b/.idea/modules/common/PhoneProfilesPlus.common.androidTest.iml @@ -7,24 +7,23 @@ - + + - + diff --git a/.idea/modules/common/PhoneProfilesPlus.common.iml b/.idea/modules/common/PhoneProfilesPlus.common.iml index a9792cba3a..e3e6e14a54 100644 --- a/.idea/modules/common/PhoneProfilesPlus.common.iml +++ b/.idea/modules/common/PhoneProfilesPlus.common.iml @@ -3,8 +3,8 @@ - @@ -13,20 +13,18 @@ - + - + \ No newline at end of file diff --git a/.idea/modules/common/PhoneProfilesPlus.common.main.iml b/.idea/modules/common/PhoneProfilesPlus.common.main.iml index 24780bd0ba..a0c24a8f50 100644 --- a/.idea/modules/common/PhoneProfilesPlus.common.main.iml +++ b/.idea/modules/common/PhoneProfilesPlus.common.main.iml @@ -7,29 +7,25 @@ - + - - - - + + - + \ No newline at end of file diff --git a/.idea/modules/common/PhoneProfilesPlus.common.unitTest.iml b/.idea/modules/common/PhoneProfilesPlus.common.unitTest.iml index a61c783a68..3c64789513 100644 --- a/.idea/modules/common/PhoneProfilesPlus.common.unitTest.iml +++ b/.idea/modules/common/PhoneProfilesPlus.common.unitTest.iml @@ -7,20 +7,18 @@ - + - + diff --git a/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.androidTest.iml b/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.androidTest.iml index 30b253f81c..612b409c2d 100644 --- a/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.androidTest.iml +++ b/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.androidTest.iml @@ -7,24 +7,23 @@ - + + - + diff --git a/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.iml b/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.iml index e5e1efbfa0..bfa6ff8c34 100644 --- a/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.iml +++ b/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.iml @@ -3,8 +3,8 @@ - @@ -13,20 +13,18 @@ - + - + \ No newline at end of file diff --git a/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.main.iml b/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.main.iml index 4d03d1b4e5..2ae4fce608 100644 --- a/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.main.iml +++ b/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.main.iml @@ -7,14 +7,12 @@ - + @@ -22,23 +20,16 @@ - - - - - - - - + - + diff --git a/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.unitTest.iml b/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.unitTest.iml index 08baf02165..5bd55b6f7a 100644 --- a/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.unitTest.iml +++ b/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.unitTest.iml @@ -7,20 +7,18 @@ - + - + diff --git a/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.androidTest.iml b/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.androidTest.iml index 1e68018685..eb2653b077 100644 --- a/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.androidTest.iml +++ b/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.androidTest.iml @@ -7,13 +7,11 @@ - + @@ -21,11 +19,11 @@ - + @@ -35,7 +33,7 @@ - + @@ -48,20 +46,20 @@ - - - - - + + + + + + + + - - - @@ -93,43 +91,42 @@ - + - - + + - - - - - + + + + + - - + + - - - + + - - - - + + + + - + diff --git a/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.iml b/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.iml index 74b4317703..751c122a18 100644 --- a/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.iml +++ b/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.iml @@ -3,8 +3,8 @@ - @@ -13,19 +13,17 @@ - + - + \ No newline at end of file diff --git a/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.main.iml b/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.main.iml index 14c65d2c9b..9dbf6dbadf 100644 --- a/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.main.iml +++ b/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.main.iml @@ -7,13 +7,11 @@ - + @@ -21,21 +19,15 @@ - - - - - - + - @@ -45,7 +37,7 @@ - + @@ -57,20 +49,20 @@ - - - - - + + + + + + + + - - - @@ -102,44 +94,43 @@ - + - - + + - - - - + + + + - + - - + + - - - + + - - - - + + + + - + diff --git a/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.unitTest.iml b/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.unitTest.iml index 62110d7c4c..22e982af78 100644 --- a/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.unitTest.iml +++ b/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.unitTest.iml @@ -7,19 +7,17 @@ - + - + @@ -32,20 +30,20 @@ - - - - - + + + + + + + + - - - @@ -77,43 +75,42 @@ - + - - + + - - - - - + + + + + - - + + - - - + + - - - - + + + + - + diff --git a/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.androidTest.iml b/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.androidTest.iml index b3b7a55def..bae65dd948 100644 --- a/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.androidTest.iml +++ b/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.androidTest.iml @@ -7,24 +7,23 @@ - + + - + diff --git a/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.iml b/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.iml index 006ed6e854..b3cdc7fcf7 100644 --- a/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.iml +++ b/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.iml @@ -3,8 +3,8 @@ - @@ -13,20 +13,18 @@ - + - + \ No newline at end of file diff --git a/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.main.iml b/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.main.iml index 4f91b8b3f4..33508cc972 100644 --- a/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.main.iml +++ b/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.main.iml @@ -7,14 +7,12 @@ - + @@ -22,17 +20,17 @@ - + - + diff --git a/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.unitTest.iml b/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.unitTest.iml index 7c9cf76ff5..5a9283c712 100644 --- a/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.unitTest.iml +++ b/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.unitTest.iml @@ -7,20 +7,18 @@ - + - + diff --git a/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.androidTest.iml b/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.androidTest.iml index d8e2736cf3..a71c39c60d 100644 --- a/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.androidTest.iml +++ b/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.androidTest.iml @@ -7,24 +7,23 @@ - + + - + diff --git a/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.iml b/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.iml index 6508fa072f..7ff3dafd29 100644 --- a/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.iml +++ b/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.iml @@ -3,8 +3,8 @@ - @@ -13,20 +13,18 @@ - + - + \ No newline at end of file diff --git a/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.main.iml b/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.main.iml index 45c80520c7..574ddc02dc 100644 --- a/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.main.iml +++ b/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.main.iml @@ -7,14 +7,12 @@ - + @@ -22,17 +20,17 @@ - + - + diff --git a/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.unitTest.iml b/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.unitTest.iml index 16debe7f5e..816925dce1 100644 --- a/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.unitTest.iml +++ b/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.unitTest.iml @@ -7,20 +7,18 @@ - + - + diff --git a/.idea/other.xml b/.idea/other.xml deleted file mode 100644 index 4604c44601..0000000000 --- a/.idea/other.xml +++ /dev/null @@ -1,252 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000000..16660f1d80 --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/AndroidClearChroma/build.gradle b/AndroidClearChroma/build.gradle index c8a0c2e362..fdb212063d 100644 --- a/AndroidClearChroma/build.gradle +++ b/AndroidClearChroma/build.gradle @@ -13,8 +13,8 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -29,6 +29,10 @@ android { // lintOptions { // abortOnError false // } + + lint { + disable += ['ExpiredTargetSdkVersion'] + } } dependencies { diff --git a/AndroidClearChroma/src/main/java/com/kunzisoft/androidclearchroma/colormode/ColorMode.java b/AndroidClearChroma/src/main/java/com/kunzisoft/androidclearchroma/colormode/ColorMode.java index 420f9b28e4..3e60ee8566 100644 --- a/AndroidClearChroma/src/main/java/com/kunzisoft/androidclearchroma/colormode/ColorMode.java +++ b/AndroidClearChroma/src/main/java/com/kunzisoft/androidclearchroma/colormode/ColorMode.java @@ -40,9 +40,6 @@ public int getId() { */ public AbstractColorMode getColorMode() { switch (this) { - case RGB: - default: - return new RGB(); case HSV: return new HSV(); case ARGB: @@ -53,6 +50,9 @@ public AbstractColorMode getColorMode() { return new CMYK255(); case HSL: return new HSL(); + case RGB: + default: + return new RGB(); } } diff --git a/AndroidClearChroma/src/main/java/com/kunzisoft/androidclearchroma/view/ChromaColorView.java b/AndroidClearChroma/src/main/java/com/kunzisoft/androidclearchroma/view/ChromaColorView.java index 42bd6da1d4..f26d06c800 100644 --- a/AndroidClearChroma/src/main/java/com/kunzisoft/androidclearchroma/view/ChromaColorView.java +++ b/AndroidClearChroma/src/main/java/com/kunzisoft/androidclearchroma/view/ChromaColorView.java @@ -11,7 +11,6 @@ import android.text.TextWatcher; import android.util.AttributeSet; import android.view.View; -import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; import android.widget.EditText; import android.widget.LinearLayout; @@ -102,6 +101,7 @@ private void init(Context context, @Nullable AttributeSet attributeSet) { colorView = root.findViewById(R.id.acch_color_view); colorEdit = root.findViewById(R.id.acch_color_edit); + //noinspection DataFlowIssue colorEdit.setBackgroundTintList(ContextCompat.getColorStateList(context/*getBaseContext()*/, R.color.highlighted_edittext_all)); //colorEditButton = root.findViewById(R.id.acch_color_edit_button); @@ -136,7 +136,8 @@ private void createView(boolean alsoColorEdit) { colorEdit.setText(String.format("%06X", 0xFFFFFF & currentColor)); //colorEditButton.setText(String.format("%06X", 0xFFFFFF & currentColor)); - ViewGroup channelContainer = findViewById(R.id.acch_channel_container); + LinearLayout channelContainer = findViewById(R.id.acch_channel_container); + //noinspection DataFlowIssue channelContainer.removeAllViews(); List channels = colorMode.getColorMode().getChannels(); @@ -260,6 +261,7 @@ public void afterTextChanged(Editable editable) { getResources().getDimensionPixelSize(R.dimen.acch_channel_view_margin_top); params.bottomMargin = getResources().getDimensionPixelSize(R.dimen.acch_channel_view_margin_bottom); + //currentChannelView.requestLayout(); } } diff --git a/AndroidClearChroma/src/main/res/layout-land/acch_chroma_color.xml b/AndroidClearChroma/src/main/res/layout-land/acch_chroma_color.xml index c8e49beb98..5ccbf68d6c 100644 --- a/AndroidClearChroma/src/main/res/layout-land/acch_chroma_color.xml +++ b/AndroidClearChroma/src/main/res/layout-land/acch_chroma_color.xml @@ -27,17 +27,51 @@ android:layout_height="wrap_content" android:orientation="vertical" > - + android:layout_marginTop="10dp" + android:layout_marginBottom="10dp"> + + + + + + + + + + + + + + + + + diff --git a/AndroidClearChroma/src/main/res/layout/acch_channel_row.xml b/AndroidClearChroma/src/main/res/layout/acch_channel_row.xml index 164bd5ef78..3dcb5334d1 100644 --- a/AndroidClearChroma/src/main/res/layout/acch_channel_row.xml +++ b/AndroidClearChroma/src/main/res/layout/acch_channel_row.xml @@ -23,7 +23,7 @@ @@ -46,8 +47,14 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" - android:layout_marginEnd="8dp" - android:layout_marginStart="16dp" android:layout_toEndOf="@id/acch_label" - android:layout_toStartOf="@id/acch_progress_text"/> + android:layout_toStartOf="@id/acch_progress_text" + android:minHeight="3dp" + android:maxHeight="3dp" + android:progressDrawable="@drawable/seek_bar_drawable" + android:thumb="@drawable/seek_bar_thumb" + android:thumbTint="@color/accent_color" + android:splitTrack="false" + /> + \ No newline at end of file diff --git a/AndroidClearChroma/src/main/res/layout/acch_chroma_color.xml b/AndroidClearChroma/src/main/res/layout/acch_chroma_color.xml index 138d1560b4..3cfd75f47a 100644 --- a/AndroidClearChroma/src/main/res/layout/acch_chroma_color.xml +++ b/AndroidClearChroma/src/main/res/layout/acch_chroma_color.xml @@ -28,18 +28,52 @@ android:layout_height="wrap_content" android:orientation="vertical"> - + android:layout_marginTop="10dp" + android:layout_marginBottom="10dp"> + + + + + + + + + + + + + + + + + + diff --git a/README.md b/README.md index eefe6a4a4a..e79b580e5b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ PhoneProfilesPlus (PPP) =========================== -[![version](https://img.shields.io/badge/version-6.5.1.1-blue)](https://github.com/henrichg/PhoneProfilesPlus/releases/tag/6.5.1.1) +[![version](https://img.shields.io/badge/version-7.0-blue)](https://github.com/henrichg/PhoneProfilesPlus/releases/tag/7.0) [![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html) [![License](https://img.shields.io/hexpm/l/plug.svg)](https://github.com/henrichg/PhoneProfilesPlus/blob/master/LICENSE) [![Crowdin](https://badges.crowdin.net/phoneprofilesplus/localized.svg)](https://crowdin.com/project/phoneprofilesplus)\ @@ -22,6 +22,10 @@ Discord PPP server invitation: https://discord.gg/Yb5hgAstQ3 ### Sources of PhoneProfilesPlus: +NOTE: Google Play Protect may display dialog box with title "Unsafe app blocked" and description "This app was build for an older version of Android and doesn`t include the latest privacy protection." +Please click in this dialog "More details" and then "Install anyway".\ +Dialog is displayed, because PPP has target SDK vesion 28 (Android 9). Must be, because of functionalities in PPP. + Use keyword "PhoneProfilesPlus" for search this application in these stores: __Droid-ify (F-Droid alternative, preferred over GitHub):__ @@ -112,12 +116,15 @@ _*** Please help me with translation, thank you: CREATOR - = new Creator() { + public static final Creator CREATOR + = new Creator<>() { public SavedState createFromParcel(Parcel in) { return new SavedState(in); } diff --git a/android-betterpickers/src/main/res/drawable-hdpi/dialog_full_holo_dark.9.png b/android-betterpickers/src/main/res/drawable-hdpi/dialog_full_holo_dark.9.png deleted file mode 100644 index 13205f05b1..0000000000 Binary files a/android-betterpickers/src/main/res/drawable-hdpi/dialog_full_holo_dark.9.png and /dev/null differ diff --git a/android-betterpickers/src/main/res/drawable-hdpi/dialog_full_holo_light.9.png b/android-betterpickers/src/main/res/drawable-hdpi/dialog_full_holo_light.9.png deleted file mode 100644 index 6f5dcc123c..0000000000 Binary files a/android-betterpickers/src/main/res/drawable-hdpi/dialog_full_holo_light.9.png and /dev/null differ diff --git a/android-betterpickers/src/main/res/drawable-mdpi/dialog_full_holo_dark.9.png b/android-betterpickers/src/main/res/drawable-mdpi/dialog_full_holo_dark.9.png deleted file mode 100644 index 63144ae128..0000000000 Binary files a/android-betterpickers/src/main/res/drawable-mdpi/dialog_full_holo_dark.9.png and /dev/null differ diff --git a/android-betterpickers/src/main/res/drawable-mdpi/dialog_full_holo_light.9.png b/android-betterpickers/src/main/res/drawable-mdpi/dialog_full_holo_light.9.png deleted file mode 100644 index 953ba78334..0000000000 Binary files a/android-betterpickers/src/main/res/drawable-mdpi/dialog_full_holo_light.9.png and /dev/null differ diff --git a/android-betterpickers/src/main/res/drawable-night/button_background.xml b/android-betterpickers/src/main/res/drawable-night/button_background.xml index 54cbcb44d1..d59d6ebdfe 100644 --- a/android-betterpickers/src/main/res/drawable-night/button_background.xml +++ b/android-betterpickers/src/main/res/drawable-night/button_background.xml @@ -1,9 +1,10 @@ - - - + + + + + + + \ No newline at end of file diff --git a/android-betterpickers/src/main/res/drawable-xhdpi/dialog_full_holo_dark.9.png b/android-betterpickers/src/main/res/drawable-xhdpi/dialog_full_holo_dark.9.png deleted file mode 100644 index a8ab305f04..0000000000 Binary files a/android-betterpickers/src/main/res/drawable-xhdpi/dialog_full_holo_dark.9.png and /dev/null differ diff --git a/android-betterpickers/src/main/res/drawable-xhdpi/dialog_full_holo_light.9.png b/android-betterpickers/src/main/res/drawable-xhdpi/dialog_full_holo_light.9.png deleted file mode 100644 index a8f02d664f..0000000000 Binary files a/android-betterpickers/src/main/res/drawable-xhdpi/dialog_full_holo_light.9.png and /dev/null differ diff --git a/android-betterpickers/src/main/res/drawable-xxhdpi/dialog_full_holo_dark.9.png b/android-betterpickers/src/main/res/drawable-xxhdpi/dialog_full_holo_dark.9.png deleted file mode 100644 index a8ab305f04..0000000000 Binary files a/android-betterpickers/src/main/res/drawable-xxhdpi/dialog_full_holo_dark.9.png and /dev/null differ diff --git a/android-betterpickers/src/main/res/drawable-xxhdpi/dialog_full_holo_light.9.png b/android-betterpickers/src/main/res/drawable-xxhdpi/dialog_full_holo_light.9.png deleted file mode 100644 index a8f02d664f..0000000000 Binary files a/android-betterpickers/src/main/res/drawable-xxhdpi/dialog_full_holo_light.9.png and /dev/null differ diff --git a/android-betterpickers/src/main/res/drawable/button_background.xml b/android-betterpickers/src/main/res/drawable/button_background.xml index 6fb258282c..d59d6ebdfe 100644 --- a/android-betterpickers/src/main/res/drawable/button_background.xml +++ b/android-betterpickers/src/main/res/drawable/button_background.xml @@ -1,9 +1,10 @@ - - - + + + + + + + \ No newline at end of file diff --git a/android-betterpickers/src/main/res/drawable/key_background.xml b/android-betterpickers/src/main/res/drawable/key_background.xml index 9e8870fd9c..391223a07d 100644 --- a/android-betterpickers/src/main/res/drawable/key_background.xml +++ b/android-betterpickers/src/main/res/drawable/key_background.xml @@ -1,7 +1,7 @@ + android:color="@color/pp_rippleRectangeleItemBackgroundColor"> diff --git a/android-betterpickers/src/main/res/layout/number_picker_view.xml b/android-betterpickers/src/main/res/layout/number_picker_view.xml index 737fa321ff..859b44d7b6 100644 --- a/android-betterpickers/src/main/res/layout/number_picker_view.xml +++ b/android-betterpickers/src/main/res/layout/number_picker_view.xml @@ -78,7 +78,7 @@ android:gravity="center" android:layout_gravity="center" android:src="@drawable/ic_backspace_bp" - android:background="?selectableItemBackgroundBorderless" + android:background="@drawable/button_background" android:contentDescription="@string/backspace_button_tooltip"/> diff --git a/android-betterpickers/src/main/res/values-night/colors.xml b/android-betterpickers/src/main/res/values-night/colors.xml index 8e289f1908..12ce04b879 100644 --- a/android-betterpickers/src/main/res/values-night/colors.xml +++ b/android-betterpickers/src/main/res/values-night/colors.xml @@ -1,5 +1,6 @@ - #606060 + + #5e524c #DFDFDF diff --git a/android-betterpickers/src/main/res/values/colors.xml b/android-betterpickers/src/main/res/values/colors.xml index 70417272db..bfb190ca6d 100644 --- a/android-betterpickers/src/main/res/values/colors.xml +++ b/android-betterpickers/src/main/res/values/colors.xml @@ -1,24 +1,29 @@ #ffffff - #4c4c4c - #525252 - + + #736b69 + + @color/accent_color + + - #33b5e5 + #000000 #b2b2b2 - #D0D0D0 + #e2d0bc - #00ddff - #00ddff + + #cccccc - #BFBFBF + #e2d0bc #303030 + #ffff4444 + #ffffffff diff --git a/android-betterpickers/src/main/res/values/themes.xml b/android-betterpickers/src/main/res/values/themes.xml index bbb0be4940..64d924a3b0 100644 --- a/android-betterpickers/src/main/res/values/themes.xml +++ b/android-betterpickers/src/main/res/values/themes.xml @@ -2,29 +2,31 @@ \ No newline at end of file diff --git a/art/phoneScreenshots/01.png b/art/phoneScreenshots/01.png old mode 100644 new mode 100755 index 1ce2959ed6..531d80c8e2 Binary files a/art/phoneScreenshots/01.png and b/art/phoneScreenshots/01.png differ diff --git a/art/phoneScreenshots/02.png b/art/phoneScreenshots/02.png old mode 100644 new mode 100755 index b1dc041498..e90809ddde Binary files a/art/phoneScreenshots/02.png and b/art/phoneScreenshots/02.png differ diff --git a/art/phoneScreenshots/03.png b/art/phoneScreenshots/03.png old mode 100644 new mode 100755 index c852978c58..95329f081a Binary files a/art/phoneScreenshots/03.png and b/art/phoneScreenshots/03.png differ diff --git a/art/phoneScreenshots/04.png b/art/phoneScreenshots/04.png old mode 100644 new mode 100755 index 63b8383a22..55a99b4396 Binary files a/art/phoneScreenshots/04.png and b/art/phoneScreenshots/04.png differ diff --git a/art/phoneScreenshots/05.png b/art/phoneScreenshots/05.png old mode 100644 new mode 100755 index fa6efee74f..faf6ecaf00 Binary files a/art/phoneScreenshots/05.png and b/art/phoneScreenshots/05.png differ diff --git a/art/phoneScreenshots/06.png b/art/phoneScreenshots/06.png old mode 100644 new mode 100755 index 16a3302fe9..ef71fbfeb3 Binary files a/art/phoneScreenshots/06.png and b/art/phoneScreenshots/06.png differ diff --git a/art/phoneScreenshots/07.png b/art/phoneScreenshots/07.png old mode 100644 new mode 100755 index f6cdf29474..a0dbf69b1d Binary files a/art/phoneScreenshots/07.png and b/art/phoneScreenshots/07.png differ diff --git a/art/phoneScreenshots/08.png b/art/phoneScreenshots/08.png old mode 100644 new mode 100755 index 778fb75a5e..6ed28a5459 Binary files a/art/phoneScreenshots/08.png and b/art/phoneScreenshots/08.png differ diff --git a/art/phoneScreenshots/09.png b/art/phoneScreenshots/09.png old mode 100644 new mode 100755 index e75c7dea12..852dd69a16 Binary files a/art/phoneScreenshots/09.png and b/art/phoneScreenshots/09.png differ diff --git a/art/phoneScreenshots/10.png b/art/phoneScreenshots/10.png old mode 100644 new mode 100755 index 3d5e81ad9b..b6d0f663c9 Binary files a/art/phoneScreenshots/10.png and b/art/phoneScreenshots/10.png differ diff --git a/art/phoneScreenshots/APKPure/01ap.png b/art/phoneScreenshots/APKPure/01ap.png old mode 100644 new mode 100755 index b921d09446..531d80c8e2 Binary files a/art/phoneScreenshots/APKPure/01ap.png and b/art/phoneScreenshots/APKPure/01ap.png differ diff --git a/art/phoneScreenshots/APKPure/02ap.png b/art/phoneScreenshots/APKPure/02ap.png old mode 100644 new mode 100755 index e956e3811a..e90809ddde Binary files a/art/phoneScreenshots/APKPure/02ap.png and b/art/phoneScreenshots/APKPure/02ap.png differ diff --git a/art/phoneScreenshots/APKPure/03ap.png b/art/phoneScreenshots/APKPure/03ap.png old mode 100644 new mode 100755 index 2b4c895bb3..95329f081a Binary files a/art/phoneScreenshots/APKPure/03ap.png and b/art/phoneScreenshots/APKPure/03ap.png differ diff --git a/art/phoneScreenshots/APKPure/04ap.png b/art/phoneScreenshots/APKPure/04ap.png old mode 100644 new mode 100755 index 514f309d2d..55a99b4396 Binary files a/art/phoneScreenshots/APKPure/04ap.png and b/art/phoneScreenshots/APKPure/04ap.png differ diff --git a/art/phoneScreenshots/APKPure/05ap.png b/art/phoneScreenshots/APKPure/05ap.png old mode 100644 new mode 100755 index 617f56bc3f..faf6ecaf00 Binary files a/art/phoneScreenshots/APKPure/05ap.png and b/art/phoneScreenshots/APKPure/05ap.png differ diff --git a/art/phoneScreenshots/APKPure/06ap.png b/art/phoneScreenshots/APKPure/06ap.png old mode 100644 new mode 100755 index 4ca668cd8a..ef71fbfeb3 Binary files a/art/phoneScreenshots/APKPure/06ap.png and b/art/phoneScreenshots/APKPure/06ap.png differ diff --git a/art/phoneScreenshots/APKPure/07ap.png b/art/phoneScreenshots/APKPure/07ap.png old mode 100644 new mode 100755 index 99595cf967..a0dbf69b1d Binary files a/art/phoneScreenshots/APKPure/07ap.png and b/art/phoneScreenshots/APKPure/07ap.png differ diff --git a/art/phoneScreenshots/APKPure/08ap.png b/art/phoneScreenshots/APKPure/08ap.png old mode 100644 new mode 100755 index d0fbac9c67..6ed28a5459 Binary files a/art/phoneScreenshots/APKPure/08ap.png and b/art/phoneScreenshots/APKPure/08ap.png differ diff --git a/art/phoneScreenshots/APKPure/09ap.png b/art/phoneScreenshots/APKPure/09ap.png old mode 100644 new mode 100755 index 10d99a03e9..852dd69a16 Binary files a/art/phoneScreenshots/APKPure/09ap.png and b/art/phoneScreenshots/APKPure/09ap.png differ diff --git a/art/phoneScreenshots/APKPure/10ap.png b/art/phoneScreenshots/APKPure/10ap.png old mode 100644 new mode 100755 index e0d773e260..b6d0f663c9 Binary files a/art/phoneScreenshots/APKPure/10ap.png and b/art/phoneScreenshots/APKPure/10ap.png differ diff --git a/art/phoneScreenshots/AppGallery/01aa.png b/art/phoneScreenshots/AppGallery/01aa.png old mode 100644 new mode 100755 index 1ce2959ed6..531d80c8e2 Binary files a/art/phoneScreenshots/AppGallery/01aa.png and b/art/phoneScreenshots/AppGallery/01aa.png differ diff --git a/art/phoneScreenshots/AppGallery/02aa.png b/art/phoneScreenshots/AppGallery/02aa.png old mode 100644 new mode 100755 index b1dc041498..e90809ddde Binary files a/art/phoneScreenshots/AppGallery/02aa.png and b/art/phoneScreenshots/AppGallery/02aa.png differ diff --git a/art/phoneScreenshots/AppGallery/04aa.png b/art/phoneScreenshots/AppGallery/04aa.png old mode 100644 new mode 100755 index 63b8383a22..55a99b4396 Binary files a/art/phoneScreenshots/AppGallery/04aa.png and b/art/phoneScreenshots/AppGallery/04aa.png differ diff --git a/art/phoneScreenshots/AppGallery/05aa.png b/art/phoneScreenshots/AppGallery/05aa.png old mode 100644 new mode 100755 index fa6efee74f..faf6ecaf00 Binary files a/art/phoneScreenshots/AppGallery/05aa.png and b/art/phoneScreenshots/AppGallery/05aa.png differ diff --git a/art/phoneScreenshots/AppGallery/06aa.png b/art/phoneScreenshots/AppGallery/06aa.png old mode 100644 new mode 100755 index 16a3302fe9..ef71fbfeb3 Binary files a/art/phoneScreenshots/AppGallery/06aa.png and b/art/phoneScreenshots/AppGallery/06aa.png differ diff --git a/art/phoneScreenshots/AppGallery/07aa.png b/art/phoneScreenshots/AppGallery/07aa.png old mode 100644 new mode 100755 index f6cdf29474..a0dbf69b1d Binary files a/art/phoneScreenshots/AppGallery/07aa.png and b/art/phoneScreenshots/AppGallery/07aa.png differ diff --git a/art/phoneScreenshots/F-Droid/phoneScreenshots/01.png b/art/phoneScreenshots/F-Droid/phoneScreenshots/01.png old mode 100644 new mode 100755 index 8e0cfabd6d..0539f0697c Binary files a/art/phoneScreenshots/F-Droid/phoneScreenshots/01.png and b/art/phoneScreenshots/F-Droid/phoneScreenshots/01.png differ diff --git a/art/phoneScreenshots/F-Droid/phoneScreenshots/02.png b/art/phoneScreenshots/F-Droid/phoneScreenshots/02.png old mode 100644 new mode 100755 index f7910dcf9c..8b226f1ed9 Binary files a/art/phoneScreenshots/F-Droid/phoneScreenshots/02.png and b/art/phoneScreenshots/F-Droid/phoneScreenshots/02.png differ diff --git a/art/phoneScreenshots/F-Droid/phoneScreenshots/03.png b/art/phoneScreenshots/F-Droid/phoneScreenshots/03.png old mode 100644 new mode 100755 index b5ac3e3cb6..0a472596f8 Binary files a/art/phoneScreenshots/F-Droid/phoneScreenshots/03.png and b/art/phoneScreenshots/F-Droid/phoneScreenshots/03.png differ diff --git a/art/phoneScreenshots/F-Droid/phoneScreenshots/04.png b/art/phoneScreenshots/F-Droid/phoneScreenshots/04.png old mode 100644 new mode 100755 index 85c58473fb..24a4fa23d7 Binary files a/art/phoneScreenshots/F-Droid/phoneScreenshots/04.png and b/art/phoneScreenshots/F-Droid/phoneScreenshots/04.png differ diff --git a/art/phoneScreenshots/F-Droid/phoneScreenshots/05.png b/art/phoneScreenshots/F-Droid/phoneScreenshots/05.png old mode 100644 new mode 100755 index 8f9780eba6..0edca6f363 Binary files a/art/phoneScreenshots/F-Droid/phoneScreenshots/05.png and b/art/phoneScreenshots/F-Droid/phoneScreenshots/05.png differ diff --git a/art/phoneScreenshots/F-Droid/phoneScreenshots/06.png b/art/phoneScreenshots/F-Droid/phoneScreenshots/06.png old mode 100644 new mode 100755 index 57d34e508b..38d5986ebf Binary files a/art/phoneScreenshots/F-Droid/phoneScreenshots/06.png and b/art/phoneScreenshots/F-Droid/phoneScreenshots/06.png differ diff --git a/art/phoneScreenshots/F-Droid/phoneScreenshots/07.png b/art/phoneScreenshots/F-Droid/phoneScreenshots/07.png old mode 100644 new mode 100755 index ca5cd3671b..df36e00c44 Binary files a/art/phoneScreenshots/F-Droid/phoneScreenshots/07.png and b/art/phoneScreenshots/F-Droid/phoneScreenshots/07.png differ diff --git a/art/phoneScreenshots/F-Droid/phoneScreenshots/08.png b/art/phoneScreenshots/F-Droid/phoneScreenshots/08.png old mode 100644 new mode 100755 index 093dd4b3e9..acf2f82267 Binary files a/art/phoneScreenshots/F-Droid/phoneScreenshots/08.png and b/art/phoneScreenshots/F-Droid/phoneScreenshots/08.png differ diff --git a/art/phoneScreenshots/F-Droid/phoneScreenshots/09.png b/art/phoneScreenshots/F-Droid/phoneScreenshots/09.png old mode 100644 new mode 100755 index 450abd8bf0..21064e380d Binary files a/art/phoneScreenshots/F-Droid/phoneScreenshots/09.png and b/art/phoneScreenshots/F-Droid/phoneScreenshots/09.png differ diff --git a/art/phoneScreenshots/F-Droid/phoneScreenshots/10.png b/art/phoneScreenshots/F-Droid/phoneScreenshots/10.png old mode 100644 new mode 100755 index 6c53b818df..d251c803b7 Binary files a/art/phoneScreenshots/F-Droid/phoneScreenshots/10.png and b/art/phoneScreenshots/F-Droid/phoneScreenshots/10.png differ diff --git a/art/phoneScreenshots/Samsung/01s.png b/art/phoneScreenshots/Samsung/01s.png old mode 100644 new mode 100755 index b921d09446..531d80c8e2 Binary files a/art/phoneScreenshots/Samsung/01s.png and b/art/phoneScreenshots/Samsung/01s.png differ diff --git a/art/phoneScreenshots/Samsung/02s.png b/art/phoneScreenshots/Samsung/02s.png old mode 100644 new mode 100755 index e956e3811a..e90809ddde Binary files a/art/phoneScreenshots/Samsung/02s.png and b/art/phoneScreenshots/Samsung/02s.png differ diff --git a/art/phoneScreenshots/Samsung/04s.png b/art/phoneScreenshots/Samsung/04s.png old mode 100644 new mode 100755 index 514f309d2d..55a99b4396 Binary files a/art/phoneScreenshots/Samsung/04s.png and b/art/phoneScreenshots/Samsung/04s.png differ diff --git a/art/phoneScreenshots/Samsung/05s.png b/art/phoneScreenshots/Samsung/05s.png old mode 100644 new mode 100755 index 617f56bc3f..faf6ecaf00 Binary files a/art/phoneScreenshots/Samsung/05s.png and b/art/phoneScreenshots/Samsung/05s.png differ diff --git a/art/phoneScreenshots/Samsung/06s.png b/art/phoneScreenshots/Samsung/06s.png old mode 100644 new mode 100755 index 4ca668cd8a..ef71fbfeb3 Binary files a/art/phoneScreenshots/Samsung/06s.png and b/art/phoneScreenshots/Samsung/06s.png differ diff --git a/art/phoneScreenshots/Samsung/07s.png b/art/phoneScreenshots/Samsung/07s.png old mode 100644 new mode 100755 index 99595cf967..a0dbf69b1d Binary files a/art/phoneScreenshots/Samsung/07s.png and b/art/phoneScreenshots/Samsung/07s.png differ diff --git a/build.gradle b/build.gradle index aa6a99e16b..e23bd62095 100644 --- a/build.gradle +++ b/build.gradle @@ -11,7 +11,7 @@ buildscript { // } } dependencies { - classpath 'com.android.tools.build:gradle:8.5.2' + classpath 'com.android.tools.build:gradle:8.7.2' //classpath 'com.google.gms:google-services:4.3.4' // google-services plugin //classpath 'com.google.firebase:firebase-crashlytics-gradle:2.3.0' } diff --git a/common/build.gradle b/common/build.gradle index 9cb9f1ea3c..0829a6cfb7 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -13,8 +13,8 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -24,6 +24,11 @@ android { consumerProguardFiles 'proguard-rules.pro' } } + + lint { + disable += ['ExpiredTargetSdkVersion'] + } + } dependencies { diff --git a/common/src/main/res/color/switch_thumb_color.xml b/common/src/main/res/color/switch_thumb_color.xml new file mode 100644 index 0000000000..e496058aef --- /dev/null +++ b/common/src/main/res/color/switch_thumb_color.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/common/src/main/res/color/switch_track_color.xml b/common/src/main/res/color/switch_track_color.xml new file mode 100644 index 0000000000..d2df304905 --- /dev/null +++ b/common/src/main/res/color/switch_track_color.xml @@ -0,0 +1,7 @@ + + + + + + diff --git a/common/src/main/res/drawable/edit_text_border.xml b/common/src/main/res/drawable/edit_text_border.xml new file mode 100644 index 0000000000..e4a60f9294 --- /dev/null +++ b/common/src/main/res/drawable/edit_text_border.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/seek_bar_drawable.xml b/common/src/main/res/drawable/seek_bar_drawable.xml new file mode 100644 index 0000000000..7fe5752231 --- /dev/null +++ b/common/src/main/res/drawable/seek_bar_drawable.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/drawable/seek_bar_thumb.xml b/common/src/main/res/drawable/seek_bar_thumb.xml new file mode 100644 index 0000000000..9fadc8e705 --- /dev/null +++ b/common/src/main/res/drawable/seek_bar_thumb.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/common/src/main/res/values-ar/strings.xml b/common/src/main/res/values-ar/strings.xml index 31ab06fa78..4ddf5446ec 100644 --- a/common/src/main/res/values-ar/strings.xml +++ b/common/src/main/res/values-ar/strings.xml @@ -263,7 +263,6 @@ الوضع الافتراضي الأولوية تكيف - Unlock device إخفاء اسم الوضع إعادة تشغيل الأحداث تم إلغاء الإتصال @@ -670,7 +669,7 @@ انقر هنا لفتح قائمة الأحداث مع خيارات: تمكين / إيقاف تشغيل ، تكرار وحذف الحدث. معالج الترتيب Drag event up/down with this handler to change the event \"Start order\". - المحرر + المحرر انقر هنا لفتح المحرر ، حيث يمكنك تكوين الأوضاع والأحداث وتغيير إعدادات التطبيق ، إلخ. وضع التنشيط انقر هنا لتنشيط الوضع. @@ -833,7 +832,6 @@ تنشيط البحث عن الإتجاة (G1)(R) الإخطارات المنبثقة أيقونة مخصصة - انقر لتعيين اسم الشبكة قد لا يعمل الاتصال إلي نقطة ساخنة في بعض الأجهزة الأخرى. بدون إستخدام البدء عند الشحن @@ -990,7 +988,6 @@ اسمح لتطبيق PhoneProfilesPlusExtender في \"إمكانية الوصول\" في إعدادات النظام. لم يتم تشغيل وظيفة الوصول للبرنامج ، وهناك حاجة إلى تشغيل الخدمة لاستقبال المكالمات. انقر هنا لتثبيت تطبيق PhoneProfilesPlusExtender. هناك حاجة لتشغيل الخدمة لتلقي المكالمات. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor استخدام الديكور نوع التخطيط توسيع @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-b+sr+Latn/strings.xml b/common/src/main/res/values-b+sr+Latn/strings.xml index 15cdf09f71..114f6f6239 100644 --- a/common/src/main/res/values-b+sr+Latn/strings.xml +++ b/common/src/main/res/values-b+sr+Latn/strings.xml @@ -263,7 +263,6 @@ Predodređeni profil Prioritet Prilagodljiv - Unlock device Sakri naziv profila Ponovo pokreni događaje Nije povezano @@ -670,7 +669,7 @@ Klikni ovde za otvaranje menija događaja sa opcijom: Omogući/ Zaustavi rad, Dupliraj i Obriši događaj. Redosled izvršavanja Prevuci gore/dole sa ovim za promenu događaja \"Redosled rada\". - Urednik + Urednik Klikni ovde za otvaranje Editora, u kojem možete podesiti profile, događaje, promeniti podešavanje aplikacije, itd. Aktiviraj profil Klikni ovde za aktiviranje profila. @@ -833,7 +832,6 @@ Omogući skeniranje orijentacije (G1)(R) Iskačuća obaveštenja Proizvoljna ikona - Klikni za izbor imena ćelije Moguće da neće raditi Hotspot sa drugim uređajima. Ne koristi Startuj kada se puni @@ -990,7 +988,6 @@ Omogući PhoneProfilesPlusExtender -u \"Pristupačnost\" u sistemskim podešavanjima. Funkcija Pristupačnosti se ne koristi, korišćenje ovoga servisa je potrebno za prijem poziva. Klikni ovde za instalaciju PhoneProfilesPlusExtender -a. Korišćenje ovog servisa je neophodno za prijem poziva. za čitanje kontakata u SMS/MMS senzoru - za čitanje kontakata, otkrijte zvono poziva (za \"noćni poziv\") u senzoru poziva Koristi dekoraciju Vrsta izgleda Proširivo @@ -1301,7 +1298,6 @@ Ušteda baterije Visoka preciznost Prilagođene boje ikona - Proizvoljna boja Uključeno ( ne isključuj Wi- Fi) Ignoriši Wi-Fi pistupnu tačku Opcija \"Uključeno ( ne isključuj Wi-Fi)\" mora biti podržana od strane sistema @@ -1660,13 +1656,7 @@ i Uklj Isklj - ne podešavaj - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. Nova verzija PhoneProfilesPlusExtender-a je neophodna. Klikni ovde za ažuriranje. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-bg/strings.xml b/common/src/main/res/values-bg/strings.xml index 7aca0ed212..dca16feec9 100644 --- a/common/src/main/res/values-bg/strings.xml +++ b/common/src/main/res/values-bg/strings.xml @@ -263,7 +263,6 @@ Профил по подразбиране Приоритет Адаптивно - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Редактор + Редактор Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-bn-rIN/strings.xml b/common/src/main/res/values-bn-rIN/strings.xml index 0ed2c007d9..f984ddbfc7 100644 --- a/common/src/main/res/values-bn-rIN/strings.xml +++ b/common/src/main/res/values-bn-rIN/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-ca/strings.xml b/common/src/main/res/values-ca/strings.xml index d7630d301a..b00148f7bf 100644 --- a/common/src/main/res/values-ca/strings.xml +++ b/common/src/main/res/values-ca/strings.xml @@ -263,7 +263,6 @@ Perfil per defecte Prioritat Adaptativa - Unlock device Amaga el nom de perfil Reiniciar esdeveniments Sense connexió @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-cs/strings.xml b/common/src/main/res/values-cs/strings.xml index c8848488b5..0540657371 100644 --- a/common/src/main/res/values-cs/strings.xml +++ b/common/src/main/res/values-cs/strings.xml @@ -263,7 +263,6 @@ Předvolený profil Prioritní Adaptivní - Odemknutí zařízení Skrýt název profilu Restartuj události Nepřipojeno @@ -670,7 +669,7 @@ Klikněte zde pro otevření menu události s možnostmi: Povol/Zastav běh, Duplikuj a Smaž událost. Posuvník pořadí Přesuňte nahoru/dolů událost s tímto posuvníkem pro změnu \"Pořadí startu\" události. - Editor + Editor Klikněte zde pro otevření Editoru. V Editoru můžete nakonfigurovat profily, události, změnit nastavení aplikace atd. Aktivovat profil Klikněte zde pro aktivaci profilu. @@ -833,7 +832,6 @@ Povolit skenování orientace (G1)(R) Pop-up notifikace Vlastní ikona - Klepnutím nastavíte název buňky Nemusí fungovat připojení do přístupového bodu z jiných zařízení. Nepoužij Start při nabíjení @@ -990,7 +988,6 @@ Povolte PhoneProfilesPlusExtender v systémovém nastavení \"Usnadnění\". Funkce dostupnosti není použita, běžící servis je potřebný pro příjem hovorů. Klikněte zde pro instalaci PhoneProfilesPlusExtender. Běžící servis je potřebný pro příjem hovorů. pro čtení kontaktů v senzoru SMS/MMS - pro čtení kontaktů, zjištění vyzvánění hovoru (pro \"noční hovor\") v senzoru Hovoru Použít dekoraci Typ rozložení Roztažitelné @@ -1301,7 +1298,6 @@ Úsporný režim baterie Vysoká přesnost Vlastní barva ikony - Vlastní barva Zapnout (nevypínat Wi-Fi) Ignorovat Wi-Fi přístupový bod Nastavení \"Zapnout (nevypínat Wi-Fi)\" musí být podporovány systémem @@ -1660,13 +1656,7 @@ a Zapnuto Vypnuto - nenastaví - pro parametr - Musíte také nakonfigurovat Zobrazuje notifikaci o stavu - je - Chcete-li jej nastavit na - nakonfigurujte a aktivujte profil s Bez trvání Typ ukončení aktivace Trvání @@ -1799,12 +1789,10 @@ Povolit běh událostí Zakázat běh událostí Nenastaveno - Vlastní nastaveno Nevybráno [ Nic ] [ Vlastní ] (A) aplikace, (S) odkaz, (I) intent. - Nenastaveno Žádné nainstalované Poloha nefunguje Promiňte, ale není možné zjistit polohu. Zkontrolujte Nastavení Polohy v zařízení. @@ -1938,8 +1926,8 @@ Poznámka: Ne všechny aplikace Hodiny používají systémovou hlasitost alarmů, protože používají svou vlastní hlasitost nakonfigurovanou ve svých nastaveních. V tomto dialogu se zobrazí seznam nakonfigurovaných Wi-Fi SSID.\nKlepnutím sem zobrazíte obrazovku nastavení Wi-Fi. Obsahuje parametr pro konfiguraci Wi-Fi sítí. PPPPutSettings - Nainstaluj\nPPPPutSettings - Spusti\nPPPPutSettings + Nainstaluj PPPPS + Spusti PPPPS Zavřít Spusti PPPPutSettings PPPPutSettings není nainstalován. @@ -1955,9 +1943,9 @@ Nová verze PPPPPPutSettings Klepněte na tuto notifikaci pro nainstalování nového vydání PPPPutSettings. PhoneProfilesPlusExtender - Nainstaluj\nPhoneProfilesPlusExtender - Spusti\nPhoneProfilesPlusExtender - Povol/Zakáž\nslužbu Dostupnost + Nainstaluj PPPE + Spusti PPPE + Povol/Zakáž Zavřít Klikněte sem pro instalaci/inovaci, zapnutí/vypnutí nastavení dostupnosti, spuštění PhoneProfilesPlusExtender. Je nutná nová verze PhoneProfilesPlusExtender. Kliknutím zde, jej můžete aktualizovat. @@ -2084,7 +2072,6 @@ Kontakty pro SMS/MMS senzor Kontakty pro Senzor notifikací Musíte udělit povolení \"Vykreslit přes další aplikace\". Je vyžadováno pro start aktivit když je PhoneProfilesPlus na pozadí. Klepněte na tlačítko \"Udělit\" pro udělení tohoto povolení. - Pokud toto povolení nelze udělit, klikněte na tento odkaz. Možná na této webové stránce je řešení pro vaše zařízení: Ø - Nepoužívat Filtr kontaktů [ Všechny ] @@ -2132,20 +2119,6 @@ Zápis bude spuštěn. Trvání běhu aplikací Neomezené - Telefonní hovory - Nastavení role kontroly hovorů - Klepnutím sem nastavíte roli kontroly hovorů pro PhoneProfilesPlus. Vyžaduje se pro \"Blokovat telefonní hovory\". - Role kontroly hovorů pro PhoneProfilesPlus je nastavena - Role kontroly hovorů pro PhoneProfilesPlus není nastavena - Blokovat telefonní hovory - UPOZORNĚNÍ: Tento parametr umožňuje blokovat hovory, nakonfigurované ve \"Skupinách kontaktů\", \"Kontakty\". Upozornění o zablokovaných hovorech se nezobrazí! - Skupiny kontaktů - Kontakty - pro čtení kontaktů v parametru profilu \"Telefonní hovory\" - Kontakty pro parametr profilu \"Telefonní hovory\" - Odeslat SMS - Text SMS - UPOZORNĚNÍ: Odesílání SMS může být zpoplatněno nebo použito z předplaceného balíčku SMS! Zobrazí se, když událost má povoleno \"Start události\"/\"Ostatní parametry\"/\"Opakovaná notifikace\". Zobrazí se, když je v profilu nakonfigurováno \"Ostatní\"/\"Generovat notifikaci\". Zobrazí se, když je povoleno \"Nastavení\"/\"Notifikace se seznamem profilů\"/\"Zobrazit notifikaci\" @@ -2201,17 +2174,108 @@ Zapnutí/vypnutí SIM UPOZORNĚNÍ: Zobrazí se obrazovka pro zadání kódu PIN pro kartu SIM, která je nakonfigurována jako \"Zapnout\". Server PhoneProfilesPlus - Pozvánka na server PhoneProfilesPlus - PhoneProfilesPlus release in APKPure: - Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. - Send SMS - Do not send SMS - State: - Paused - Running - Stopped - Paused with delay - Running with delay - This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. - If you have problems, questions and suggestions, click here and write me. + Pozvánka na server + Vydání PhoneProfilesPlus v ApkPure: + Nainstalujte si prosím Droid-ify. Vyžaduje se pro instalaci PPPPutSettings. Potom znovu nainstalujte PPPutSettings. + Odeslat SMS + Neodesílat SMS + Stav: + Pozastaveno + Bežíci + Zastavena + Pozastavená se zpožděním + Bežíci se zpožděním + Tato aplikace je v IzzyOnDroid repositáři a GitHub Releases. Klikněte zde pro její instalaci. + Pokud máte problémy, dotazy a návrhy, klikněte sem a napište mi. + Prosím povolte Přístup k notifikacím pro PhoneProfilesPlus v Nastavení systému. Bez toho Senzor hudby nerozpozná aplikaci, která přehrává hudbu. + Přístup k notifikacím vypnutý + Přístup k notifikacím zapnutý + Nastavení role kontroly hovorů + Klepnutím sem nastavíte roli kontroly hovorů pro PhoneProfilesPlus. Vyžaduje se pro senzor \"Kontrola hovoru\". + Rola kontroly hovorov pre PhoneProfilesPlus je nastavená + Role kontroly hovorů pro PhoneProfilesPlus není nastavena + Senzor Kontrola hovoru + Senzor Kontrola hovoru + Tento senzor spustí událost, pokud se během hovoru zobrazí obrazovka telefonního hovoru. Je v něm podporováno blokování hovorů. Parametry: Skupiny kontaktů, Kontakty, Trvání, Trvalý běh, Blokovat hovor, Odeslat SMS, Text SMS. + Kontakty pro senzor \"Kontrola hovoru\" + Blokovat telefonní hovory + Poslat SMS + Text SMS + UPOZORNĚNÍ: Odesílání SMS může být zpoplatněno nebo použito z předplaceného balíčku SMS! + není nastavena role kontroly hovorů pro PhoneProfilesPlus + pro čtení kontaktů, posílání SMS v senzoru událostí \"Sledování hovorů\" + Směr hovoru + Příchozí hovory + Odchozí hovory + Všechny hovory + Blokovat hovory + Pro každý profil s nakonfigurovaným parametrem \"Telefonní hovory\"\/\"Blokovat hovory\" je vygenerována nová událost se senzorem \"Kontrola hovorů\". Tato událost má zakázaný parametr \"Spuštění události\". Parametr „Telefonní hovory“ z profilů je odstraněn. + Poslat SMS + Skupiny kontaktů + Kontakty + pro čtení kontaktů v parametru profilu \"Poslat SMS\" + Kontakty pro parametr profilu \"Poslat SMS\" + Poslat SMS + Text SMS + profil - chyba při posílání SMS + Poslat SMS + Text SMS + pro čtení kontaktů, detekci vyzvánění hovoru (pro \"noční hovor\"), poslat SMS v senzoru Hovoru + Notifikace + Mazání notifikací + Povolte \"Přístup k notifikacím\". Bez toho nebude mazání notifikace fungovat. + Mazání notifikací + pro čtení kontaktů v parametru profilu \"Mazání notifikací\" + Aplikace: + Skupiny kontaktů: + Kontakty: + Text + Kontakty pro parametr profilu \"Mazání notifikací\" + Tel. čísla, která nejsou v kontaktech + Blokované hovory + tel. číslo: + UPOZORNĚNÍ: Tento parametr umožňuje blokování hovorů. Notifikace o zablokovaných hovorech se nezobrazí!\nAle zablokováno tel. čísla se zaznamenávají do \"Záznamu aktivity\", který umožňuje zpětné volání na zablokované tel. číslo klepnutím na tento řádek záznamu. + Celý záznam + Blokované hovory + Chyby + Start událostí + Pozastavení událostí + Zastavení událostí + Restart událostí + Aktivace profilů + instalace aplikace + (G1)(R) Noční režim + (Z)(R) Režim čtení + Ochrana zraku + (G1)(R) Ochrana zraku + pro zapnutí/vypnutí Ochrany zraku + (I) Nastavení pro Noční režim + (I) Nastavení pro Štít pro pohodlí očí + (I) Nastavení pro Režim čtení + (S)(Z)(R) Štít pro pohodlí očí + Pokud není možné udělit toto oprávnění, nemusí být povolena omezená nastavení pro PhoneProfilesPlus. Klikněte zde pro jeho povolení. + pro zapnutí/vypnutí VPN + Potřeba mít trvale povoleno \"Vykreslit přes další aplikace\" byla odstraněna. Protože toto právo se nachází v části \"Omezená nastavení\" a je-li povoleno, bankovní aplikace a webové stránky, platby za zboží, služby atp. mohou být zablokovány nebo mohou vyžadovat vypnutí funkce \"Vykreslit přes další aplikace\" v PhoneProfilesPlus. + Doporučuje se nainstalovat novou verzi PPPPutSettings (1.1), kde je změna, která nevyžaduje \"Vykreslit přes další aplikace\". Pro verze starší 1.1 budou parametry označené (S) stále vyžadovat toto právo. + Pro některé parametry profilu se stále vyžaduje \"Vykreslit přes další aplikace\", například pro \"Spustit aplikace, odkazy, intenty\". + Hodnota barvy + Název polohy + Vlastní akce + Prázdný seznam + Tón + Šipka doprava + Šipka doleva + [ Nenastaveno ] + Uzamykací obrazovka zařízení + Tento parametr zapíná/Vypne zamykací obrazovku. Když je nastaveno na Vypnuto, zamykací obrazovka se nezobrazí, když se obrazovka zapne. + Nastavení \"Čas do vypnutí obrazovky\" v systému (aktivací profilu) nezakáže \"Udržet obrazovku zapnutou\". Chcete-li, aby v systému fungoval \"Čas do vypnutí obrazovky\", musíte také nakonfigurovat \"Udržet obrazovku zapnutou\" na \"Vypnout\". + Zapnutí/vypnutí obrazovky + \"Udržet obrazovku zapnutou\" je \"Zapnuto\". Chcete-li jej nastavit na \"Vypnuto\", nakonfigurujte a aktivujte profil pomocí \"Udržet obrazovku zapnutou\"=\"Vypnuto\". + pro zapnutí/vypnutí obrazovky + Když je nakonfigurováno \"Zapnutí/Vypnutí obrazovky\", \"Obrazovka uzamčení zařízení\" je deaktivována a naopak. Nelze nakonfigurovat obojí. + Shizuku je nainstalován, ale není spuštěn. Otevřete Shizuku a spusťte jej z jeho aplikace. + Otevřít + Pomoc + Tento parametr je pro \"Události hovoru\" = \"Zmeškaný hovor\". + \"Světlo\" je okolní světlo detekované snímačem světla v zařízení. diff --git a/common/src/main/res/values-da/strings.xml b/common/src/main/res/values-da/strings.xml index 759834f125..dda42ca038 100644 --- a/common/src/main/res/values-da/strings.xml +++ b/common/src/main/res/values-da/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-de/strings.xml b/common/src/main/res/values-de/strings.xml index 6e6073e92d..ed1b817527 100644 --- a/common/src/main/res/values-de/strings.xml +++ b/common/src/main/res/values-de/strings.xml @@ -263,7 +263,6 @@ Standardprofil Wichtig Adaptiv - Gerät entsperren Profilnamen ausblenden Ereignisse neu starten Nicht verbunden @@ -286,7 +285,7 @@ Ereignis anhalten - Aktivieren und Profil widerrufen Ereignisse neu starten Ereignisse anhalten - Ereignisse ausführen aktivieren + „Ereignisse ausführen” aktivieren App starten App beenden Einstellungen wiederherstellen @@ -582,9 +581,9 @@ Spenden Finden Sie diese Anwendung nützlich?\nUnterstützen Sie die Entwicklung durch eine Spende an den Entwickler. Versionen: - Über andere Apps legen - Sie haben \"Über andere Apps zeichnen\" nicht erlaubt. Nicht mehr nachfragen? - Über andere Apps legen + Über andere Apps ziehen + Sie haben \"Über andere Apps ziehen\" nicht erlaubt. Nicht mehr nachfragen? + Über andere Apps ziehen Bitte suche nach der App \"PhoneProfilesPlus\" und aktiviere sie. nicht in den System-Einstellungen konfiguriert Verbunden: @@ -670,7 +669,7 @@ Hier klicken, um das Ereignismenü mit folgenden Optionen zu öffnen: Aktivieren/Ausführen beenden, Duplizieren und Löschen von Ereignissen. Festlegung Reihenfolge Ereignis nach oben/unten verschieben, um die Startreihenfolge zu ändern. - Editor + Editor Hier klicken, um den Editor zu öffnen, in dem Sie Profile, Ereignisse, Anwendungseinstellungen usw. konfigurieren können. Aktiviere Profil Hier klicken, um ein Profil zu aktivieren. @@ -833,7 +832,6 @@ Bestimmung der Geräteausrichtung aktivieren (G1)(R) Popup-Benachrichtigungen Benutzerdefiniertes Symbol - Hier klicken, um den Zellnamen festzulegen Verbindung könnte eventuell nicht funktionieren mit anderen Geräte HotSpots. Nicht verwenden Beginnt beim Laden @@ -990,7 +988,6 @@ PhoneProfilesPlusExtender „Eingabehilfen” in den Systemeinstellungen zulassen. Die Funktion Eingabehilfen ist derzeit deaktiviert. Diese wird aber für den Empfang von SMS und MMS benötigt. Klicken Sie hier, um PhoneProfilesPlusExtender zu installieren. Dieser Dienst wird für das Entgegennehmen von Anrufen benötigt. Um Kontakte im SMS/MMS-Sensor auszulesen - Um Kontakte auszulesen, zur Ruferkennung (bei „Nachtruf”) im Anrufsensor Dekoration verwenden Layout-Typ Erweiterbar @@ -1055,7 +1052,7 @@ PhoneProfilesPlusExtender verwenden In Android 9+ müssen Sie für das Überprüfen von Mobilfunkzellen die Option „Standortbestimmung” in den Systemeinstellungen aktivieren. Ereignis wird nicht gestartet, wenn: - You have disabled global events run (red \"traffic light\") - enable it in Editor top bar icon \"Enable events run\". + Sie haben die Ausführung von globalen Ereignissen deaktiviert (rote „Ampel”) - aktivieren Sie sie in der oberen Leiste des Editors mit dem Symbol „Ereignisse ausführen aktivieren”. du ein Profil manuell aktiviert hast (gelbe \"Ampel\"). Dann musst du \"Ereignisse neu starten\" im Starter, Editor oder der Benachrichtigung wählen. Ein manuell aktiviertes Profil wird auch mit einem \"[M]\" vor dem Profilnamen angezeigt. Ausnahmen bilden Ereignisse, in denen \"Manuelle Aktivierung ignorieren\" ausgewählt ist. du das Ereignis in den Ereigniseinstellungen angehalten hast. \"Ereignis aktiveren\" muss ausgewählt sein. Beachte: Die \"Ampel\" ist oben im Starter und Editor. Wenn das Überprüfen von Mobilfunkzellen nicht funktioniert, aktivieren Sie die Standortbestimmung in den Systemeinstellungen. @@ -1256,15 +1253,15 @@ Laufwerkstypen Bitte nicht stören (Aus) Bitte nicht stören (Ein) - Berechtigung „Zeichnen über Apps” - Sie müssen die Berechtigung \"Über Apps ziehen\" erteilen. Es ist erforderlich, um Aktivitäten zu starten, wenn PhoneProfilesPlus im Hintergrund ist. Klicken Sie hier, um diese Berechtigung zu erteilen. + Berechtigung „Über andere Apps ziehen” + Sie müssen die Berechtigung \"Über andere Apps ziehen\" erteilen. Es ist erforderlich, um Aktivitäten zu starten, wenn PhoneProfilesPlus im Hintergrund ist. Klicken Sie hier, um diese Berechtigung zu erteilen. G1-Einstellungen zulassen Erlaubnis für (G1)-Präferenzen nicht erteilt Erlaubnis für (G1)-Präferenzen nicht erteilt. Hier klicken, um sie zu gewähren. Bitte erteilen Sie WRITE_SECURE_SETTINGS die Erlaubnis für PhoneProfilesPlus. Wird für Profil- und Ereignisparameter benötigt, die mit (G1) gekennzeichnet sind. Dadurch wird ROOT-Zugriff nicht benötigt. Profil nicht gefunden. Wurde es gelöscht? Ereignis nicht gefunden. Wurde es gelöscht? - Sie haben die Berechtigung \"Über Apps ziehen\" nicht erteilt. Diese Berechtigung ist jedoch für Android 10 erforderlich. Bitte erteilen Sie sie. + Sie haben die Berechtigung \"Über andere Apps ziehen\" nicht erteilt. Diese Berechtigung ist jedoch für Android 10 erforderlich. Bitte erteilen Sie sie. Warnung zum Batteriestatus Unterer Füllstand > 0% oder oberer Füllstand < 100% Akku verbraucht! Dieser Sensor startet das Ereignis unmittelbar nach dem Booten des Geräts. Parameter: Dauerhaft ausführen, Dauer (Dauer des Ereignisses). @@ -1301,7 +1298,6 @@ Energiesparmodus Hohe Genauigkeit Benutzerdefinierte Symbolfarben - Benutzerdefinierte Farbe Ein (WLAN nicht deaktivieren) WLAN-Hotspot ignorieren Die Option „Ein (WLAN nicht deaktivieren)” muss vom System unterstützt werden @@ -1576,7 +1572,7 @@ Komplett lautlos Aus, Vibration erlaubt Priorität mit Vibration - Sound profile sensor + Sensor für Schallprofil F-Droid öffnen PhoneProfilesPlus im Repository: Helligkeit erhöhen @@ -1660,13 +1656,7 @@ und An Aus - Nicht festgelegt - für Parameter - Sie müssen zudem konfigurieren Zeigt Benachrichtigung über den Status von - ist - Um es festzulegen - Profil einrichten und aktivieren mit Ohne Dauer Art des Aktivierungsendes Dauer @@ -1721,8 +1711,8 @@ Suchen Sie es in Google Play. Schließen Indikator für Profileinstellungen - Start of event profile preferences indicator - End of event profile preferences indicator + Indikator für die Profileinstellungen zu Beginn eines Ereignisses + Indikator für die Profileinstellungen am Ende eines Ereignisses Symbol für Profileinstellungen Ampel-Symbol Symbol für Undurchsichtigkeit/Helligkeit @@ -1799,12 +1789,10 @@ „Ereignisse ausführen” aktivieren „Ereignisse ausführen” deaktivieren Nicht festgelegt - Custom not set Nicht ausgewählt [ Keine ] [ Benutzerdefiniert ] (A) Anwendung, (S) Tastaturküürzel, (I) Absicht. - Nicht festgelegt Keine installiert Standortbestimmung funktioniert nicht Leider ist es nicht möglich, den Standort zu ermitteln. Bitte überprüfen Sie die Ortsbestimmungs-Einstellungen Ihres Geräts. @@ -1826,91 +1814,91 @@ Decoration for notification is enabled only when \"Background color\" is of type \"Native\". Decoration is always displayed, when \"Notification style\" is set to \"Native\". Funkgeräte im Flugzeugmodus Klicken Sie hier, um anzuzeigen, wie Sie konfigurieren können, welche Funkgeräte ausgeschaltet werden sollen, wenn der Flugzeugmodus des Geräts aktiviert ist. - Is possible to configure, which radios are to be switched off when is enabled in device airplane mode. - This help is better to open it in computer in his Internet browser. Help is in PhoneProfilesPlus GitHub README.md, marked as - This sensor will start and end an event by profile activation. Parameters: Start profile (profile which starts event), End profile (profile which ends event). - Activated profile + Es ist möglich zu konfigurieren, welche Funkgeräte ausgeschaltet werden sollen, wenn das Gerät im Flugzeugmodus aktiviert ist. + Für diese Hilfe ist es empfehlenswert, sie auf dem Computer in einem Internet-Browser zu öffnen. Die Hilfe ist in PhoneProfilesPlus GitHub README.md, gekennzeichnet als + Dieser Sensor startet und beendet ein Ereignis durch die Aktivierung eines Profils. Parameter: Startprofil (Profil, das das Ereignis startet), Endprofil (Profil, das das Ereignis beendet). + Aktiviertes Profil Start profile End profile - Activated profile sensor - Configured profiles - Profiles must not be the same. If profiles are the same, both parameters will be marked as error in configuration. - Activate profile - Setting screen not found.\n\nPlease go into device settings: \"Settings / Apps / App launch\" and set \"Manage manually\" for PhoneProfilesPlus. - Notifications permission is not granted.\n\nPlease enable notifications for PhoneProfilesPlus. Without this enabled, notifications from PhoneProfilesPlus will not be displayed. - Enable - Use dynamic colors - Purple: sensor is in waiting state. \"Pass\" status is determined. - Green with double arrow: sensor is \"passed\". - Blue: sensor is not \"passed\". - Used colors - Profile activation - Event start - Event end - Restart events - Event in delay start/end - Error - Other situations - \"Restart events\" icon color - Choose language + Aktivierter Profilsensor + Konfigurierte Profile + Die Profile dürfen nicht identisch sein. Wenn die Profile gleich sind, werden beide Parameter in der Konfiguration als Fehler gekennzeichnet. + Profil aktivieren + Einstellungsbildschirm nicht gefunden.\n\nBitte öffnen Sie die Geräteeinstellungen: \"Einstellungen\" ➜ \"Apps\" ➜ \"App starten\" und legen Sie „Manuell verwalten” für PhoneProfilesPlus fest. + Die Berechtigung für Benachrichtigungen ist nicht erteilt.\n\nBitte aktivieren Sie Benachrichtigungen für PhoneProfilesPlus. Wenn dies nicht aktiviert ist, werden die Benachrichtigungen von PhoneProfilesPlus nicht angezeigt. + Aktivieren + Dynamische Farben verwenden + Violett: Sensor befindet sich im Wartezustand. Der Status „Bestanden/Nicht bestanden” wird ermittelt. + Grün mit Doppelpfeil: Sensor hat „bestanden”. + Blau: Sensor hat nicht „bestanden”. + Verwendete Farben + Profil-Aktivierung + Beginn des Ereignisses + Ende des Ereignisses + Ereignisse neu starten + Beginn/Ende der Verzögerung eines Ereignisses + Fehler + Sonstige Situationen + Farbe des Symbols „Ereignisse neu starten” + Sprache wählen [ System ] - Icon color - In a dark application theme, the color of the preview icon may have increased brightness. - An icon with this increased brightness will be used throughout the GUI of the application. Also in notification and widgets, when their background is dark. - Please open PhoneProfilesPlus Settings and configure it. Especially parameters marked with a double arrow sign. - Current configuration: + Symbolfarbe + In einem dunklen Farbschema kann die Farbe des Vorschausymbols eine höhere Helligkeit aufweisen. + Ein Symbol mit dieser erhöhten Helligkeit wird in der gesamten Benutzeroberfläche der Anwendung verwendet. Auch in Benachrichtigungen und Widgets, wenn deren Hintergrund dunkel ist. + Bitte öffnen Sie die Einstellungen von PhoneProfilesPlus und konfigurieren Sie diese. Insbesondere die mit einem Doppelpfeil gekennzeichneten Parameter. + Aktuelle Konfiguration: This sensor will start an event when network or data are in roaming. Parameters: Check network, Check data. Roaming Roaming sensor - Check network - Check data - For SIM card + Netzwerk prüfen + Daten prüfen + Für SIM-Karte for check, if network or data are in roaming On with Assistant Off with Assistant Toggle with Assistant not two SIM cards inserted - Background color - Dark mode off - Background color - Dark mode on + Hintergrundfarbe - Dunkler Modus aus + Hintergrundfarbe - Dunkler Modus ein By Dark mode - Change colors by Dark mode - If enabled, widget colors will be set by system Dark mode (as in Pixel launcher) - If enabled, widget colors will be set by system Dark mode. + Farben gemäß dunklem Modus ändern + Wenn aktiviert, werden die Farben der Widgets durch den dunklen Modus des Systems festgelegt (wie im Pixel Launcher) + Wenn aktiviert, werden die Farben der Widgets durch den dunklen Modus des Systems festgelegt. VPN - VPN application: - Enable VPN - Disable VPN - OpenVPN profile name: - WireGuard tunnel name: - profile - error on set VPN - Connect/disconnect VPN for OpenVPN is moved from \"Others\"/\"Run applications, shortcuts, intents\" into parameter \"VPN\". - for set tunnel up/down by WireGuard application - WireGuard is not installed or is in non-supported version. - OpenVPN Connect is not installed. - OpenVPN for Android is not installed. + VPN-Anwendung: + VPN aktivieren + VPN deaktivieren + Name des OpenVPN-Profils: + Name des WireGuard-Tunnels: + Profil - Fehler beim Festlegen des VPN + VPN für OpenVPN verbinden/trennen wurde von „Andere“/„Anwendungen, Tastaturkürzel und Absichten ausführen“ in den Parameter „VPN“ verschoben. + zum Auf- und Abbau des Tunnels durch die WireGuard-Anwendung + WireGuard ist nicht installiert oder liegt in einer nicht unterstützten Version vor. + OpenVPN Connect ist nicht installiert. + OpenVPN für Android ist nicht installiert. VPN - This sensor will start an event when device is connected to/disconnected from VPN. Parameters: Connection status. - VPN sensor - Connection status - Connected - Disconnected + Dieser Sensor löst ein Ereignis aus, wenn das Gerät mit dem VPN verbunden oder von ihm getrennt wird. Parameter: Verbindungsstatus. + VPN-Sensor + Verbindungsstatus + Verbunden + Verbindung getrennt Do not set when VPN is already in state - profile - error on set camera flash - Check in Droid-ify - Open Droid-ify + Profil - Fehler bei eingeschaltetem Kamerablitz + In Droid-ify prüfen + Droid-ify öffnen Name kopieren - Note: Location data will also be included in the exported settings. If you share the backup with other people, select the parameters that should not be exported. - What not export? - Locations for Location sensor - Wi-Fi SSIDs for Wi-Fi sensor - Bluetooth names for Bluetooth sensor - Mobile cells for Mobile cell sensor - Vibration intensity - Incomming call - Notifications + Hinweis: Die Standortdaten werden ebenfalls in die exportierten Einstellungen aufgenommen. Wenn Sie die Sicherung mit anderen Personen teilen, wählen Sie jene Parameter aus, die nicht exportiert werden sollen. + Was soll nicht exportiert werden? + Standorte für Standortsensor + WLAN-SSIDs für WLAN-Sensor + Bluetooth-Namen für Bluetooth-Sensoren + Mobilfunkzellen für Mobilfunkzellen-Sensor + Vibrationsstärke + Eingehender Anruf + Benachrichtigungen Touch interaction - Vibration intensity - Some profile preferences need the PPPPutSettings helper application to put setting parameter into the system database. ROOT is not required. These preferences are marked with (S). + Vibrationsstärke + Einige Profileinstellungen benötigen das Hilfsprogramm PPPPutSettings, um die Einstellungsparameter in die Systemdatenbank zu übertragen. ROOT ist nicht erforderlich. Diese Einstellungen sind mit (S) gekennzeichnet. Profile parameters marked with (S) need helper application PPPPutSettings. After successful installation, all profile parameters marked with (S) will be enabled. Install PPPPutSettings @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Schließen Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Schließen Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. Neue Version nötig. Hier klicken um PhoneProfilePlusExtender zu aktualisieren. @@ -1970,7 +1958,7 @@ Profil aktivieren Profil duplizieren Profil löschen - Enable event run + Ereignisablauf aktivieren Ereignis anhalten Ereignis duplizieren Ereignis löschen @@ -2042,7 +2030,7 @@ Scanning paused error code "GitHub download is not supported. Please install PhoneProfilesPlus with Droid-ify." - Brightness sensor + Helligkeitssensor This sensor will start an event by brightness level change. Parameters: Operator from\/to, Brightness level from\/to. Brightness level from Operator from @@ -2061,7 +2049,7 @@ Jede Mobilfunkzelle muss einen Namen haben. Mehrere Zellen können denselben Namen haben. Ein Name repräsentiert eine Gruppe von Zellen, und diese Gruppen sind in „Zellennamen” konfiguriert.\n\nKlicken Sie hier, um Zellennamen zu konfigurieren. Dadurch wird der Bildschirm \"Mobilfunkzellen scannen\" geöffnet, und darin befindet sich der „Mobilfunkzellen-Editor”. Each mobile cell must have a name. Multiple cells can have the same name. A name represents a group of cells and these groups are configured in \"Mobile cell sensor\"\/\"Cell Names\". Show notification for detection of new mobile cells - Cell registration is for registering new mobile cells. Registration will be running in background. During running registration, is recommended to not change location of device. + Die Zellenregistrierung dient der Registrierung neuer Mobilfunkzellen. Die Registrierung wird im Hintergrund ausgeführt. Während der laufenden Registrierung wird empfohlen, den Standort des Geräts nicht zu ändern. Die Zellregistrierung dient dazu, neue Mobilfunkzellen zu registrieren.\n\nKlicken Sie hier, wenn Sie die Zellregistrierung starten möchten. Dadurch wird der Bildschirm „Mobilfunkzellen scannen” geöffnet, und darin befindet sich die „Zellregistrierung”. Scanning enabled, interval set Mobile cell scan interval @@ -2072,7 +2060,7 @@ Start Activator Start Editor Restart events - Enable\/Disable events run + Ereignisse ausführen Ein/Aus Verknüpfung zu „Mobilfunkzellen scannen” Klicken Sie hier, um eine Verknüpfung zu „Mobilfunkzellen scannen” im Startbildschirm zu erstellen. Verknüpfung zu „Mobilfunkzellen scannen” erstellt @@ -2084,13 +2072,12 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] Grant Shizuku permission Some profile preferences require Shizuku. ROOT is not required. These preferences are marked with \"(Z)\". - Please install, run and grant Shizuku permission for PhoneProfilesPlus. Is required for profile and event parameters, marked with (Z). Then ROOT will not be needed. + Bitte installieren, ausführen und Shizuku die Berechtigung für PhoneProfilesPlus erteilen. Wird für Profil- und Ereignisparameter benötigt, gekennzeichnet mit (Z). Dann wird ROOT nicht benötigt. Permission for (Z) preferences not granted Click here to grant it. Shizuku is not installed or running. @@ -2132,20 +2119,6 @@ Write will be started. Laufzeit der Anwendungen Unbegrenzt - Telefonanrufe - Funktion zur Anrufüberprüfung festlegen - Klicken Sie hier, um die Anrufüberwachungsfunktion für PhoneProfilesPlus einzustellen. Wird für „Anrufe sperren“ benötigt. - Anrufüberwachungsfunktion für PhoneProfilesPlus ist festgelegt - Die Funktion zur Anrufüberprüfung für PhoneProfilesPlus ist nicht festgelegt - Telefonanrufe sperren - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Kontaktgruppen - Kontakte - für gelesene Kontakte im Profilparameter „Telefonanrufe“ - Kontakte für Profilparameter „Telefonanrufe“ - SMS senden - SMS-Text - Warnhinweis: Das Versenden von SMS kann mit einem Prepaid-SMS-Paket verrechnet oder verbraucht werden! Wird angezeigt, wenn das Ereignis „Beginn des Ereignisses“/„Andere Parameter“/„Wiederholte Benachrichtigung“ aktiviert ist. Is displayed, when profile has configured \"Others\"/\"Generate notification\". Wird angezeigt, wenn „Einstellungen“/„Benachrichtigung über Profilliste“/„Benachrichtigung anzeigen“ aktiviert ist @@ -2201,7 +2174,7 @@ SIM wechseln (Ein/Aus) ACHTUNG: Es wird der Bildschirm zur Eingabe des PIN-Codes für die SIM-Karte angezeigt, die als „Ein“ konfiguriert ist. PhoneProfilesPlus-Server - PhoneProfilesPlus-Server-Einladung + Server-Einladung PhoneProfilesPlus Veröffentlichung in APKPure: Bitte installieren Sie Droid-ify. Wird für die Installation von PPPPutSettings benötigt. Führen Sie danach die Installation von PPPPutSettings erneut durch. SMS senden @@ -2214,4 +2187,95 @@ Mit Verzögerung ausgeführt Diese Anwendung wird im IzzyOnDroid-Repository und in GitHub Releases bereitgestellt. Klicken Sie hier, um sie zu installieren. Wenn Sie Probleme, Fragen und Anregungen haben, klicken Sie hier und kontaktieren Sie mich. + Bitte aktivieren Sie den Benachrichtigungszugriff für PhoneProfilesPlus in den Systemeinstellungen. Andernfalls wird der Musiksensor keine Anwendung erkennen, die Musik wiedergibt. + Zugriff auf Benachrichtigungen deaktiviert + Zugriff auf Benachrichtigungen aktiviert + Funktion zur Anrufüberwachung festlegen + Klicken Sie hier, um die Anrufüberwachungsfunktion für PhoneProfilesPlus festzulegen. Wird für den Ereignissensor „Anrufüberwachung“ benötigt. + Die Funktion der Anrufüberprüfung für PhoneProfilesPlus wurde eingerichtet + Die Funktion der Anrufüberprüfung für PhoneProfilesPlus wurde nicht eingerichtet + Anrufüberwachung + Anrufüberwachung + Dieser Sensor löst ein Ereignis aus, wenn während eines Anrufs der Anrufbildschirm angezeigt wird. Die Anrufsperre wird unterstützt. Parameter: Kontaktgruppen, Kontakte, Dauer, Dauerlauf, Anrufsperre, SMS senden, SMS-Text. + Kontakte für den Sensor „Anrufüberwachung“ + Telefonanrufe sperren + SMS senden + SMS-Nachricht + Warnhinweis: Für den SMS Versand können Kosten anfallen oder von einem Prepaid-SMS-Paket genutzt werden! + keine Anrufüberwachungsfunktion für PhoneProfilesPlus festgelegt + für gelesene Kontakte, SMS senden im Ereignissensor „Anrufüberwachung“ + Richtung des Anrufs + Eingehende Anrufe + Ausgehende Anrufe + Alle Anrufe + Anrufe sperren + Für jedes Profil mit dem konfigurierten Parameter „Telefonanrufe“/„Anrufe sperren“ wird ein neues Ereignis mit dem Sensor „Anrufüberwachung“ erzeugt. Bei diesem Ereignis ist der Parameter „Ereignisablauf“ deaktiviert. Der Parameter „Telefonanrufe“ wird aus den Profilen entfernt. + SMS senden + Kontaktgruppen + Kontakte + für gelesene Kontakte im Profilparameter „SMS senden“ + Kontakte für Profilparameter „SMS senden“ + SMS senden + SMS-Nachricht + Profil - Fehler beim Senden von SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Rufnummern nicht in Kontakten + Gesperrter Anruf + Rufnummer: + Warnhinweis: Dieser Parameter ermöglicht das Sperren von Anrufen. Eine Benachrichtigung über gesperrte Anrufe wird nicht angezeigt!\nDie gesperrten Rufnummern werden jedoch im „Aktivitätsprotokoll“ protokolliert, das einen Rückruf an die gesperrte Rufnummer ermöglicht, wenn Sie auf diese Protokollzeile klicken. + Vollständiges Protokoll + Gesperrte Anrufe + Fehler + Ereignisbeginn + Ereignisse pausieren + Ereignisse beenden + Ereignisse neu starten + Profil-Aktivierungen + Anwendungsinstallation + (G1)(R) Nachtbeleuchtung + (Z)(R) Lesemodus + Augenschonend + (G1)(R) Augenschonend + zum Aktivieren/Deaktivieren der Augenschonung + (I) Einstellungen für Nachtbeleuchtung + (I) Einstellungen des Augenschonungsschutzes + (I) Einstellungen des Lesemodus + (S)(Z)(R) Eye comfort shield + Wenn es nicht möglich ist, diese Berechtigung zu erteilen, sind eingeschränkte Einstellungen für PhoneProfilesPlus möglicherweise nicht zulässig. Klicken Sie hier, um es zuzulassen. + zum Aktivieren/Deaktivieren von VPN + Die Notwendigkeit, „Über andere Apps ziehen“ dauerhaft zu aktivieren, wurde entfernt. Da sich dieses Recht in den „Eingeschränkten Einstellungen“ befindet und wenn es aktiviert ist, können Banking-Anwendungen und -Websites, Zahlungen für Waren, Dienstleistungen usw. gesperrt werden oder erfordern die Deaktivierung von „Über andere Apps ziehen“ in PhoneProfilesPlus. + Es wird empfohlen, die neue Version von PPPPutSettings (1.1) zu installieren, in der es eine Änderung gibt, die „Über andere Apps ziehen“ nicht erfordert. Bei Versionen vor 1.1 erfordern die mit (S) gekennzeichneten Parameter weiterhin dieses Recht. + Für einige Profilparameter ist „Über andere Apps ziehen“ weiterhin erforderlich, zum Beispiel für „Anwendungen, Tastaturkürzel und Absichten ausführen“. + Farbwert + Standortname + Benutzerdefinierte Aktion + Liste leeren + Ton + Pfeil nach rechts + Pfeil nach links + [ Nicht festgelegt ] + Sperrbildschirm des Geräts + Dieser Parameter aktiviert/deaktiviert den Sperrbildschirm des Geräts. Bei der Einstellung „Aus” wird der Sperrbildschirm nicht angezeigt, wenn der Bildschirm eingeschaltet wird. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Bildschirm Ein/Aus + „Bildschirm einschalten” ist „Ein”. Um es auf „Aus“ zu stellen, konfigurieren und aktivieren Sie das Profil mit „Bildschirm einschalten“=„Aus“. + zum Ein- und Ausschalten des Bildschirms + Wenn „Bildschirm Ein/Aus“ konfiguriert ist, ist „Gerätesperrbildschirm“ deaktiviert ist und umgekehrt. Es ist nicht möglich, beides zu konfigurieren. + Shizuku ist installiert, wird aber nicht ausgeführt. Bitte öffnen Sie Shizuku und starten Sie es aus seiner Anwendung. + Öffnen + Hilfe + Dieser Parameter ist für „Anrufereignis“=„Entgangener Anruf“. + „Licht“ ist das vom Lichtsensor des Geräts erfasste Umgebungslicht. diff --git a/common/src/main/res/values-el/strings.xml b/common/src/main/res/values-el/strings.xml index baaacd8460..3f390c1f03 100644 --- a/common/src/main/res/values-el/strings.xml +++ b/common/src/main/res/values-el/strings.xml @@ -263,7 +263,6 @@ Προεπιλεγμένο προφίλ Προτεραιότητα Προσαρμοστική - Unlock device Απόκρυψη ονόματος προφίλ Επανεκκίνηση συμβάντων Χωρίς σύνδεση @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Ενεργοποίηση προφίλ Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color Ενεργό (μην απενεργοποιήσετε το Wi-Fi) Ignore Wi-Fi hotspot Η επιλογή \"Ενεργό (μην απενεργοποιήσετε το Wi-Fi)\" πρέπει να υποστηρίζεται από το σύστημα @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-es/strings.xml b/common/src/main/res/values-es/strings.xml index 25651bc603..8865c5309c 100644 --- a/common/src/main/res/values-es/strings.xml +++ b/common/src/main/res/values-es/strings.xml @@ -263,7 +263,6 @@ Perfil predeterminado Prioridad Adaptativo - Desbloquear dispositivo Ocultar nombre de perfil [M] Reiniciar eventos No conectado @@ -413,7 +412,7 @@ En el título del Activador y del Editor hay un \"semáforo\". Se pueden iniciar eventos. Los eventos no pueden iniciarse - el perfil se activó manualmente. - Events are stopped - events run can be enabled through Editor top bar icon \"Enable events run\". + Los eventos están detenidos - los eventos se pueden activar a través del icono de la barra superior del Editor \"Activar ejecución de eventos\". Icono de reiniciar eventos: Icono de \"Semáforo\": Android 6+ implementa \"Doze mode\" y \"App Standby\". Para evitar problemas con eventos de activación de perfiles —cuando dejas de usar el dispositivo durante un tiempo, con la pantalla apagada, sin conectarlo al cargador e inmoóvil— haz clic aquí para añadir PhoneProfilesPlus a \"No optimizado\". @@ -670,7 +669,7 @@ Haz clic aquí para abrir el menú de eventos con opciones: Habilitar/Detener funcionamiento, Duplicar y Borrar evento. Manipulador de orden Arrastra el evento arriba/abajo con este manipulador para cambiar el \"Orden de inicio\" del evento. - Editor + Editor Haz clic aquí para abrir el Editor, donde puedes configurar perfiles, eventos, cambiar los ajustes de la aplicación, etc. Activar perfil Haz clic aquí para activar un perfil. @@ -833,7 +832,6 @@ Habilitar el escaneo de orientación (G1)(R) Notificaciones emergentes Icono personalizado - Haz clic para establecer el nombre de la celda Puede que la conexión a Punto de Acceso no funcione desde otros dispositivos. No utilizar Iniciar al cargar @@ -990,7 +988,6 @@ Permite \"Accesibilidad\" a PhoneProfilesPlusExtender en los ajustes del sistema. La función de Accesibilidad no se utiliza, pero se necesita ejecutar el servicio para recibir llamadas. Haz clic aquí para instalar PhoneProfilesPlusExtender. Es necesario que el servicio esté en ejecución para recibir llamadas. para leer contactos con el sensor SMS/MMS - para leer contactos, detectar llamada si suena (para \"llamada nocturna\") con el sensor de llamada Usar decorado Tipo de diseño Expandible @@ -1055,7 +1052,7 @@ Usar PhoneProfilesPlusExtender En Android 9+, para que el escaneo de celdas móviles funcione, debes habilitar la Ubicación en los ajustes del sistema. El evento no se iniciará cuando: - You have disabled global events run (red \"traffic light\") - enable it in Editor top bar icon \"Enable events run\". + Has deshabilitado la ejecución global de eventos (\"semáforo\" en rojo) - habilítala desde el menú del Editor en la opción \"Habilitar ejecución de eventos\". Has activado manualmente el perfil (\"semáforo\" en ámbar) - debes reiniciar los eventos. Usa el icono de Reiniciar eventos en el título del Activador, Editor o en la notificación. Un perfil activado manualmente se indica también con \"[M]\" delante del nombre del perfil. Excepto cuando en el evento se ha activado la opción \"Ignorar activación automática\". Has deshabilitado la ejecución de eventos desde las preferencias de evento - la opción de evento \"Ejecutar eventos\" debe estar marcada. Nota: El \"Semáforo\" está en el título del Activador y en el Editor. Si el escaneo de celdas móviles no funciona, habilita la Ubicación en los Ajustes del Sistema. @@ -1301,7 +1298,6 @@ Ahorro de batería Alta precisión Color de icono personalizado - Color personalizado Encendido (no deshabilitar Wi-Fi) Ignorar punto de acceso Wi-Fi La opción \"Encendido (no deshabilitar Wi-Fi)\" debe estar soportada por el sistema @@ -1660,13 +1656,7 @@ y Encendido Apagado - no establecer - para el parámetro - También debes configurar Muestra una notificación sobre el estado de - es - Para establecerlo - configurar y activar perfil con Sin duración Tipo de fin de activación Duración @@ -1799,12 +1789,10 @@ Habilitar la ejecución de eventos Deshabilitar la ejecución de eventos No establecido - Personalizado no establecido No seleccionado [ Ninguno ] [ Personalizado ] (A) aplicación, (S) acceso directo, (I) intento. - No establecido Ninguna instalada Ubicación no funciona Lo sentimos, pero no es posible obtener la ubicación. Por favor, comprueba la configuración de ubicación del dispositivo. @@ -1938,8 +1926,8 @@ Nota: No todas las aplicaciones de Reloj utilizan el volumen de alarma del sistema porque utilizan su propio volumen configurado en sus ajustes. En este cuadro de diálogo se muestra la lista de SSID Wi-Fi configurados.\nHaz clic aquí para ver la pantalla de configuración Wi-Fi. Contiene un parámetro para configurar redes Wi-Fi. PPPPutSettings - Instalar\nPPPPutSettings - Iniciar\nPPPPutSettings + Instalar PPPPS + Iniciar PPPPS Cerrar Iniciar PPPPutSettings PPPPutSettings no está instalado. @@ -1955,9 +1943,9 @@ Nueva versión de PPPPutSettings Haz clic en esta notificación para instalar la nueva versión de PPPPutSettings. PhoneProfilesPlusExtender - Instalar\nPhoneProfilesPlusExtender - Iniciar\nPhoneProfilesPlusExtender - Activar/desactivar\najustes de accesibilidad + Instalar PPPE + Iniciar PPPE + Activar/desactivar Cerrar Haz clic aquí para instalar/actualizar, activar/desactivar los ajustes de accesibilidad, iniciar PhoneProfilesPlusExtender. Se requiere una nueva versión de PhoneProfilesPlusExtender. Haz clic aquí para actualizarla. @@ -2084,7 +2072,6 @@ Contactos para el sensor de SMS/MMS Contactos para el sensor de notificaciones Debes conceder el permiso \"mostrar sobre otras aplicaciones\". Es necesario para iniciar las actividades cuando PhoneProfilesPlus está en segundo plano. Haz clic en el botón \"Conceder\" para conceder este permiso. - Si no es posible conceder este permiso, haz clic en este enlace. Tal vez en esta página web esté la solución para tu dispositivo: Ø - No usar Filtro de contactos [ Todos ] @@ -2132,20 +2119,6 @@ Se iniciará la escritura. Duración de la ejecución de aplicaciones Ilimitado - Llamadas telefónicas - Establecer función de selección de llamada - Haz clic aquí para establecer el rol de detección de llamadas para PhoneProfilesPlus. Es necesario para \"Bloquear llamadas telefónicas\". - Se ha establecido el rol de detección de llamadas para PhoneProfilesPlus - No se ha establecido el rol de detección de llamadas para PhoneProfilesPlus - Bloquear llamadas - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Grupos de contactos - Contactos - para leer contactos en el parámetro de perfil \"Llamadas telefónicas\" - Contactos para el parámetro de perfil \"Llamadas telefónicas\" - Enviar SMS - Texto SMS - ATENCIÓN: El envío de SMS puede ser de contrato o de prepago! Se muestra cuando el evento tiene habilitado \"Inicio del evento\"/\"Otros parámetros\"/\"Repetir notificación\". Se muestra cuando en el perfil se ha configurado \"Otros\"/\"Generar notificación\". Se muestra cuando está habilitado \"Configuración\"/\"Notificación de lista de perfiles\"/\"Mostrar notificación\" @@ -2201,7 +2174,7 @@ Activar/desactivar SIM ADVERTENCIA: Esto activa la pantalla de entrada de código PIN para la tarjeta SIM que está configurada como «On». Servidor PhoneProfilesPlus - Invitación al servidor PhoneProfilesPlus + Invitación al servidor Versión de PhoneProfilesPlus en ApkPure: Por favor, instala Droid-ify. Es necesario para la instalación de PPPPutSettings. Después, vuelve a instalar PPPPutSettings. Enviar SMS @@ -2214,4 +2187,95 @@ Ejecutándose con retraso Esta aplicación está en el repositorio IzzyOnDroid y en GitHub. Haz clic aquí para instalarla. Si tienes problemas, preguntas y sugerencias, haz clic aquí y escríbeme. + Por favor, activa el acceso de notificación para PhoneProfilesPlus en la configuración del sistema. Sin esto, Music sensor no detectará la aplicación que reproduce música. + Acceso a notificaciones deshabilitado + Acceso a notificaciones habilitado + Establecer rol de filtro de llamadas + Haz clic aquí para establecer el rol de filtro de llamadas para PhoneProfilesPlus. Es necesario para \"Filtrar llamadas\". + Se ha establecido el rol de filtro de llamadas para PhoneProfilesPlus + No se ha establecido el rol de filtro de llamadas para PhoneProfilesPlus + Filtro de llamadas + Filtro de llamadas + Este sensor activa un evento si se muestra la pantalla de llamada telefónica durante una llamada. El bloqueo de llamadas es compatible con él. Parámetros: Grupos de contacto, Contactos, Duración, ejecución permanente, Bloquear llamada telefónica, Enviar SMS, texto SMS. + Contactos para el sensor \"Filtro de de llamadas\" + Bloquear llamadas + Enviar SMS + Texto SMS + ATENCIÓN: El envío de SMS puede ser de contrato o de prepago! + no establecer función de filtro de llamadas para PhoneProfilesPlus + para leer contactos, enviar SMS en el sensor de evento \"Filtro de llamadas\" + Dirección de la llamada + Llamadas entrantes + Llamadas salientes + Todas las llamadas + Bloquear llamadas + Para cada perfil con el parámetro \"Llamadas telefónicas\"\/\"Bloquear llamadas\" configurado se genera un nuevo evento con el sensor \"Filtro de llamadas\". Este evento tiene deshabilitado el parámetro \"Ejecutar evento\". El parámetro \"Llamadas telefónicas\" de los perfiles se elimina. + Enviar SMS + Grupos de contactos + Contactos + para leer contactos en el parámetro de perfil \"Enviar SMS\" + Contactos del parámetro de perfil \"Enviar SMS\" + Enviar SMS + Texto SMS + perfil - error al enviar SMS + Enviar SMS + Texto SMS + para leer contactos, detectar llamadas entrantes (para \"llamada nocturna\") y enviar SMS en el sensor de llamada + Notificaciones + Limpiar notificaciones + Por favor, habilita el \"Acceso a notificaciones\". Sin esto, \"limpiar notificaciones\" no funcionará. + Limpiar notificaciones + para leer contactos en el parámetro de perfil \"Limpiar notificaciones\" + Aplicaciones: + Grupos de contactos: + Contactos: + Texto + Contactos para el parámetro de perfil \"Limpiar notificaciones\" + Los números de teléfono no están en Contactos + Llamada bloqueada + tel. número: + ADVERTENCIA: Este parámetro permite bloquear llamadas. ¡No se mostrarán notificaciones sobre llamadas bloqueadas!\nPero los números de teléfono bloqueados se registran en el \"Registro de actividades\", lo que permite volver a llamar al número de teléfono bloqueado haciendo clic en su línea de registro. + Registro completo + Llamadas bloqueadas + Errores + Inicio de eventos + Pausa de eventos + Parada de eventos + Reinicio de eventos + Activaciones del perfil + instalación de la aplicación + (G1)(R) Luz nocturna + (Z)(R) Modo de lectura + Confort ocular + (G1)(R) Confort ocular + para activar/desactivar confort ocular + (I) Ajustes de luz nocturna + (I) Ajustes de apantallamiento de confort ocular + (I) Configuración del modo de lectura + (S)(Z)(R) Apantallamiento de confort ocular + Si no es posible conceder este permiso, tal vez los ajustes restringidos para PhoneProfilesPlus no estén permitidos. Haz clic aquí para permitirlos. + para activar/desactivar la VPN + La necesidad de tener habilitado el permiso \"Mostrar sobre otras aplicaciones\" permanentemente ha sido eliminada ya que este permiso forma ahora parte de la \"Configuración restringida\" y, si se habilita, puede bloquear aplicaciones bancarias, sitios web, medios de pago, etc., que además podrían solicitarte deshabilitar el permiso \"Mostrar sobre otras aplicaciones\" para PhoneProfilesPlus. + Se recomienda instalar la nueva versión de PPPPutSettings (1.1), donde hay un cambio que no requiere \"Mostrar sobre otras aplicaciones\". Para versiones anteriores a la 1.1, los parámetros marcados con (S) requerirán este permiso. + Para algunos parámetros de perfil todavía es necesario el permiso \"Mostrar sobre otras aplicaciones\", por ejemplo, para \"Ejecutar aplicaciones, atajos, intentos\". + Valor de color + Nombre de ubicación + Acción personalizada + Lista vacía + Tono + Flecha derecha + Flecha izquierda + [ No establecido ] + Pantalla de bloqueo de dispositivo + Este parámetro activa o desactiva la pantalla de bloqueo del dispositivo. Cuando esté desactivada, la pantalla de bloqueo no aparecerá cuando la pantalla está encendida. + La configuración de \"Tiempo de espera de pantalla\" en el sistema (por activación de perfil) no desactiva \"Mantener pantalla encendida\". También necesitarás configurar \"Mantener la pantalla encendida\" comop \"Apagado\" si deseas que \"Tiempo de espera de pantalla\" funcione. + Pantalla encendida/apagada + \"Mantener la pantalla encendida\" es \"Activado\". Para desactivarla, configure y active el perfil con \"Mantener la pantalla encendida\"=\"Desactivado\". + para encender/apagar la pantalla + Cuando se configura \"Encendido o Apagado\", \"Pantalla de bloqueo de dispositivo\" se desactiva, y viceversa. No es posible configurar ambos. + Shizuku está instalado, pero no se está ejecutando. Por favor, abre Shizuku e inícialo. + Abrir + Ayuda + Este parámetro es para \"Evento de llamada\"=\"Llamada perdida\". + \"Luz\" es la luz ambiental detectada por el sensor de luz del dispositivo. diff --git a/common/src/main/res/values-et/strings.xml b/common/src/main/res/values-et/strings.xml index 0ed2c007d9..f984ddbfc7 100644 --- a/common/src/main/res/values-et/strings.xml +++ b/common/src/main/res/values-et/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-fa/strings.xml b/common/src/main/res/values-fa/strings.xml index 104d27f071..5c881fcb7d 100644 --- a/common/src/main/res/values-fa/strings.xml +++ b/common/src/main/res/values-fa/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-fi/strings.xml b/common/src/main/res/values-fi/strings.xml index 1fda5f8ba4..516e455b30 100644 --- a/common/src/main/res/values-fi/strings.xml +++ b/common/src/main/res/values-fi/strings.xml @@ -263,7 +263,6 @@ Oletusprofiili Tärkeysjärjestys Mukautuva - Unlock device Piilota profiili nimi Käynnistä tapahtumat uudelleen Yhdistämättä @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-fr/strings.xml b/common/src/main/res/values-fr/strings.xml index 4e4ca6b0ea..62abba0882 100644 --- a/common/src/main/res/values-fr/strings.xml +++ b/common/src/main/res/values-fr/strings.xml @@ -263,7 +263,6 @@ Profil par défaut Prioritaire Adaptatif - Déverrouiller l\'appareil Cacher le nom du profil Redémarrer les événements Non connecté @@ -413,7 +412,7 @@ Un feu de circulation s\'affiche dans le titre de l\'activateur et de l\'éditeur. Les événements peuvent être démarrés. Les événements ne peuvent pas démarrer - le profil est activé manuellement. - Events are stopped - events run can be enabled through Editor top bar icon \"Enable events run\". + Les événements sont arrêtés - les événements exécutés peuvent être activés via l\'icône de la barre supérieure de l\'éditeur « Activer l\'exécution des événements ». Icône de redémarrage des événements : Icône \"Feu\": Android 6+ implémente le \"mode Doze\" et \"App Standby\". Concernant les problèmes d\'activation du profil d\'événement lorsque vous laissez l\'appareil débranché et immobile pendant un certain temps avec l\'écran éteint, cliquez ici pour ajouter PhoneProfilesPlus dans \"Non optimisé\". @@ -670,7 +669,7 @@ Cliquez sur ce bouton pour ouvrir le menu événement avec options : activer/arrêt, dupliquer et supprimer. Gestionnaire de priorité Faites glisser l’événement vers le haut ou le bas pour modifier l\'ordre dans l\'activateur. - Éditeur + Éditeur Cliquez sur ce bouton pour ouvrir l’éditeur. Dans l’éditeur, que pouvez configurer les profils, les événements, changer les paramètres de l’application… Activer le profil Cliquez sur ce bouton pour activer le profil. @@ -833,7 +832,6 @@ Activer l’analyse de l’orientation (G1)(R) Utiliser des notifications contextuelles (Popup) Icône personnalisée - Cliquez pour définir le nom de l\'antenne-relais Il est possible que la connexion ne fonctionne sur ce hotspot à partir d\'un autre appareil. Ne pas utiliser Démarrer lors de la charge @@ -990,7 +988,6 @@ Autoriser PhoneProfilesPlusExtender dans les paramètres système. La fonction d\'accessibilité n\'est pas utilisée, un service en cours d\'exécution est nécessaire pour recevoir des appels. Cliquez ici pour installer PhoneProfilesPlusExtender. Le service en cours d\'exécution est nécessaire pour recevoir des appels. pour lire les contacts dans le capteur SMS/MMS - pour lire les contacts, détecter la sonnerie d\'appel (pour les \"appels de nuit\") dans le capteur d\'appe Utiliser la décoration Type de mise en page Déveloper @@ -1055,7 +1052,7 @@ Utiliser PhoneProfilesPlusExtender Dans Android 9+, pour que l\'analyse du réseau mobile fonctionne, vous devez activer la localisation dans les paramètres système. L\'événement n\'est pas commencé quand : - You have disabled global events run (red \"traffic light\") - enable it in Editor top bar icon \"Enable events run\". + Vous avez désactivé l\'exécution des événements globaux (« feu tricolore » rouge) - activez-le dans l\'icône de la barre supérieure de l\'éditeur « Activer l\'exécution des événements ». Vous avez activé manuellement le profil (\"feu orange\") - vous devez redémarrer les événements. Utilisez l\'icône redémarrer les événements de l\'activateur. Les profils activés manuellement sont indiqués par \"[M]\" devant le nom du profil. Il y a une exception quand l\'événement a la case \"ignorer activation manuelle\" cochée. Vous avez désactivé les évènements dans les préférences des événements. Note: \"Le Feu\" est dans la barre de titre. Si l\'analyse du réseau mobile ne fonctionne pas, activez la localisation dans les paramètres du système. @@ -1301,7 +1298,6 @@ Économie de batterie Haute précision Couleur de l\'icône personnalisée - Couleur personnalisée Activé (ne pas désactiver le Wi-Fi) Ignorer le point d\'accès Wi-Fi L\'option \"Activé (ne pas désactiver le Wi-Fi) doit être prise en charge par le système @@ -1660,13 +1656,7 @@ et Activé Désactivé - ne pas définir - pour le paramètre - Vous devez également configurer Affiche la notification à propos de l\'état de - est - Pour le définir - configurer et activer le profil avec Sans durée Type de fin d\'activation Durée @@ -1799,12 +1789,10 @@ Activer les événements Désactiver les événements Non défini - Personnalisation non définie Non sélectionné [ Aucun ] [Personalisé] (A) application, (S) raccourci, (I) événement. - Non défini Aucun installé Localisation non fonctionnelle Localisation impossible. Veuillez vérifier les paramètres du téléphone. @@ -1938,8 +1926,8 @@ Remarque : toutes les applications Horloge n\'utilisent pas le volume d\'alarme du système car elles utilisent leur propre volume configuré dans leurs paramètres. Cette boîte de dialogue affiche la liste des SSID Wi-Fi configurés.\nCliquez ici pour voir les paramètres Wi-Fi. Il sera possible de configurer les réseaux Wi-Fi. PPPPutSettings - Installer\nPPPPutSettings - Lancer\nPPPPutSettings + Installer PPPPS + Lancer PPPPS Fermer Lancer PPPPutSettings PPPPutSettings n\'est pas installé. @@ -1955,9 +1943,9 @@ Nouvelle version de PPPPutSettings Cliquez sur cette notification pour installer la nouvelle version de PPPPutSettings. PhoneProfilesPlusExtender - Installer\nPhoneProfilesPlusExtender - Lancer\nPhoneProfilesPlusExtender - Activer/désactiver\nParamètres d\'accessibilité + Installer PPPE + Lancer PPPE + Activer/désactiver Fermer Cliquez ici pour installer/mettre à niveau, activer/désactiver les paramètres d\'accessibilité, lancer PhoneProfilesPlusExtender. Une nouvelle version de PhoneProfilesPlusExtender est nécessaire. Cliquez ici pour le mettre à jour. @@ -2084,7 +2072,6 @@ Contacts pour le capteur SMS/MMS Contacts pour le capteur de notification Vous devez accorder l\'autorisation \"Superposition des applications\". Elle est nécessaire au bon fonctionnement de PhoneProfilesPlus en arrière-plan. Cliquez sur le bouton « Accorder » pour accorder cette autorisation. - S\'il n\'est pas possible d\'accorder cette autorisation, cliquez sur ce lien. Cette page Web contient peut-être une solution pour votre appareil : Ø - Ne pas utiliser Filtre de contacts [ Tous ] @@ -2132,20 +2119,6 @@ L\'écriture va commencer. Durée d\'exécution des applications Illimité - Appels téléphoniques - Définir le rôle de filtrage des appels - Cliquez ici pour définir le rôle de filtrage des appels pour PhoneProfilesPlus. Est requis pour « Bloquer les appels téléphoniques ». - Le rôle de filtrage des appels pour PhoneProfilesPlus est défini - Le rôle de filtrage des appels pour PhoneProfilesPlus n’est pas défini - Bloquer les appels téléphoniques - AVERTISSEMENT : Ce paramètre permet de bloquer les appels, configurés dans \"Groupes de contacts\", \"Contacts\". La notification des appels bloqués ne sera pas affichée ! - Groupes de contacts - Contacts - pour lire les contacts dans le paramètre de profil \"Appels téléphoniques\" - Contacts pour le paramètre de profil \"Appels téléphoniques\" - Envoyer des SMS - SMS texte - AVERTISSEMENT : L\'envoi de SMS peut être facturé ou utilisé à partir d\'un forfait SMS prépayé ! S\'affiche lorsque l\'événement a activé \"Début de l\'événement\"/\"Autres paramètres\"/\"Répéter la notification\". S\'affiche lorsque le profil a configuré \"Autres\"/\"Générer une notification\". S\'affiche lorsque \"Paramètres\"/\"Notification de liste de profils\"/\"Afficher la notification\" est affiché @@ -2201,7 +2174,7 @@ Activer/désactiver la carte SIM AVERTISSEMENT : Ceci affiche l\'écran de saisie du code PIN de la carte SIM qui est configuré comme « Activé ». Serveur PhoneProfilesPlus - Invitation du serveur PhoneProfilesPlus + Invitation du serveur Version de PhoneProfilesPlus sur ApkPure : Veuillez installer Droid-ify. Il est nécessaire à l\'installation de PhoneProfilesPlusExtender. Ensuite, réinstallez PhoneProfilesPlusExtender. Envoyer des SMS @@ -2214,4 +2187,95 @@ Exécution différée Cette application est dans le dépôt IzzyOnDroid et sur GitHub. Cliquez ici pour l\'installer. Si vous avez des problèmes, des questions et des suggestions, cliquez ici et écrivez-moi. + Veuillez activer l\'accès aux notifications pour PhoneProfilesPlus dans les paramètres système. Sans cela, le capteur de musique ne détectera pas les applications qui diffusent de la musique. + Accès aux notifications désactivé + Accès aux notifications activé + Définir le rôle de filtrage des appels + Cliquez ici pour définir le rôle de filtrage des appels pour PhoneProfilesPlus. Requis pour le capteur d’événement \"Filtrage des appels\". + Le rôle de filtrage des appels pour PhoneProfilesPlus est défini + Le rôle de filtrage des appels pour PhoneProfilesPlus n’est pas défini + Filtrage des appels + Filtrage des appels + Ce capteur déclenchera un événement si l\'écran d\'appel téléphonique s\'affiche pendant un appel. Le blocage des appels est pris en charge. Paramètres : Groupes de contacts, Contacts, Durée, Exécution permanente, Bloquer l\'appel téléphonique, Envoyer SMS, SMS. + Contacts pour le capteur \"Filtrage des appels\" + Bloquer les appels téléphoniques + Envoyer des SMS + Texte SMS + ATTENTION : L\'envoi de SMS peut être facturé ou utilisé depuis un forfait SMS prépayé ! + ne pas définir le rôle de filtrage des appels pour PhoneProfilesPlus + pour lire les contacts, envoyer des SMS dans le capteur d\'événements \"Filtrage des appels\" + Direction de l’appel + Appels entrants + Appels sortants + Tous les appels + Bloquer les appels + Pour chaque profil avec le paramètre configuré \"Appels téléphoniques\"\/\"Bloquer les appels\", un nouvel événement est généré avec le capteur \"Filtrage des appels\". Cet événement a le paramètre \"Exécution d\'événement\" désactivé. Le paramètre \"Appels téléphoniques\" des profils est supprimé. + Envoyer des SMS + Groupes de contacts + Contacts + pour lire les contacts dans le paramètre de profil \"Envoyer SMS\" + Contacts pour le paramètre de profil \"Envoyer SMS\" + Envoyer des SMS + Texte SMS + profil - erreur lors de l\'envoi de SMS + Envoyer des SMS + SMS texte + pour lire les contacts, détecter la sonnerie d\'appel (pour « appel de nuit »), envoyer des SMS dans le capteur d\'appel + Notifications + Effacer les notifications + Veuillez activer « Accès aux notifications ». Sans cela, effacer les notifications ne fonctionnera pas. + Effacer les notifications + pour lire les contacts dans le paramètre de profil « Effacer les notifications » + Applications : + Groupes de contacts : + Contacts : + Texte + Contacts pour le paramètre de profil « Effacer les notifications » + Numéros de tél. non présents dans les contacts + Appel bloqué + numéro de tél. : + ATTENTION : Ce paramètre permet de bloquer les appels. Les notifications concernant les appels bloqués ne seront pas affichées !\nMais les numéros de téléphone bloqués sont enregistrés dans le « Journal d\'activité », ce qui permet de rappeler le numéro de téléphone bloqué en cliquant sur cette ligne du journal. + Journal complet + Appels bloqués + Erreurs + Début des événements + Pause des événements + Arrêt des événements + Redémarrage des événements + Activations de profil + installation de l\'application + (G1)(R) Lumière nocturne + (Z)(R) Mode lecture + Confort des yeux + (G1)(R) Confort des yeux + pour activer/désactiver le confort des yeux + (I) Réglages de la lumière nocturne + (I) Paramètres de la protection pour le confort des yeux + (I) Paramètres du mode lecture + (S)(Z)(R) Protection pour le confort des yeux + S\'il n\'est pas possible d\'accorder cette autorisation, il se peut que les paramètres restreints de PhoneProfilesPlus ne soient pas autorisés. Cliquez ici pour l\'autoriser. + pour activer/désactiver le VPN + Le besoin d\'avoir activé « Dessiner sur les applications » de façon permanente a été supprimé. Parce que ce droit est dans les « paramètres restreints » et s\'il est activé, les applications bancaires et les sites Web, les paiements pour les biens, les services, etc. peut être bloqué ou avoir besoin de désactiver « Dessiner sur les applications » dans PhoneProfilesPlus. + Il est recommandé d\'installer la nouvelle version de PPPPutSettings (1.1), où il y a un changement qui ne nécessite pas « Dessiner sur les applications ». Pour les versions antérieures à 1.1, les paramètres marqués avec (S) exigeront toujours ce droit. + Pour certains paramètres de profil, « Dessiner sur les applications » est toujours nécessaire, par exemple pour « Exécuter des applications, des raccourcis, des intentions ». + Valeur de la couleur + Nom du lieu + Action personnalisée + Vider la liste + Tonalité + Flèche droite + Flèche gauche + [ Non défini ] + Écran de verrouillage de l\'appareil + Ce paramètre active ou désactive l\'écran de verrouillage de l\'appareil. Lorsque la valeur est désactivée, l\'écran de verrouillage n\'apparaîtra pas lorsque l\'écran est allumé. + Le réglage « Délai d\'attente de l\'écran » dans le système (par activation du profil) ne désactive pas « Garder l\'écran allumé ». Vous devez également configurer « Garder l\'écran allumé » à « Éteint » si vous voulez que « Délai d\'attente de l\'écran » fonctionne sur le système. + Écran Allumé/Éteint + \"Garder l\'écran allumé\" est \"Activé\". Pour le désactiver, configurez et activez le profil avec \"Garder l\'écran allumé\"=\"Désactivé\". + pour allumer ou éteindre l\'écran + Lorsque \"Écran Allumé/Éteint\" est configuré, \"Écran de verrouillage de l\'appareil\" est désactivé et vice versa. Il n\'est pas possible de configurer les deux. + Shizuku est installé, mais n\'est pas en cours d\'exécution. Veuillez ouvrir Shizuku et le démarrer à partir de son application. + Ouvrir + Aide + Ce paramètre est pour \"Événement d\'appel\"=\"Appel manqué\". + \"Lumière\" est la lumière ambiante détectée par le capteur de luminosité. diff --git a/common/src/main/res/values-ga-rIE/strings.xml b/common/src/main/res/values-ga-rIE/strings.xml index 0ed2c007d9..f984ddbfc7 100644 --- a/common/src/main/res/values-ga-rIE/strings.xml +++ b/common/src/main/res/values-ga-rIE/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-hi/strings.xml b/common/src/main/res/values-hi/strings.xml index 65af4de8f7..ff60e2c0c4 100644 --- a/common/src/main/res/values-hi/strings.xml +++ b/common/src/main/res/values-hi/strings.xml @@ -263,7 +263,6 @@ डिफ़ॉल्ट प्रोफ़ाइल प्राथमिकता अनुकूली - Unlock device प्रोफ़ाइल नाम छुपाएं इवेंट पुनरारंभ करें कनेक्ट नहीं है @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications कस्टम चिह्न - कक्ष का नाम सेट करने के लिए क्लिक करें किसी अंय डिवाइस से हॉटस्पॉट में कनेक्शन काम नहीं कर सकता है । का उपयोग नहीं करते चार्ज करते समय शुरू करें @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. PhoneProfilesPlusExtender का नया संस्करण आवश्यक है। इसे अपग्रेड करने के लिए यहां क्लिक करें @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-hr/strings.xml b/common/src/main/res/values-hr/strings.xml index 0d1a705761..1dc5fa83dc 100644 --- a/common/src/main/res/values-hr/strings.xml +++ b/common/src/main/res/values-hr/strings.xml @@ -263,7 +263,6 @@ Predodređeni profil Prioritet Prilagodljiv - Unlock device Sakri naziv profila Ponovo pokreni događaje Nije spojeno @@ -670,7 +669,7 @@ Klikni ovdje za otvaranje menija događaja sa opcijom: Omogući/ Zaustavi rad, Dupliciraj i Obriši događaj. Redosled izvršavanja Prevuci gore/dole sa ovim za promjenu događaja \"Redosled rada\". - Urednik + Urednik Klikni ovdje za otvaranje Editora, u kojem možete podesiti profile, događaje, promjeniti postavke aplikacije, itd. Aktiviraj Profil Klikni ovdje za aktiviranje profila. @@ -833,7 +832,6 @@ Omogući skeniranje orijentacije (G1)(R) Iskačuće obavijesti Proizvoljna ikona - Klikni za izbor imena ćelije Moguće da neće raditi Hotspot sa drugim uređajima. Ne koristi Startuj kada se puni @@ -990,7 +988,6 @@ Omogući PhoneProfilesPlusExtender -u \"Pristupačnost\" upostavkama sustava. Funkcija Pristupačnosti se ne koristi, korišćenje ovoga servisa je potrebno za prijem poziva. Klikni ovdje za instalaciju PhoneProfilesPlusExtender -a. Korišćenje ovog servisa je neophodno za prijem poziva. za čitanje kontakata u SMS/MMS senzoru - za čitanje kontakata, otkrijte zvono poziva (za \"noćni poziv\") u senzoru poziva Koristi dekoraciju Vrsta izgleda Proširivo @@ -1301,7 +1298,6 @@ Štednja baterije Visoka preciznost Prilagođene boje ikona - Prilagođena boja Uključeno ( ne isključuj Wi- Fi) Ignoriraj Wi-Fi pistupnu točku Opcija \"Uključeno ( ne isključuj Wi-Fi)\" mora biti podržana od strane sustava @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. Nova verzija PhoneProfilesPlusExtender-a je neophodna. Klikni ovdje za ažuriranje. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-hu/strings.xml b/common/src/main/res/values-hu/strings.xml index 74443129a5..997e949cb3 100644 --- a/common/src/main/res/values-hu/strings.xml +++ b/common/src/main/res/values-hu/strings.xml @@ -263,7 +263,6 @@ Alapértelmezett profil Elsőbbség Adaptív - Unlock device Profil név elrejtés Eseményt újra indít Nincs csatlakozva @@ -670,7 +669,7 @@ Ide kattintva megnyílik az események menü az opcióival: Engedélyezett/Leállít futtatást, Duplázása és Törlése az eseménynek. Rendezés kezelő Esemény húzza fel/le ezzel módosításának esemény \"Indítási sorrend\"-jét. - Szerkesztő + Szerkesztő Kattintson ide a szerkesztő megnyitásához. A szerkesztőben konfigurálhatja a profilokat, eseményeket, változtathat az alkalmazás beállításain… Profil aktiválása Kattintsunk ide, a profil aktiválásához. @@ -833,7 +832,6 @@ Tájolás vizsgálat engedélyezés (G1)(R) felugró értesítések Egyéni ikon - Ide kattintva adhatja meg a cella nevét Még nem működik a kapcsolat hotspot-on keresztül másik készülékekkel. Nem használható Start töltés közben @@ -990,7 +988,6 @@ Engedélyezze a PhoneProfilesPlusExtender \"Kisegítő lehetőségek\" a rendszerbeállításokban. Kisegítő funkciót nem használja, a szolgáltatás futtaására van szükség a hívások fogadásához. Kattintson ide a PhoneProfilesPlusExtender telepítéséhez. A szolgáltatás futtatására van szükség a hívások fogadásához. kontaktok olvasásához az SMS/MMS érzékelőben - kontaktok olvasásához, csengő felismeréséhez (\"éjszakai hívásnál\") a hívás érzékelőben Használjon dekorációt Elrendezés tipusa Kiterjeszthető @@ -1301,7 +1298,6 @@ Energiatakarékos Nagy pontosságú Egyéni ikonszín - Egyéni szín On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. Új változata van a PhoneProfilesPlusExtender-nek ami szükséges. Kattintson ide, hogy frissítse azt. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-in/strings.xml b/common/src/main/res/values-in/strings.xml index ac0768ee5f..b1d705216d 100644 --- a/common/src/main/res/values-in/strings.xml +++ b/common/src/main/res/values-in/strings.xml @@ -263,7 +263,6 @@ Profil standar Prioritas Adaptif - Unlock device Sembunyikan nama profil Mulai ulang acara Tidak terhubung @@ -670,7 +669,7 @@ Klik ini untuk membuka menu acara dengan opsi: Enable / Stop run, Duplicate and Delete event. Pesanan handler Tarik acara naik / turun dengan handler ini untuk mengubah acara \"Start Order\". - Editor + Editor Klik ini untuk membuka Editor, di mana Anda dapat mengkonfigurasi profil, acara, mengubah pengaturan aplikasi, dll. Aktifkan profil Klik ini untuk mengaktifkan profil. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-is/strings.xml b/common/src/main/res/values-is/strings.xml index 0ed2c007d9..f984ddbfc7 100644 --- a/common/src/main/res/values-is/strings.xml +++ b/common/src/main/res/values-is/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-it/strings.xml b/common/src/main/res/values-it/strings.xml index 8a2406cb26..07d158b5d8 100644 --- a/common/src/main/res/values-it/strings.xml +++ b/common/src/main/res/values-it/strings.xml @@ -263,7 +263,6 @@ Profilo predefinito Priorità Adattiva - Unlock device Nascondi il nome del profilo Riavvia gli eventi Non collegato @@ -670,7 +669,7 @@ Clicca per aprire il menù eventi con le opzioni: Abilita/Ferma, Duplica e Cancella evento. Gestore di ordinamento Trascina gli eventi su/giù con questo strumento per cambiare \"Ordine di avvio\" degli eventi. - Editor + Editor Clicca qui per aprire l\'Editor da cui potrai configurare i profili, gli eventi, cambiare la configurazione dell\'applicazione, ecc. Attiva il profilo Fai clic qui per attivare un profilo. @@ -833,7 +832,6 @@ Abilita scansione orientamento (G1)(R) notifiche pop-up Icona personalizzata - Clicca per impostare nome cella Potrebbe non funzionare la connessione in hotspot da altri dispositivi. Non utilizzare Avvia quando in carica @@ -990,7 +988,6 @@ Consenti a PhoneProfilesPlusExtender la \"Accessibilità\" nelle impostazioni di sistema. La funzione di accessibilità non viene usata, il servizio di esecuzione è necessario per ricevere le chiamate. Clicca qui per installare PhoneProfilesPlusExtender. Il servizio di esecuzione è necessario per ricevere le chiamate. per leggere i contatti nel sensore SMS/MMS - per i contatti di lettura, rileva le chiamate (per \"chiamata notturna\") nel sensore di Chiamata Usa decorazione Tipo di layout Espandibile @@ -1301,7 +1298,6 @@ Risparmio batteria Alta precisione Colore icona personalizzato - Colore personalizzato Attiva (non disabilitare il Wi-Fi) Ignora il Wi-Fi hotspot L\'opzione \"On (non disabilitare il Wi-Fi)\" deve essere supportata dal sistema byt @@ -1660,13 +1656,7 @@ e Acceso Off - non impostato - per parametro - È necessario configurare anche Mostra la notifica sullo stato di - è - Per impostarlo - configurare e attivare il profilo con Senza durata Tipo di fine attivazione Durata @@ -1799,12 +1789,10 @@ Abilita esecuzione eventi Disabilita esecuzione eventi Non impostato - Personalizzato non impostato Non selezionato [ Nessuno ] [ Personalizzato ] (A) applicazione, (S) scorciatoia, (I) intento. - Non impostato Nessuno installato Posizione non funzionante Spiacenti, impossibile ottenere la posizione. Sei pregato di verificare le impostazioni della Posizione del dispositivo. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifiche Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Nota: Non tutte le applicazioni Orologio usano il volume degli avvisi di sistema perché usano il proprio volume configurato nelle impostazioni. In questa finestra viene visualizzata la lista degli SSID Wi-Fi configurati.\nClicca qui per visualizzare la schermata delle impostazioni Wi-Fi. Contiene un parametro per configurare le reti Wi-Fi. PPPPutSettings - Installa\nPPPPutSettings - Avvia\nPPPPutSettings + Installa PPPPS + Avvia PPPPS Chiudi Avvia PPPPutSettings PPPPutSettings non è installato. @@ -1955,9 +1943,9 @@ Nuova versione di PPPPutSettings Fare clic su questa notifica per installare la nuova versione di PPPPutSettings. PhoneProfilesPlusExtender - Installa\nPhoneProfilesPlusExtender - Avvia\nPhoneProfilesPlusExtender - Attiva/disattiva\nImpostazioni di accessibilità + Installa PPPE + Avvia PPPE + Attiva/disattiva Chiudi Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. È richiesta una nuova versione di PhoneProfilesPlusExtender. Clicca qui per aggiornarla. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-iw/strings.xml b/common/src/main/res/values-iw/strings.xml index 661eeb120b..5aa54ef5bc 100644 --- a/common/src/main/res/values-iw/strings.xml +++ b/common/src/main/res/values-iw/strings.xml @@ -263,7 +263,6 @@ פרופיל ברירת מחדל עדיפות מסתגלת - Unlock device הסתרת שם הפרופיל הפעלת אירועים מחדש לא מחובר @@ -670,7 +669,7 @@ לחצו כאן לפתיחת התפריט האירועים עם אפשרויות: אפשור/עצירת הפעלה, שכפול ומחיקה של האירוע. סדרן גרורו אירוע למעלה/למטה כאן לשינוי סדר ההפעלה של אירועים. - עורך + עורך לחצו כאן לפתיחת העורך. העורך מאפשר להגדיר פרופילים, אירועים, שינוי הגדרות יישום… הפעלת פרופיל לחצו כאן להפעלת פרופיל. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-ja/strings.xml b/common/src/main/res/values-ja/strings.xml index 2da69610e1..d290964f07 100644 --- a/common/src/main/res/values-ja/strings.xml +++ b/common/src/main/res/values-ja/strings.xml @@ -263,7 +263,6 @@ デフォルトのプロファイル 優先順位 自動調節 - Unlock device プロファイル名を非表示します イベントを再始動 接続されていません @@ -670,7 +669,7 @@ ここをクリックすると、イベントメニューとオプションを開きます: イベントの有効化/停止、重複、削除ができます。 順序のつまみ イベントの「開始順序」を変更するには、このつまみでイベントを上下にドラッグします。 - エディター + エディター ここをクリックすると、エディターを開き、プロファイル、イベント、アプリケーション設定などを変更できます。 プロファイルの有効化 ここをクリックしてプロファイルを有効にします。 @@ -833,7 +832,6 @@ 傾きのスキャンを有効にする (G1)(R) ポップアップ通知 カスタムアイコン - クリックしてセル名を設定 May not working connection into hotspot from another devices. 使用しない 充電時に開始 @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. SMS/MMS センサーの連絡先の読み取り - for read contacts, detect ringing call (for \"night call\") in Call sensor 装飾を使用 レイアウトタイプ 開閉する @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Wi-Fi ホットスポットを無視 Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-ko/strings.xml b/common/src/main/res/values-ko/strings.xml index 762e545f11..0dcd38079c 100644 --- a/common/src/main/res/values-ko/strings.xml +++ b/common/src/main/res/values-ko/strings.xml @@ -263,7 +263,6 @@ 기본 프로필 우선 순위 순응 - Unlock device 프로필 이름 숨김 이벤트 다시시작 연결되지 않음 @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-ku/strings.xml b/common/src/main/res/values-ku/strings.xml index 0ed2c007d9..f984ddbfc7 100644 --- a/common/src/main/res/values-ku/strings.xml +++ b/common/src/main/res/values-ku/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-lb/strings.xml b/common/src/main/res/values-lb/strings.xml index 0ed2c007d9..f984ddbfc7 100644 --- a/common/src/main/res/values-lb/strings.xml +++ b/common/src/main/res/values-lb/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-lv/strings.xml b/common/src/main/res/values-lv/strings.xml index 0ed2c007d9..f984ddbfc7 100644 --- a/common/src/main/res/values-lv/strings.xml +++ b/common/src/main/res/values-lv/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-ms/strings.xml b/common/src/main/res/values-ms/strings.xml index 0ed2c007d9..f984ddbfc7 100644 --- a/common/src/main/res/values-ms/strings.xml +++ b/common/src/main/res/values-ms/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-night/colors.xml b/common/src/main/res/values-night/colors.xml index ea4439a72b..fb2a729179 100644 --- a/common/src/main/res/values-night/colors.xml +++ b/common/src/main/res/values-night/colors.xml @@ -3,4 +3,11 @@ #f8b367 #59f8b367 #f8b367 + #191614 + + #FFb2916d + #FFa1a09f + #FF996e3f + #736b69 + #595250 diff --git a/common/src/main/res/values-nl/strings.xml b/common/src/main/res/values-nl/strings.xml index cbfa747be3..d7b23eafca 100644 --- a/common/src/main/res/values-nl/strings.xml +++ b/common/src/main/res/values-nl/strings.xml @@ -263,7 +263,6 @@ Standaardprofiel Prioriteit Adaptieve - Apparaat ontgrendelen Profielnaam verbergen Events herstarten Niet verbonden @@ -413,7 +412,7 @@ In de titel van Activator en Editor is het \"verkeerslicht\". Events kunnen starten. Events kunnen niet starten - profiel was handmatig geactiveerd. - Events are stopped - events run can be enabled through Editor top bar icon \"Enable events run\". + Events zijn gestopt - events uitvoeren kan via het Editor bovenste pictogram \"Events uitvoeren\" worden ingeschakeld. Herstart events icoon: \"Verkeerslicht\" icoon: Android 6+ implementeert \"Doze mode\" en \"App stand-by\". Dit kan problemen geven bij het activeren van een event profiel als je het apparaat niet aangesloten en stil laat liggen gedurende enige tijd met het scherm uit. Klik hier om PhoneProfilesPlus toe te voegen aan \"Niet geoptimaliseerd\" om dit op te lossen. @@ -670,7 +669,7 @@ Klik hierop voor het openen van event menu met de opties: Inschakelen/Stoppen, Dupliceren en verwijderen event. Volgorde afhandelaar Sleep event omhoog/omlaag voor het wijzigen van de \"Startvolgorde\". - Editor + Editor Klik hier om de Editor te openen. In de Editor kun je profielen en events configureren, programma-instellingen wijzigen, enz. Activeer profiel Klik hier om het profiel te activeren. @@ -833,7 +832,6 @@ Oriëntatie scannen inschakelen (G1) (R) Pop-up meldingen Aangepast icoon - Klik om celnaam in te stellen Werkt mogelijk niet bij hotspot connectie van andere apparaten. Niet gebruiken Start bij het opladen @@ -990,7 +988,6 @@ Sta PhoneProfilesPlusExtender toe \"Toegankelijkheid\" in systeeminstellingen. Toegankelijkheidsfunctie wordt niet gebruikt. De service is nodig voor het ontvangen van oproepen. Klik hier om PhoneProfilesPlusExtender te installeren. Een actieve service is nodig voor het ontvangen van oproepen. voor lezen contacten in SMS/MMS sensor - voor lezen contacten, detecteren gespreksbeltoon (voor \"nachtoproep\") in oproepsensor Gebruik notificatie aanpassing Lay-out type Uitbreidbaar @@ -1055,7 +1052,7 @@ Gebruik PhoneProfilesPlusExtender In Android 9+, moet u locatie inschakelen in systeeminstellingen om zendmast cellen te scannen. Event wordt niet gestart wanneer: - You have disabled global events run (red \"traffic light\") - enable it in Editor top bar icon \"Enable events run\". + Je hebt de globale events uitvoeren (rood \"verkeerslicht\") uitgeschakeld - schakel het in de Editor bovenste pictogram \"Events uitvoeren\" in. Je handmatig een profiel hebt geactiveerd (oranje verkeerslicht) - herstart de events. Gebruik de \"Events herstarten\" knop in de header van de activator, de editor of in de melding. Handmatig geactiveerde profielen zijn ook herkenbaar aan de \"[M]\" voor de profielnaam. De enige uitzondering is wanneer er in een event de optie \"Negeer handmatige activatie\" is geselecteerd. Je een of meerdere events niet hebt geactiveerd, activeer deze per event in de editor door \"Uitvoeren inschakelen\" te selecteren. Noot: het \"verkeerslicht\" is zichtbaar in de header van de activator en de editor. Als zendmast cellen scannen niet werkt, schakel Locatie in bij Systeeminstellingen. @@ -1301,7 +1298,6 @@ Accubesparing Hoge nauwkeurigheid Aangepaste icoon kleur - Aangepaste kleur Aan (Wi-Fi niet uitschakelen) Negeer Wi-Fi hotspot Optie \"Aan (Wi-Fi niet uitschakelen)\" moet worden ondersteund door het systeem @@ -1660,13 +1656,7 @@ en Aan Uit - niet instellen - voor parameter - Je configureert ook Toont notificatie over status van - is - Om in te stellen - configureer an activeer profiel met Zonder tijdsduur Soort activatie einde Tijdsduur @@ -1799,12 +1789,10 @@ Events uitvoeren inschakelen Events uitvoeren uitschakelen Niet ingesteld - Aangepaste niet ingesteld Niet geselecteerd [ None ] [ Aangepast ] (A) applicatie, (S) snelkoppeling, (I) intent. - Niet ingesteld Geen geïnstalleerd Locatie werkt niet Sorry, maar het is niet mogelijk om locatiegegevens te krijgen. Controleer de locatie-instellingen. @@ -1906,7 +1894,7 @@ Bluetooth namen voor Bluetooth sensor Zendmast informatie voor zendmast cel sensor Trilintensiteit - Inkomend gesprek + Inkomende oproep Meldingen Aaanraak interactie Trilintensiteit @@ -1938,8 +1926,8 @@ Opmerking: niet alle Klok programma\'s gebruiken het systeem alarmvolume omdat ze hun eigen volume gebruiken in hun instellingen. In dit venster vind je een lijst van geconfigureerde SSID\'s.\nKlik hier om het Wi-Fi instellingen scherm te bekijken. Het bevat een instellingen voor het configureren van wifi-netwerken. PPPPutInstellingen - \nPPPPutSettings - Start\nPPPPutSettings + Installeer PPPPS + Start PPPPS Sluit Start PPPPutSettings PPPPutSettings is niet geïnstalleerd. @@ -1955,9 +1943,9 @@ Nieuwe versie PPPPutSettings Klik op deze melding om de nieuwe PPPPutSettings versie te installeren. PhoneProfilesPlusExtender - Installeer\nPhoneProfilesPlusExtender - Start\nPhoneProfilesPlusExtender - Inschakelen/uitschakelen\nToegankelijkheidsinstellingen + Installeer PPPE + Start PPPE + Inschakelen/uitschakelen Sluiten Klik hier voor installatie/upgrade, in- uit schakelen Toegankelijkheidsinstellingen, starten PhoneProfilesPlusExtender. De nieuwevversie van PhioneProfilesPlusExtender is nodig. Klik hier om te upgrade. @@ -2084,7 +2072,6 @@ Contacten voor SMS/MMS sensor Contacten voor meldingssensor Je moet \"Weergeven over apps\" toestaan. Dit is vereist om activiteiten te starten wanneer PhoneProfilesPlus op de achtergrond is. Klik op de knop \"Machtigen\" om deze toestemming te verlenen. - Als het niet mogelijk is deze toestemming te verlenen, klik je op deze link. Misschien vind je op deze webpagina de oplossing voor je toestel: Ø - Niet gebruiken Contacten filter [ Alle ] @@ -2132,20 +2119,6 @@ Schrijven start. Duur van de applicaties uitvoeren Onbeperkt - Telefoongesprekken - Gesprekscontrolerol instellen - Klik hier om de belcontrole rol voor PhoneProfilesPlus in te stellen. Dit is vereist voor \"Blokkeren van telefoongesprekken\". - Gesprekscontrolerol voor PhoneProfilesPlus is ingesteld - Gesprekscontrolerol voor PhoneProfilesPlus is niet ingesteld - Oproepen blokkeren - WAARSCHUWING: Deze parameter staat blokkeren oproepen toe, geconfigureerd in \"Contactgroepen\", \"Contacten\". Notificatie over geblokkeerde oproepen wordt niet weergegeven! - Contactgroepen - Contacten - voor lezen contacten in profiel parameter \"Telefonische oproepen\" - Contacten voor profiel parameter \"Phone calls\" - Verstuur sms - SMS tekst - WAARSCHUWING: SMS verzenden kan in rekening worden gebracht of gebruikt je prepaid beltegoed! Wordt weergegeven, wanneer event \"Start van de event\"/\"Overige parameters\"/\"Herhaal notificatie\" is ingeschakeld. Wordt weergegeven, wanneer profiel \"Anders\"/\"Melding genereren\" is geconfigureerd. Wordt weergegeven, wanneer \"Instellingen\"/\"Profiellijst melding\"/\"Toon melding\" is ingesteld @@ -2201,7 +2174,7 @@ Simkaart aan- of uitzetten WAARSCHUWING: Dit geeft het scherm voor de Pincode van de Simkaart die is ingesteld als \"Aan\". PhoneProfilesPlus server - PhoneProfilesPlus server uitnodiging + Server uitnodiging PhoneProfilesPlus release in APKPure: Installeer Droid-ify. Dit is vereist voor de installatie van PPPPutSettings. Installeer daarna opnieuw PPPPutSettings. Verstuur SMS @@ -2214,4 +2187,95 @@ Bezig met vertraging Deze applicatie is beschikbaar in de IzzyOnDroid repository en GitHub Releases. Klik hier om te installeren. Als je problemen, vragen en suggesties hebt, klik dan hier en schrijf me. + Schakel meldingen toegang in voor PhoneProfilesPlus in bij systeem instellingen. Zonder dit zal de Muzieksensor geen programma detecteren dat muziek afspeelt. + Toegang tot meldingen uitgeschakeld + Toegang tot meldingen ingeschakeld + Gespreksscreeningrol instellen + Klik hier om de gesprekscontrolerol voor PhoneProfilesPlus in te stellen. Is vereist voor de \"bel screening\" event sensor. + Gesprekscontrolerol voor PhoneProfilesPlus is ingesteld + Gesprekscontrolerol voor PhoneProfilesPlus is ingesteld + Gesprekscontrole + Gesprekscontrole + Deze sensor is voor het starten van een event bij het weergeven van een telefoongesprek. Hiermee werkt oproepblokkering. Parameters: Contactgroepen, contactpersonen, duur, permanent draaien, telefoneren blokkeren, sms-tekst verzenden. + Contacten voor sensor \"Gesprekscontrole\" + Oproepen blokkeren + Sms verzenden + SMS Tekst + WAARSCHUWING: SMS verzenden kan in rekening worden gebracht of worden gebruikt vanuit een prepaid SMS-pakket! + geen belscreening instellen voor PhoneProfilesPlus + voor lezen contacten, versturen SMS in event sensor \"Oproepscherm\" + Oproep richting + Inkomende oproepen + Uitgaande oproepen + Alle oproepen + Oproepen blokkeren + Voor elk profiel met geconfigureerde parameter \"Telefonische oproepen\" \/\"Blokkeer oproepen\" wordt een nieuw event gegenereerd met de \"Oproepscherm\" sensor. Dit event heeft de parameter \"Event run\" uitgeschakeld. \"Telefonische oproepen\" parameter uit profielen is verwijderd. + Sms verzenden + Contactgroepen + Contacten + voor lezen contacten in profiel parameter \"Send SMS\" + Contacten voor profiel parameter \"Verzenden van SMS\" + Sms verzenden + SMS Tekst + profiel - fout bij verzenden van SMS + Verstuur sms + SMS Tekst + voor lezen van contacten, detecteren beloproep (voor \"nachtgesprek\"), SMS verzenden in Oproep sensor + Meldingen + Wis meldingen + Schakel \"Toegang tot meldingen\" in. Zonder deze optie zal verwijderen notificatie niet werken. + Wis meldingen + for lezen van contacten in profiel parameter \"Wis meldingen\" + Programma\'s: + Contactpersoon groepen: + Contacten: + Tekst + Contacten voor profiel parameter \"Wis meldingen\" + Tel. nummers niet in contacten + Geblokkeerde oproep + tel. nummer: + WAARSCHUWING: Deze parameter staat oproepen toe. Notificatie geblokkeerde oproepen wordt niet weergegeven!\nMaar het geblokkeerde tel. nummers worden gelogd in het \"Activiteitenlogboek\", dat het mogelijk maakt om terug te bellen naar een geblokkeerd tel. nummer door te klikken op deze logregel. + Gehele logboek + Geblokkeerde oproepen + Fouten + Start van events + Pauzeer events + Stop events + Herstarten events + Profiel activatie + programma installatie + (G1) (R) Nachtlicht + (Z)(R) leesmodus + Oogcomfort + (G1) (R) Oogcomfort + voor aan-/uitzetten Oogcomfort + (I) Nachtlichtinstellingen + (I) Oogcomfortbescherming instellingen + (I) Leesmodus instellingen + (S)(Z)(R) Oogcomfortschild + Als het niet mogelijk is om toegang tot meldingen in te schakelen zijn er misschien nog niet toegestane instellingen voor PhoneProfilesPlus. Klik hier om toe te staan. + voor aan-/uitzetten VPN + De noodzaak om \"Weergeven over apps\" permanent aan te zetten is verwijderd. Omdat deze toestemming een \"Beperkte instelling\" is kan het, als ingeschakeld, banktoepassingen en websites, betalingen voor goederen, diensten, enzovoort blokkeren. \"Weergeven over apps\" moet je dan uitschakelen in PhoneProfilesPlus. + Installeer de nieuwe versie van PPutSettings (1.1) waarbij de toestemming \"Weergeven over apps\" niet meer nodig is. Voor versies eerder dan 1.1 hebben parameters die met (S) zijn gemarkeerd nog steeds deze toestemming nodig. + Voor sommige profiel parameters is nog steeds \"Weergegeven over apps\" nodig. Bijvoorbeeld voor starten \"Programma\'s, snelkoppelingen, intents\". + Kleurwaarde + Locatienaam + Aangepaste actie + Lege lijst + Toon + Pijl naar rechts + Pijl naar links + [ Niet ingesteld ] + Apparaat vergrendelscherm + Deze parameter schakelt het vergrendelscherm aan/uit. Wanneer uitgeschakeld wordt het vergrendelscherm niet weergegeven wanneer je het scherm aanzet. + \"Scherm timeout\" instellen in het systeem (bij profiel activering) schakelt \"Scherm aanhouden\" niet uit. Je moet ook \"Scherm ingeschakeld houden\" configureren als je \"Scherm Timeout\" wilt gebruiken om aan het systeem te werken. + Scherm aan/uit + \"Scherm aan\" is \"Aan\". Om \"Uit\" in te stellen, configureer en activeer je profiel met \"Scherm aan\"=\"Uit\". + voor inschakelen van scherm aan/uit + Wanneer \"Scherm Aan/Uit\" is geconfigureerd, is \"Apparaat vergrendelingsscherm\" uitgeschakeld en vice versa. Het is niet mogelijk om beide te configureren. + Shizuku is geïnstalleerd, maar werkt niet. Open Shizuku en start het vanuit de applicatie. + Open + Help + Deze parameter is voor \"Oproep event\"=\"Gemiste oproep\". + \"Licht\" is omgevingslicht gedetecteerd door de sensor van het lichtsensor. diff --git a/common/src/main/res/values-no/strings.xml b/common/src/main/res/values-no/strings.xml index 0ed2c007d9..f984ddbfc7 100644 --- a/common/src/main/res/values-no/strings.xml +++ b/common/src/main/res/values-no/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-pl/strings.xml b/common/src/main/res/values-pl/strings.xml index 54d82f3113..8540c0d8f1 100644 --- a/common/src/main/res/values-pl/strings.xml +++ b/common/src/main/res/values-pl/strings.xml @@ -2,7 +2,7 @@ - Redaktor + Edytor Ustawienia Ustawienia profilu Ustawienia zdarzeń @@ -41,7 +41,7 @@ Pokaż powiadomienie Styl ikony powiadomień Identyfikatory profilu - Tomy + Głośności Dźwięki Nazwa profilu Ikona profilu @@ -263,7 +263,6 @@ Profil domyślny Priorytet Adaptacyjna - Odblokuj urządzenie Ukryj nazwę profilu Zrestartuj zdarzenia Nie połączono @@ -413,7 +412,7 @@ W tytule aktywatora i edytora jest \"sygnalizacja świetlna\". Zdarzenia mogą być uruchomione. Zdarzenia nie mogą być uruchomione - profil był aktywowany ręcznie. - Events are stopped - events run can be enabled through Editor top bar icon \"Enable events run\". + Zdarzenia są zatrzymane — uruchamianie zdarzeń może być włączone za pomocą ikony górnego paska edytora \"Uruchom zdarzenia\". Ikona restartu zdarzeń: Ikona \"Sygnalizacja świetlna\": Android 6+ posiada funkcje oszczędzające energię: \"Doze mode\" i \"App standby\". Dodaj PhoneProfilesPlus do \"Ustawienia→Użycie baterii→Optymalizacja baterii→Bez optymalizacji\" jeśli napotykasz problemy z aktywacją profili przez zdarzenia w czasie, gdy telefon leży nieruchomo, odłączony od prądu i z wygaszonym ekranem. @@ -670,7 +669,7 @@ Kliknij, tutaj, aby otrzymać menu zdarzeń z opcjami: Włącz/zatrzymaj uruchomienie, Powiel i Usuń zdarzenie. Kolejność obsługi Przeciągnij zdarzenie w górę/dół za pomocą tego uchwytu, aby zmienić \"porządek uruchamiania\" zdarzeń. - Edytor + Edytor Kliknij tutaj, aby otworzyć Edytor, w którym możesz konfigurować profile, zdarzenia, zmienić ustawienia aplikacji, itp. Aktywuj profil Kliknij tutaj, aby aktywować profil. @@ -833,7 +832,6 @@ Włącz skanowanie orientacji (G1)(R) wyskakujące powiadomienia Ikona niestandardowa - Kliknij, aby ustawić nazwę stacji Włączenie może uniemożliwiać łączenie z innymi hotspot\'ami. Nie monitoruj Aktywuj, gdy ładowany @@ -990,7 +988,6 @@ Włącz usługę PhoneProfilesPlusExtender w systemowych systemowych \"Ułatwieniach Dostępu\". Ułatwienia dostępu nie są używane, usługa jest potrzebna dla odbierania rozmów Kliknij tu, aby zainstalować PhoneProfilesPlusExtender. Usługa jest potrzebna dla odbierania rozmów. aby odczytywać nazwy kontaktów przez sensor SMS/MMS - aby odczytać nazwy kontaktów, wykrywać rozmowę przychodzącą (dla \"nocnej rozmowy\") za pomocą Czujnika rozmowy Użyj stylu Wygląd Rozwijalne @@ -1055,7 +1052,7 @@ Użyj PhoneProfilesPlus W Android 9+, aby działało skanowanie sieci komórkowych, musisz włączyć Lokalizację w ustawieniach systemowych. Zdarzenie nie zostanie rozpoczęte gdy: - You have disabled global events run (red \"traffic light\") - enable it in Editor top bar icon \"Enable events run\". + Wyłączyłeś globalnie uruchamianie zdarzeń (czerwone światło na \"sygnalizacji świetlnej\") - włącz je z powrotem ikoną na górnym pasku Edytora \"Włącz uruchamianie zdarzeń\". Ręcznie uaktywniono profil (pomarańczowe światło na\"sygnalizacji świetlnej\") - należy ponownie uruchomić zdarzenia. Użyj ikony \"Restart zdarzeń\" w oknie Aktywatora, Edytora lub w powiadomieniu. Ręcznie aktywowany profil jest oznaczony\"[M]\" przed nazwą profilu. Wyjątek: gdy zdarzenie ma zaznaczoną opcję \"Ignoruj ręczną aktywację\". Wyłączono uruchamianie zdarzenia - \"Włącz uruchamianie\" w opcjach zdarzenia musi być zaznaczone. Uwaga:\"Sygnalizacja świetlna\" znajduje się w oknie Aktywatora i Edytora Jeżeli skanowanie sieci komórkowych nie działa, włącz Lokalizację w Ustawieniach Systemowych. @@ -1301,7 +1298,6 @@ Tryb oszczędzania baterii Wysoka dokładność Niestandardowy kolor ikony - Kolor niestandardowy Włączony (nie wyłączaj Wi-Fi) Ignoruj hotspot Wi-Fi Opcja \"Włączone (nie wyłączaj Wi-Fi)\" musi być obsługiwana przez system @@ -1660,13 +1656,7 @@ i Włączony Wyłączony - nie ustawiaj - dla parametru - Musisz również skonfigurować Pokazuje powiadomienie o statusie - jest - Aby to ustawić - skonfiguruj i aktywuj profil z Bez czasu trwania Typ końca aktywacji Czas trwania @@ -1799,12 +1789,10 @@ Włącz uruchamianie zdarzeń Wyłącz uruchamianie zdarzeń Nie ustawiono - Niestandardowe nie ustawione Nie wybrane [ Żaden ] [ Niestandardowy ] (A) aplikacja, (S) skrót, (I) intent. - Nie ustawione Brak zainstalowanych Lokalizacja nie działa Przepraszamy, ale nie można uzyskać lokalizacji. Proszę sprawdzić ustawienia Lokalizacji urządzenia. @@ -1938,8 +1926,8 @@ Uwaga: Nie wszystkie aplikacje zegara używają systemowej głośności alarmu, ponieważ używają własnego poziomu głośności skonfigurowanego w ustawieniach. W tym oknie dialogowym wyświetlana jest lista skonfigurowanych SSID Wi-Fi.\nKliknij tutaj, aby wyświetlić ekran ustawień Wi-Fi. Zawiera on parametr konfiguracji sieci Wi-Fi. PPPPutSettings - Zainstaluj\nPPPPutSettings - Uruchom\nPPPPutSettings + Zainstaluj PPPPS + Uruchom PPPPS Zamknij Uruchom PPPPutSettings PPPPutSettings nie jest zainstalowany. @@ -1955,9 +1943,9 @@ Nowa wersja PPPPutSettings Kliknij to powiadomienie, aby zainstalować nową wersję PPPPPPutSettings. PhoneProfilesPlusExtender - Zainstaluj\nPhoneProfilesPlusExtender - Uruchom\nPhoneProfilesPlusExtender - Włącz/Wyłącz\nUłatwienia dostępu + Zainstaluj PPPE + Uruchom PPPE + Włącz/Wyłącz Zamknij Kliknij tutaj, aby zainstalować/zaktualizować, włączyć/wyłączyć ustawienia ułatwień dostępu, uruchom PhoneProfilesPlusExtender. Wymagana nowa wersja PhoneProfilesPlusExtender. Kliknij tu aby zaktualizować. @@ -2084,7 +2072,6 @@ Kontakty dla czujnika SMS/MMS Kontakty dla czujnika powiadomień Musisz udzielić zezwolenia na \"Wyświetlaj nad innymi aplikacjami\". Jest to konieczne, aby uruchamiać aktywności, gdy PhoneProfilesPlus pracuje w tle. Kliknij przycisk \"Zezwól\" aby przyznać to uprawnienie. - Jeśli nie jest możliwe udzielenie tego zezwolenia, kliknij ten link. Być może na tej stronie znajdziesz rozwiązanie dla swojego urządzenia: Ø - Nie używaj Filtr kontaktów [Wszystkie] @@ -2132,20 +2119,6 @@ Zapis zostanie uruchomiony. Długość czasu pracy aplikacji Nieograniczona - Połączenia telefoniczne - Ustaw rolę filtra połączeń - Kliknij tutaj, aby ustawić rolę filtra połączeń dla PhoneProfilesPlus. Jest to wymagane dla \"Blokuj połączenia telefoniczne\". - Ustawiono funkcję filtra połączeń dla PhoneProfilesPlus - Funkcja filtra połączeń dla PhoneProfilesPlus wyłączona - Zablokuj połączenia telefoniczne - OSTRZEŻENIE: Ten parametr umożliwia blokowanie połączeń, skonfigurowanych w \"kontaktach\", \"grupach kontaktów\". Powiadomienie o zablokowanych połączeniach nie będzie wyświetlane! - Grupy kontaktów - Kontakty - dla odczytu kontaktów w parametrze profilu \"Połączenia telefoniczne\" - Kontakty dla parametru profilu \"Połączenia telefoniczne\" - Wyślij SMS - Tekst SMS - OSTRZEŻENIE: Wysyłanie wiadomości SMS może być obciążone opłatą lub użyje przedpłacony pakiet SMS! Jest wyświetlane, gdy zdarzenie włączyło \"Początek zdarzenia\"/\"Inne parametry\"/\"Powtórz powiadomienie\". Jest wyświetlany, gdy profil skonfigurowano \"Inne\"/\"Wygeneruj powiadomienie\". Wyświetla się, gdy jest włączone \"Ustawienia\"/\"Powiadomienie listy profili\"/\"Wyświetlaj powiadomienie\" @@ -2201,17 +2174,108 @@ Włącz/wyłącz kartę SIM OSTRZEŻENIE: To wyświetli ekran wprowadzania kodu PIN dla karty SIM, która jest skonfigurowana jako \"Włączona\". Serwer PhoneProfilesPlus - Zaproszenie do serwera PhoneProfilesPlus - PhoneProfilesPlus release in APKPure: - Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. - Send SMS - Do not send SMS - State: - Paused - Running - Stopped - Paused with delay - Running with delay - This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. - If you have problems, questions and suggestions, click here and write me. + Zaproszenie do serwera + Wersja PhoneProfilesPlus w APKPure: + Zainstaluj proszę Droid-ify. Jest wymagane do instalacji PPPPutSettings. Następnie ponownie zainstaluj PPPPutSettings. + Wyślij SMS + Nie wysyłaj SMS + Stan: + Wstrzymane + Uruchomione + Zatrzymane + Wstrzymane z opóźnieniem + Uruchomione z opóźnieniem + Ta aplikacja znajduje się w repozytorium IzzyOnDroid i wersjach GitHub. Kliknij tutaj, aby ją zainstalować. + Jeśli masz problemy, pytania i sugestie, kliknij tutaj i napisz do mnie. + Proszę włączyć dostęp do powiadomień dla PhoneProfilesPlus w ustawieniach systemowych. Bez tego czujnik muzyki nie wykryje aplikacji, która odtwarza muzykę. + Dostęp do powiadomień wyłączony + Dostęp do powiadomień włączony + Ustaw rolę filtra połączeń + Kliknij tutaj, aby ustawić rolę filtra połączeń dla PhoneProfilesPlus. Jest to wymagane dla czujnika zdarzenia \"Filtr połączeń\". + Ustawiono funkcję filtra połączeń dla PhoneProfilesPlus + Funkcja filtra połączeń dla PhoneProfilesPlus wyłączona + Filtr połączeń + Filtr połączeń + Ten czujnik uruchomi zdarzenie, jeśli wyświetlane jest ekran połączenia podczas połączenia. Podczas połączenia obsługiwane jest blokowanie połączeń. Parametry: grupy kontaktów, kontakty, czas trwania, stałe uruchamianie, blokowanie połączeń telefonicznych, wysyłanie wiadomości SMS, tekst SMS. + Kontakty dla czujnika \"Filtr połączeń\" + Zablokuj połączenia telefoniczne + Wyślij SMS + Tekst SMS + OSTRZEŻENIE: Wysyłanie wiadomości SMS może być obciążone opłatą lub użyje przedpłacony pakiet SMS! + PhoneProfilesPlus nieustawiony jako filtr połączeń + dla odczytu kontaktów, wysyłania SMS w czujniku zdarzeń \"Filtr połączeń\" + Kierunek połączenia + Połączenia przychodzące + Połączenia wychodzące + Wszystkie połączenia + Blokada połączeń + Dla każdego profilu ze skonfigurowanym parametrem \"Połączenia telefoniczne\"\/\"Blokada połączeń\", jest generowane nowe zdarzenie z czujnikiem \"Filtr połączeń\". To zdarzenie ma wyłączony parametr \"uruchamianie zdarzenia\". Parametr \"rozmowy telefoniczne\" z profili został usunięty. + Wysyłanie SMS-ów + Grupy kontaktów + Kontakty + dla odczytu kontaktów w parametrze profilu \"Wysyłanie SMS\" + Kontakty dla parametru profilu \"Wysyłanie SMS\" + Wyślij SMS + Tekst SMS + profil - błąd przy wysyłaniu SMS + Wysyłanie SMS + Tekst SMS + aby odczytać nazwy kontaktów, wykrywać rozmowę przychodzącą (\"połączenie nocne\"), wysyłać SMS za pomocą Czujnika rozmowy + Powiadomienia + Wyczyść powiadomienia + Proszę włączyć \"Dostęp do powiadomień\". Bez tego czyszczenie powiadomień nie będzie działać. + Wyczyść powiadomienia + dla odczytu kontaktów w parametrze profilu \"Wyczyść powiadomienia\" + Aplikacje: + Grupy kontaktów: + Kontakty: + Tekst + Kontakty dla parametru profilu \"Wyczyść powiadomienia\" + Numery telefonów spoza kontaktów + Zablokowane połączenie + nr telefonu: + UWAGA: Ten parametr pozwala na blokowanie połączeń. Powiadomienie o zablokowanych połączeniach nie będzie wyświetlane!\nAle zablokowane numery telefonów są zapisywane w \"dzienniku aktywności\", który umożliwia zadzwonienie do zablokowanego numeru po kliknięciu tej linii dziennika. + Cały dziennik + Zablokowane połączenia + Błędy + Uruchomienie zdarzeń + Pauza zdarzeń + Zatrzymanie zdarzeń + Restart zdarzeń + Aktywacje profili + instalacja aplikacji + (G1)(R) Tryb nocny + (Z)(R) Tryb czytania + Ochrona oczu + (G1)(R) Ochrona oczu + aby włączyć/wyłączyć Ochronę oczu + (I) Ustawienia trybu nocnego + (I) Ustawienia Ochrony oczu + (I) Ustawienia trybu czytania + (S)(Z)(R) Ochrona komfortu wzroku + Jeśli nie jest możliwe przyznanie tego uprawnienia, to być może nie jest włączony dostęp do ustawień zastrzeżonych dla PhoneProfilesPlus. Kliknij tutaj, aby go włączyć. + aby włączyć/wyłączyć VPN + Żądanie uprawnienia \"wyświetlaj nad innymi aplikacjami\" zostało usunięte. To uprawnienie należy do \"uprawnień wysokiego ryzyka\" i jeśli jest włączone, aplikacje i strony bankowe, płatności za towary i usługi itp. mogą być zablokowane lub wymagać wyłączenia \"wyświetlania nad innymi aplikacjami\" w PhoneProfilesPlus. + Zaleca się zainstalować nową wersję PPPPutSettings (1.1), gdzie nastąpiła zmiana, która nie wymaga \"wyświetlaj nad innymi aplikacjami\". Dla wersji wcześniejszych niż 1.1, parametry oznaczone (S) będą nadal wymagały tego uprawnienia. + Dla niektórych parametrów profilu \"wyświetlaj nad innymi aplikacjami\" jest nadal wymagane, na przykład dla \"Uruchom aplikacje, skróty, intent\'y\". + Wartość koloru + Nazwa lokalizacji + Działanie niestandardowe + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-pt-rBR/strings.xml b/common/src/main/res/values-pt-rBR/strings.xml index eb29460a17..87eb015936 100644 --- a/common/src/main/res/values-pt-rBR/strings.xml +++ b/common/src/main/res/values-pt-rBR/strings.xml @@ -263,7 +263,6 @@ Perfil padrão Prioridade Adaptável - Unlock device Esconder o nome do perfil Reiniciar eventos Não conectado @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-pt-rPT/strings.xml b/common/src/main/res/values-pt-rPT/strings.xml index a500945b01..8bf9f079c9 100644 --- a/common/src/main/res/values-pt-rPT/strings.xml +++ b/common/src/main/res/values-pt-rPT/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-ro/strings.xml b/common/src/main/res/values-ro/strings.xml index 6b9b2a82a3..794935a28b 100644 --- a/common/src/main/res/values-ro/strings.xml +++ b/common/src/main/res/values-ro/strings.xml @@ -263,7 +263,6 @@ Profil implicit Prioritate Adaptivă - Unlock device Ascunde numele profilului Repornire evenimente Neconectat @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-ru/strings.xml b/common/src/main/res/values-ru/strings.xml index 6e5d52461c..ebcc9e7b65 100644 --- a/common/src/main/res/values-ru/strings.xml +++ b/common/src/main/res/values-ru/strings.xml @@ -263,7 +263,6 @@ Профиль по умолчанию Важные Адаптивная - Разблокировка устройства Скрыть имя профиля Перезапустить события Не подключено @@ -413,7 +412,7 @@ В шапках и Активатора, и Редактора показывается «светофор». Зелёный цвет: события могут быть запущены. Цвет: события не выполняются - профиль активирован вручную. - Events are stopped - events run can be enabled through Editor top bar icon \"Enable events run\". + События остановлены - запуск событий может быть возобновлён нажатием кнопки \"Разрешить запуск событий\" в верхней панели Редактора. Иконка перезапуска событий: Значок «Светофор»: В Android 6+ реализованы функции Doze Mode и App Standby. Если вы сталкиваетесь с проблемами при активации профилей по событиям, когда устройство отключено от зарядки и какое-то время просто лежит с выключенным экраном, нажмите сюда и добавьте PhoneProfilesPlus в список \"Не экономят заряд\". @@ -670,7 +669,7 @@ Нажмите сюда, чтобы открыть меню события с вариантами: Разрешить запуск/Приостановить событие, Создать копию и Удалить событие. Упорядочиватель Перетащите событие вверх/вниз, чтобы изменить его порядок запуска. - Редактор + Редактор Нажмите, чтобы открыть Редактор. В Редакторе Вы можете настроить профили и события, изменить настройки приложения и т.д. Активировать профиль Нажмите здесь для активации профиля. @@ -833,7 +832,6 @@ Включить сканирование ориентации (G1)(R) Всплывающие уведомления Пользовательская иконка - Нажмите, чтобы задать имя вышки Подключение к точке доступа с других устройств может не работать. Не использовать Запускать при зарядке @@ -990,7 +988,6 @@ Разрешите доступ службе PhoneProfilesPlusExtender в разделе \"Спец. возможности\" системных настроек. Функция спец. возможностей не используется; для получения звонков нужна запущенная служба. Нажмите сюда, чтобы установить PhoneProfilesPlusExtender. Эта запущенная служба нужна для получения звонков. для чтения контактов в Датчике SMS/MMS - для чтения контактов, определения мелодии звонка (для \"ночного звонка\") в Датчике вызовов Использовать оформление Тип макета Расширяемый @@ -1055,7 +1052,7 @@ Использовать PhoneProfilesPlusExtender В Android 9+ для работы сканера мобильных вышек нужно включить определение местоположения в настройках системы. Событие не начнётся, если: - You have disabled global events run (red \"traffic light\") - enable it in Editor top bar icon \"Enable events run\". + Вы запретили запуск всех событий (красный цвет \"светофора\") - разрешить его можно, нажав на кнопку \"Разрешить запуск событий\" в верхней панели Редактора. Вы активировали профиль вручную (оранжевый цвет \"светофора\") - необходимо перезапустить все события. В меню Активатора, Редактора или в уведомлении нажмите \"Перезапустить события\". Если профиль активирован вручную, то перед его названием появляется буква \"[M]\" (Manual). Исключение: в настройках события включено \"Игнорировать ручную активацию\". Вы отключили запуск данного события в его настройках - включите \"Разрешить запуск\" в настройках данного события. Примечание: \"светофор\" показывается в шапках Активатора и Редактора. Если сканирование мобильных вышек не работает, включите определение местоположения в настройках системы. @@ -1301,7 +1298,6 @@ По координатам сети По всем источникам Пользовательский цвет иконки - Пользовательский цвет Включить (не отключая Wi-Fi) Игнорировать точку доступа Wi-Fi Вариант \"Включить (не отключая Wi-Fi)\" должен поддерживаться системой @@ -1660,13 +1656,7 @@ и Вкл. Выкл. - не устанавливает значение - для параметра - Вы должны вручную установить параметр Показывает уведомление о состоянии - - - Чтобы установить его - настройте и активируйте профиль с Без продолжительности Тип окончания активации Продолжительность @@ -1799,12 +1789,10 @@ Разрешить запуск событий Запретить запуск событий Не задано - Пользовательское действие не задано Не выбрано [ Нет ] [ Пользовательское ] (A) приложение, (S) ярлык, (I) intent. - Не задано Не установлены Местоположение не определяется Невозможно определить местоположение. Проверьте, пожалуйста, настройки местоположения устройства. @@ -1938,8 +1926,8 @@ Примечание: не все приложения-будильники используют системный уровень громкости будильника - они могут использовать и собственный уровень громкости, заданный в настройках этих приложений. В этом диалоговом окне отображается список настроенных Wi-Fi SSID.\nНажмите сюда, чтобы открыть экран настроек Wi-Fi. Он содержит параметры для настройки сетей Wi-Fi. PPPPutSettings - Установить\nPPPPutSettings - Запустить\nPPPPutSettings + Установить PPPPS + Запустить PPPPS Закрыть Запустить PPPPutSettings PPPPutSettings не установлено. @@ -1955,9 +1943,9 @@ Новая версия PPPPPPutSettings Нажмите на это уведомление, чтобы установить новую версию PPPPutSettings. PhoneProfilesPlusExtender - Установить\nPhoneProfilesPlusExtender - Запустить\nPhoneProfilesPlusExtender - Включить/отключить\nнастройки спец. возможностей + Установить PPPE + Запустить PPPE + Включить/отключить Закрыть Нажмите сюда, чтобы установить, обновить или запустить PhoneProfilesPlusExtender, а также включить/отключить настройки спец. возможностей. Требуется новая версия PhoneProfilesPlusExtender. Нажмите сюда для обновления. @@ -2084,7 +2072,6 @@ Контакты для Датчика SMS/MMS Контакты для Датчика уведомлений Необходимо предоставить разрешение \"Поверх других приложений\". Оно нужно для запуска activities, когда PhoneProfilesPlus находится в фоновом режиме. Чтобы предоставить это разрешение, нажмите на кнопку \"Предоставить\". - Если предоставить разрешение не удалось, нажмите на эту ссылку. Возможно, по ней вы найдёте решение этой проблемы для вашего устройства: Ø - Не использовать Фильтр контактов [ Все ] @@ -2132,20 +2119,6 @@ После этого начнётся запись. Время работы приложений Неограниченно - Телефонные звонки - Назначить роль \"Фильтр звонков\" - Нажмите сюда, чтобы назначить PhoneProfilesPlus роль \"Фильтр звонков\". Это нужно для блокировки телефонных звонков. - Роль \"Фильтр звонков\" назначена PhoneProfilesPlus - Роль \"Фильтр звонков\" не назначена PhoneProfilesPlus - Блокировать телефонные звонки - ВНИМАНИЕ: Этот параметр позволяет блокировать звонки, указанные в \"Группах контактов\" и \"Контактах\". Уведомления о заблокированных звонках отображаться не будут! - Группы контактов - Контакты - для чтения контактов в параметре профиля \"Телефонные звонки\" - Контакты для параметра профиля \"Телефонные звонки\" - Отправить SMS - Текст SMS - ВНИМАНИЕ: Отправка SMS может быть платной или расходовать предоплаченный пакет SMS! Оно отображается, когда включён параметр \"Начало события\"/\"Прочие параметры\"/\"Повторять уведомление\". Оно отображается, когда включён параметр \"Прочие\"/\"Сгенерировать уведомление\". Он отображается, когда включён параметр \"Настройки\"/\"Уведомление со списком профилей\"/\"Показывать уведомление\". @@ -2201,17 +2174,108 @@ Вкл./выкл. SIM ВНИМАНИЕ: Это действие вызовет экран ввода PIN-кода для включаемой SIM-карты. Сервер PhoneProfilesPlus - Приглашение на сервер PhoneProfilesPlus - PhoneProfilesPlus release in APKPure: - Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. - Send SMS - Do not send SMS - State: - Paused - Running - Stopped - Paused with delay - Running with delay - This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. - If you have problems, questions and suggestions, click here and write me. + Приглашение на сервер + PhoneProfilesPlus на APKPure: + Для установки PPPPutSettings требуется Droid-ify. Пожалуйста, установите его и после этого запустите установку PPPPutSettings ещё раз. + Отправить SMS + Не отправлять SMS + Состояние: + Приостановлено + Выполняется + Остановлено + Приостановлено с задержкой + Выполняется с задержкой + Приложение можно найти в репозитории IzzyOnDroid или на GitHub. Чтобы установить его, нажмите сюда. + Если у Вас возникли проблемы, появились вопросы или предложения, нажмите сюда и напишите мне. + Разрешите, пожалуйста, PhoneProfilesPlus доступ к уведомлениям в настройках системы. Без этого Датчик музыки не сможет определить приложение, воспроизводящее музыку. + Доступ к уведомлениям запрещён + Доступ к уведомлениям разрешён + Назначить роль \"Фильтр звонков\" + Нажмите сюда, чтобы назначить PhoneProfilesPlus роль \"Фильтр звонков\". Это нужно для работы датчика \"Фильтрация вызовов\". + Роль \"Фильтр звонков\" назначена PhoneProfilesPlus + Роль \"Фильтр звонков\" не назначена PhoneProfilesPlus + Фильтрация вызовов + Фильтрация вызовов + Этот датчик запускает событие, если во время вызова отображается экран вызова. В нём доступна блокировка звонков. Параметры: \"Группы контактов\", \"Контакты\", \"Продолжительность\", \"Постоянный запуск\", \"Блокировать телефонные звонки\", \"Отправить SMS\", \"Текст SMS\". + Контакты для датчика \"Фильтрация вызовов\" + Блокировать телефонные звонки + Отправить SMS + Текст SMS + ВНИМАНИЕ: Отправка SMS может быть платной или расходовать предоплаченный пакет SMS! + PhoneProfilesPlus не назначена роль \"Фильтр звонков\" + для чтения контактов, отправки SMS в датчике \"Фильтрация вызовов\" + Направление вызова + Входящие вызовы + Исходящие вызовы + Все вызовы + Блокировать вызовы + Для каждого профиля с настроенным параметром \"Вызовы\"/\"Блокировать вызовы\" создано новое событие с датчиком \"Фильтрация вызовов\". Параметр \"Запуск события\" такого события отключён. Параметр \"Вызовы\" из профилей удалён. + Отправить SMS + Группы контактов + Контакты + для чтения контактов в параметре профиля \"Отправить SMS\" + Контакты для параметра профиля \"Отправить SMS\" + Отправить SMS + Текст SMS + профиль - ошибка при отправке SMS + Отправить SMS + Текст SMS + для чтения контактов, определения звонка (для \"ночного звонка\") в Датчике вызовов + Уведомления + Очистить уведомления + Разрешите, пожалуйста, приложению доступ к уведомлениям. Без этого очистка уведомлений работать не будет. + Очистить уведомления + для чтения контактов в параметре профиля \"Очистить уведомления\" + Приложения: + Группы контактов: + Контакты: + Текст + Контакты для параметра профиля \"Очистить уведомления\" + Тел. номера - не в контактах + Заблокированный вызов + тел. номер: + ВНИМАНИЕ: Этот параметр позволяет блокировать вызовы, но уведомление о блокировке при этом не отображается!\nОднако заблокированные номера сохраняются в \"Журнале событий\", и на них можно перезвонить, нажав на строку с нужным номером. + Весь журнал + Заблокированные вызовы + Ошибки + Начало событий + Приостановка событий + Остановка событий + Перезапуск событий + Активация профилей + установка приложения + (G1)(R) Ночной режим + (Z)(R) Режим чтения + Защита зрения + (G1)(R) Защита глаз + для включения/отключения \"Защиты зрения\" + (I) Настройки \"Ночного режима\" + (I) Настройки режима \"Комфорт для глаз\" + (I) Настройки режима чтения + (S)(Z)(R) Комфорт для глаз + Если предоставить это разрешение не получается, возможно, приложению PhoneProfilesPlus не разрешён доступ к настройкам. Чтобы разрешить его, нажмите сюда. + для включения/отключения VPN + Необходимость в предоставлении разрешения \"Поверх других приложений\" удалена. Так как оно является частью \"Настроек с ограниченным доступом\", банковские приложения и сайты, платёжные системы и т.д. могут стать недоступны или требовать отзыва разрешения \"Поверх других приложений\" для PhoneProfilesPlus. + Рекомендуется установить новую версию PPPPutSettings (1.1), которая больше не требует разрешения \"Поверх других приложений\". Для более ранних, чем 1.1, версий параметры, отмеченные буквой (S), всё ещё будут требовать наличие этого разрешения. + Однако для некоторых параметров профиля, например, для \"Запуска приложений, ярлыков, intent\'ов\" разрешение \"Поверх других приложений\" всё ещё необходимо. + Значение цвета + Название местоположения + Пользовательское действие + Пустой список + Мелодия + Стрелка вправо + Стрелка влево + [ Не задано ] + Экран блокировки устройства + Этот параметр включает/отключает экран блокировки устройства. Когда установлено значение \"Выкл.\", экран блокировки при включённом экране появляться не будет. + Задание \"Времени таймаута экрана\" в системе (при активации профиля) не отключает настройку \"Не выключать экран\". Если вы хотите, чтобы \"Время таймаута экрана\" работало, нужно также отключить \"Не выключать экран\". + Включение/выключение экрана + Параметр \"Не выключать экран\" включён. Чтобы отключить его, настройте и активируйте профиль, в котором он выключен. + для включения/выключения экрана + Когда задано \"Включение/выключение экрана\", \"Экран блокировки устройства\" недоступен, и наоборот. Невозможно задать и то, и другое. + Shizuku установлен, но не запущен. Пожалуйста, откройте Shizuku и запустите его из его приложения. + Открыть + Справка + Этот параметр - для \"Состояние и тип вызова\"=\"Пропущенный вызов\". + \"Освещённость\" - это окружающий свет, определяемый датчиком освещённости устройства. diff --git a/common/src/main/res/values-sk/strings.xml b/common/src/main/res/values-sk/strings.xml index 86a663e835..4caef007b6 100644 --- a/common/src/main/res/values-sk/strings.xml +++ b/common/src/main/res/values-sk/strings.xml @@ -263,7 +263,6 @@ Predvolený profil Prioritné Prispôsobenie - Odomknúť zariadenie Skryť názov profilu Reštartuj udalosti Nepripojené @@ -580,7 +579,7 @@ Tag nie je zapisovateľný Prosím prispejte Príspevok - Je tato aplikácia užitočná?\nPodporte jej vývoj zaslaním príspevku vývojárovi. + Je táto aplikácia užitočná?\nPodporte jej vývoj zaslaním príspevku vývojárovi. Vydania: Vykresliť cez ďalšie aplikácie Nepovolili ste \"Vykresliť cez ďalšie aplikácie\". Nabudúce sa už nepýtať? @@ -670,7 +669,7 @@ Kliknite sem pre otvorenie menu udalosti s možnosťami: Povoľ/Zastav beh, Duplikuj a Zmaž udalosť. Posuvník poradia Presuňte nahor/nadol udalosť s týmto posuvníkom pre zmenu \"Poradia štartu\" udalosti. - Editor + Editor Kliknite sem pre otvorenie Editora. V Editore môžete nakonfigurovať profily, udalosti, zmeniť nastavenia aplikácie atď. Aktivovať profil Kliknite sem pre aktivovanie profilu. @@ -833,7 +832,6 @@ Povoliť skenovanie orientácie (G1)(R) Vyskakovacie notifikácie Vlastná ikona - Kliknite pre nastavenie názvu bunky Nemusí fungovať pripojenie do prístupového bodu z iných zariadení. Nepouži Štart pri nabíjaní @@ -990,7 +988,6 @@ Povoľ PhoneProfilesPlusExtender v systémovom nastavení \"Dostupnosť\". Funkcia dostupnosti nie je použitá, bežiaci servis je potrebný pre príjem hovorov. Kliknite tu pre inštaláciu PhoneProfilesPlusExtender. Bežiaci servis je potrebný pre príjem hovorov. pre čítanie kontaktov v senzore SMS/MMS - pre čítanie kontaktov, detekciu zvonenia hovoru (pre \"nočný hovor\") v senzore hovoru Použiť dekoráciu Typ rozloženia Roztiahnuteľné @@ -1301,7 +1298,6 @@ Režim šetrenia batérie Vysoká presnosť Vlastná farba ikony - Vlastná farba Zapnúť (nevypínať Wi-Fi) Ignorovať Wi-Fi prístupový bod Nastavenie \"Zapnúť (nevypínať Wi-Fi)\" musí byť podporované systémom @@ -1660,13 +1656,7 @@ a Zapnuté Vypnuté - nenastaví - pre parameter - Musíte tiež nakonfigurovať Zobrazuje notifikáciu o stave - je - Ak ho chcete nastaviť na - nakonfigurujte a aktivujte profil s Bez trvania Typ konca aktivácie Trvanie @@ -1799,12 +1789,10 @@ Povoliť beh udalostí Zakázať beh udalostí Nenastavené - Vlastné nenastavené Nevybraté [ Nič ] [ Vlastné ] (A) aplikácia, (S) odkaz, (I) intent. - Nenastavené Žiadne nainštalované Poloha nefunguje Prepáčte, ale nie je možné zistiť polohu. Skontrolujte Nastavenia Polohy v zariadení. @@ -1938,8 +1926,8 @@ Poznámka: Nie všetky aplikácie Hodiny používajú systémovú hlasitosť alarmov, pretože používajú svoju vlastnú hlasitosť nakonfigurovanú vo svojich nastaveniach. V tomto dialógu sa zobrazí zoznam nakonfigurovaných Wi-Fi SSID.\nKliknutím sem zobrazíte obrazovku nastavení Wi-Fi. Obsahuje parameter pre konfiguráciu Wi-Fi sietí. PPPPutSettings - Nainštaluj\nPPPPutSettings - Spusti\nPPPPutSettings + Nainštaluj PPPPS + Spusti PPPPS Zavrieť Spusti PPPPutSettings PPPPutSettings nie je nainštalované. @@ -1955,9 +1943,9 @@ Nová verzia PPPPutSettings Kliknite na túto notifikáciu pre nainštalovanie nového vydania PPPPutSettings. PhoneProfilesPlusExtender - Nainštaluj\nPhoneProfilesPlusExtender - Spusti\nPhoneProfilesPlusExtender - Povoľ/Zakáž\nslužbu Dostupnosť + Nainštaluj PPPE + Spusti PPPE + Povoľ/Zakáž Zavrieť Kliknite sem pre inštaláciu/inováciu, zapnutie/vypnutie nastavení dostupnosti, spustenie PhoneProfilesPlusExtender. Je potrebná nová verzia PhoneProfilesPlusExtender. Kliknutím sem ho môžete aktualizovať. @@ -2084,7 +2072,6 @@ Kontakty pre Senzor SMS/MMS Kontakty pre Senzor notifikácií Musíte udeliť povolenie \"Vykresliť cez ďalšie aplikácie\". Je vyžadované pre štart aktivít keď je PhoneProfilesPlus na pozadí. Kliknite na tlačítko \"Udeliť\" pre udelenie tohoto povolenia. - Ak toto povolenie nie je možné udeliť, kliknite na tento odkaz. Možno na tejto webovej stránke je riešenie pre vaše zariadenie: Ø - Nepoužívať Filter kontaktov [ Všetko ] @@ -2132,20 +2119,6 @@ Spustí sa zápis. Trvanie behu aplikácií Neobmedzené - Telefónne hovory - Nastavenie role kontroly hovorov - Kliknutím sem nastavíte rolu kontroly hovorov pre PhoneProfilesPlus. Vyžaduje sa pre \"Blokovať telefónne hovory\". - Rola kontroly hovorov pre PhoneProfilesPlus je nastavená - Rola kontroly hovorov pre PhoneProfilesPlus nie je nastavená - Blokovať telefónne hovory - UPOZORNENIE: Tento parameter umožňuje blokovať hovory, nakonfigurované v \"Skupinách kontaktov\", \"Kontakty\". Upozornenie o zablokovaných hovoroch sa nezobrazí! - Skupiny kontaktov - Kontakty - pre čítanie kontaktov v parametri profilu \"Telefónne hovory\" - Kontakty pre parameter profilu \"Telefónne hovory\" - Poslať SMS - Text SMS - UPOZORNENIE: Odosielanie SMS môže byť spoplatnené alebo použité z predplateného balíčka SMS! Zobrazí sa, keď udalosť má povolené \"Štart udalosti\"/\"Ostatné parametre\"/\"Opakovaná notifikácia\". Zobrazí sa, keď je v profile nakonfigurované \"Ostatné\"/\"Generovať notifikáciu\". Zobrazí sa, keď je povolené \"Nastavenia\"/\"Notifikácia so zoznamom profilov\"/\"Zobraziť notifikáciu\" @@ -2201,17 +2174,108 @@ Zapnutie/vypnutie SIM UPOZORNENIE: Zobrazí sa obrazovka na zadanie kódu PIN pre kartu SIM, ktorá je nakonfigurovaná ako \"Zapnúť\". Server PhoneProfilesPlus - Pozvánka na server PhoneProfilesPlus - PhoneProfilesPlus release in APKPure: - Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. - Send SMS - Do not send SMS - State: - Paused - Running - Stopped - Paused with delay - Running with delay - This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. - If you have problems, questions and suggestions, click here and write me. + Pozvánka na server + Vydanie PhoneProfilesPlus v ApkPure: + Nainštalujte si prosím Droid-ify. Vyžaduje sa pre inštaláciu PPPPutSettings. Potom znova nainštalujte PPPutSettings. + Odoslať SMS + Neposlať SMS + Stav: + Pozastavená + Bežiaca + Zastavená + Pozastavená so zdržaním + Bežiaca so zdržaním + Táto aplikácia sa nachádza v úložisku IzzyOnDroid a vydaniach GitHub. Kliknutím sem ho nainštalujete. + Ak máte problémy, otázky a návrhy, kliknite sem a napíšte mi. + Prosím povoľte Prístup k notifikáciám pre PhoneProfilesPlus v Nastaveniach systému. Bez toho Senzor hudby nerozpozná aplikáciu, ktorá prehráva hudbu. + Prístup k notifikáciám vypnutý + Prístup k notifikáciám zapnutý + Nastavenie role kontroly hovorov + Kliknutím sem nastavíte rolu kontroly hovorov pre PhoneProfilesPlus. Vyžaduje sa pre senzor \"Kontrola hovoru\". + Rola kontroly hovorov pre PhoneProfilesPlus je nastavená + Rola kontroly hovorov pre PhoneProfilesPlus nie je nastavená + Senzor Kontrola hovoru + Senzor Kontrola hovoru + Tento senzor spustí udalosť, ak sa počas hovoru zobrazí obrazovka telefónneho hovoru. Je v ňom podporované blokovanie hovorov. Parametre: Skupiny kontaktov, Kontakty, Trvanie, Trvalý beh, Blokovať hovor, Odoslať SMS, Text SMS. + Kontakty pre senzor \"Kontrola hovoru\" + Blokovať telefónne hovory + Poslať SMS + Text SMS + UPOZORNENIE: Odosielanie SMS môže byť spoplatnené alebo použité z predplateného balíčka SMS! + nie je nastavená rola kontroly hovorov pre PhoneProfilesPlus + pre čítanie kontaktov, posielanie SMS v senzore udalostí \"Sledovanie hovorov\" + Smer hovoru + Prichádzajúce hovory + Odchádzajúce hovory + Všetky hovory + Blokovať hovory + Pre každý profil s nakonfigurovaným parametrom \"Telefónne hovory\"\/\"Blokovať hovory\" je vygenerovaná nová udalosť so senzorom \"Kontrola hovorov\". Táto udalosť má zakázaný parameter \"Spustenie udalosti\". Parameter „Telefónne hovory“ z profilov je odstránený. + Poslať SMS + Skupiny kontaktov + Kontakty + pre čítanie kontaktov v parametri profilu \"Poslať SMS\" + Kontakty pre parameter profilu \"Poslať SMS\" + Poslať SMS + Text SMS + profil - chyba pri posielaní SMS + Poslať SMS + Text SMS + pre čítanie kontaktov, detekciu zvonenia hovoru (pre \"nočný hovor\"), poslať SMS v senzore Hovoru + Notifikácie + Vymazať notifikácie + Povoľte \"Prístup k notifikáciám\". Bez toho nebude mazanie notifikácie fungovať. + Mazanie notifikácií + pre čítanie kontaktov v parametri profilu \"Mazanie notifikácií\" + Aplikácie: + Skupiny kontaktov: + Kontakty: + Text + Kontakty pre parameter profilu \"Mazanie notifikácií\" + Tel. čísla, ktoré nie sú v kontaktoch + Blokované hovory + tel. číslo: + UPOZORNENIE: Tento parameter umožňuje blokovanie hovorov. Notifikácia o zablokovaných hovoroch sa nezobrazí!\nAle zablokované tel. čísla sa zaznamenávajú do \"Záznamu aktivity\", ktorý umožňuje spätné volanie na zablokované tel. číslo kliknutím na tento riadok záznamu. + Celý záznam + Blokované hovory + Chyby + Štart udalostí + Pozastavenie udalostí + Zastavenie udalostí + Reštart udalostí + Aktivácia profilov + inštalácia aplikácie + (G1)(R) Nočný režim + (Z)(R) Režim čítania + Ochrana zraku + (G1)(R) Ochrana zraku + na zapnutie/vypnutie Ochrany zraku + (I) Nastavenia pre Nočný režim + (I) Nastavenia pre Štít pre pohodlie očí + (I) Nastavenia pre Režim čítania + (S)(Z)(R) Štít pre pohodlie očí + Ak nie je možné udeliť toto povolenie, možno nie sú povolené obmedzené nastavenia pre PhoneProfilesPlus. Kliknutím sem to povolíte. + pre zapnutie/vypnutie VPN + Potreba mať natrvalo povolené \"Vykresliť cez ďalšie aplikácie\" bola odstránená. Pretože toto právo sa nachádza v časti \"Obmedzené nastavenia\" a ak je povolené, bankové aplikácie a webové stránky, platby za tovar, služby atď. môžu byť zablokované alebo môžu vyžadovať vypnutie funkcie \"Vykresliť cez ďalšie aplikácie\" v PhoneProfilesPlus. + Odporúča sa nainštalovať novú verziu PPPPutSettings (1.1), kde je zmena, ktorá si nevyžaduje \"Vykresliť cez ďalšie aplikácie\". Pre verzie staršie ako 1.1 budú parametre označené (S) stále vyžadovať toto právo. + Pre niektoré parametre profilu sa stále vyžaduje \"Vykresliť cez ďalšie aplikácie\", napríklad pre \"Spustiť aplikácie, odkazy, intenty\". + Hodnota farby + Názov polohy + Vlastná akcia + Prázdny zoznam + Tón + Šípka vpravo + Šípka vľavo + [ Nenastavené ] + Obrazovka uzamknutia zariadenia + Tento parameter zapína/vypína obrazovku uzamknutia zariadenia. Keď je nastavená na Zapnúť, uzamknutá obrazovka sa nezobrazí, keď sa obrazovka zapne. + Nastavenie \"Čas do vypnutia obrazovky\" v systéme (aktiváciou profilu) nezakáže \"Udržať obrazovku zapnutú\". Ak chcete, aby v systéme fungoval \"Čas do vypnutia obrazovky\", musíte tiež nakonfigurovať \"Udržať obrazovku zapnutú\" na \"Vypnúť\". + Zapnutie/vypnutie obrazovky + \"Udržať obrazovku zapnutú\" je \"Zapnuté\". Ak ho chcete nastaviť na \"Vypnuté\", nakonfigurujte a aktivujte profil pomocou \"Udržať obrazovku zapnutú\"=\"Vypnuté\". + pre zapnutie/vypnutie obrazovky + Keď je nakonfigurované \"Zapnutie/Vypnutie obrazovky\", \"Obrazovka uzamknutia zariadenia\" je deaktivovaná a naopak. Nie je možné nakonfigurovať oboje. + Shizuku je nainštalovaný, ale nie je spustený. Otvorte Shizuku a spustite ho z jeho aplikácie. + Otvoriť + Pomoc + Tento parameter je pre \"Udalosť hovoru\"=\"Zmeškaný hovor\". + \"Svetlo\" je okolité svetlo detekované snímačom svetla v zariadení. diff --git a/common/src/main/res/values-sl/strings.xml b/common/src/main/res/values-sl/strings.xml index 39816dd209..45f4028de2 100644 --- a/common/src/main/res/values-sl/strings.xml +++ b/common/src/main/res/values-sl/strings.xml @@ -263,7 +263,6 @@ Privzeti profil Prednost Prilagodljivi - Unlock device Skrij ime profila Ponovno zaženi dogodke Brez povezave @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-sr/strings.xml b/common/src/main/res/values-sr/strings.xml index 5da63aa031..32ee8168d0 100644 --- a/common/src/main/res/values-sr/strings.xml +++ b/common/src/main/res/values-sr/strings.xml @@ -263,7 +263,6 @@ Постављени профил Приоритет Прилагодљиво - Unlock device Сакриј назив профила Понови догађаје Није повезано @@ -670,7 +669,7 @@ Кликни овде да отвориш мени догађаја са опцијом Омогући/Заустави покрени, Дуплирај и Обриши догађај. Уређивач распореда Drag event up/down with this handler to change the event \"Start order\". - Едитор + Едитор Click this to open Editor, where you can configure profiles, events, change application settings, etc. Активирај профил Кликни овде за активирање профила. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-sv/strings.xml b/common/src/main/res/values-sv/strings.xml index 08b31e9ff7..2e84e6d3c0 100644 --- a/common/src/main/res/values-sv/strings.xml +++ b/common/src/main/res/values-sv/strings.xml @@ -263,7 +263,6 @@ Standardprofil Prioritet Adaptiv - Unlock device Dölj profilnamn Starta om händelser Inte ansluten @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-te/strings.xml b/common/src/main/res/values-te/strings.xml index f7f4639ea5..9b5983a99e 100644 --- a/common/src/main/res/values-te/strings.xml +++ b/common/src/main/res/values-te/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device దాచు ప్రొఫైల్ పేరు ఈవెంట్స్ పునఃప్రారంభించు Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-th/strings.xml b/common/src/main/res/values-th/strings.xml index d5d00cf33e..ba4e46cd10 100644 --- a/common/src/main/res/values-th/strings.xml +++ b/common/src/main/res/values-th/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-tr/strings.xml b/common/src/main/res/values-tr/strings.xml index 475719dbc3..d8b72b15af 100644 --- a/common/src/main/res/values-tr/strings.xml +++ b/common/src/main/res/values-tr/strings.xml @@ -263,7 +263,6 @@ Varsayılan Tercih Öncelik Ortama göre - Cihazın kilidini aç Tercih ismini gizle Durumları tekrar başlat Wi-Fi bağlanmadı @@ -670,7 +669,7 @@ Seçenekleri ile Durum menüsünü açmak için buna dokunun: Durumu Başlatmak/Durdurmak, Çoğaltmak ve Silmek. Sıra düzenleyici Durumun \"Başlatma sırası\"nı değiştirmek için bununla Durumu yukarı/aşağı sürükleyin. - Düzenleyici + Düzenleyici Tercihleri, Durumları, uygulama ayarlarını vs. ayarlayabileceğiniz Düzenleyici\'yi açmak için buna dokunun. Tercihi faaliyete geçir Tercihi faaliyete geçirmek için buraya dokunun. @@ -833,7 +832,6 @@ Döndürme şartı taramasını aç (G1)(R) açılan bildirimler Hususi simge - Hücre ismi vermek için buraya dokunun Başka bir cihazdan hotspot\'a yapılan bağlantı çalışmayabilir. Kullanılmasın Şarjda iken başla @@ -990,7 +988,6 @@ • \"Erişebilirlik\" için PhoneProfilesPlusExtender\'a sistem ayarlarında izin verin. Erişebilirlik özelliği kullanılmıyor. Çalışan hizmet, gelen çağrıları almak için lüzumlu. PhoneProfilesPlusExtender\'ı kurmak için buraya dokunun. Çalışan hizmet, gelen çağrıları almak için lüzumlu. SMS/MMS şartında kişi verilerini okumak için - Çağrı şartında çalan çağrıyı tesbit etmek (\"gece çağrıları\" için), kişileri okumak için Döşemeyi kullan Düzen türü Genişletilebilir @@ -1301,7 +1298,6 @@ Pil tasarrufu Yüksek doğruluk Hususi simge rengi - Hususi renk Açık (Wi-Fi kapatılmasın) Wi-Fi Hotspot\'u ihmal et \"Açık (Wi-Fi\'yi devre dışı bırakma)\" tercihi sistem tarafından desteklenmelidir @@ -1660,13 +1656,7 @@ ve Açık Kapalı - ayarlanmasın - değer için - Tarihi de ayarlamanız lazım Vaziyet hakkında bildirim gösterir: - dır/dir - Ayarlamak için - tercihi şununla ayarlayıp faaliyete geçirin: Süresiz Faaliyetin bitiş çeşidi Müddet @@ -1799,12 +1789,10 @@ Durumların çalışmasına izin ver Durumların çalışmasına izin verilmesin Ayarlanmadı - Özelleştirme ayarlanmadı Seçilmedi [ Hiçbiri ] [ Hususi ] (A) Uygulama, (S) kısayol, (I) intent. - Ayarlanmadı Yüklü Yok Konum çalışmıyor Maalesef, ancak konum almak mümkün değil. Lütfen cihazın Konum ayarlarını kontrol edin. @@ -1906,7 +1894,7 @@ Bluetooth şartı için Bluetooth isimleri Şebeke hücre şartı için Şebeke hücreleri Titreşim gücü - Gelen çağrı + Incoming call Bildirimler Dokunmatik etkileri Titreşim gücü @@ -1938,8 +1926,8 @@ Dikkat: Saat uygulamalarının tamamı, ayarlarında yapılandırılan kendi ses seviyelerini kullandıkları için sistem alarm ses seviyesini kullanmazlar. Bu malumat penceresinde, ayarlanmış Wi-Fi isimlerinin listesi görüntülenir.\nWi-Fi ayarları ekranını görüntülemek için buraya dokunun. Bu, Wi-Fi ağlarını ayarlamak için bir değer ihtiva eder. PPPAyarlarıYap - PPPAyarlarıYap\'ı kur - PPPAyarlarıYap\'ı başlat + Install PPPPS + Launch PPPPS Kapat PPPAyarlarıYap\'ı başlat PPPAyarlarıYap kurulmadı. @@ -1955,9 +1943,9 @@ Yeni PPPAyarlarıYap sürümü PPPAyarlarıYap\'ın yeni sürümünü kurmak için bu bildirime dokunun. PhoneProfilesPlusExtender - PhoneProfilesPlusExtender\'ı kur - PhoneProfilesPlusExtender\'ı başlat - Aç/Kapat\nErişebilirlik ayarları + Install PPPE + Launch PPPE + Aç/Kapat Kapat Erişilebilirlik ayarlarını kurmak/yükseltmek, izin vermek/devre dışı bırakmak, PhoneProfilesPlusExtender\'ı başlatmak için buraya dokununuz. PhoneProfilesPlusExtender\'ın yeni bir sürümü lüzumlu. Bunu yükseltmek için buraya dokunun. @@ -2084,7 +2072,6 @@ SMS/MMS şartı için Kişiler Bildirim şartı için Kişiler You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - SMS Gönder - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-uk/strings.xml b/common/src/main/res/values-uk/strings.xml index e60f017104..02c7007231 100644 --- a/common/src/main/res/values-uk/strings.xml +++ b/common/src/main/res/values-uk/strings.xml @@ -263,7 +263,6 @@ Стандартно налаштований профіль Важливі Адаптивна - Розблокувати пристрій Приховати назву профілю Перезапустити події Не під’єднано @@ -670,7 +669,7 @@ Натисніть цю кнопку для відкриття меню подій із опціями: Увімкнути/Зупинити, Дублювати та Вилучити подію. Регулятор черги Перетягніть подію вгору/вниз із цим регулятором для зміни порядку представлення події в «Порядок запуску». - Редактор + Редактор Натисніть, щоб відкрити Редактор. В Редакторі Ви можете налаштувати профілі та події, змінити налаштування застосунку і т. д. Активувати профіль Натисніть тут для активації профілю. @@ -833,7 +832,6 @@ Увімкнути сканування орієнтації (G1)(R) Сповіщення що виринають Власна іконка - Натисніть, щоб встановити назву вежі Підключення до точки доступу з інших пристроїв може не працювати. Не використовувати Запускати при зарядці @@ -990,7 +988,6 @@ Дозволити PhoneProfilesPlusExtender \"Служба спец. можливостей\" в налаштуваннях системи. Служба спец. можливостей не використовується, вона потрібна для отримання викликів. Натисніть, щоб встановити PhoneProfilesPlusExtender. Запущена служба необхідна для отримання викликів. для читання контактів SMS/MMS датчиком - для читання контактів, виявлення виклику для \"нічний виклик\") Датчиком викликів Використовувати оформлення Тип Розширювальний @@ -1301,7 +1298,6 @@ Економія батареї Висока точність Власний колір іконки - Власний колір Увімкнуто (не вимикайте Wi-Fi) Нехтувати точкою доступу Wi-Fi Опція \"Увімкнуто (не вимикайте Wi-Fi)\" повинна підтримуватися системою @@ -1660,13 +1656,7 @@ та Увімк Вимк - не встановлено - для параметра - Ви повинні також налаштувати Показує сповіщення про стан - є - Щоб встановити - налаштувати та активувати профіль з Без обмежень Тип закінчення активації Тривалість @@ -1799,12 +1789,10 @@ Запустити події Зупинити події Не визначено - Не визначено користувачем Не обрано [ Нічого ] [ Власне ] (А) застосунок, (S) ярлик, (I) intent. - Не встановлено Не встановлено Розташування не визначено Вибачте, але неможливо визначити розташування. Будь ласка, перевірте налаштування пристрою. @@ -1938,8 +1926,8 @@ Примітка: Не всі програми \"Годинник\" використовують гучність системного будильника, оскільки вони використовують свою власну налаштовану гучність. У цьому діалозі показується список налаштованих Wi-Fi SSIDs.\nНатисніть тут, щоб переглянути екран налаштувань Wi-Fi. Він містить параметр для налаштування мереж Wi-Fi. PPPPutSettings - Встановіть\nPPPPutSettings - Запустить\nPPPPutSettings + Встановіть PPPPS + Запустить PPPPS Закрити Запустити PPPPutSettings PPPPutSettings не встановлено. @@ -1955,9 +1943,9 @@ Нова версія PPPPutSettings Натисніть на це сповіщення, щоб встановити нову версію PPPPutsettings. PhoneProfilesPlusExtender - Встановити\nPhoneProfilesPlusExtender - Запустити\nPhoneProfilesPlusExtender - Увімкнути/вимкнути\nНалаштування Спеціальних можливостей + Встановити PPPE + Запустити PPPE + Увімкнути/вимкнути Закрити Натисніть тут для встановлення/оновлення. Ввімкнення/вимкнення налаштувань Спеціальних можливостей, запуску PhoneProfilesPlusExtender. Необхідна нова версія PhoneProfilesPlusExtender. Натисніть тут для оновлення. @@ -2084,7 +2072,6 @@ Контакти до Датчика SMS/MMS Контакти до Датчика сповіщення Ви повинні надати дозвіл \"Показувати поверх застосунків\". Це потрібно для запуску activities коли PhoneProfilesPlus працює у фоні. Для цього натисніть кнопку \"Надати\". - Якщо неможливо надати дозвіл, натисніть на посилання. Можливо на цій вебсторінці є рішення для Вашого приладу: [P:--] Не використовуйте Фільтр контактів [ Всі ] @@ -2132,20 +2119,6 @@ Запис розпочнеться. Час роботи застосунку Без обмежень - Виклики - Встановити дію екрана виклику - Натисніть тут, щоб встановити дію екрана виклику для PhoneProfilesPlus. Це потрібно для \"Блокувати виклики\". - Дію екрана виклику призначено - Дію екрана виклику не призначено - Блокувати телефонні дзвінки - УВАГА: Цей параметр дозволяє блокувати виклики, які налаштовуються в \"Групи контактів\", \"Контакти\". Сповіщення про заблоковані виклики не будуть показуватися! - Групи контактів - Контакти - для читання контактів в параметрі профілю \"Виклики\" - Контакти для параметра профілю \"Виклики\" - Надіслати SMS - Текст SMS - УВАГА: SMS може бути не безкоштовне! Якщо увімкнута подія \"Початок події\"/\"Інші параметри\"/\"Повторювати сповіщення\", тоді буде показано. Відображається, коли профіль налаштовано \"Інші\" /\"Генерувати сповіщення\". Якщо увімкнуто \"Налаштування\"/\"Повідомлення списку профілів\"/\"Показувати сповіщення\", тоді буде показано @@ -2201,17 +2174,108 @@ SIM увім/вимк УВАГА: Буде потрібно ввести ПІН код для SIM карти яка буде увімкнута. PhoneProfilesPlus сервер - Запрошення до сервера PhoneProfilesPlus + Запрошення до сервера PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. - Send SMS - Do not send SMS - State: - Paused - Running - Stopped - Paused with delay - Running with delay - This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. - If you have problems, questions and suggestions, click here and write me. + Надіслати SMS + Не надсилати SMS + Стан: + Призупинено + Працює + Зупинено + Призупинено із затримкою + Запущено із затримкою + Цей застосунок є в репозиторіях izzyOnDroid і GitHub. Натисніть тут, щоб встановити її. + Якщо у вас є проблеми, питання та пропозиції, натисніть тут і напишіть мені. + Увімкніть доступ до сповіщень для PhoneProfilesPlus в налаштуваннях системи. Без цього, датчик Музики не буде визначати застосунок, що відтворює музику. + Доступ до сповіщень вимкнено + Доступ до сповіщень увімкнено + Встановити дію екрана виклику + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Блокувати телефонні дзвінки + Надіслати SMS + Текст SMS + УВАГА: SMS може бути не безкоштовне! + PhoneProfilesPlus не є фільтром дзвінків + для доступу до контактів відправте SMS у датчику \"Фільтр дзвінків\" + Напрямок дзвінку + Вхідні виклики + Вихідні виклики + Всі виклики + Блокувати виклики + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Надіслати SMS + Текст SMS + профіль - помилка при відправці SMS + Надіслати SMS + Текст SMS + для читання контактів, виявлення дзвінка (для \"нічний виклик\"), надсилання SMS в датчику викликів + Сповіщення + Очистити сповіщення + Будь ласка, увімкніть \"Доступ до сповіщень\". Без цього очищення сповіщень не буде працювати. + Очистити сповіщення + для читання контактів у параметрі профілю \"Очистити сповіщення\" + Застосунки: + Групи контактів: + Контакти: + Текст + Контакти для параметра профілю \"Очистити сповіщення\" + Тел. номерів немає в контактах + Заблокований виклик + тел. номер: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Журнал повністю + Заблоковані виклики + Помилки + Початок подій + Призупинення подій + Зупинення подій + Перезавантаження подій + Активації профілю + встановлення застосунку + (G1)(R) Нічний режим + (Z)(R) Режим читання + Комфорт для очей + (G1)(R) Комфорт для очей + увімк/вимк Комфорт для очей + (I) Налаштування нічного режиму + (I) Налаштування захисту очей + (I) Налаштування режиму читання + (S)(Z)(R) Захист очей + Якщо не виходить надати цей дозвіл, можливо PhoneProfilesPlus немає доступу до налаштувань. Натисніть тут щоб надати його. + для вкл/вимк VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Порожній список + Тон + Стрілка вправо + Стрілка вліво + [ Не вказано ] + Екран блокування + Цей параметр вмикає/вимикає екран блокування пристрою. Коли встановлено на \"Вимкнено\" - екран блокування не з\'являється при увімкненні екрану. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-v33/dimens.xml b/common/src/main/res/values-v33/dimens.xml new file mode 100644 index 0000000000..2f8fe0cf21 --- /dev/null +++ b/common/src/main/res/values-v33/dimens.xml @@ -0,0 +1,4 @@ + + + 10dp + diff --git a/common/src/main/res/values-vi/strings.xml b/common/src/main/res/values-vi/strings.xml index e24f55e122..72cdecf89b 100644 --- a/common/src/main/res/values-vi/strings.xml +++ b/common/src/main/res/values-vi/strings.xml @@ -263,7 +263,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -670,7 +669,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -833,7 +832,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -990,7 +988,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1301,7 +1298,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1660,13 +1656,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1799,12 +1789,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-zh-rCN/strings.xml b/common/src/main/res/values-zh-rCN/strings.xml index d9e138efbb..3eeac1978a 100644 --- a/common/src/main/res/values-zh-rCN/strings.xml +++ b/common/src/main/res/values-zh-rCN/strings.xml @@ -19,7 +19,7 @@ 事件 确定要删除情景吗? 确定要删除事件? - 情景 + 情景情景 已激活 未做更改 应用设置 @@ -41,7 +41,7 @@ 显示Toast通知 通知图标样式 情景标记 - 音量 + 音量音量 声音 情景名称 情景图标 @@ -263,7 +263,6 @@ 默认情景 优先级 自适应 - 解锁设备 隐藏情景名称 重新启动事件 未连接 @@ -413,7 +412,7 @@ 在激活清单和编辑器的标题中显示的是“红绿灯”。 事件可以启动。 事件不能启动 - 已手动激活情景。 - Events are stopped - events run can be enabled through Editor top bar icon \"Enable events run\". + 事件已停止 - 可以通过顶栏信号灯图标“允许事件运行”启用事件。 重新启动事件图标: “红绿灯”图标: Android 6+ 实现了“Doze模式”和“应用程序待机”。 关于事件配置文件激活的问题,如果您将设备断开电源,锁屏后后保持静止一段时间。 点此添加 PhoneProfilesPlus 到“未优化”。 @@ -670,7 +669,7 @@ 单击此按钮打开包含选项的事件菜单:启用/停止运行、复制和删除事件。 排序手柄 用此图标拖动事件向上/向下以更改事件“启动顺序”。 - 编辑器 + 编辑器 单击此处打开编辑器。在编辑器中您可以配置情景、事件、更改应用程序设置…… 激活情景 点击此处激活情景。 @@ -833,7 +832,6 @@ 启用方向扫描 (G1)(R) 弹出通知 自定义图标 - 单击以设置基站名称 可能无法连接到其他设备的热点。 不使用 充电时启动 @@ -990,7 +988,6 @@ 在系统设置中允许PhoneProfilesPlusExtender“辅助功能”。未使用辅助功能,接收呼叫需要运行服务。 单击此处安装PhoneProfilesPlusExtender。接听电话需要运行服务。 用于SMS / MMS传感器中的读取联系人 - 对于读取联系人,检测呼叫传感器中的振铃呼叫(用于“夜间呼叫”) 使用装饰 布局类型 扩展 @@ -1055,7 +1052,7 @@ 使用PhoneProfilesPlusExtender 在Android 9+中,要扫描移动基站,您必须在系统设置中启用位置。 以下情况事件将不会启动: - You have disabled global events run (red \"traffic light\") - enable it in Editor top bar icon \"Enable events run\". + 您已禁用了全局事件运行(\"红灯\") - 在顶栏信号灯图标“允许事件运行”中启用它。 你手工激活了情景 (显示黄灯) - 必须重新运行事件。使用激活清单、编辑器或通知中的“重新启动事件”图标。手动激活的情景在情景名称前用“[M]”标记。例外的情况:如果事件设置中选中了“忽略手工激活”,则事件仍会运行。 你在事件设置中禁止了事件运行 - 必须在事件设置中选中“允许运行”选项n注意:“红绿灯”在激活清单和编辑器的标题中显示。 如果基站扫描不工作,在系统设置中启用定位。 @@ -1301,7 +1298,6 @@ 省电模式 高准确度 自定义图标颜色 - 自定义颜色 开启(不禁用Wi-Fi) 忽略 Wi-Fi 热点 选项\"开启(不禁用Wi-Fi)\"必须由系统支持 @@ -1584,7 +1580,7 @@ 点击此通知以检查 PhoneProfilesPlus 版本。也许会发布更新版本。 "应用程序商店将很快有新版本。" 显示情景设置 - 更改为图片 + 更改为图片图片 (I) 更改为动态壁纸 图片壁纸 (I) 动态壁纸 @@ -1660,13 +1656,7 @@ - 不设置 - 用于参数 - 您还必须配置 显示关于状态的通知 - - 设置它 - 配置并激活配置文件 无持续时间 激活结束的类型 持续时间 @@ -1799,12 +1789,10 @@ 允许事件运行 禁止事件运行 未设置 - 自定义未设置 未选中 [ 无 ] [ 自定义 ] (A) 应用程序, (S) 快捷方式, (I) intent。 - 未设置 未安装 定位不可用 对不起,无法获取位置。请检查设备定位设置。 @@ -1869,7 +1857,7 @@ 用语音助手打开 用语音助手关闭 用语音助手切换 - 没有插入两张 SIM 卡 + 未插入两张 SIM 卡 背景颜色 - 关闭暗色模式 背景颜色 - 开启暗色模式 按暗色模式 @@ -1938,8 +1926,8 @@ 注意:并非所有时钟应用程序都使用系统报警音量,因为它们使用自己在设置中配置的音量。 在此对话框中显示已配置的 Wi-Fi SSID 列表。\n点击这里查看Wi-Fi设置屏幕。它包含配置Wi-Fi网络的参数。 PPPPutSettings - 安装\nPPPPutSettings - 启动\nPPPPutSettings + 安装 PPPPS + 启动 PPPPS 关闭 启动PPPPutSettings PPPPutSettings 未安装 ! @@ -1955,9 +1943,9 @@ 最新 PPPPutSettings 版本 点击此通知安装新发布的 PPPPutSetting。 PhoneProfilesPlusExtender - 安装\nPhoneProfilesPlusExtender - 启动\nPhoneProfilesPlusExtender - 启用/禁用\n辅助功能设置 + 安装 PPPE + 启动 PPPE + 启用/禁用 关闭 点击这里安装/升级,启用/禁用辅助功能设置,启动 PhoneProfilesPlusExtender。 需要新版本的PhoneProfilesPlusExtender。点击这里升级它。 @@ -2047,7 +2035,7 @@ 亮度级别从 运算符从 亮度级别到 - 运算符到 + 运算符 亮度 音量从 音量到 @@ -2084,7 +2072,6 @@ 联系人用于 短信/彩信 传感器 联系人用于通知传感器 您必须授予“在其他应用上显示”权限。它需要在 PhoneProfilesPlus 处于后台时激活。点击按钮授权。 - 若无法授权,请点击此链接获取您设备的解决方案: Ø - 不使用 联系人筛选 [ 全部 ] @@ -2132,20 +2119,6 @@ 写入即将开始。 应用持续运行时间 无限制 - 手机通话 - 设置通话筛选权限 - 点此为 PhoneProfilesPlus 设置通话筛选权限,“骚扰拦截”需要此功能 - 为 PhoneProfilesPlus 设置通话筛选权限 - PhoneProfilesPlus 通话筛选权限未设置 - 电话骚扰拦截 - 警告:该参数允许阻止在 \"联系人群组\"、\"联系人 \"中配置的通话。将不显示骚扰拦截通知! - 联系人群组 - 联系人 - 读取情景参数“电话”中的联系人 - 情景参数“电话”中的联系人 - 发送短信 - 短信文本 - 警告:发送短信可能发生费用! 事件启用 \"事件开始\"/\"其他参数\"/\"重复通知 \"时显示。 情景配置了“其他”/“生成通知”时,将会显示。 启用 \"设置\"/\"情景列表通知\"/\"显示通知 \"后会显示。 @@ -2201,17 +2174,108 @@ 切换 SIM 卡 开/关 警告:设为 \"开启 \"的 SIM 卡的解锁时将需要输入 PIN 码。 PhoneProfilesPlus 服务器 - PhoneProfilesPlus 服务器邀请 - PhoneProfilesPlus release in APKPure: - Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. - Send SMS - Do not send SMS - State: - Paused - Running - Stopped - Paused with delay - Running with delay - This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. - If you have problems, questions and suggestions, click here and write me. + 服务器邀请 + PhoneProfilesPlus 发布在 APKPure: + 安装 PPPPutSettings 前需要安装 Droid-ify,然后再安装 PPPPutSettings。 + 发送短信 + 不发送短信 + 状态: + 已暂停 + 正在运行 + 已停止 + 延迟暂停 + 延时运行 + 此应用程序位于 IzzyOnDroid 仓库和 GitHub ,点此安装。 + 若你有问题和建议,请点击此处。 + 请在系统设置中启用 PhoneProfilesPlus 通知权限。没有这个权限,音乐传感器将无法检测播放音乐的应用程序。 + 通知访问权限已禁用 + 通知访问权限已启用 + 设置来电过滤权限 + 点此设置 PhoneProfilesPlus 的来电过滤权限。“来电过滤”事件传感器需要此功能。 + 为 PhoneProfilesPlus 设置来电过滤权限 + PhoneProfilesPlus 来电过滤权限未设置 + 来电过滤 + 来电过滤 + 如果通话时显示呼叫界面,此传感器将启动事件。它支持呼叫拦截,参数:联系人组、联系人、持续时间、永久运行、拦截电话呼叫、发送短信、短信文本。 + “来电过滤”传感器的联系人 + 电话骚扰拦截 + 发送短信 + 短信文本 + 警告:发送短信可能发生费用! + 未设置 PhoneProfilesPlus 的来电过滤权限 + 读取联系人,在事件传感器“来电过滤”时发送短信 + 通话方向 + 来电 + 去电 + 所有通话 + 骚扰拦截 + 对于每个配置了参数“电话通话”/“骚扰拦截”的情景模式,都会生成带有“来电过滤”传感器的新事件。此事件的“事件运行”参数已被禁用。来自情景模式的“电话通话”参数已被移除。 + 发送短信 + 联系人组 + 联系人 + 读取情景参数“发送短信”中的联系人 + 情景参数“发送短信”中的联系人 + 发送短信 + 短信文本 + 情景 - 发送短信时出错 + 发送短信 + 短信文本 + 读取联系人,检测响铃(用于\"夜间通话\"),在通话传感器中发送短信 + 通知 + 清除通知 + 请启用\"访问通知\"权限。否则,清除通知将无法工作。 + 清除通知 + 读取情景参数“清除通知”中的联系人 + 应用程序: + 联系人组: + 联系人: + 文本 + 情景参数“清除通知”中的联系人 + 电话号码不在联系人中 + 骚扰拦截 + 电话号码: + 警告:此参数允许通话拦截。拦截通话的通知将不会显示!\n但被拦截的电话号码会记录在“活动日志”中,通过点击此日志行可以回拨被阻止的电话号码。 + 全部日志 + 骚扰拦截 + 错误 + 事件启动 + 事件暂停 + 事件停止 + 事件重启 + 激活情景 + 应用安装 + (G1)(R) 夜晚模式 + (Z)(R) 阅读模式 + 护眼 + (G1)(R) 护眼 + 启用/禁用护眼 + (I) 夜晚模式设置 + (I) 护眼设置 + (I) 阅读模式设置 + (S)(Z)(R) 护眼护盾 + 若未授予此权限,PhoneProfilesPlus 将无法设置。点此授权。 + 启用/禁用 VPN + \"在其他应用上绘制/显示\"权限被移除,由于此权限位于“受限设置”中,如果启用,一些银行类应用和网站支付可能会被阻止,需要 PhoneProfilesPlus 关闭“在其他应用上绘制/显示”。 + 建议安装新版本的PPPutSetting(1.1),其不需要“在其他应用上绘制/显示”。 对于早于1.1的版本,用(S) 标记的参数仍然需要此权限。 + 对于某些情景参数,仍然需要\"在其他应用上绘制/显示\",例如\"运行应用,快捷方式,intents\"。 + 颜色值 + 位置名称 + 自定义操作 + 空列表 + Tone + 右箭头 + 左箭头 + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values-zh-rTW/strings.xml b/common/src/main/res/values-zh-rTW/strings.xml index be30e76e48..27d1fbf3af 100644 --- a/common/src/main/res/values-zh-rTW/strings.xml +++ b/common/src/main/res/values-zh-rTW/strings.xml @@ -263,7 +263,6 @@ 預設設定檔 優先 自動調整 - Unlock device 隱藏設定檔名稱 重新啟動事件 未連接 @@ -670,7 +669,7 @@ 按下此選項可開啟包含選項的事件選單: 啟用/停止執行、複製和刪除事件。 排序器 上/下拖曳事件來變更 \"啟動順序\"。 - 編輯器 + 編輯器 按下此按鍵可開啟編輯器,您可以在其中設置設定檔、事件、變更應用程式設定等。 啟動設定檔 點擊此處啟動設定檔. @@ -833,7 +832,6 @@ 啟用翻轉掃描 (G1)(R) 彈出通知 自訂圖示 - 按下來設定基地台名稱 可能無法連接到其它裝置的熱點。 不使用 充電時啟動 @@ -990,7 +988,6 @@ 在系統設定\"無障礙功能\"中允許 PhoneProfilesPlusExtender 。未使用無障礙功能,需執行服務才能接收來電。 按此處安裝 PhoneProfilesPlusExtender。需執行服務才能接收來電。 用於簡訊/多媒體簡訊感測器中讀取聯絡人 - 用於來電感測器中讀取聯絡人、偵測來電(\"夜間來電\") 使用獎章 佈局類型 可展開 @@ -1301,7 +1298,6 @@ 省電模式 高精確度 自訂圖示色彩 - 自訂色彩 關 (不停用 Wi-Fi) 忽略 Wi-Fi 熱點 選項\"開 (不停用 Wi-Fi)\"必須由系統支援 @@ -1660,13 +1656,7 @@ - 不設定 - 對於參數 - 您還必須設置 顯示有關狀態的通知 - - 設定它 - 設置並啟用設定檔 無持續時間 啟用結束的類型 期間 @@ -1799,12 +1789,10 @@ 啟用事件執行 停用事件執行 未設定 - 未設自訂 未選取 [ None ] [ Custom ] (A) 應用程式、(S) 捷徑、(I) 意圖。 - 未設定 無安裝 位置不運作 抱歉,無法取得位置。請檢查裝置的位置設定。 @@ -1906,7 +1894,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1938,8 +1926,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1955,9 +1943,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. 需要新版的 PhoneProfilesPlusExtender。按此處升級它。 @@ -2084,7 +2072,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2132,20 +2119,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2201,7 +2174,7 @@ Switch SIM on/off WARNING: This brings the PIN code entry screen for the SIM card that is configured as \"On\". PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. Send SMS @@ -2214,4 +2187,95 @@ Running with delay This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. + Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. + Notification access disabled + Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + for enable/disable VPN + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + Color value + Location name + Custom action + Empty list + Tone + Right arrow + Left arrow + [ Not set ] + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. diff --git a/common/src/main/res/values/colors.xml b/common/src/main/res/values/colors.xml index 7a1b888ff7..463f101d06 100644 --- a/common/src/main/res/values/colors.xml +++ b/common/src/main/res/values/colors.xml @@ -3,4 +3,11 @@ #A35E19 #59A35E19 #A35E19 + #FFFFFF + + #FFcba17a + #FFb2aba3 + #FF7b4713 + #C0C0C0 + #FFB0B0B0 diff --git a/common/src/main/res/values/dimens.xml b/common/src/main/res/values/dimens.xml new file mode 100644 index 0000000000..6d5cf792b1 --- /dev/null +++ b/common/src/main/res/values/dimens.xml @@ -0,0 +1,4 @@ + + + 0dp + diff --git a/common/src/main/res/values/strings.xml b/common/src/main/res/values/strings.xml index ad3fb68b00..8a90526a0b 100644 --- a/common/src/main/res/values/strings.xml +++ b/common/src/main/res/values/strings.xml @@ -268,7 +268,6 @@ Default profile Priority Adaptive - Unlock device Hide profile name Restart events Not connected @@ -675,7 +674,7 @@ Click this to open event menu with options: Enable/Stop run, Duplicate and Delete event. Order handler Drag event up/down with this handler to change the event \"Start order\". - Editor + Editor Click this to open Editor, where you can configure profiles, events, change application settings, etc. Activate profile Click this to activate a profile. @@ -838,7 +837,6 @@ Enable orientation scanning (G1)(R) Pop-up notifications Custom icon - Click to set cell name May not working connection into hotspot from another devices. Do not use Start when charging @@ -996,7 +994,6 @@ Allow PhoneProfilesPlusExtender \"Accessibility\" in system settings. Accessibility function is not used, running service is needed for receiving calls. Click here to install PhoneProfilesPlusExtender. Running service is needed for receiving calls. for read contacts in SMS/MMS sensor - for read contacts, detect ringing call (for \"night call\") in Call sensor Use decoration Layout type Expandable @@ -1310,7 +1307,6 @@ Battery saving High accuracy Custom icon color - Custom color On (do not disable Wi-Fi) Ignore Wi-Fi hotspot Option \"On (do not disable Wi-Fi)\" must be supported by system @@ -1671,13 +1667,7 @@ and On Off - do not set - for parameter - You must configure also Shows notification about status of - is - To set it - configure and activate profile with Without duration Type of activation end Duration @@ -1811,12 +1801,10 @@ Enable events run Disable events run Not set - Custom not set Not selected [ None ] [ Custom ] (A) application, (S) shortcut, (I) intent. - Not set None installed Location not working Sorry, but is not possible to get location. Please check device Location settings. @@ -1919,7 +1907,7 @@ Bluetooth names for Bluetooth sensor Mobile cells for Mobile cell sensor Vibration intensity - Incomming call + Incoming call Notifications Touch interaction Vibration intensity @@ -1951,8 +1939,8 @@ Note: Not all Clock applications use the system alarm volume because they use their own volume configured in their settings. In this dialog is displayed list of configured Wi-Fi SSIDs.\nClick here to view Wi-Fi settings screen. It contains a parameter for configuring Wi-Fi networks. PPPPutSettings - Install\nPPPPutSettings - Launch\nPPPPutSettings + Install PPPPS + Launch PPPPS Close Launch PPPPutSettings PPPPutSettings is not installed. @@ -1968,9 +1956,9 @@ New PPPPutSettings version Click this notification to install new PPPPutSettings release. PhoneProfilesPlusExtender - Install\nPhoneProfilesPlusExtender - Launch\nPhoneProfilesPlusExtender - Enable/disable\nAccessibility settings + Install PPPE + Launch PPPE + Enable/disable Close Click here for install/upgrade, enable/disable Accessibility settings, launch PhoneProfilesPlusExtender. New version of PhoneProfilesPlusExtender is required. Click here to upgrade it. @@ -2100,7 +2088,6 @@ Contacts for SMS/MMS sensor Contacts for Notification sensor You must grant permission \"Draw over apps\". It is required to start activities when PhoneProfilesPlus is in background. Click button \"Grant\" to grant this permission. - If is not possible to grant this permission, click this link. Maybe in this web page is solution for your device: Ø - Do not use Contacts filter [ All ] @@ -2148,20 +2135,6 @@ Write will be started. Applications run duration Unlimited - Phone calls - Set call screening role - Click here to set call screening role for PhoneProfilesPlus. Is required for \"Block phone calls\". - Call screening role for PhoneProfilesPlus is set - Call screening role for PhoneProfilesPlus is not set - Block phone calls - WARNING: This parameter allows block calls, configured in \"Contact groups\", \"Contacts\". Notification about blocked calls will not be displayed! - Contact groups - Contacts - for read contacts in profile parameter \"Phone calls\" - Contacts for profile parameter \"Phone calls\" - Send SMS - SMS Text - WARNING: Sending SMS may be charged or used from a prepaid SMS package! Is displayed, when event has enabled \"Start of event\"/\"Other parameters\"/\"Repeat notification\". Is displayed, when profile has configured \"Others\"/\"Generate notification\". Is displayed, when is enabled \"Settings\"/\"Profile list notification\"/\"Display notification\" @@ -2221,54 +2194,148 @@ XDA-developers Discord PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation Twitter/X Reddit Bluesky - PhoneProfilesPlus release in APKPure: Please install Droid-ify. Is required for installation of PPPPutSettings. After that, do again installation of PPPPutSettings. - Send SMS Do not send SMS - State: Paused Running Stopped Paused with delay Running with delay - This application is in IzzyOnDroid repository and GitHub Releases. Click here to install it. If you have problems, questions and suggestions, click here and write me. - - Green color: - Orange color: - Red color: - Please enable Notification access for PhoneProfilesPlus in system Settings. Without this, Music sensor will not detect application which plays music. Notification access disabled Notification access enabled + Set call screening role + Click here to set call screening role for PhoneProfilesPlus. Is required for \"Call screening\" event sensor. + Call screening role for PhoneProfilesPlus is set + Call screening role for PhoneProfilesPlus is not set + Call screening sensor + Call screening sensor + This sensor will start an event if displayed is phone call screen during call. Call blocking is supported in it. Parameters: Contact groups, Contacts, Duration, Permanent run, Block phone call, Send SMS, SMS text. + Contacts for sensor \"Call screening\" + Block phone calls + Send SMS + SMS Text + WARNING: Sending SMS may be charged or used from a prepaid SMS package! + not set call screening role for PhoneProfilesPlus + for read contacts, send SMS in event sensor \"Call screening\" + Call direction + Incoming calls + Outgoing calls + All calls + Block calls + For each profile with configured parameter \"Phone calls\"\/\"Block calls\", is generated new event with \"Call screening\" sensor. This event has the \"Event run\" parameter disabled. \"Phone calls\" parameter from profiles is removed. + Send SMS + Contact groups + Contacts + for read contacts in profile parameter \"Send SMS\" + Contacts for profile parameter \"Send SMS\" + Send SMS + SMS Text + profile - error on send SMS + + Send SMS + SMS Text + for read contacts, detect ringing call (for \"night call\"), send SMS in Call sensor + + Notifications + Clear notifications + Please enable \"Notification access\". Without this, clear notification will not work. + Clear notifications + for read contacts in profile parameter \"Clear notifications\" + Applications: + Contact groups: + Contacts: + Text + Contacts for profile parameter \"Clear notifications\" + + Tel. numbers not in contacts + Blocked call + tel. number: + WARNING: This parameter allows block of calls. Notification about blocked calls will not be displayed!\nBut the blocked tel. numbers are logged in the \"Activity log\", which enables calling back to blocked tel. number by clicking on this log line. + Entire log + Blocked calls + Errors + Start of events + Pause of events + Stop of events + Restart of events + Profile activations + application installation + + (G1)(R) Night light + (Z)(R) Reading mode + Eye comfort + (G1)(R) Eye comfort + for enable/disable Eye comfort + (I) Night light settings + (I) Eye comfort shield settings + (I) Reading mode settings + (S)(Z)(R) Eye comfort shield + + If is not possible to grant this permission, maybe are not allowed restricted settings for PhoneProfilesPlus. Click here to allow it. + + for enable/disable VPN + + The need to have \"Draw over apps\" permanently enabled has been removed. Because this right is in \"Restricted settings\" and if it is enabled, banking applications and websites, payments for goods, services, etc., may be blocked or require turning off \"Draw over apps\" in PhoneProfilesPlus. + It is recommended to install the new version of PPPPutSettings (1.1), where there is a change that does not require \"Draw over apps\". For versions earlier than 1.1, parameters marked with (S) will still require this right. + For some profile parameters \"Draw over apps\" is still required, for example for \"Run applications, shortcuts, intents\". + + Color value + Location name + Custom action + + Empty list + Tone + Right arrow + Left arrow + + [ Not set ] + + Device lock screen + This parameter switches On/Off the device lock screen. When set to Off, the lock screen will not appear when the screen is turned on. + + Setting \"Screen timeout\" in the system (by profile activation) does not disable \"Keep screen on\". You also need to configure \"Keep Screen On\" to \"Off\" if you want \"Screen Timeout\" to work on the system. + Screen On/Off + \"Keep screen on\" is \"On\". To set it \"Off\", configure and activate profile with \"Keep screen on\"=\"Off\". + for switch screen on/off + When \"Screen On/Off\" is configured, \"Device lock screen\" is disabled and vice versa. Is not possible to configure both. + + Shizuku is installed, but not running. Please open Shizuku and start it from its application. + Open + Help + + This parameter is for \"Call event\"=\"Missed call\". + \"Light\" is ambient light detected by Light device sensor. PhoneProfilesPlusExtender PPPE + PhoneProfilesPlusExtender Extender for PhoneProfilesPlus. It working only in conjunction with PhoneProfilesPlus. Version: Accessibility service for profile parameter \"Force stop applications\" Accessibility service for event parameters \"Application sensor\" and \"Orientation sensor\" Enabled Disabled - Enable/Disable\nAccessibility service + Enable/Disable Accessibility service Setting screen not found. PhoneProfilesPlusExtender accessibility service Accessibility service for event parameter \"SMS/MMS sensor\". Accessibility function is not used, service is needed for receiving SMS and MMS. Permissions for event parameter \"SMS/MMS sensor\" - permission SMS Not granted Granted - Grant/deny\npermissions + Grant/deny permissions Accessibility service for event parameter \"Call sensor\". Accessibility function is not used, service is needed for receiving calls. Permissions for event parameter \"Call sensor\" - permission Phone Permissions for event parameter \"Call sensor\" - permission Phone, Call logs @@ -2285,11 +2352,11 @@ Battery optimization for PhoneProfilesPlusExtender - please add it to \"Not optimized\" group Optimized Not optimized - Open\nBattery optimization + Open Battery optimization Device: Android version: Please enable \"Display pop-up windows while running in the background\". Without this enabled, \"Force stop applications\" will not be working. - Open\nOther permissions\n(MIUI) + Open Other permissions (MIUI) Grant permission Shows permission which is needed grant it. Permission not granted @@ -2315,7 +2382,7 @@ XDA-developers Discord PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation Twitter/X Reddit Bluesky @@ -2355,7 +2422,7 @@ XDA-developers Discord PhoneProfilesPlus server - PhoneProfilesPlus server invitation + Server invitation Twitter/X Reddit Bluesky diff --git a/cospravit.txt b/cospravit.txt index 4adf1ffdb3..108ed56537 100644 --- a/cospravit.txt +++ b/cospravit.txt @@ -1,76 +1,8 @@ --------------------------------- -Hadanie warningov v kode: -Toto hladaj: -@SuppressLint -@SuppressWarnings -//noinspection - ------------------- - -Ked nejde git push, skus v terminaly AS: -git config credential.helper store - --------------------------------- - -Preco uz nie je PPP v GPlay: - -Google restrictions: -1. Android - All Wi-Fi related functions not working since Android 10. -2. Google Play - Google require (currently) Android 10+ for applications. In application exists gradle configuration parameter: - targetSdkVersion targetSdk - and in PPP must be target sdk = 28. Android 10 is 29. - -In stores, in which is currently deployed PPP, restriction about target sdk not exists. - ----------------------------------------- - -indicator color and its complementary color: -dark tema: indicator:62a9f8 -> accent:f8b162 -> event delay:#F862F4 -light tema: indicator:4289d8 -> accent:cc893e -> event delay:#D842D4 - -https://www.canva.com/colors/color-wheel/ - ------------------------- - Widget Preview Builder: https://play.google.com/store/apps/details?id=lav.widgetpreviewbuilder.free&hl=en_US&gl=US ------------------------ -Ulohy, ktore su spravene [x] a ktore nie [ ]: -[ ] Priority Notification Event -[x] Normal media volume, headphone media volume, Bluetooth media volume -[ ] Sony's "Stamina" mode as profile preference - skor Power save change senzor -[ ] USB connection to PC as storage device, USB connection to PC as camera, connection to USB stick in accessories parameter for events -[ ] option to hide PPP from Launcher -[ ] Set min and max CPU frequency -[ ] Open a website with profile -[ ] profile/event search -[x] Persistent profile/event: sets its options every x minutes - asi periodic sensor -[ ] Android Wear support? -[ ] (AND, OR, XOR, NOT. Or at least NOT.)<-NOT is already available in most preferences. If that stays, that does the same. -[ ] a plugin system? (very small core app, ability to install additional event preferences, maybe only time event preinstalled) - ------------------------- - -System.Settings: -notifications_use_ring_volume ---+--> ze by na odlinkovanie zvonenia a notifikacii? -unlink_volumes_together ---------+ -mute_streams_affected -mode_ringer_streams_affected - -System.Global: -heads_up_notifications_enabled - -Ako disablovat lockscreen, 2 kroky: -1. nastavit, ze power tlacitko nema lockovat - /data/system/locksettings.db - lockscreen.power_button_instantly_locks (0,1) - len je otazka, ci toto existuje aj na starsich androidoch ako 5.0 -2. nastavit lockscreen timeout - Settings.Secure - lock_screen_lock_after_timeout (milisekundy) - ----------- PIN/password - 1. ako zrusim pin/heslo deviceManager.setPasswordMinimumLength(compName, 0); @@ -287,21 +219,21 @@ Night light (blue light filter): Vypada to, ze takto sa to robi: if (isActive) { - if (Build.VERSION.SDK_INT == Build.VERSION_CODES.N) { // API 24, ale skontroluj - prefManager.saveOption(SettingsType.SECURE, "twilight_mode", 0) - writeSecure("twilight_mode", 0) - } else { + //if (Build.VERSION.SDK_INT == Build.VERSION_CODES.N) { // API 24, ale skontroluj + // prefManager.saveOption(SettingsType.SECURE, "twilight_mode", 0) + // writeSecure("twilight_mode", 0) + //} else { prefManager.saveOption(SettingsType.SECURE, "night_display_activated", 0) writeSecure("night_display_activated", 0) - } + //} } else { - if (Build.VERSION.SDK_INT == Build.VERSION_CODES.N) { // API 24, ale skontroluj - prefManager.saveOption(SettingsType.SECURE, "twilight_mode", 1) - writeSecure("twilight_mode", 1) - } else { + //if (Build.VERSION.SDK_INT == Build.VERSION_CODES.N) { // API 24, ale skontroluj + // prefManager.saveOption(SettingsType.SECURE, "twilight_mode", 1) + // writeSecure("twilight_mode", 1) + //} else { prefManager.saveOption(SettingsType.SECURE, "night_display_activated", 1) writeSecure("night_display_activated", 1) - } + //} } fun Context.writeSecure(key: String?, value: Any?): Boolean { @@ -314,29 +246,33 @@ fun Context.writeSecure(key: String?, value: Any?): Boolean { } } -const val TWILIGHT_MODE = "twilight_mode" +//const val TWILIGHT_MODE = "twilight_mode" const val NIGHT_DISPLAY_ACTIVATED = "night_display_activated" +- pouzijem toto len, chcem len zapnut/vypnut const val NIGHT_DISPLAY_AUTO_MODE = "night_display_auto_mode" const val NIGHT_DISPLAY_COLOR_TEMPERATURE = "night_display_color_temperature" -// tiet dve este musim zistit, ci vobec vie nastavit. +// tieto dve este musim zistit, ci vobec vie nastavit. // v aplikacii to nie je const val NIGHT_DISPLAY_CUSTOM_START_TIME = "night_display_custom_start_time" const val NIGHT_DISPLAY_CUSTOM_END_TIME = "night_display_custom_end_time" // pre API 24 -writeSecure(NightModeView.TWILIGHT_MODE, info.twilightMode) +//writeSecure(NightModeView.TWILIGHT_MODE, info.twilightMode) // pre API 25+ writeSecure(NightModeView.NIGHT_DISPLAY_ACTIVATED, info.nightModeActivated) +- Funguje na Pixeli + writeSecure(NightModeView.NIGHT_DISPLAY_AUTO_MODE, info.nightModeAuto) -writeSecure(NightModeView.NIGHT_DISPLAY_COLOR_TEMPERATURE, info.nightModeTemp) +- Toto mozno bude treba na inych mobiloch ako Pixel. K tomu NIGHT_DISPLAY_ACTIVATED + +//writeSecure(NightModeView.NIGHT_DISPLAY_COLOR_TEMPERATURE, info.nightModeTemp) Zdroj: https://github.com/zacharee/Tweaker/blob/master/app/src/main/java/com/zacharee1/systemuituner/services/tiles/NightModeTile.kt Bude potrebovat WRITE_SECURE_SETTINGS. Testovane cez System UI Tuner s grantnutym WRITE_SECURE_SETTINGS na Pixel 3a. ---- Testni to potom este na Samsungu, ci to ide. Neviem, niekde som cital, ze to zhasne obrazovku a pomoze len restart mobilu. Len neviem ci to bolo pri tomto. !!! Hm, tak ako som pisal. Na Samsungu to zhaslo obrazovku. @@ -345,6 +281,33 @@ a pomoze len restart mobilu. Len neviem ci to bolo pri tomto. !!! Ale? Mozno System UI tuner zapise len pri zmene automatiky aj to zapnutie. A to je mozno problem. !!! Testni, testni testni. +!!! Mozno treba len writeSecure(NightModeView.NIGHT_DISPLAY_ACTIVATED, info.nightModeActivated) +!!! Lebo som sa rozhodol, ze to budem len zapinat/vypinat, nebudem menit parametre +!!! Lebo toto asi je pre sunrise/sunset - ak teda toto blbne na Samsungu: +!!! writeSecure(NightModeView.NIGHT_DISPLAY_AUTO_MODE, info.nightModeAuto) + +Mam ine, uvidime - ktohovie ci pojde na Samsungoch. Asi prd pomoze, ta apka je natvrdo pre API 24. +https://github.com/farmerbb/Night-Light/blob/master/app/src/main/java/com/farmerbb/nightlight/util/U.java + +Ale mam toto: +https://github.com/zacharee/Tweaker/issues/120 + +Pre Samsung: https://www.macrodroidforum.com/index.php?threads/samsung-s21-eye-comfort-shield-setting-key.2962/ +Funguje na S10, S21, S23 = supeeer!!! a je to Setting.System "blue_light_filter", takze netreba G1 pravo. +Nefunguje. Meni switch v Nastavenia ale filter nenhadzuje. + +Xiaomi Settings.System "screen_paper_mode_enabled" Rreba root!!! PPPPSaj G1 je tu nanic. + + +Huawei: Settings.System "eyes_protection_mode", netreba G1 pravo. - tu je to trocha cudne (dava tam aj ine hodnoty), ale funguje 0/1 +Toto dam default pre vsetky ostatne mobily, napr. Oppo je vraj to iste co OnePlus: +Pixel: Settings.Secure "night_display_activated", treba G1 pravo. +OnePlus: Settings.Secure "night_display_activated", treba G1 pravo. Musel som si ho ale pridat, lebo ho tam nemal. + +Kde netreba G1, skus, ci nebude treba PPPPS. + +--- +Toto asi nie: Mozno taky test tam dat, ze nech si uzivatel skusi a za par sekund vrati, teda ak to pojde. Vyskusaj aj to. Testuj na Galaxy S10. Ak to vrati, tak potom to sprav tak, ze uzivatel musi cez test dako prejst. A len ak potvrdi @@ -359,6 +322,7 @@ Cize sprav na to dialog s tymi 3 parametrami: S pouiztim public Dialog onCreateDialog(Bundle savedInstanceState) --- +Zavolanie Settings = (I) parameter: Toto je, ked to hore nepojde. Cize zavolanie Settings. Take uz mam pri nejakych parametroch profilu: ACTION_NIGHT_DISPLAY_SETTINGS @@ -387,24 +351,6 @@ Zatial mam nenapadlo, co s tym. Do nastaveni senzora daj aspon info preference o ----------------------- -Treba pravo SYSTEM_ALERT_WINDOW pre (od API 29) - HOTOVO: -- doExecuteForRunApplications() -- PREF_PROFILE_DEVICE_MOBILE_DATA_PREFS -- PREF_PROFILE_DEVICE_NETWORK_TYPE_PREFS -- profile._deviceLocationServicePrefs -- profile._deviceWiFiAPPrefs -- profile._deviceVPNSettingsPrefs -- profile._deviceWallpaperChange -- profile._deviceVPN -- profile._deviceCloseAllApplications -- Permissions.grantPlayRingtoneNotificationPermissions() -- ActivateProfileHelper.putSettingsParameter() - cize zavolanie PPPPS - -Toto neviem, mozno treba, mozno nie: netreba -- CustomACRAEmailSender.send() - ------------------------ - 6.4: - Add: Added support for Shizuku for some profile parameters which requires ROOT. - Change: Event priority displayed in Editor as sensor, also with pass status. @@ -469,103 +415,75 @@ https://developer.android.com/develop/connectivity/nfc/nfc#ext-type ------------------------------------- -Profil a novy parameter "Block phone calls" - -Ak je role nastavene, uz nefunguje jeho znovu-nastavenie, nozbrazuje sa ten bottom sheet na to. -Ide len zrusit v Settings "Caller ID & spam app". -Ak je nastavena ina apka ako PPP, zobrazi sa bottom sheet, takze toto je OK. -Ako postupovat: -1. ak je nastavene PPP, disablovat tuto volbu HOTOVO -2. zobrazovat v summary stav, cize k tomu, co tam uz je dat pred to este stav. HOTOVO - -Treba permission na tie kontakty. Contacts. -Samotny contacts a groups dialog, pyta pravo. Je volane: Permissions.grantContactsDialogPermissions(prefContext). -Cize treba uz iba klasicky ako u inych parametroch. HOTOVO - -Treba este zistit, ci netreba dake dalise pravo. -Ak bude treba, treba este dorobit Phone permission pre: - - -NETREBA, testnute. - -A pridaj ešte contact list type, ako je v call senzore. -No ale tuto nie je dobra vec, davat tam EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE. -Prilis kriticke je toto blokovanie. Ta hodnota by znamenala, ze kazdy jeden hovor by to blokovalo. -HOTOVO - -Import/Export -- kontakty treba zakriptovat, pozri to u udalosti -- kontakty treba dat, ze ich nechcem do backupu, je na to aj dialog, ten treba tiez upravit -HOTOVO - -"Block phone calls" -> treba spravit indikator HOTOVO - -V servise nesmies blokovat, ak kontakty nie su nastavene. HOTOVO - -------------------------------- - -Volane: restartEventsWithRescan() -DataWrapper: -- stopEventsForProfile() - false - kedy volane? - daj true, je to volane z EditorProfileListFragment.deleteProfile() -- startEventAtFirstFtart() - false 2x - kedy volane? - nastav podla toho odkial je volane, cize pridaj parameter manualRestart - -EventStatic: -- runStopEvent() - false - kedy volane? - daj true, je to volane len z GUI - -RestartEventsWithDealyWorker: -- doWork() - false = kedy volane? - nastav podla dat z workera - -TimeChangedReceiver: -- doWork() - false - kedy volane? - daj true, sice znova zacne duration, ale nevadi, toto je volane len na zmenu time zony - ---- - -Volane: restartEventsWithDelay() -EditorEventListAdapter: -- clearView() - false - kedy volane? - daj true, je to volane pri manualnom presuvani itemov eventov v Editore - -GrantPermisionActivity: -- finishGrant() - false - kedy volane? - daj true vo vsetkych pripadoch, je to volane ked monci grant, ktory je bud z Editora alebo z notifikacie - -PPExtenderBroadcastReceiver: -- onReceive() 0 false - kedy volane? - daj true, volane len raz, ked sa nakonektuje Extender - ------------------- - -Chyba v ACTION_VIEW a aj v Chrome. Download apk, napriklad InstallWithOptions. -Testni znova. - -Samsung, One UI 6. Problem je download apk cez ACTION_VIEW. Stale zobrazuje Downloading a hotovo. -Cize tuto mam velky problem. Skus pozriet alebo pouzi DownloadManager. S21. Tych Samsungov je veľa. -Cize to bude daky bug v Samsung One UI asi. -Sranda, to iste robi Chrome aj ked priamo v nom otvorim InstallWithOtions releases a dam stiahnut. -Problém je zjavne v Chrome. Keď dam default Samsung internet, žiaden problém s downloadom nie je. -Alebo v One UI. Že je tam zlý downloader. - ------------- - -Takze zatial kazdy mobil ma spriahnute ringing a system volume. Teda taky, co system nema v Settings. - ------------------ - -PPPPS: -Added Neo Store into README.md. -Change: Added GMail, Discord, Twitter, XDA-developers, Twitter, Reddit, Bluesky badges to README.md -Change: Added "Support" submenu. -Change: Changed label of main activity to "PPPPS". -Change: Added more info about installation into README.md. -Fixed appcompat 1.7.0 dependencies problem. -Fix: Fixed download link of InstallWithOptions.pak in docs. - --------------- - -Tieto retazce zmen: - Green: events can be started. - Orange: events cannot start - profile was activated manually. -Tieto da j prepozitn nanovo (najprv si ho uprav tu), hlavne o tom povoleni behu udalsoti, uz nie je v menu, je v top bare. - Red: events are stopped - events run can be enabled through Editor menu item \"Enable events run\". - You disable global events run (red \"traffic light\") - enable it in Editor menu with item \"Enable events run\". - ---- +PPP: +Add: "Call screening" event sensor (move of profile parameter "Phone call") +Add: Send SMS for missed call into Call senzor. +Add: Profile parameter "Clear notifications". +Add: "Eye comfort shield" profile parameter. +Add: "Night light" profile parameter. +Add: "(I) Night light settings" profile parameter. +Add: Profile parameter "Screen on/off". +Added but not tested and not used: Fix for dynamic colors in Samsung devices. +Change: Added "Applications" parameter into "Music sensor". +Change: Added filter into "Activity log". +Change: Changed 404 link in "Draw over apps" permission wth "Restricted settings" info dialog. +Change: Added support for "Restricted settings" if is required. +Change: Called PPPPS over the service. +Change: "Unlock device" changed to "Device lockscreen". Because this parameter enable/disable lockscreen. +Change: Removed support for Huawei AppGallery. +Change: Important info News about "Draw over apps". +Change: "Phone call" profile parameter and "Send SMS" preference changed to dialog preference. +Change: Added event state icon into popup about event states. +Change: Moved "Enable events run" at top of popup about event states, run/stop indicator. +Change: Added missing BT profiles into BT connected devices detector. +Change: Show dialog for start Shizuku, when is not running but is installed. +Change: New versions of PPPE and PPPPS. +Change: Added bullets into description in traffic light popup. +Change: Important info email link changed to Support popup menu. +Change: Increased PPPE REQUIRED version code. +Change: Added check for PPPPS REQUIRED version code, when must be used. +Change: new LATEST PPPPS version code. +Change: Added "Do not disturb access" into Settings/Permissions. +Change: Added "History of UI changes" into README.md +Change: Do not use hiding of header at scroll in Activator grid view. +Change: "Change wallpaper" profile parameter - wallpaper URI conversion to bitmap with MediaStore/ImageDecoder. +Change: README.md Added note about "Google Play Protect" dialog displayed during PPP installation. +Change: fastlane full_description: Added note about "Google Play Protect" dialog displayed during PPP installation. +Change: Added info about "Send SMS" in "Call sensor". +Change: Added info about "Check light" in "Orientation sensor". +Change: GUI: backgroung color, coponents colors, design. +Fix: GUI: coponents colors, design. +Fix: Fixed rectangle ripple for Android < 13. +Fix: Bad aligned color channels in AndroidClearChroma. +Fixed string in APKPure check PPP release dialog. +Fix: Fixed set volume when unlink is disabled and volumes are merged. +Fix: Do not stop event in EventsHandler even when is not good by sensors requirements. +Fix: Fixed installation of PPPE and PPPPS. Required is Droid-ify for API >= 33. +Fix: Fixed version code and name of PPPE a PPPPS. +Fix: Fixed not playing notification about profile activation when "Confirm activating profile" is disabled. +Fix: Fixed native notification style. Removed is big space in notification. +Fix: Fixed not working "Change to random image" in Android 14+. +Fixed layout of PPP compact notification for Samsung One UI 6. +Fix: Fixed notification without decorator for Samsung. +Fix: Maybe fixed not paused event even when is not good configured. +Fix: Check location permission only when is required. +Fix: Fixed deleted "Vibration intensity" in profile parameters screen. +Fix: "Vibration intensity" max. values for Android 14+. +Fix: Fixed SQLite TEXT constants. +Fix: Fixed activity log for installation of PPP. +Fix: Fixed check of SYSTEM_ALERT_WINDOW permission. +Fix: Fixed "Mobile cells scanning": was not possible to enable it, if Phone permission is not granted. +Fix: Added check for permissions in profile preferences screen for profile parameters in "Others". +Fix: Do not show red text for grant Shizuku, when Shizuku is started, but not granted, and is not used any parameter using (Z) parameters. +Fix: Mobile cells editor and Re-Scan button - enable it and ask for grant needed permissions. +Fix: "Change wallpaper" profile parameter and "Draw over apps" permission check. +Fix: Fixed change of wallpapers by "Change wallpaper" profile parameter. +Fix: Maybe fixed adding groups into contacts. +Fix: Detection of in system configured BT Names by its address. +Fix: Detection of configured BT. Better for multithreading. +Fix: Bluetooth sensor - Connection type=Connected. +Fix: Not working send e-mail with attachments in Android 15. +Fix: Do not ask for grant Shizuku if is PPPPS installed. +Fix: Fixed "Custom color dialog" for "Restart events icon". +Fix: Detection of BTLE devices (watch). -Pokusxxx \ No newline at end of file diff --git a/dependencies.gradle b/dependencies.gradle index 4c9539adb0..8cc5f6b080 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -5,13 +5,13 @@ ext.ppVersions = [ // Add new version, published in GitHub Relases, also into Discord PPP server - publishVersion : '6.5.1.2b', - publishVersionCode: 7174, + publishVersion : '7.0', + publishVersionCode: 7200, minSdk : 26, targetSdk : 28, - compileSdk : 34, - buildTools : '34.0.0', + compileSdk : 35, + buildTools : '35.0.0', appcompatXLib : '1.7.0', //'1.6.1', //'1.5.1', kotlinStdlibJdk8 : '1.8.22', // appcompat 1.7.0 - dependencies problem, this fixed it @@ -19,7 +19,7 @@ ext.ppVersions = [ recyclerView : '1.3.2', //''1.3.1', autoservice : '1.1.1', - acra : '5.11.3', //'5.11.2' + acra : '5.11.4', //'5.11.3' - shizuku : '12.1.0' // It must by this version, because of Shizuku.newProcess() + shizuku : '13.1.0' // It must by this version, because of Shizuku.newProcess() ] diff --git a/docs/FDroid_ChangeLog.html b/docs/FDroid_ChangeLog.html index 5b4088d647..3256dcaeb1 100644 --- a/docs/FDroid_ChangeLog.html +++ b/docs/FDroid_ChangeLog.html @@ -7,45 +7,79 @@

PhoneProfilesPlus Changelog

-

Version: 6.5.1, 6.5.1.1

+

Version: 7.0

    -
  • Added Neo Store into README.md.
  • -
  • Add: Dash Clock Widget in Settings.
  • -
  • Change: Added support for "Neo Store" for PPP, PPPE, PPPPS installation.
  • -
  • Change: Added support for "Neo Store".
  • -
  • Change: Installation of PPP, PPPE from GitHub.
  • -
  • Change: Applied patch #131, which fixes detection of mobile cells when is checked "Start when outside mobile cell".
  • -
  • Change: Detection of PPPPS if Shizuku is installed but PPPPS not. Use Shizuku instead.
  • -
  • Change: Do not use broadcast for start Activator/Editor from notification in API < 31. Not nedded it.
  • -
  • Change: Launcher for widgets, notification moved from "Application interface" to widgets, notification settings.
  • -
  • Change: Changed label of main activity to "PPP".
  • -
  • Change: Create shortcuts: added possibility to set icon name for shortcut.
  • -
  • Change: Added private constructor to utility classes (with all methods static).
  • -
  • Change: Added call of doAfterFirstStart when Shizuku is started.
  • -
  • Change: Added test for managers, adapters to check the enablement of the event sensor.
  • -
  • Change: "Music sensor": added support for detection of music controller.
  • -
  • Change: "Default SIM": added support for Android 13-. Maybe will be working in all devices.
  • -
  • Change: "SIM on/off": added support for Android 12+. Maybe will be working in all devices.
  • -
  • Change: Added button divider into Samsung edge panel.
  • -
  • Change: Added support for CellInfoNr into Mobile cells scanning. It is for 5G mobile net.
  • -
  • Change: Removed Support e-mail from "About application".
  • -
  • Change: Use Shizuku if PPPPS is not installed.
  • -
  • Change: Show red text about not granted Shizuku, if is running and PPPPS is also checked.
  • -
  • Change: Added required version of PPPPS.
  • -
  • Change: Added GMail, XDA-developers, Twitter, Reddit, Bluesky, Discord PPP server badge into README.md
  • -
  • Change: Added labels into README.md badges.
  • -
  • Change: Added XDA-developers, Twitter, Reddit, Bluesky, Discord into Editor "Support" menu.
  • -
  • Fixed appcompat 1.7.0 dependencies problem.
  • -
  • Fix: Fixed download url for InstallWithOptions.apk.
  • -
  • Fix: Force set Wi-Fi, Bluetooth, Mobile cells sensor not passed, when Location is disabled.
  • -
  • Fix: Installation of PPPPS for API 34+: download urls for InstallWithOptions.apk. and PPPPutSettings.apk.
  • -
  • Fix: Fixed show error when scanning is not enabled and is required for sensor.
  • -
  • Fix: Maybe fixed set volume during Priority DND.
  • -
  • Fix: Maybe fixed set volumes.
  • -
  • Fix: Simulating ringing call: Fixed check of mute ringing state. Must be checked not form system, but from activated profile.
  • -
  • Fix: Fixed check of settings, service commands.
  • -
  • Fix: Fixed test of preference allowed state for dual sim notification tone profile parameter.
  • +
  • Add: "Call screening" event sensor (move of profile parameter "Phone call")
  • +
  • Add: Send SMS for missed call into Call senzor.
  • +
  • Add: Profile parameter "Clear notifications".
  • +
  • Add: "Eye comfort shield" profile parameter.
  • +
  • Add: "Night light" profile parameter.
  • +
  • Add: "(I) Night light settings" profile parameter.
  • +
  • Add: Profile parameter "Screen on/off".
  • +
  • Added but not tested and not used: Fix for dynamic colors in Samsung devices.
  • +
  • Change: Added "Applications" parameter into "Music sensor".
  • +
  • Change: Added filter into "Activity log".
  • +
  • Change: Changed 404 link in "Draw over apps" permission wth "Restricted settings" info dialog.
  • +
  • Change: Added support for "Restricted settings" if is required.
  • +
  • Change: Called PPPPS over the service.
  • +
  • Change: "Unlock device" changed to "Device lockscreen". Because this parameter enable/disable lockscreen.
  • +
  • Change: Removed support for Huawei AppGallery.
  • +
  • Change: Important info News about "Draw over apps".
  • +
  • Change: "Phone call" profile parameter and "Send SMS" preference changed to dialog preference.
  • +
  • Change: Added event state icon into popup about event states.
  • +
  • Change: Moved "Enable events run" at top of popup about event states, run/stop indicator.
  • +
  • Change: Added missing BT profiles into BT connected devices detector.
  • +
  • Change: Show dialog for start Shizuku, when is not running but is installed.
  • +
  • Change: New versions of PPPE and PPPPS.
  • +
  • Change: Added bullets into description in traffic light popup.
  • +
  • Change: Important info email link changed to Support popup menu.
  • +
  • Change: Increased PPPE REQUIRED version code.
  • +
  • Change: Added check for PPPPS REQUIRED version code, when must be used.
  • +
  • Change: new LATEST PPPPS version code.
  • +
  • Change: Added "Do not disturb access" into Settings/Permissions.
  • +
  • Change: Added "History of UI changes" into README.md
  • +
  • Change: Do not use hiding of header at scroll in Activator grid view.
  • +
  • Change: "Change wallpaper" profile parameter - wallpaper URI conversion to bitmap with MediaStore/ImageDecoder.
  • +
  • Change: README.md Added note about "Google Play Protect" dialog displayed during PPP installation.
  • +
  • Change: fastlane full_description: Added note about "Google Play Protect" dialog displayed during PPP installation.
  • +
  • Change: Added info about "Send SMS" in "Call sensor".
  • +
  • Change: Added info about "Check light" in "Orientation sensor".
  • +
  • Change: GUI: backgroung color, coponents colors, design.
  • +
  • Fix: GUI: coponents colors, design.
  • +
  • Fix: Fixed rectangle ripple for Android < 13.
  • +
  • Fix: Bad aligned color channels in AndroidClearChroma.
  • +
  • Fixed string in APKPure check PPP release dialog.
  • +
  • Fix: Fixed set volume when unlink is disabled and volumes are merged.
  • +
  • Fix: Do not stop event in EventsHandler even when is not good by sensors requirements.
  • +
  • Fix: Fixed installation of PPPE and PPPPS. Required is Droid-ify for API >= 33.
  • +
  • Fix: Fixed version code and name of PPPE a PPPPS.
  • +
  • Fix: Fixed not playing notification about profile activation when "Confirm activating profile" is disabled.
  • +
  • Fix: Fixed native notification style. Removed is big space in notification.
  • +
  • Fix: Fixed not working "Change to random image" in Android 14+.
  • +
  • Fixed layout of PPP compact notification for Samsung One UI 6.
  • +
  • Fix: Fixed notification without decorator for Samsung.
  • +
  • Fix: Maybe fixed not paused event even when is not good configured.
  • +
  • Fix: Check location permission only when is required.
  • +
  • Fix: Fixed deleted "Vibration intensity" in profile parameters screen.
  • +
  • Fix: "Vibration intensity" max. values for Android 14+.
  • +
  • Fix: Fixed SQLite TEXT constants.
  • +
  • Fix: Fixed activity log for installation of PPP.
  • +
  • Fix: Fixed check of SYSTEM_ALERT_WINDOW permission.
  • +
  • Fix: Fixed "Mobile cells scanning": was not possible to enable it, if Phone permission is not granted.
  • +
  • Fix: Added check for permissions in profile preferences screen for profile parameters in "Others".
  • +
  • Fix: Do not show red text for grant Shizuku, when Shizuku is started, but not granted, and is not used any parameter using (Z) parameters.
  • +
  • Fix: Mobile cells editor and Re-Scan button - enable it and ask for grant needed permissions.
  • +
  • Fix: "Change wallpaper" profile parameter and "Draw over apps" permission check.
  • +
  • Fix: Fixed change of wallpapers by "Change wallpaper" profile parameter.
  • +
  • Fix: Maybe fixed adding groups into contacts.
  • +
  • Fix: Detection of in system configured BT Names by its address.
  • +
  • Fix: Detection of configured BT. Better for multithreading.
  • +
  • Fix: Bluetooth sensor - Connection type=Connected.
  • +
  • Fix: Not working send e-mail with attachments in Android 15.
  • +
  • Fix: Do not ask for grant Shizuku if is PPPPS installed.
  • +
  • Fix: Fixed "Custom color dialog" for "Restart events icon".
  • +
  • Fix: Detection of BTLE devices (watch).
    @@ -57,7 +91,7 @@

    Version: 6.5.1, 6.5.1.1

- Release information on GitHub. + Release information on GitHub.

diff --git a/docs/FDroid_ChangeLog_CS.html b/docs/FDroid_ChangeLog_CS.html index dcc1fb1b52..23de7130eb 100644 --- a/docs/FDroid_ChangeLog_CS.html +++ b/docs/FDroid_ChangeLog_CS.html @@ -7,45 +7,79 @@

PhoneProfilesPlus Seznam změn

-

Verze: 6.5.1, 6.5.1.1

+

Verze: 7.0

    -
  • Added Neo Store into README.md.
  • -
  • Add: Dash Clock Widget in Settings.
  • -
  • Change: Added support for "Neo Store" for PPP, PPPE, PPPPS installation.
  • -
  • Change: Added support for "Neo Store".
  • -
  • Change: Installation of PPP, PPPE from GitHub.
  • -
  • Change: Applied patch #131, which fixes detection of mobile cells when is checked "Start when outside mobile cell".
  • -
  • Change: Detection of PPPPS if Shizuku is installed but PPPPS not. Use Shizuku instead.
  • -
  • Change: Do not use broadcast for start Activator/Editor from notification in API < 31. Not nedded it.
  • -
  • Change: Launcher for widgets, notification moved from "Application interface" to widgets, notification settings.
  • -
  • Change: Changed label of main activity to "PPP".
  • -
  • Change: Create shortcuts: added possibility to set icon name for shortcut.
  • -
  • Change: Added private constructor to utility classes (with all methods static).
  • -
  • Change: Added call of doAfterFirstStart when Shizuku is started.
  • -
  • Change: Added test for managers, adapters to check the enablement of the event sensor.
  • -
  • Change: "Music sensor": added support for detection of music controller.
  • -
  • Change: "Default SIM": added support for Android 13-. Maybe will be working in all devices.
  • -
  • Change: "SIM on/off": added support for Android 12+. Maybe will be working in all devices.
  • -
  • Change: Added button divider into Samsung edge panel.
  • -
  • Change: Added support for CellInfoNr into Mobile cells scanning. It is for 5G mobile net.
  • -
  • Change: Removed Support e-mail from "About application".
  • -
  • Change: Use Shizuku if PPPPS is not installed.
  • -
  • Change: Show red text about not granted Shizuku, if is running and PPPPS is also checked.
  • -
  • Change: Added required version of PPPPS.
  • -
  • Change: Added GMail, XDA-developers, Twitter, Reddit, Bluesky, Discord PPP server badge into README.md
  • -
  • Change: Added labels into README.md badges.
  • -
  • Change: Added XDA-developers, Twitter, Reddit, Bluesky, Discord into Editor "Support" menu.
  • -
  • Fixed appcompat 1.7.0 dependencies problem.
  • -
  • Fix: Fixed download url for InstallWithOptions.apk.
  • -
  • Fix: Force set Wi-Fi, Bluetooth, Mobile cells sensor not passed, when Location is disabled.
  • -
  • Fix: Installation of PPPPS for API 34+: download urls for InstallWithOptions.apk. and PPPPutSettings.apk.
  • -
  • Fix: Fixed show error when scanning is not enabled and is required for sensor.
  • -
  • Fix: Maybe fixed set volume during Priority DND.
  • -
  • Fix: Maybe fixed set volumes.
  • -
  • Fix: Simulating ringing call: Fixed check of mute ringing state. Must be checked not form system, but from activated profile.
  • -
  • Fix: Fixed check of settings, service commands.
  • -
  • Fix: Fixed test of preference allowed state for dual sim notification tone profile parameter.
  • +
  • Add: "Call screening" event sensor (move of profile parameter "Phone call")
  • +
  • Add: Send SMS for missed call into Call senzor.
  • +
  • Add: Profile parameter "Clear notifications".
  • +
  • Add: "Eye comfort shield" profile parameter.
  • +
  • Add: "Night light" profile parameter.
  • +
  • Add: "(I) Night light settings" profile parameter.
  • +
  • Add: Profile parameter "Screen on/off".
  • +
  • Added but not tested and not used: Fix for dynamic colors in Samsung devices.
  • +
  • Change: Added "Applications" parameter into "Music sensor".
  • +
  • Change: Added filter into "Activity log".
  • +
  • Change: Changed 404 link in "Draw over apps" permission wth "Restricted settings" info dialog.
  • +
  • Change: Added support for "Restricted settings" if is required.
  • +
  • Change: Called PPPPS over the service.
  • +
  • Change: "Unlock device" changed to "Device lockscreen". Because this parameter enable/disable lockscreen.
  • +
  • Change: Removed support for Huawei AppGallery.
  • +
  • Change: Important info News about "Draw over apps".
  • +
  • Change: "Phone call" profile parameter and "Send SMS" preference changed to dialog preference.
  • +
  • Change: Added event state icon into popup about event states.
  • +
  • Change: Moved "Enable events run" at top of popup about event states, run/stop indicator.
  • +
  • Change: Added missing BT profiles into BT connected devices detector.
  • +
  • Change: Show dialog for start Shizuku, when is not running but is installed.
  • +
  • Change: New versions of PPPE and PPPPS.
  • +
  • Change: Added bullets into description in traffic light popup.
  • +
  • Change: Important info email link changed to Support popup menu.
  • +
  • Change: Increased PPPE REQUIRED version code.
  • +
  • Change: Added check for PPPPS REQUIRED version code, when must be used.
  • +
  • Change: new LATEST PPPPS version code.
  • +
  • Change: Added "Do not disturb access" into Settings/Permissions.
  • +
  • Change: Added "History of UI changes" into README.md
  • +
  • Change: Do not use hiding of header at scroll in Activator grid view.
  • +
  • Change: "Change wallpaper" profile parameter - wallpaper URI conversion to bitmap with MediaStore/ImageDecoder.
  • +
  • Change: README.md Added note about "Google Play Protect" dialog displayed during PPP installation.
  • +
  • Change: fastlane full_description: Added note about "Google Play Protect" dialog displayed during PPP installation.
  • +
  • Change: Added info about "Send SMS" in "Call sensor".
  • +
  • Change: Added info about "Check light" in "Orientation sensor".
  • +
  • Change: GUI: backgroung color, coponents colors, design.
  • +
  • Fix: GUI: coponents colors, design.
  • +
  • Fix: Fixed rectangle ripple for Android < 13.
  • +
  • Fix: Bad aligned color channels in AndroidClearChroma.
  • +
  • Fixed string in APKPure check PPP release dialog.
  • +
  • Fix: Fixed set volume when unlink is disabled and volumes are merged.
  • +
  • Fix: Do not stop event in EventsHandler even when is not good by sensors requirements.
  • +
  • Fix: Fixed installation of PPPE and PPPPS. Required is Droid-ify for API >= 33.
  • +
  • Fix: Fixed version code and name of PPPE a PPPPS.
  • +
  • Fix: Fixed not playing notification about profile activation when "Confirm activating profile" is disabled.
  • +
  • Fix: Fixed native notification style. Removed is big space in notification.
  • +
  • Fix: Fixed not working "Change to random image" in Android 14+.
  • +
  • Fixed layout of PPP compact notification for Samsung One UI 6.
  • +
  • Fix: Fixed notification without decorator for Samsung.
  • +
  • Fix: Maybe fixed not paused event even when is not good configured.
  • +
  • Fix: Check location permission only when is required.
  • +
  • Fix: Fixed deleted "Vibration intensity" in profile parameters screen.
  • +
  • Fix: "Vibration intensity" max. values for Android 14+.
  • +
  • Fix: Fixed SQLite TEXT constants.
  • +
  • Fix: Fixed activity log for installation of PPP.
  • +
  • Fix: Fixed check of SYSTEM_ALERT_WINDOW permission.
  • +
  • Fix: Fixed "Mobile cells scanning": was not possible to enable it, if Phone permission is not granted.
  • +
  • Fix: Added check for permissions in profile preferences screen for profile parameters in "Others".
  • +
  • Fix: Do not show red text for grant Shizuku, when Shizuku is started, but not granted, and is not used any parameter using (Z) parameters.
  • +
  • Fix: Mobile cells editor and Re-Scan button - enable it and ask for grant needed permissions.
  • +
  • Fix: "Change wallpaper" profile parameter and "Draw over apps" permission check.
  • +
  • Fix: Fixed change of wallpapers by "Change wallpaper" profile parameter.
  • +
  • Fix: Maybe fixed adding groups into contacts.
  • +
  • Fix: Detection of in system configured BT Names by its address.
  • +
  • Fix: Detection of configured BT. Better for multithreading.
  • +
  • Fix: Bluetooth sensor - Connection type=Connected.
  • +
  • Fix: Not working send e-mail with attachments in Android 15.
  • +
  • Fix: Do not ask for grant Shizuku if is PPPPS installed.
  • +
  • Fix: Fixed "Custom color dialog" for "Restart events icon".
  • +
  • Fix: Detection of BTLE devices (watch).
    @@ -57,7 +91,7 @@

    Verze: 6.5.1, 6.5.1.1

- Informace o vydání na GitHub. + Informace o vydání na GitHub.

diff --git a/docs/FDroid_ChangeLog_SK.html b/docs/FDroid_ChangeLog_SK.html index 50a8d7a25f..efe047d33d 100644 --- a/docs/FDroid_ChangeLog_SK.html +++ b/docs/FDroid_ChangeLog_SK.html @@ -7,45 +7,79 @@

PhoneProfilesPlus Zoznam zmien

-

Verzia: 6.5.1, 6.5.1.1

+

Verzia: 7.0

    -
  • Added Neo Store into README.md.
  • -
  • Add: Dash Clock Widget in Settings.
  • -
  • Change: Added support for "Neo Store" for PPP, PPPE, PPPPS installation.
  • -
  • Change: Added support for "Neo Store".
  • -
  • Change: Installation of PPP, PPPE from GitHub.
  • -
  • Change: Applied patch #131, which fixes detection of mobile cells when is checked "Start when outside mobile cell".
  • -
  • Change: Detection of PPPPS if Shizuku is installed but PPPPS not. Use Shizuku instead.
  • -
  • Change: Do not use broadcast for start Activator/Editor from notification in API < 31. Not nedded it.
  • -
  • Change: Launcher for widgets, notification moved from "Application interface" to widgets, notification settings.
  • -
  • Change: Changed label of main activity to "PPP".
  • -
  • Change: Create shortcuts: added possibility to set icon name for shortcut.
  • -
  • Change: Added private constructor to utility classes (with all methods static).
  • -
  • Change: Added call of doAfterFirstStart when Shizuku is started.
  • -
  • Change: Added test for managers, adapters to check the enablement of the event sensor.
  • -
  • Change: "Music sensor": added support for detection of music controller.
  • -
  • Change: "Default SIM": added support for Android 13-. Maybe will be working in all devices.
  • -
  • Change: "SIM on/off": added support for Android 12+. Maybe will be working in all devices.
  • -
  • Change: Added button divider into Samsung edge panel.
  • -
  • Change: Added support for CellInfoNr into Mobile cells scanning. It is for 5G mobile net.
  • -
  • Change: Removed Support e-mail from "About application".
  • -
  • Change: Use Shizuku if PPPPS is not installed.
  • -
  • Change: Show red text about not granted Shizuku, if is running and PPPPS is also checked.
  • -
  • Change: Added required version of PPPPS.
  • -
  • Change: Added GMail, XDA-developers, Twitter, Reddit, Bluesky, Discord PPP server badge into README.md
  • -
  • Change: Added labels into README.md badges.
  • -
  • Change: Added XDA-developers, Twitter, Reddit, Bluesky, Discord into Editor "Support" menu.
  • -
  • Fixed appcompat 1.7.0 dependencies problem.
  • -
  • Fix: Fixed download url for InstallWithOptions.apk.
  • -
  • Fix: Force set Wi-Fi, Bluetooth, Mobile cells sensor not passed, when Location is disabled.
  • -
  • Fix: Installation of PPPPS for API 34+: download urls for InstallWithOptions.apk. and PPPPutSettings.apk.
  • -
  • Fix: Fixed show error when scanning is not enabled and is required for sensor.
  • -
  • Fix: Maybe fixed set volume during Priority DND.
  • -
  • Fix: Maybe fixed set volumes.
  • -
  • Fix: Simulating ringing call: Fixed check of mute ringing state. Must be checked not form system, but from activated profile.
  • -
  • Fix: Fixed check of settings, service commands.
  • -
  • Fix: Fixed test of preference allowed state for dual sim notification tone profile parameter.
  • +
  • Add: "Call screening" event sensor (move of profile parameter "Phone call")
  • +
  • Add: Send SMS for missed call into Call senzor.
  • +
  • Add: Profile parameter "Clear notifications".
  • +
  • Add: "Eye comfort shield" profile parameter.
  • +
  • Add: "Night light" profile parameter.
  • +
  • Add: "(I) Night light settings" profile parameter.
  • +
  • Add: Profile parameter "Screen on/off".
  • +
  • Added but not tested and not used: Fix for dynamic colors in Samsung devices.
  • +
  • Change: Added "Applications" parameter into "Music sensor".
  • +
  • Change: Added filter into "Activity log".
  • +
  • Change: Changed 404 link in "Draw over apps" permission wth "Restricted settings" info dialog.
  • +
  • Change: Added support for "Restricted settings" if is required.
  • +
  • Change: Called PPPPS over the service.
  • +
  • Change: "Unlock device" changed to "Device lockscreen". Because this parameter enable/disable lockscreen.
  • +
  • Change: Removed support for Huawei AppGallery.
  • +
  • Change: Important info News about "Draw over apps".
  • +
  • Change: "Phone call" profile parameter and "Send SMS" preference changed to dialog preference.
  • +
  • Change: Added event state icon into popup about event states.
  • +
  • Change: Moved "Enable events run" at top of popup about event states, run/stop indicator.
  • +
  • Change: Added missing BT profiles into BT connected devices detector.
  • +
  • Change: Show dialog for start Shizuku, when is not running but is installed.
  • +
  • Change: New versions of PPPE and PPPPS.
  • +
  • Change: Added bullets into description in traffic light popup.
  • +
  • Change: Important info email link changed to Support popup menu.
  • +
  • Change: Increased PPPE REQUIRED version code.
  • +
  • Change: Added check for PPPPS REQUIRED version code, when must be used.
  • +
  • Change: new LATEST PPPPS version code.
  • +
  • Change: Added "Do not disturb access" into Settings/Permissions.
  • +
  • Change: Added "History of UI changes" into README.md
  • +
  • Change: Do not use hiding of header at scroll in Activator grid view.
  • +
  • Change: "Change wallpaper" profile parameter - wallpaper URI conversion to bitmap with MediaStore/ImageDecoder.
  • +
  • Change: README.md Added note about "Google Play Protect" dialog displayed during PPP installation.
  • +
  • Change: fastlane full_description: Added note about "Google Play Protect" dialog displayed during PPP installation.
  • +
  • Change: Added info about "Send SMS" in "Call sensor".
  • +
  • Change: Added info about "Check light" in "Orientation sensor".
  • +
  • Change: GUI: backgroung color, coponents colors, design.
  • +
  • Fix: GUI: coponents colors, design.
  • +
  • Fix: Fixed rectangle ripple for Android < 13.
  • +
  • Fix: Bad aligned color channels in AndroidClearChroma.
  • +
  • Fixed string in APKPure check PPP release dialog.
  • +
  • Fix: Fixed set volume when unlink is disabled and volumes are merged.
  • +
  • Fix: Do not stop event in EventsHandler even when is not good by sensors requirements.
  • +
  • Fix: Fixed installation of PPPE and PPPPS. Required is Droid-ify for API >= 33.
  • +
  • Fix: Fixed version code and name of PPPE a PPPPS.
  • +
  • Fix: Fixed not playing notification about profile activation when "Confirm activating profile" is disabled.
  • +
  • Fix: Fixed native notification style. Removed is big space in notification.
  • +
  • Fix: Fixed not working "Change to random image" in Android 14+.
  • +
  • Fixed layout of PPP compact notification for Samsung One UI 6.
  • +
  • Fix: Fixed notification without decorator for Samsung.
  • +
  • Fix: Maybe fixed not paused event even when is not good configured.
  • +
  • Fix: Check location permission only when is required.
  • +
  • Fix: Fixed deleted "Vibration intensity" in profile parameters screen.
  • +
  • Fix: "Vibration intensity" max. values for Android 14+.
  • +
  • Fix: Fixed SQLite TEXT constants.
  • +
  • Fix: Fixed activity log for installation of PPP.
  • +
  • Fix: Fixed check of SYSTEM_ALERT_WINDOW permission.
  • +
  • Fix: Fixed "Mobile cells scanning": was not possible to enable it, if Phone permission is not granted.
  • +
  • Fix: Added check for permissions in profile preferences screen for profile parameters in "Others".
  • +
  • Fix: Do not show red text for grant Shizuku, when Shizuku is started, but not granted, and is not used any parameter using (Z) parameters.
  • +
  • Fix: Mobile cells editor and Re-Scan button - enable it and ask for grant needed permissions.
  • +
  • Fix: "Change wallpaper" profile parameter and "Draw over apps" permission check.
  • +
  • Fix: Fixed change of wallpapers by "Change wallpaper" profile parameter.
  • +
  • Fix: Maybe fixed adding groups into contacts.
  • +
  • Fix: Detection of in system configured BT Names by its address.
  • +
  • Fix: Detection of configured BT. Better for multithreading.
  • +
  • Fix: Bluetooth sensor - Connection type=Connected.
  • +
  • Fix: Not working send e-mail with attachments in Android 15.
  • +
  • Fix: Do not ask for grant Shizuku if is PPPPS installed.
  • +
  • Fix: Fixed "Custom color dialog" for "Restart events icon".
  • +
  • Fix: Detection of BTLE devices (watch).
    @@ -57,7 +91,7 @@

    Verzia: 6.5.1, 6.5.1.1

- Informácie o vydaní na GitHub. + Informácie o vydaní na GitHub.

diff --git a/docs/history_of_ui_changes.md b/docs/history_of_ui_changes.md new file mode 100644 index 0000000000..16af6e3ebb --- /dev/null +++ b/docs/history_of_ui_changes.md @@ -0,0 +1,4 @@ +History Of UI Changes +===================== + +https://drive.google.com/drive/folders/1B7znFAZ-TN7IsASfNldjOerCys3a6_iJ?usp=drive_link \ No newline at end of file diff --git a/docs/pp_features.md b/docs/pp_features.md index 80fc19bbee..19d63fcb73 100644 --- a/docs/pp_features.md +++ b/docs/pp_features.md @@ -1,5 +1,5 @@ Profiles features -====================== +================= - Shizuku (Z): for non-rooted devices in parameters that normally require root - WRITE_SECUE_SETTNGS permission (G1): for non-rooted devices in parameters that normally require root diff --git a/docs/releases-debug.md b/docs/releases-debug.md index 7ca3b928c8..5a22abe74e 100644 --- a/docs/releases-debug.md +++ b/docs/releases-debug.md @@ -1 +1 @@ -@@@ppp-release:6.5.1.1:7165:normal***@@@ \ No newline at end of file +@@@ppp-release:7.0:7200:normal***@@@ \ No newline at end of file diff --git a/docs/releases.md b/docs/releases.md index 7ca3b928c8..5a22abe74e 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -1 +1 @@ -@@@ppp-release:6.5.1.1:7165:normal***@@@ \ No newline at end of file +@@@ppp-release:7.0:7200:normal***@@@ \ No newline at end of file diff --git a/fastlane/android/metadata/cs-CZ/changelogs/7200.txt b/fastlane/android/metadata/cs-CZ/changelogs/7200.txt new file mode 100644 index 0000000000..41279a8a2c --- /dev/null +++ b/fastlane/android/metadata/cs-CZ/changelogs/7200.txt @@ -0,0 +1,9 @@ +7.0 +Seznam změn: +- Novinky v GUI a procesech na pozadí. +- Změny v GUI a procesech na pozadí. +- Opravy v GUI a procesů na pozadí. +- Opravy pádů aplikace. +- Aktualizované překlady. + +Úplný seznam změn je v GitHub vydáních. (https://henrichg.github.io/PhoneProfilesPlus/FDroid_ChangeLog_CS) diff --git a/fastlane/android/metadata/cs-CZ/full_description.txt b/fastlane/android/metadata/cs-CZ/full_description.txt index e497bad956..47a545c376 100644 --- a/fastlane/android/metadata/cs-CZ/full_description.txt +++ b/fastlane/android/metadata/cs-CZ/full_description.txt @@ -1,6 +1,8 @@ **PhoneProfilesPlus umožňuje automaticky nebo s jedním kliknutím konfiguraci zařízení pro životní situace (doma, v práci, v autě, v spánku, venku, ...).** -*Prosím hlaste mi chyby, připomínky a návrhy na můj mail. Urychlí to hlavně opravy chyb. Děkuji velmi pěkně.* +*POZNÁMKA: Služba Google Play Protect může zobrazit dialogové okno s názvem „Nebezpečná aplikace je zablokována“ a popisem „Tato aplikace byla vytvořena pro starší verzi systému Android a neobsahuje nejnovější ochranu soukromí.“ +V tomto dialogovém okně klikněte na „Více podrobností“ a poté na „I tak nainstalovat“. +Zobrazí se dialogové okno, protože PPP má cílovou verzi SDK 28 (Android 9). Musí být kvůli funkcím v PPP.* **Funkce:** diff --git a/fastlane/android/metadata/de/changelogs/7200.txt b/fastlane/android/metadata/de/changelogs/7200.txt new file mode 100644 index 0000000000..84342480be --- /dev/null +++ b/fastlane/android/metadata/de/changelogs/7200.txt @@ -0,0 +1,9 @@ +7.0 +Change log: +- GUI and background additions. +- GUI and background changes. +- GUI and background fixes. +- Fixed application crashes. +- Updated translations. + +Full change log is in GitHub releases. (https://henrichg.github.io/PhoneProfilesPlus/FDroid_ChangeLog) diff --git a/fastlane/android/metadata/en-US/changelogs/7200.txt b/fastlane/android/metadata/en-US/changelogs/7200.txt new file mode 100644 index 0000000000..84342480be --- /dev/null +++ b/fastlane/android/metadata/en-US/changelogs/7200.txt @@ -0,0 +1,9 @@ +7.0 +Change log: +- GUI and background additions. +- GUI and background changes. +- GUI and background fixes. +- Fixed application crashes. +- Updated translations. + +Full change log is in GitHub releases. (https://henrichg.github.io/PhoneProfilesPlus/FDroid_ChangeLog) diff --git a/fastlane/android/metadata/en-US/full_description.txt b/fastlane/android/metadata/en-US/full_description.txt index 50e943b0e6..f405624d81 100644 --- a/fastlane/android/metadata/en-US/full_description.txt +++ b/fastlane/android/metadata/en-US/full_description.txt @@ -1,6 +1,8 @@ **PhoneProfilesPlus allows automatically or with one click configuring the device for life situations (at home, at work, in your car, sleep outside, ...).** -*Please report me bugs, comments and suggestions to my mail. Speed up the especially bug fixes. Thank you very much.* +*NOTE: Google Play Protect may display dialog box with title "Unsafe app blocked" and description "This app was build for an older version of Android and doesn`t include the latest privacy protection." +Please click in this dialog "More details" and then "Install anyway". +Dialog is displayed, because PPP has target SDK vesion 28 (Android 9). Must be, because of functionalities in PPP.* **Features:** diff --git a/fastlane/android/metadata/en-US/images/phoneScreenshots/01.png b/fastlane/android/metadata/en-US/images/phoneScreenshots/01.png old mode 100644 new mode 100755 index 8e0cfabd6d..0539f0697c Binary files a/fastlane/android/metadata/en-US/images/phoneScreenshots/01.png and b/fastlane/android/metadata/en-US/images/phoneScreenshots/01.png differ diff --git a/fastlane/android/metadata/en-US/images/phoneScreenshots/02.png b/fastlane/android/metadata/en-US/images/phoneScreenshots/02.png old mode 100644 new mode 100755 index f7910dcf9c..8b226f1ed9 Binary files a/fastlane/android/metadata/en-US/images/phoneScreenshots/02.png and b/fastlane/android/metadata/en-US/images/phoneScreenshots/02.png differ diff --git a/fastlane/android/metadata/en-US/images/phoneScreenshots/03.png b/fastlane/android/metadata/en-US/images/phoneScreenshots/03.png old mode 100644 new mode 100755 index b5ac3e3cb6..0a472596f8 Binary files a/fastlane/android/metadata/en-US/images/phoneScreenshots/03.png and b/fastlane/android/metadata/en-US/images/phoneScreenshots/03.png differ diff --git a/fastlane/android/metadata/en-US/images/phoneScreenshots/04.png b/fastlane/android/metadata/en-US/images/phoneScreenshots/04.png old mode 100644 new mode 100755 index 85c58473fb..24a4fa23d7 Binary files a/fastlane/android/metadata/en-US/images/phoneScreenshots/04.png and b/fastlane/android/metadata/en-US/images/phoneScreenshots/04.png differ diff --git a/fastlane/android/metadata/en-US/images/phoneScreenshots/05.png b/fastlane/android/metadata/en-US/images/phoneScreenshots/05.png old mode 100644 new mode 100755 index 8f9780eba6..0edca6f363 Binary files a/fastlane/android/metadata/en-US/images/phoneScreenshots/05.png and b/fastlane/android/metadata/en-US/images/phoneScreenshots/05.png differ diff --git a/fastlane/android/metadata/en-US/images/phoneScreenshots/06.png b/fastlane/android/metadata/en-US/images/phoneScreenshots/06.png old mode 100644 new mode 100755 index 57d34e508b..38d5986ebf Binary files a/fastlane/android/metadata/en-US/images/phoneScreenshots/06.png and b/fastlane/android/metadata/en-US/images/phoneScreenshots/06.png differ diff --git a/fastlane/android/metadata/en-US/images/phoneScreenshots/07.png b/fastlane/android/metadata/en-US/images/phoneScreenshots/07.png old mode 100644 new mode 100755 index ca5cd3671b..df36e00c44 Binary files a/fastlane/android/metadata/en-US/images/phoneScreenshots/07.png and b/fastlane/android/metadata/en-US/images/phoneScreenshots/07.png differ diff --git a/fastlane/android/metadata/en-US/images/phoneScreenshots/08.png b/fastlane/android/metadata/en-US/images/phoneScreenshots/08.png old mode 100644 new mode 100755 index 093dd4b3e9..acf2f82267 Binary files a/fastlane/android/metadata/en-US/images/phoneScreenshots/08.png and b/fastlane/android/metadata/en-US/images/phoneScreenshots/08.png differ diff --git a/fastlane/android/metadata/en-US/images/phoneScreenshots/09.png b/fastlane/android/metadata/en-US/images/phoneScreenshots/09.png old mode 100644 new mode 100755 index 450abd8bf0..21064e380d Binary files a/fastlane/android/metadata/en-US/images/phoneScreenshots/09.png and b/fastlane/android/metadata/en-US/images/phoneScreenshots/09.png differ diff --git a/fastlane/android/metadata/en-US/images/phoneScreenshots/10.png b/fastlane/android/metadata/en-US/images/phoneScreenshots/10.png old mode 100644 new mode 100755 index 6c53b818df..d251c803b7 Binary files a/fastlane/android/metadata/en-US/images/phoneScreenshots/10.png and b/fastlane/android/metadata/en-US/images/phoneScreenshots/10.png differ diff --git a/fastlane/android/metadata/sk-SK/changelogs/7200.txt b/fastlane/android/metadata/sk-SK/changelogs/7200.txt new file mode 100644 index 0000000000..d3e3492fe9 --- /dev/null +++ b/fastlane/android/metadata/sk-SK/changelogs/7200.txt @@ -0,0 +1,9 @@ +7.0 +Zoznam zmien: +- Novinky v GUI a procesoch na pozadí. +- Zmeny v GUI a procesoch na pozadí. +- Opravy v GUI a procesov na pozadí. +- Opravy pádov aplikácie. +- Aktualizované preklady. + +Úplný zoznam zmien je v GitHub vydaniach. (https://henrichg.github.io/PhoneProfilesPlus/FDroid_ChangeLog_SK) diff --git a/fastlane/android/metadata/sk-SK/full_description.txt b/fastlane/android/metadata/sk-SK/full_description.txt index 433d476960..397d53a4e1 100644 --- a/fastlane/android/metadata/sk-SK/full_description.txt +++ b/fastlane/android/metadata/sk-SK/full_description.txt @@ -1,6 +1,8 @@ **PhoneProfilesPlus umožňuje automaticky alebo s jedným kliknutím konfiguráciu zariadenia pre životné situácie (doma, v práci, v aute, v spánku, vonku, ...).** -*Prosím hláste mi chyby, pripomienky a návrhy na môj mail. Urýchli to hlavne opravy chýb. Ďakujem veľmi pekne.* +*POZNÁMKA: Služba Google Play Protect môže zobraziť dialógové okno s názvom „Nebezpečná aplikácia je zablokovaná“ a popisom „Táto aplikácia bola vytvorená pre staršiu verziu systému Android a neobsahuje najnovšiu ochranu súkromia.“ +V tomto dialógovom okne kliknite na „Viac podrobností“ a potom na „Aj tak nainštalovať“. +Zobrazí sa dialógové okno, pretože PPP má cieľovú verziu SDK 28 (Android 9). Musí byť kvôli funkciám v PPP.* **Funkcie:** diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a37b3a566e..07ab9d9597 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip diff --git a/noobcameraflash/build.gradle b/noobcameraflash/build.gradle index 380a4672b9..2ef0a1eafd 100644 --- a/noobcameraflash/build.gradle +++ b/noobcameraflash/build.gradle @@ -13,8 +13,8 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -24,7 +24,11 @@ android { consumerProguardFiles 'proguard-rules.pro' } } - namespace 'com.noob.noobcameraflash' + + lint { + disable += ['ExpiredTargetSdkVersion'] + } + } dependencies { diff --git a/noobcameraflash/src/main/java/com/noob/noobcameraflash/utilities/CameraUtilMarshMallow.java b/noobcameraflash/src/main/java/com/noob/noobcameraflash/utilities/CameraUtilMarshMallow.java index 6e6a2021cf..b621822279 100644 --- a/noobcameraflash/src/main/java/com/noob/noobcameraflash/utilities/CameraUtilMarshMallow.java +++ b/noobcameraflash/src/main/java/com/noob/noobcameraflash/utilities/CameraUtilMarshMallow.java @@ -24,37 +24,39 @@ private void openCamera() throws CameraAccessException { if (mCameraManager == null) mCameraManager = (CameraManager) getContext().getSystemService(Context.CAMERA_SERVICE); - // check for all cameras - boolean flashAvailable = false; - String[] cameraIds = mCameraManager.getCameraIdList(); - for (String id : cameraIds) { - flashAvailable = isFlashAvailable(id); - } + if (mCameraManager != null) { + // check for all cameras + boolean flashAvailable = false; + String[] cameraIds = mCameraManager.getCameraIdList(); + for (String id : cameraIds) { + flashAvailable = isFlashAvailable(id); + } - if (flashAvailable /*isFlashAvailable()*/) { - mTorchCallback = new CameraManager.TorchCallback() { - @Override - public void onTorchModeUnavailable(@NonNull String cameraId) { - super.onTorchModeUnavailable(cameraId); - //onCameraTorchModeChanged(TorchMode.Unavailable); - } + if (flashAvailable /*isFlashAvailable()*/) { + mTorchCallback = new CameraManager.TorchCallback() { + @Override + public void onTorchModeUnavailable(@NonNull String cameraId) { + super.onTorchModeUnavailable(cameraId); + //onCameraTorchModeChanged(TorchMode.Unavailable); + } - @Override - public void onTorchModeChanged(@NonNull String cameraId, boolean enabled) { - super.onTorchModeChanged(cameraId, enabled); + @Override + public void onTorchModeChanged(@NonNull String cameraId, boolean enabled) { + super.onTorchModeChanged(cameraId, enabled); /*if (enabled) setTorchMode(TorchMode.SwitchedOn); else setTorchMode(TorchMode.SwitchedOff);*/ - } - }; - mCameraManager.registerTorchCallback(mTorchCallback, null); + } + }; + mCameraManager.registerTorchCallback(mTorchCallback, null); + } } } private boolean isFlashAvailable(String cameraId) throws CameraAccessException { CameraCharacteristics cameraCharacteristics = mCameraManager.getCameraCharacteristics(cameraId /*"0"*/); - return cameraCharacteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE); + return Boolean.TRUE.equals(cameraCharacteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE)); } @Override @@ -65,7 +67,7 @@ public void turnOnFlash() throws CameraAccessException { // only log exception, because for all cameras must be set torch try { CameraCharacteristics characteristics = getCameraManager().getCameraCharacteristics(id); - if (characteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE)) { + if (Boolean.TRUE.equals(characteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE))) { // added facing check - allowed is only back flash Integer facing = characteristics.get(CameraCharacteristics.LENS_FACING); if ((facing != null) && (facing == CameraCharacteristics.LENS_FACING_BACK)) { @@ -91,7 +93,7 @@ public void turnOffFlash() throws CameraAccessException { // only log exception, because for all cameras must be set torch try { CameraCharacteristics characteristics = getCameraManager().getCameraCharacteristics(id); - if (characteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE)) { + if (Boolean.TRUE.equals(characteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE))) { // added facing check - allowed is only back flash Integer facing = characteristics.get(CameraCharacteristics.LENS_FACING); if ((facing != null) && (facing == CameraCharacteristics.LENS_FACING_BACK)) { diff --git a/phoneProfilesPlus/build.gradle b/phoneProfilesPlus/build.gradle index ed2cb4fa19..bb3c568542 100644 --- a/phoneProfilesPlus/build.gradle +++ b/phoneProfilesPlus/build.gradle @@ -3,6 +3,16 @@ apply from: '../dependencies.gradle' apply from: '../passwords_keys.gradle' android { + // This is IMORTANT dfor combinig of release and debug versions of PPP, PPPE, PPPPS. + // Also in PPPE a PPPPS is this and must be the same! + signingConfigs { + debug { + storeFile file('/home/henrichg/Projekty/AndroidStudio/AndroidReleases/henrichg.keystore') + storePassword 'H3nr1sk0Gr0n6220' + keyAlias 'henrichg' + keyPassword 'H3nr1sk0Gr0n6220' + } + } namespace 'sk.henrichg.phoneprofilesplus' compileSdkVersion ppVersions.compileSdk @@ -20,8 +30,8 @@ android { } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_11 + targetCompatibility JavaVersion.VERSION_11 } buildTypes { @@ -46,7 +56,8 @@ android { } lint { abortOnError false - disable 'ManifestResource', 'LongLogTag', 'AppBundleLocaleChanges' + disable += ['ManifestResource', 'LongLogTag', 'AppBundleLocaleChanges'] + disable += ['ExpiredTargetSdkVersion'] } bundle { language { @@ -66,6 +77,7 @@ android { buildFeatures { buildConfig true } + } dependencies { @@ -81,7 +93,7 @@ dependencies { implementation 'org.lsposed.hiddenapibypass:hiddenapibypass:4.3' /// ACRA - implementation "com.google.guava:guava:33.2.1-android" //33.0.0-android" + implementation 'com.google.guava:guava:33.3.1-android' //33.3.0-android" implementation "ch.acra:acra-mail:$ppVersions.acra" implementation "ch.acra:acra-notification:$ppVersions.acra" // https://github.com/ACRA/acra/tree/master/examples/acra-basic-java-example @@ -90,7 +102,7 @@ dependencies { ///// /// for usage of WorkManager - implementation 'androidx.work:work-runtime:2.9.0' //2.8.1' + implementation 'androidx.work:work-runtime:2.10.0' //2.9.1' //2.8.1' /// for fix bitmaps orietnation implementation 'androidx.exifinterface:exifinterface:1.3.7' @@ -110,14 +122,17 @@ dependencies { //noinspection GradleDependency implementation 'androidx.preference:preference:1.1.1' + //implementation 'androidx.activity:activity:1.9.1' implementation "androidx.appcompat:appcompat:$ppVersions.appcompatXLib" implementation "androidx.appcompat:appcompat-resources:$ppVersions.appcompatXLib" + /* // appcompat 1.7.0 - dependencies problem, this fixed it constraints { //noinspection ForeignDelegate implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8:$ppVersions.kotlinStdlibJdk8") } + */ //1.11.0' is not good, not working dynamic colors //https://github.com/material-components/material-components-android/issues/3924 @@ -128,7 +143,7 @@ dependencies { implementation 'com.github.ibrahimsn98:SmoothBottomBar:1.7.9' /// for map display in Location editor dialog - implementation 'org.osmdroid:osmdroid-android:6.1.18' + implementation 'org.osmdroid:osmdroid-android:6.1.20' //6.1.18' /// for json usage in some preferenses (wifi, bluetooth connection, scanning, ...) implementation 'com.google.code.gson:gson:2.11.0' //2.10.1' @@ -136,12 +151,12 @@ dependencies { /// for DashClock support implementation 'com.google.android.apps.dashclock:dashclock-api:2.0.0' - // for GUI click help (Editor menu / Help with GUI items - implementation 'com.getkeepsafe.taptargetview:taptargetview:1.13.3' + // for GUI click help (Editor menu / Help with GUI items) + implementation 'com.getkeepsafe.taptargetview:taptargetview:1.15.0'//1.14.0' //'1.13.3' /// for DontKillMyApp dialog // required for dev.doubledot.doki.views.DokiContentView - - implementation 'androidx.constraintlayout:constraintlayout:2.1.4' + implementation 'androidx.constraintlayout:constraintlayout:2.2.0' //2.1.4' implementation 'dev.doubledot.doki:library:0.0.1' //implementation('dev.doubledot.doki:library:0.0.1@aar') { // transitive = true @@ -155,7 +170,7 @@ dependencies { implementation "com.github.skydoves:expandablelayout:1.0.7" /// for Wi-Fi AP profile parameter - implementation 'com.linkedin.dexmaker:dexmaker:2.28.3' + implementation 'com.linkedin.dexmaker:dexmaker:2.28.4' /// for backup/restore encripted data implementation 'com.github.simbiose:Encryption:2.0.1' diff --git a/phoneProfilesPlus/src/debug/java/sk/henrichg/phoneprofilesplus/LogCrashActivity.java b/phoneProfilesPlus/src/debug/java/sk/henrichg/phoneprofilesplus/LogCrashActivity.java index ba4a883f98..c89b2ca089 100644 --- a/phoneProfilesPlus/src/debug/java/sk/henrichg/phoneprofilesplus/LogCrashActivity.java +++ b/phoneProfilesPlus/src/debug/java/sk/henrichg/phoneprofilesplus/LogCrashActivity.java @@ -56,8 +56,10 @@ protected void onCreate(Bundle savedInstanceState) { listView.setAdapter(logCrashAdapter); Button goToBtn = findViewById(R.id.log_crash_list_go_to_bottom); + //noinspection DataFlowIssue goToBtn.setOnClickListener(v -> listView.setSelection(logCrashAdapter.getCount() - 1)); goToBtn = findViewById(R.id.log_crash_list_go_to_top); + //noinspection DataFlowIssue goToBtn.setOnClickListener(v -> listView.setSelection(0)); } diff --git a/phoneProfilesPlus/src/main/AndroidManifest.xml b/phoneProfilesPlus/src/main/AndroidManifest.xml index b67a85c45f..0b182555e5 100644 --- a/phoneProfilesPlus/src/main/AndroidManifest.xml +++ b/phoneProfilesPlus/src/main/AndroidManifest.xml @@ -87,6 +87,9 @@ + + + @@ -98,7 +101,8 @@ + android:required="true" + tools:ignore="UnnecessaryRequiredFeature" /> @@ -142,6 +146,9 @@ + @@ -153,12 +160,19 @@ + + + + + + + + android:name=".ProfilesPrefsActivity"> + + android:name=".EventsPrefsActivity"> + @@ -471,7 +486,9 @@ + android:label="@string/donation_activity_title" + android:theme="@style/DialogTheme_dayNight" + > - - + + + + + + + + { Intent intent; intent = new Intent(getBaseContext(), DonationPayPalActivity.class); startActivity(intent); }); + /* Button closeButton = findViewById(R.id.about_application_close); + //noinspection DataFlowIssue closeButton.setOnClickListener(view -> finish()); + */ } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActionForExternalApplicationActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActionForExternalApplicationActivity.java index adad1b9efc..3d401df8ce 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActionForExternalApplicationActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActionForExternalApplicationActivity.java @@ -131,6 +131,10 @@ protected void onStart() serviceIntent.putExtra(PhoneProfilesService.EXTRA_START_FOR_SHIZUKU_START, false); // PPApplicationStatic.logE("[START_PP_SERVICE] ActionForExternalApplicationActivity.onStart", "xxx"); PPApplicationStatic.startPPService(this, serviceIntent, true); + + // this permission will be required in MainWorker.doAfterFirstStart() + DrawOverAppsPermissionNotification.showNotification(getApplicationContext(), true); + finish(); return; } @@ -380,7 +384,7 @@ protected void onDestroy() private void showNotification(String title, String text) { PPApplicationStatic.createExclamationNotificationChannel(getApplicationContext(), false); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext(), PPApplication.EXCLAMATION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(getApplicationContext(), R.color.error_color)) + .setColor(ContextCompat.getColor(getApplicationContext(), R.color.errorColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_exclamation_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(getApplicationContext().getResources(), R.drawable.ic_exclamation_notification)) .setContentTitle(title) // title for notification diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java index 5abf1af11c..fa3282e70b 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java @@ -23,6 +23,7 @@ import android.database.Cursor; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.graphics.ImageDecoder; import android.graphics.PixelFormat; import android.graphics.Rect; import android.hardware.camera2.CameraAccessException; @@ -39,11 +40,15 @@ import android.net.wifi.WifiManager; import android.nfc.NfcAdapter; import android.os.Build; +import android.os.Bundle; import android.os.Handler; import android.os.PowerManager; import android.os.ServiceManager; import android.os.UserHandle; +import android.provider.MediaStore; import android.provider.Settings; +import android.service.notification.StatusBarNotification; +import android.telephony.SmsManager; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; import android.telephony.TelephonyManager; @@ -126,14 +131,19 @@ class ActivateProfileHelper { private static final String PPPPS_SETTINGS_TYPE_SYSTEM = "system"; private static final String SETTINGS_PREF_VIBRATE_IN_NORMAL = "vibrate_in_normal"; private static final String SETTINGS_PREF_VIBRATE_IN_SILENT = "vibrate_in_silent"; - private static final String SETTINGS_PREF_RING_VIBRATION_INTENSITY = "ring_vibration_intensity"; private static final String SETTINGS_PREF_VIBRATE_ON = "vibrate_on"; - private static final String SETTINGS_PREF_NOTIFICATION_VIBRATION_INTENSITY = "notification_vibration_intensity"; private static final String SETTINGS_AUDIO_SAFE_VOLUME_STATE = "audio_safe_volume_state"; private static final String SETTINGS_HEADSUP_NOTIFICATION_ENABLED = "heads_up_notifications_enabled"; private static final String SETTINGS_LOW_POWER = "low_power"; private static final String SETTINGS_DOZE_ALWAYS_ON = "doze_always_on"; private static final String SETTINGS_UI_NIGHT_MODE = "ui_night_mode"; + private static final String SETTINGS_PREF_RING_VIBRATION_INTENSITY = "ring_vibration_intensity"; + private static final String SETTINGS_PREF_NOTIFICATION_VIBRATION_INTENSITY = "notification_vibration_intensity"; + private static final String SETTINGS_PREF_HAPTIC_FEEDBACK_VIBRATION_INTENSITY = "haptic_feedback_intensity"; + private static final String SETTINGS_BLUE_LIGHT_FILTER = "blue_light_filter"; + private static final String SETTINGS_SCREEN_PAPER_MODE_ENABLED = "screen_paper_mode_enabled"; + private static final String SETTINGS_EYES_PROTECTION_MODE = "eyes_protection_mode"; + private static final String SETTINGS_NIGHT_DISPLAY_ACTIVATED = "night_display_activated"; // private static final String PPPPS_SETTINGS_TYPE_SPECIAL = "setting_type_special"; // private static final String SETTINGS_SET_WIFI_ENABLED = "setWifiEnabled"; @@ -160,7 +170,7 @@ private static void doExecuteForRadios(Context context, Profile profile, SharedP if (phoneCount > 1) { if (profile._deviceOnOffSIM1 != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { //noinspection ConstantConditions if (!firstSleepCalled) { @@ -189,7 +199,7 @@ private static void doExecuteForRadios(Context context, Profile profile, SharedP } } if (profile._deviceOnOffSIM2 != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (!firstSleepCalled) { GlobalUtils.sleep(300); firstSleepCalled = true; @@ -223,7 +233,7 @@ private static void doExecuteForRadios(Context context, Profile profile, SharedP // change default SIM if (!profile._deviceDefaultSIMCards.equals("0|0|0")) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (!firstSleepCalled) { GlobalUtils.sleep(300); firstSleepCalled = true; @@ -269,7 +279,7 @@ private static void doExecuteForRadios(Context context, Profile profile, SharedP // setup network type // in array.xml, networkTypeGSMValues are 100+ values if (profile._deviceNetworkType >= 100) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (!firstSleepCalled) { GlobalUtils.sleep(300); firstSleepCalled = true; @@ -285,7 +295,7 @@ private static void doExecuteForRadios(Context context, Profile profile, SharedP int phoneCount = telephonyManager.getPhoneCount(); if (phoneCount > 1) { if (profile._deviceNetworkTypeSIM1 >= 100) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM1, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM1, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (!firstSleepCalled) { GlobalUtils.sleep(300); firstSleepCalled = true; @@ -297,7 +307,7 @@ private static void doExecuteForRadios(Context context, Profile profile, SharedP } } if (profile._deviceNetworkTypeSIM2 >= 100) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM2, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM2, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (!firstSleepCalled) { GlobalUtils.sleep(300); firstSleepCalled = true; @@ -313,7 +323,7 @@ private static void doExecuteForRadios(Context context, Profile profile, SharedP // setup mobile data if (profile._deviceMobileData != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (!firstSleepCalled) { GlobalUtils.sleep(300); firstSleepCalled = true; @@ -435,7 +445,7 @@ private static void doExecuteForRadios(Context context, Profile profile, SharedP // setup WiFi AP boolean canChangeWifi = true; if (profile._deviceWiFiAP != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WIFI_AP, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WIFI_AP, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (!firstSleepCalled) { GlobalUtils.sleep(300); firstSleepCalled = true; @@ -534,7 +544,7 @@ private static void doExecuteForRadios(Context context, Profile profile, SharedP if (canChangeWifi) { // setup Wi-Fi if (profile._deviceWiFi != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WIFI, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WIFI, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (!firstSleepCalled) { GlobalUtils.sleep(300); firstSleepCalled = true; @@ -604,7 +614,7 @@ private static void doExecuteForRadios(Context context, Profile profile, SharedP } // connect to SSID - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_CONNECT_TO_SSID, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_CONNECT_TO_SSID, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (!profile._deviceConnectToSSID.equals(StringConstants.CONNECTTOSSID_JUSTANY)) { if (!firstSleepCalled) { GlobalUtils.sleep(300); @@ -702,7 +712,7 @@ private static void doExecuteForRadios(Context context, Profile profile, SharedP // setup bluetooth if (profile._deviceBluetooth != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_BLUETOOTH, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_BLUETOOTH, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (!firstSleepCalled) { GlobalUtils.sleep(300); firstSleepCalled = true; @@ -760,7 +770,7 @@ private static void doExecuteForRadios(Context context, Profile profile, SharedP // setup location mode if (profile._deviceLocationMode != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_LOCATION_MODE, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_LOCATION_MODE, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (!firstSleepCalled) { GlobalUtils.sleep(300); firstSleepCalled = true; @@ -820,7 +830,7 @@ private static void doExecuteForRadios(Context context, Profile profile, SharedP // setup GPS if (profile._deviceGPS != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_GPS, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_GPS, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (!firstSleepCalled) { GlobalUtils.sleep(300); firstSleepCalled = true; @@ -859,7 +869,7 @@ private static void doExecuteForRadios(Context context, Profile profile, SharedP // setup NFC if (profile._deviceNFC != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NFC, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NFC, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (!firstSleepCalled) { GlobalUtils.sleep(300); //noinspection UnusedAssignment @@ -944,7 +954,7 @@ private static void executeForRadios(Profile _profile, Context context, SharedPr boolean _setAirplaneMode = false; boolean _useAssistant = false; if (profile._deviceAirplaneMode != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { _isAirplaneMode = isAirplaneMode(appContext); switch (profile._deviceAirplaneMode) { case 1: @@ -1790,7 +1800,7 @@ private static void setVibrateWhenRinging(Context context, Profile profile, int if (lValue != -1) { Context appContext = context.getApplicationContext(); - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATE_WHEN_RINGING, null, executedProfileSharedPreferences, false, appContext).allowed + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATE_WHEN_RINGING, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (Permissions.checkVibrateWhenRinging(appContext)) { { @@ -1808,6 +1818,8 @@ private static void setVibrateWhenRinging(Context context, Profile profile, int } else if (PPApplication.deviceIsOnePlus) { + // Must be set minimal to 2, because without this, in OnePlus will not vibrates + // Exists another parameter "Vibration intesity", which sets specific intensity for OnePlus switch (lValue) { case 1: if (Settings.System.getInt(appContext.getContentResolver(), @@ -1826,26 +1838,29 @@ private static void setVibrateWhenRinging(Context context, Profile profile, int //Log.e("ActivateProfileHelper.setVibrateWhenRinging", Log.getStackTraceString(ee)); //PPApplicationStatic.recordException(ee); - if (isPPPPutSettingsInstalled(appContext) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { + int ppppsVersion = isPPPPutSettingsInstalled(appContext); + if (ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { if (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, Settings.System.VIBRATE_WHEN_RINGING, String.valueOf(lValue)); - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_VIBRATE_IN_NORMAL, String.valueOf(lValue)); - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_VIBRATE_IN_SILENT, String.valueOf(lValue)); + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, Settings.System.VIBRATE_WHEN_RINGING, String.valueOf(lValue)); + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_VIBRATE_IN_NORMAL, String.valueOf(lValue)); + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_VIBRATE_IN_SILENT, String.valueOf(lValue)); } else if (PPApplication.deviceIsOnePlus) { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, Settings.System.VIBRATE_WHEN_RINGING, String.valueOf(lValue)); + // Must be set minimal to 2, because without this, in OnePlus will not vibrates + // Exists another parameter "Vibration intesity", which sets specific intensity for OnePlus + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, Settings.System.VIBRATE_WHEN_RINGING, String.valueOf(lValue)); switch (lValue) { case 1: - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_RING_VIBRATION_INTENSITY, "2"); + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_RING_VIBRATION_INTENSITY, "2"); break; case 0: - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_RING_VIBRATION_INTENSITY, "0"); + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_RING_VIBRATION_INTENSITY, "0"); break; } } else { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, Settings.System.VIBRATE_WHEN_RINGING, String.valueOf(lValue)); + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, Settings.System.VIBRATE_WHEN_RINGING, String.valueOf(lValue)); } } - else if (ShizukuUtils.hasShizukuPermission()) { + else if (ShizukuUtils.hasShizukuPermission() && RootUtils.settingsBinaryExists(false)) { synchronized (PPApplication.rootMutex) { try { String command1; @@ -1858,6 +1873,8 @@ else if (ShizukuUtils.hasShizukuPermission()) { } else if (PPApplication.deviceIsOnePlus) { + // Must be set minimal to 2, because without this, in OnePlus will not vibrates + // Exists another parameter "Vibration intesity", which sets specific intensity for OnePlus command1 = COMMAND_SETTINGS_PUT_SYSTEM + Settings.System.VIBRATE_WHEN_RINGING + " " + lValue; command2 = ""; switch (lValue) { @@ -1898,6 +1915,8 @@ else if (ShizukuUtils.hasShizukuPermission()) { } else if (PPApplication.deviceIsOnePlus) { + // Must be set minimal to 2, because without this, in OnePlus will not vibrates + // Exists another parameter "Vibration intesity", which sets specific intensity for OnePlus command1 = COMMAND_SETTINGS_PUT_SYSTEM + Settings.System.VIBRATE_WHEN_RINGING + " " + lValue; String command2 = ""; switch (lValue) { @@ -1964,21 +1983,22 @@ private static void setVibrateNotification(Context context, Profile profile, int if (lValue != -1) { Context appContext = context.getApplicationContext(); - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATE_NOTIFICATIONS, null, executedProfileSharedPreferences, false, appContext).allowed + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATE_NOTIFICATIONS, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { - if (isPPPPutSettingsInstalled(appContext) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { + int ppppsVersion = isPPPPutSettingsInstalled(appContext); + if (ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { if (PPApplication.deviceIsPixel) { if (lValue > 0) { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_VIBRATE_ON, "1"); - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_NOTIFICATION_VIBRATION_INTENSITY, String.valueOf(lValue)); + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_VIBRATE_ON, "1"); + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_NOTIFICATION_VIBRATION_INTENSITY, String.valueOf(lValue)); } else { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_NOTIFICATION_VIBRATION_INTENSITY, String.valueOf(lValue)); + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_NOTIFICATION_VIBRATION_INTENSITY, String.valueOf(lValue)); } } else { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_NOTIFICATION_VIBRATION_INTENSITY, String.valueOf(lValue)); + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_NOTIFICATION_VIBRATION_INTENSITY, String.valueOf(lValue)); } } - else if (ShizukuUtils.hasShizukuPermission()) { + else if (ShizukuUtils.hasShizukuPermission() && RootUtils.settingsBinaryExists(false)) { synchronized (PPApplication.rootMutex) { String command1; String command2 = ""; @@ -2047,18 +2067,20 @@ private static void _setVibrationIntensity(Context context, SharedPreferences executedProfileSharedPreferences) { if (value != -1) { Context appContext = context.getApplicationContext(); - if (ProfileStatic.isProfilePreferenceAllowed(preferenceName, null, executedProfileSharedPreferences, false, appContext).allowed + if (ProfileStatic.isProfilePreferenceAllowed(preferenceName, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { { // Log.e("ActivateProfileHelper._setVibrationIntensity", "parameterName="+parameterName); // Log.e("ActivateProfileHelper._setVibrationIntensity", "value="+value); + int ppppsVersion = isPPPPutSettingsInstalled(appContext); + if ((PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) || PPApplication.deviceIsOnePlus) { - if (isPPPPutSettingsInstalled(appContext) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, parameterName, String.valueOf(value)); - else if (ShizukuUtils.hasShizukuPermission()) { + if (ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, parameterName, String.valueOf(value)); + else if (ShizukuUtils.hasShizukuPermission() && RootUtils.settingsBinaryExists(false)) { synchronized (PPApplication.rootMutex) { String command1 = COMMAND_SETTINGS_PUT_SYSTEM + parameterName + " " + value; try { @@ -2068,25 +2090,28 @@ else if (ShizukuUtils.hasShizukuPermission()) { } } } else { + if ((!ApplicationPreferences.applicationNeverAskForGrantRoot) && + (RootUtils.isRooted(/*false*/) && RootUtils.settingsBinaryExists(false))) { // PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper._setVibrationIntensity", "(1) PPApplication.rootMutex"); - synchronized (PPApplication.rootMutex) { - String command1; - Command command; - command1 = COMMAND_SETTINGS_PUT_SYSTEM + parameterName + " " + value; - command = new Command(0, /*false,*/ command1); - try { - RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command); - RootUtils.commandWait(command, RootCommandWaitCalledFromConstants.ROOT_COMMAND_WAIT_CALLED_FROM_SET_VIBRATION_INTENSITY); - } catch (Exception e) { - // com.stericson.rootshell.exceptions.RootDeniedException: Root Access Denied - //Log.e("ActivateProfileHelper._setVibrationIntensity", Log.getStackTraceString(e)); - //PPApplicationStatic.recordException(e); + synchronized (PPApplication.rootMutex) { + String command1; + Command command; + command1 = COMMAND_SETTINGS_PUT_SYSTEM + parameterName + " " + value; + command = new Command(0, /*false,*/ command1); + try { + RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command); + RootUtils.commandWait(command, RootCommandWaitCalledFromConstants.ROOT_COMMAND_WAIT_CALLED_FROM_SET_VIBRATION_INTENSITY); + } catch (Exception e) { + // com.stericson.rootshell.exceptions.RootDeniedException: Root Access Denied + //Log.e("ActivateProfileHelper._setVibrationIntensity", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } } } } } else { - if (isPPPPutSettingsInstalled(appContext) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, parameterName, String.valueOf(value)); + if (ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, parameterName, String.valueOf(value)); else if (ShizukuUtils.hasShizukuPermission() && RootUtils.settingsBinaryExists(false)) { synchronized (PPApplication.rootMutex) { String command1; @@ -2190,7 +2215,7 @@ private static void setVibrationIntensity(Context context, Profile profile, Shar _setVibrationIntensity(context, Profile.PREF_PROFILE_VIBRATION_INTENSITY_RINGING, "ring_stepless_vibration_intensity", - lValueRinging + VibrationIntensityPreference.getMinValue("RINGING"), + lValueRinging + VibrationIntensityPreference.getMinValue(VibrationIntensityPreference.RINGING_VYBRATION_INTENSITY_TYPE), executedProfileSharedPreferences ); } @@ -2199,7 +2224,7 @@ private static void setVibrationIntensity(Context context, Profile profile, Shar _setVibrationIntensity(context, Profile.PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS, "notification_stepless_vibration_intensity", - lValueNotificaitons + VibrationIntensityPreference.getMinValue("NOTIFICATIONS"), + lValueNotificaitons + VibrationIntensityPreference.getMinValue(VibrationIntensityPreference.NOTIFICATIONS_VYBRATION_INTENSITY_TYPE), executedProfileSharedPreferences ); } @@ -2208,7 +2233,7 @@ private static void setVibrationIntensity(Context context, Profile profile, Shar _setVibrationIntensity(context, Profile.PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION, "touch_stepless_vibration_intensity", - lValueTouchIntensity + VibrationIntensityPreference.getMinValue("TOUCHINTERACTION"), + lValueTouchIntensity + VibrationIntensityPreference.getMinValue(VibrationIntensityPreference.TOUCHINTERACTION_VYBRATION_INTENSITY_TYPE), executedProfileSharedPreferences ); } @@ -2223,8 +2248,11 @@ private static void setVibrationIntensity(Context context, Profile profile, Shar if (profile.getVibrationIntensityTouchInteractionChange()) lValueTouchIntensity = profile.getVibrationIntensityTouchInteractionValue(); - if ((lValueRinging > 0) || (lValueNotificaitons > 0) || (lValueTouchIntensity > 0)) - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_VIBRATE_ON, "1"); + if ((lValueRinging > 0) || (lValueNotificaitons > 0) || (lValueTouchIntensity > 0)) { + int ppppsVersion = isPPPPutSettingsInstalled(context); + if (ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_PREF_VIBRATE_ON, "1"); + } if (profile.getVibrationIntensityRingingChange()) { lValueRinging = profile.getVibrationIntensityRingingValue(); @@ -2249,7 +2277,7 @@ private static void setVibrationIntensity(Context context, Profile profile, Shar lValueTouchIntensity = profile.getVibrationIntensityTouchInteractionValue(); _setVibrationIntensity(context, Profile.PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION, - "haptic_feedback_intensity", + SETTINGS_PREF_HAPTIC_FEEDBACK_VIBRATION_INTENSITY, lValueTouchIntensity, executedProfileSharedPreferences ); @@ -2575,7 +2603,7 @@ private static boolean setTones(Context context, Profile profile, } if (profile._soundRingtoneChangeSIM1 == 1) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { boolean sim1Exists = hasSIMCardData.hasSIM1; if (sim1Exists) { @@ -2737,7 +2765,7 @@ private static boolean setTones(Context context, Profile profile, } } if (profile._soundRingtoneChangeSIM2 == 1) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { boolean sim2Exists = hasSIMCardData.hasSIM2; @@ -2890,7 +2918,9 @@ private static boolean setTones(Context context, Profile profile, } } if (profile._soundNotificationChangeSIM1 == 1) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + + int ppppsVersion = isPPPPutSettingsInstalled(appContext); boolean sim1Exists = hasSIMCardData.hasSIM1; @@ -2929,10 +2959,10 @@ private static boolean setTones(Context context, Profile profile, //Settings.System.putString(context.getContentResolver(), "notification_sound", uri.toString()); - if (isPPPPutSettingsInstalled(appContext) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM1_SAMSUNG, uri.toString()); + if (ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM1_SAMSUNG, uri.toString()); } - else if (ShizukuUtils.hasShizukuPermission()) { + else if (ShizukuUtils.hasShizukuPermission() && RootUtils.settingsBinaryExists(false)) { synchronized (PPApplication.rootMutex) { String command1 = COMMAND_SETTINGS_PUT_SYSTEM + PREF_NOTIFICATION_SIM1_SAMSUNG + " " + uri.toString(); try { @@ -2970,10 +3000,10 @@ else if (ShizukuUtils.hasShizukuPermission()) { } catch (Exception ignored) { } - if (isPPPPutSettingsInstalled(appContext) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM1_HUAWEI, uri.toString()); + if (ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM1_HUAWEI, uri.toString()); } - else if (ShizukuUtils.hasShizukuPermission()) { + else if (ShizukuUtils.hasShizukuPermission() && RootUtils.settingsBinaryExists(false)) { synchronized (PPApplication.rootMutex) { String command1 = COMMAND_SETTINGS_PUT_SYSTEM + PREF_NOTIFICATION_SIM1_HUAWEI + " " + uri.toString(); try { @@ -3051,10 +3081,10 @@ else if (ShizukuUtils.hasShizukuPermission()) { //Settings.System.putString(context.getContentResolver(), "notification_sound", null); - if (isPPPPutSettingsInstalled(appContext) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM1_SAMSUNG, ""); + if (ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM1_SAMSUNG, ""); } - else if (ShizukuUtils.hasShizukuPermission()) { + else if (ShizukuUtils.hasShizukuPermission() && RootUtils.settingsBinaryExists(false)) { synchronized (PPApplication.rootMutex) { String command1 = COMMAND_SETTINGS_PUT_SYSTEM + PREF_NOTIFICATION_SIM1_SAMSUNG + " \"\""; try { @@ -3090,10 +3120,10 @@ else if (ShizukuUtils.hasShizukuPermission()) { // notifikacie ine ako sms - zvlastna katergoria v Huawei //Settings.System.putString(context.getContentResolver(), "notification_sound", null); - if (isPPPPutSettingsInstalled(appContext) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM1_HUAWEI, ""); + if (ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM1_HUAWEI, ""); } - else if (ShizukuUtils.hasShizukuPermission()) { + else if (ShizukuUtils.hasShizukuPermission() && RootUtils.settingsBinaryExists(false)) { synchronized (PPApplication.rootMutex) { String command1 = COMMAND_SETTINGS_PUT_SYSTEM + PREF_NOTIFICATION_SIM1_HUAWEI + " \"\""; try { @@ -3146,7 +3176,9 @@ else if (ShizukuUtils.hasShizukuPermission()) { } if (profile._soundNotificationChangeSIM2 == 1) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification SIM2"); - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + + int ppppsVersion = isPPPPutSettingsInstalled(appContext); boolean sim2Exists = hasSIMCardData.hasSIM2; //Log.e("ActivateProfileHelper.setTones", "sim2Exists="+sim2Exists); @@ -3186,10 +3218,10 @@ else if (ShizukuUtils.hasShizukuPermission()) { //Settings.System.putString(context.getContentResolver(), "notification_sound_2", uri.toString()); - if (isPPPPutSettingsInstalled(appContext) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM2_SAMSUNG, uri.toString()); + if (ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM2_SAMSUNG, uri.toString()); } - else if (ShizukuUtils.hasShizukuPermission()) { + else if (ShizukuUtils.hasShizukuPermission() && RootUtils.settingsBinaryExists(false)) { synchronized (PPApplication.rootMutex) { String command1 = COMMAND_SETTINGS_PUT_SYSTEM + PREF_NOTIFICATION_SIM2_SAMSUNG + " " + uri.toString(); try { @@ -3304,10 +3336,10 @@ else if (ShizukuUtils.hasShizukuPermission()) { //Settings.System.putString(context.getContentResolver(), "notification_sound_2", null); - if (isPPPPutSettingsInstalled(appContext) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM2_SAMSUNG, ""); + if (ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM2_SAMSUNG, ""); } - else if (ShizukuUtils.hasShizukuPermission()) { + else if (ShizukuUtils.hasShizukuPermission() && RootUtils.settingsBinaryExists(false)) { synchronized (PPApplication.rootMutex) { String command1 = COMMAND_SETTINGS_PUT_SYSTEM+PREF_NOTIFICATION_SIM2_SAMSUNG + " \"\""; try { @@ -3393,7 +3425,9 @@ else if (ShizukuUtils.hasShizukuPermission()) { } if (profile._soundSameRingtoneForBothSIMCards != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + + int ppppsVersion = isPPPPutSettingsInstalled(appContext); boolean sim1Exists = hasSIMCardData.hasSIM1; boolean sim2Exists = hasSIMCardData.hasSIM2; @@ -3407,13 +3441,13 @@ else if (ShizukuUtils.hasShizukuPermission()) { if (profile._soundSameRingtoneForBothSIMCards == 2) value = "0"; - if (isPPPPutSettingsInstalled(appContext) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { + if (ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { if (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_RINGTONE_FOLLOW_SIM1_XIAOMI, value); + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_RINGTONE_FOLLOW_SIM1_XIAOMI, value); else if (PPApplication.deviceIsOnePlus) - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_RINGTONE_FOLLOW_SIM1_ONEPLUS, value); + putSettingsParameter(context, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_RINGTONE_FOLLOW_SIM1_ONEPLUS, value); } - else if (ShizukuUtils.hasShizukuPermission()) { + else if (ShizukuUtils.hasShizukuPermission() && RootUtils.settingsBinaryExists(false)) { synchronized (PPApplication.rootMutex) { String command1 = null; if (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) @@ -3523,6 +3557,9 @@ static Uri getUriOfSavedTone(Context context, String savedTone, int toneType) { } static void executeForVolumes(Profile _profile, final int linkUnlinkVolumes, final boolean forProfileActivation, Context context, SharedPreferences _executedProfileSharedPreferences) { +// PPApplicationStatic.recordException(new Exception("test")); + + final Context appContext = context.getApplicationContext(); final WeakReference profileWeakRef = new WeakReference<>(_profile); final WeakReference sharedPreferencesWeakRef = new WeakReference<>(_executedProfileSharedPreferences); @@ -3651,12 +3688,13 @@ private static void setNotificationLed(Context context, final int value, SharedP wakeLock.acquire(10 * 60 * 1000); } - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_NOTIFICATION_LED, null, executedProfileSharedPreferences, false, appContext).allowed + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_NOTIFICATION_LED, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { final String NOTIFICATION_LIGHT_PULSE = "notification_light_pulse"; - if (isPPPPutSettingsInstalled(appContext) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) - putSettingsParameter(appContext, PPPPS_SETTINGS_TYPE_SYSTEM, NOTIFICATION_LIGHT_PULSE, String.valueOf(value)); - else if (ShizukuUtils.hasShizukuPermission()) { + int ppppsVersion = isPPPPutSettingsInstalled(appContext); + if (ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) + putSettingsParameter(appContext, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, NOTIFICATION_LIGHT_PULSE, String.valueOf(value)); + else if (ShizukuUtils.hasShizukuPermission() && RootUtils.settingsBinaryExists(false)) { synchronized (PPApplication.rootMutex) { String command1 = COMMAND_SETTINGS_PUT_SYSTEM + NOTIFICATION_LIGHT_PULSE + " " + value; try { @@ -3723,7 +3761,7 @@ private static void setHeadsUpNotifications(Context context, final int value, Sh wakeLock.acquire(10 * 60 * 1000); } - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_HEADS_UP_NOTIFICATIONS, null, executedProfileSharedPreferences, false, appContext).allowed + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_HEADS_UP_NOTIFICATIONS, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { boolean G1OK = false; if (Permissions.hasPermission(appContext, Manifest.permission.WRITE_SECURE_SETTINGS)) { @@ -3794,7 +3832,7 @@ private static void setAlwaysOnDisplay(Context context, final int value, SharedP wakeLock.acquire(10 * 60 * 1000); } - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_ALWAYS_ON_DISPLAY, null, executedProfileSharedPreferences, false, appContext).allowed + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_ALWAYS_ON_DISPLAY, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { boolean G1OK = false; //if (PPApplication.deviceIsOnePlus) { @@ -3860,12 +3898,102 @@ private static void setAlwaysOnDisplay(Context context, final int value, SharedP PPApplication.profileActiationExecutorPool.submit(runnable); } - private static void setScreenOnPermanent(Profile profile, Context context) { - if (Permissions.checkProfileScreenOnPermanent(context, profile, null)) { - if (profile._screenOnPermanent == 1) - createKeepScreenOnView(context); - else if (profile._screenOnPermanent == 2) - removeKeepScreenOnView(context); + private static void setScreenOn(final Context context) { + PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE); + PowerManager.WakeLock wakeLock = null; + try { + if (powerManager != null) { + //noinspection deprecation + wakeLock = powerManager.newWakeLock(PowerManager.FULL_WAKE_LOCK | + PowerManager.ACQUIRE_CAUSES_WAKEUP | + PowerManager.ON_AFTER_RELEASE, + WakelockTags.WAKELOCK_TAG_ActivateProfileHelper_screenOn); + + wakeLock.acquire(1000); + + GlobalUtils.sleep(500); + + //release will release the lock from CPU, in case of that, + // screen will go back to sleep mode in defined time bt device settings + wakeLock.release(); + } + + } catch (Exception e) { +// PPApplicationStatic.logE("[IN_EXECUTOR] PPApplication.startHandlerThread", Log.getStackTraceString(e)); + PPApplicationStatic.recordException(e); + } finally { + if ((wakeLock != null) && wakeLock.isHeld()) { + try { + wakeLock.release(); + } catch (Exception ignored) { + } + } + } + } + + private static void setScreenOff(Profile _profile, final Context context) { + final Context appContext = context.getApplicationContext(); + final WeakReference profileWeakRef = new WeakReference<>(_profile); + //final WeakReference sharedPreferencesWeakRef = new WeakReference<>(_executedProfileSharedPreferences); + Runnable runnable = () -> { +// PPApplicationStatic.logE("[IN_EXECUTOR] PPApplication.startHandlerThreadProfileActivation", "START run - from=ActivateProfileHelper.setScreenOff"); + + if (PPApplication.blockProfileEventActions) + // not lock device after boot + return; + + //Context appContext= appContextWeakRef.get(); + Profile profile = profileWeakRef.get(); + //SharedPreferences executedProfileSharedPreferences = executedProfileSharedPreferencesWeakRef.get(); + + if (/*(appContext != null) &&*/ (profile != null) /*&& (executedProfileSharedPreferences != null)*/) { + + PowerManager powerManager = (PowerManager) appContext.getSystemService(Context.POWER_SERVICE); + PowerManager.WakeLock wakeLock = null; + try { + if (powerManager != null) { + wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WakelockTags.WAKELOCK_TAG_ActivateProfileHelper_screenOff); + wakeLock.acquire(10 * 60 * 1000); + } + + if (PhoneProfilesService.getInstance() != null) { + if (Permissions.checkScreenOnOff(appContext) && (!PPApplication.lockDeviceActivityDisplayed)) { + try { + Intent intent = new Intent(appContext, LockDeviceActivity.class); + intent.putExtra(LockDeviceActivity.EXTRA_ONLY_SCREEN_OFF, true); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); + intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); + appContext.startActivity(intent); + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } + } + } + } catch (Exception e) { +// PPApplicationStatic.logE("[IN_EXECUTOR] PPApplication.startHandlerThread", Log.getStackTraceString(e)); + PPApplicationStatic.recordException(e); + } finally { + if ((wakeLock != null) && wakeLock.isHeld()) { + try { + wakeLock.release(); + } catch (Exception ignored) { + } + } + } + } + }; + PPApplicationStatic.createProfileActiationExecutorPool(); + PPApplication.profileActiationExecutorPool.submit(runnable); + } + + private static void setScreenOnOff(Profile profile, Context context) { + if (Permissions.checkProfileScreenOnOff(context, profile, null)) { + if (profile._screenOnOff == 1) + setScreenOn(context); + else if ((profile._screenOnOff == 2) && + (profile._lockDevice != 1)) // only when is not configured "Quick screen" version of "Lock device" + setScreenOff(profile, context); } } @@ -4037,6 +4165,51 @@ static void requestInterruptionFilter(Context context, final int zenMode) { PPApplication.soundModeExecutorPool.submit(runnable); } + private static Bitmap _changeWallpaperGetBitmapFromUri(String wallpaperUri, Context appContext) { + Bitmap bitmap = null; + Uri uri = Uri.parse(wallpaperUri); + if (uri != null) { + try { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { + ImageDecoder.Source source = ImageDecoder.createSource(appContext.getContentResolver(), uri); + bitmap = ImageDecoder.decodeBitmap(source, (decoder, info, src) -> { + //decoder.setTargetSampleSize(1); + //decoder.setMutableRequired(true); + //decoder.setAllocator(ImageDecoder.ALLOCATOR_SOFTWARE); + }); + } + else + bitmap = MediaStore.Images.Media.getBitmap(appContext.getContentResolver(), uri); + } catch (Exception ignored) {} + } + return bitmap; + } + + private static Exception _changeWallpaperForLockscreen(WallpaperManager wallpaperManager, Bitmap bitmap, int height, int width) { + // calculates sizes to maintain aspect ratio + int scaleToUse = 100; // this will be our percentage + int sizeY = height * scaleToUse / 100; + int sizeX = bitmap.getWidth() * sizeY / bitmap.getHeight(); + // resize bitmap for lockscreen + Bitmap resizedBitmap = Bitmap.createScaledBitmap(bitmap, sizeX, sizeY, true); + + int flags = WallpaperManager.FLAG_LOCK; + int left = 0; + int right = resizedBitmap.getWidth(); + if (resizedBitmap.getWidth() > width) { + left = (resizedBitmap.getWidth() / 2) - (width / 2); + right = (resizedBitmap.getWidth() / 2) + (width / 2); + } + Rect visibleCropHint = new Rect(left, 0, right, resizedBitmap.getHeight()); + + try { + wallpaperManager.setBitmap(resizedBitmap, visibleCropHint, true, flags); + return null; + } catch (Exception e) { + return e; + } + } + private static void _changeImageWallpapers(Profile profile, String wallpaperUri, String lockScreenWallpaperUri, boolean fromFolder, Context appContext) { DisplayMetrics displayMetrics = new DisplayMetrics(); WindowManager wm = (WindowManager) appContext.getSystemService(Context.WINDOW_SERVICE); @@ -4053,31 +4226,36 @@ private static void _changeImageWallpapers(Profile profile, String wallpaperUri, } // for lock screen no double width - if (profile._deviceWallpaperFor != 2) - width = width << 1; // best wallpaper width is twice screen width + //if (profile._deviceWallpaperFor != 2) + // width = width << 1; // best wallpaper width is twice screen width if (fromFolder) { - Bitmap decodedSampleBitmap = BitmapManipulator.resampleBitmapUri(wallpaperUri, width, height, false, true, appContext); + Bitmap decodedSampleBitmap = _changeWallpaperGetBitmapFromUri(wallpaperUri, appContext); if (decodedSampleBitmap != null) { // set wallpaper WallpaperManager wallpaperManager = WallpaperManager.getInstance(appContext); try { - int flags = WallpaperManager.FLAG_SYSTEM | WallpaperManager.FLAG_LOCK; - Rect visibleCropHint = null; - if (profile._deviceWallpaperFor == 1) - flags = WallpaperManager.FLAG_SYSTEM; + if (profile._deviceWallpaperFor == 0) { + // home+lock + int flags = WallpaperManager.FLAG_SYSTEM; + wallpaperManager.setBitmap(decodedSampleBitmap, null, true, flags); + Exception ee = _changeWallpaperForLockscreen(wallpaperManager, decodedSampleBitmap, height, width); + if (ee != null) + throw(ee); + } + else + if (profile._deviceWallpaperFor == 1) { + // home only + int flags = WallpaperManager.FLAG_SYSTEM; + wallpaperManager.setBitmap(decodedSampleBitmap, null, true, flags); + } + else if (profile._deviceWallpaperFor == 2) { - flags = WallpaperManager.FLAG_LOCK; - int left = 0; - int right = decodedSampleBitmap.getWidth(); - if (decodedSampleBitmap.getWidth() > width) { - left = (decodedSampleBitmap.getWidth() / 2) - (width / 2); - right = (decodedSampleBitmap.getWidth() / 2) + (width / 2); - } - visibleCropHint = new Rect(left, 0, right, decodedSampleBitmap.getHeight()); + // lock only + Exception ee = _changeWallpaperForLockscreen(wallpaperManager, decodedSampleBitmap, height, width); + if (ee != null) + throw(ee); } - wallpaperManager.setBitmap(decodedSampleBitmap, visibleCropHint, true, flags); - decodedSampleBitmap.recycle(); // this is required for "change random image from folder" PPApplicationStatic.setWallpaperChangeTime(appContext); @@ -4100,48 +4278,38 @@ private static void _changeImageWallpapers(Profile profile, String wallpaperUri, } else { Bitmap decodedSampleBitmapHome = null; Bitmap decodedSampleBitmapLock = null; - if ((profile._deviceWallpaperFor == 0) || (profile._deviceWallpaperFor == 1)) - decodedSampleBitmapHome = BitmapManipulator.resampleBitmapUri(wallpaperUri, width, height, false, true, appContext); + if ((profile._deviceWallpaperFor == 0) || (profile._deviceWallpaperFor == 1)) { + decodedSampleBitmapHome = _changeWallpaperGetBitmapFromUri(wallpaperUri, appContext); + } if ((lockScreenWallpaperUri != null) && (!lockScreenWallpaperUri.isEmpty()) && (!lockScreenWallpaperUri.equals("-")) && - (profile._deviceWallpaperFor == 0) || (profile._deviceWallpaperFor == 2)) - decodedSampleBitmapLock = BitmapManipulator.resampleBitmapUri(lockScreenWallpaperUri, width, height, false, true, appContext); + (profile._deviceWallpaperFor == 0) || (profile._deviceWallpaperFor == 2)) { + decodedSampleBitmapLock = _changeWallpaperGetBitmapFromUri(lockScreenWallpaperUri, appContext); + } WallpaperManager wallpaperManager = WallpaperManager.getInstance(appContext); try { if (profile._deviceWallpaperFor == 0) { // home+lock if ((decodedSampleBitmapHome != null)) { - int flags; - if (decodedSampleBitmapLock == null) - flags = WallpaperManager.FLAG_SYSTEM | WallpaperManager.FLAG_LOCK; - else - flags = WallpaperManager.FLAG_SYSTEM; - + int flags = WallpaperManager.FLAG_SYSTEM; wallpaperManager.setBitmap(decodedSampleBitmapHome, null, true, flags); } if (decodedSampleBitmapLock != null) { - int flags = WallpaperManager.FLAG_LOCK; - int left = 0; - int right = decodedSampleBitmapLock.getWidth(); - if (decodedSampleBitmapLock.getWidth() > width) { - left = (decodedSampleBitmapLock.getWidth() / 2) - (width / 2); - right = (decodedSampleBitmapLock.getWidth() / 2) + (width / 2); - } - Rect visibleCropHint = new Rect(left, 0, right, decodedSampleBitmapLock.getHeight()); - - wallpaperManager.setBitmap(decodedSampleBitmapLock, visibleCropHint, true, flags); + Exception ee = _changeWallpaperForLockscreen(wallpaperManager, decodedSampleBitmapLock, height, width); + if (ee != null) + throw(ee); } } + else if (profile._deviceWallpaperFor == 1) { // home only if ((decodedSampleBitmapHome != null)) { - int flags; - flags = WallpaperManager.FLAG_SYSTEM; - + int flags = WallpaperManager.FLAG_SYSTEM; wallpaperManager.setBitmap(decodedSampleBitmapHome, null, true, flags); } } + else if (profile._deviceWallpaperFor == 2) { // lock only Bitmap decodedSampleBitmap = decodedSampleBitmapHome; @@ -4149,16 +4317,9 @@ private static void _changeImageWallpapers(Profile profile, String wallpaperUri, decodedSampleBitmap = decodedSampleBitmapLock; if (decodedSampleBitmap != null) { - int flags = WallpaperManager.FLAG_LOCK; - int left = 0; - int right = decodedSampleBitmap.getWidth(); - if (decodedSampleBitmap.getWidth() > width) { - left = (decodedSampleBitmap.getWidth() / 2) - (width / 2); - right = (decodedSampleBitmap.getWidth() / 2) + (width / 2); - } - Rect visibleCropHint = new Rect(left, 0, right, decodedSampleBitmap.getHeight()); - - wallpaperManager.setBitmap(decodedSampleBitmap, visibleCropHint, true, flags); + Exception ee = _changeWallpaperForLockscreen(wallpaperManager, decodedSampleBitmap, height, width); + if (ee != null) + throw(ee); } } @@ -4441,10 +4602,18 @@ private static void changeImageWallpaper(Profile _profile, Context context) { final WeakReference profileWeakRef = new WeakReference<>(_profile); //final WeakReference sharedPreferencesWeakRef = new WeakReference<>(_executedProfileSharedPreferences); + boolean canChangeWallpaper = true; // startActivity from background: Android 10 (API level 29) // Exception: // - The app is granted the SYSTEM_ALERT_WINDOW permission by the user. - if ((Build.VERSION.SDK_INT < 29) || (Settings.canDrawOverlays(context))) { + if (Build.VERSION.SDK_INT >= 29) { + if ((_profile._deviceWallpaperChange == Profile.CHANGE_WALLPAPER_IMAGE_WITH) || + (_profile._deviceWallpaperChange == Profile.CHANGE_WALLPAPER_LIVE)) { + canChangeWallpaper = Settings.canDrawOverlays(context); + } + } + + if (canChangeWallpaper) { Runnable runnable = () -> { // PPApplicationStatic.logE("[IN_EXECUTOR] PPApplication.startHandlerThreadWallpaper", "START run - from=ActivateProfileHelper.executeForWallpaper"); @@ -4460,7 +4629,6 @@ private static void changeImageWallpaper(Profile _profile, Context context) { wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, WakelockTags.WAKELOCK_TAG_ActivateProfileHelper_executeForWallpaper); wakeLock.acquire(10 * 60 * 1000); } - _changeImageWallpapers(profile, profile._deviceWallpaper, profile._deviceWallpaperLockScreen, false, appContext); } catch (Exception e) { // PPApplicationStatic.logE("[IN_EXECUTOR] PPApplication.startHandlerThread", Log.getStackTraceString(e)); @@ -4933,7 +5101,7 @@ static void executeForInteractivePreferences(final Profile profile, final Contex //PowerManager pm = (PowerManager) context.getSystemService(POWER_SERVICE); KeyguardManager myKM = (KeyguardManager) appContext.getSystemService(Context.KEYGUARD_SERVICE); - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_PREFS, null, executedProfileSharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_PREFS, null, executedProfileSharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (profile._deviceMobileDataPrefs == 1) { final String SETTINGS_DATA_USAGE_CLASS_NAME = "com.android.settings.Settings$DataUsageSummaryActivity"; final String SETTINGS_PHONE_CLASS_NAME = "com.android.phone.Settings"; @@ -5023,7 +5191,7 @@ static void executeForInteractivePreferences(final Profile profile, final Contex } } - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_PREFS, null, executedProfileSharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_PREFS, null, executedProfileSharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (profile._deviceNetworkTypePrefs == 1) { if (PPApplication.isScreenOn && (myKM != null) && !myKM.isKeyguardLocked()) { try { @@ -5172,10 +5340,10 @@ static void executeForInteractivePreferences(final Profile profile, final Contex PPApplicationStatic.recordException(e); } } else { - /*String PACKAGE_PREFIX = - VpnManager.class.getPackage().getName() + "."; - String ACTION_VPN_SETTINGS = - PACKAGE_PREFIX + "SETTINGS";*/ + /*String PACKAGE_PREFIX = + VpnManager.class.getPackage().getName() + "."; + String ACTION_VPN_SETTINGS = + PACKAGE_PREFIX + "SETTINGS";*/ String ACTION_VPN_SETTINGS = "android.net.vpn.SETTINGS"; Intent intent = new Intent(ACTION_VPN_SETTINGS); if (GlobalGUIRoutines.activityIntentExists(intent, appContext)) { @@ -5190,6 +5358,32 @@ static void executeForInteractivePreferences(final Profile profile, final Contex } } + if (profile._screenNightLightPrefs == 1) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed + == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (PPApplication.isScreenOn && (myKM != null) && !myKM.isKeyguardLocked()) { + try { + Intent intent = new Intent(Settings.ACTION_NIGHT_DISPLAY_SETTINGS); + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(intent); + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } + } else { + Intent intent = new Intent(Settings.ACTION_NIGHT_DISPLAY_SETTINGS); + if (GlobalGUIRoutines.activityIntentExists(intent, appContext)) { + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + String title = appContext.getString(R.string.profile_activation_interactive_preference_notification_title) + " " + profile._name; + String text = appContext.getString(R.string.profile_activation_interactive_preference_notification_text) + " " + + ProfileStatic.getNightLightPrefsStringString(appContext); + showNotificationForInteractiveParameters(appContext, title, text, intent, + PPApplication.PROFILE_ACTIVATION_SCREEN_NIGHT_LIGHT_PREFS_NOTIFICATION_ID, + PPApplication.PROFILE_ACTIVATION_SCREEN_NIGHT_LIGHT_PREFS_NOTIFICATION_TAG); + } + } + } + } + } } @@ -5225,7 +5419,7 @@ private static void showNotificationForInteractiveParameters(Context context, St PPApplicationStatic.createInformationNotificationChannel(appContext, false); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(appContext, PPApplication.EXCLAMATION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(appContext, R.color.information_color)) + .setColor(ContextCompat.getColor(appContext, R.color.informationColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_exclamation_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(appContext.getResources(), R.drawable.ic_information_notification)) .setContentTitle(title) // title for notification @@ -5255,7 +5449,7 @@ private static void showNotificationForInteractiveParameters(Context context, St } } - static void execute(final Context context, final Profile profile) + static void execute(final Context context, final Profile profile, final boolean forRestartEvents) { final Context appContext = context.getApplicationContext(); @@ -5368,6 +5562,11 @@ static void execute(final Context context, final Profile profile) setScreenOnPermanent(profile, appContext); //} + // screen on/off + if (profile._deviceKeyguard == 0) + // only when deviceKeyguard is not configured do screen on/off + setScreenOnOff(profile, appContext); + // screen timeout if (Permissions.checkProfileScreenTimeout(appContext, profile, null)) { //PowerManager pm = (PowerManager) context.getSystemService(POWER_SERVICE); @@ -5391,23 +5590,26 @@ static void execute(final Context context, final Profile profile) // PPApplication.setActivatedProfileScreenTimeout(context, 0); // on/off lock screen - boolean setLockScreen = false; - switch (profile._deviceKeyguard) { - case 1: - // enable lock screen - setLockScreenDisabled(appContext, false); - setLockScreen = true; - break; - case 2: - // disable lock screen - setLockScreenDisabled(appContext, true); - setLockScreen = true; - break; - } - if (setLockScreen) { - //boolean isScreenOn; - //PowerManager pm = (PowerManager) context.getSystemService(POWER_SERVICE); - //if (pm != null) { + if (profile._screenOnOff == 0) { + // only when screen on/off is not configured do device keyguard + + boolean setLockScreen = false; + switch (profile._deviceKeyguard) { + case 1: + // enable lock screen + setLockScreenDisabled(appContext, false); + setLockScreen = true; + break; + case 2: + // disable lock screen + setLockScreenDisabled(appContext, true); + setLockScreen = true; + break; + } + if (setLockScreen) { + //boolean isScreenOn; + //PowerManager pm = (PowerManager) context.getSystemService(POWER_SERVICE); + //if (pm != null) { boolean keyguardShowing; KeyguardManager kgMgr = (KeyguardManager) appContext.getSystemService(Context.KEYGUARD_SERVICE); if (kgMgr != null) { @@ -5417,14 +5619,15 @@ static void execute(final Context context, final Profile profile) try { //PhoneProfilesService ppService = PhoneProfilesService.getInstance(); //if (ppService != null) { - GlobalUtils.switchKeyguard(context); + GlobalUtils.switchKeyguard(context); //} } catch (Exception e) { PPApplicationStatic.recordException(e); } } } - //} + //} + } } // setup display brightness @@ -5731,17 +5934,17 @@ static void execute(final Context context, final Profile profile) setScreenDarkMode(context, profile._screenDarkMode, executedProfileSharedPreferences); } - // set always on display - if (profile._alwaysOnDisplay != 0) { - switch (profile._alwaysOnDisplay) { - case 1: - setAlwaysOnDisplay(appContext, 1, executedProfileSharedPreferences); - break; - case 2: - setAlwaysOnDisplay(appContext, 0, executedProfileSharedPreferences); - break; - } + // set always on display + if (profile._alwaysOnDisplay != 0) { + switch (profile._alwaysOnDisplay) { + case 1: + setAlwaysOnDisplay(appContext, 1, executedProfileSharedPreferences); + break; + case 2: + setAlwaysOnDisplay(appContext, 0, executedProfileSharedPreferences); + break; } + } // close all applications @@ -5851,6 +6054,15 @@ static void execute(final Context context, final Profile profile) setVibrationIntensity(appContext, profile, executedProfileSharedPreferences); + sendSMS(appContext, profile, executedProfileSharedPreferences, forRestartEvents); + + clearNotificaitons(appContext, profile, executedProfileSharedPreferences, forRestartEvents); + + // set screen dark mode + if (profile._screenNightLight != 0) { + setScreenNightLight(context, profile, executedProfileSharedPreferences); + } + if (profile._applicationDisableGloabalEventsRun != 0) { DataWrapper dataWrapper = new DataWrapper(appContext, false, 0, false, 0, 0, 0); dataWrapper.globalRunStopEvents(profile._applicationDisableGloabalEventsRun == 1, @@ -5892,9 +6104,13 @@ static void setScreenTimeout(int screenTimeout, boolean forceSet, Context contex case 1: // 15 seconds //removeScreenTimeoutAlwaysOnView(context); //if ((PPApplication.lockDeviceActivity != null) && (!forceSet)) - if (PPApplication.lockDeviceActivityDisplayed && (!forceSet)) + if (PPApplication.lockDeviceActivityDisplayed && (!forceSet)) { // in LockDeviceActivity.onDestroy() will be used this value to revert back system screen timeout - PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayed = 15000; + if (PPApplication.lockDeviceActivityOnlyScreenOff) + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForScreenOff = 15000; + else + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForDeviceLock = 15000; + } else { if (PPApplication.deviceIsOppo || PPApplication.deviceIsRealme || PPApplication.deviceIsOnePlus) { if (ShizukuUtils.hasShizukuPermission()) { @@ -5934,9 +6150,13 @@ static void setScreenTimeout(int screenTimeout, boolean forceSet, Context contex case 2: // 30 seconds //removeScreenTimeoutAlwaysOnView(context); //if ((PPApplication.lockDeviceActivity != null) && (!forceSet)) - if (PPApplication.lockDeviceActivityDisplayed && (!forceSet)) + if (PPApplication.lockDeviceActivityDisplayed && (!forceSet)) { // in LockDeviceActivity.onDestroy() will be used this value to revert back system screen timeout - PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayed = 30000; + if (PPApplication.lockDeviceActivityOnlyScreenOff) + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForScreenOff = 30000; + else + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForDeviceLock = 30000; + } else { if (PPApplication.deviceIsOppo || PPApplication.deviceIsRealme || PPApplication.deviceIsOnePlus) { if (ShizukuUtils.hasShizukuPermission()) { @@ -5977,9 +6197,13 @@ static void setScreenTimeout(int screenTimeout, boolean forceSet, Context contex case 3: // 1 minute //removeScreenTimeoutAlwaysOnView(context); //if ((PPApplication.lockDeviceActivity != null) && (!forceSet)) - if (PPApplication.lockDeviceActivityDisplayed && (!forceSet)) + if (PPApplication.lockDeviceActivityDisplayed && (!forceSet)) { // in LockDeviceActivity.onDestroy() will be used this value to revert back system screen timeout - PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayed = 60000; + if (PPApplication.lockDeviceActivityOnlyScreenOff) + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForScreenOff = 60000; + else + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForDeviceLock = 60000; + } else { if (PPApplication.deviceIsOppo || PPApplication.deviceIsRealme || PPApplication.deviceIsOnePlus) { if (ShizukuUtils.hasShizukuPermission()) { @@ -6020,9 +6244,13 @@ static void setScreenTimeout(int screenTimeout, boolean forceSet, Context contex case 4: // 2 minutes //removeScreenTimeoutAlwaysOnView(context); //if ((PPApplication.lockDeviceActivity != null) && (!forceSet)) - if (PPApplication.lockDeviceActivityDisplayed && (!forceSet)) + if (PPApplication.lockDeviceActivityDisplayed && (!forceSet)) { // in LockDeviceActivity.onDestroy() will be used this value to revert back system screen timeout - PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayed = 120000; + if (PPApplication.lockDeviceActivityOnlyScreenOff) + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForScreenOff = 120000; + else + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForDeviceLock = 120000; + } else { if (PPApplication.deviceIsOppo || PPApplication.deviceIsRealme || PPApplication.deviceIsOnePlus) { if (ShizukuUtils.hasShizukuPermission()) { @@ -6063,9 +6291,13 @@ static void setScreenTimeout(int screenTimeout, boolean forceSet, Context contex case 5: // 10 minutes //removeScreenTimeoutAlwaysOnView(context); //if ((PPApplication.lockDeviceActivity != null) && (!forceSet)) - if (PPApplication.lockDeviceActivityDisplayed && (!forceSet)) + if (PPApplication.lockDeviceActivityDisplayed && (!forceSet)) { // in LockDeviceActivity.onDestroy() will be used this value to revert back system screen timeout - PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayed = 600000; + if (PPApplication.lockDeviceActivityOnlyScreenOff) + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForScreenOff = 600000; + else + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForDeviceLock = 600000; + } else { if (PPApplication.deviceIsOppo || PPApplication.deviceIsRealme || PPApplication.deviceIsOnePlus) { if (ShizukuUtils.hasShizukuPermission()) { @@ -6118,9 +6350,13 @@ static void setScreenTimeout(int screenTimeout, boolean forceSet, Context contex case 7: // 5 minutes //removeScreenTimeoutAlwaysOnView(context); //if ((PPApplication.lockDeviceActivity != null) && (!forceSet)) - if (PPApplication.lockDeviceActivityDisplayed && (!forceSet)) + if (PPApplication.lockDeviceActivityDisplayed && (!forceSet)) { // in LockDeviceActivity.onDestroy() will be used this value to revert back system screen timeout - PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayed = 300000; + if (PPApplication.lockDeviceActivityOnlyScreenOff) + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForScreenOff = 300000; + else + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForDeviceLock = 300000; + } else { if (PPApplication.deviceIsOppo || PPApplication.deviceIsRealme || PPApplication.deviceIsOnePlus) { if (ShizukuUtils.hasShizukuPermission()) { @@ -6169,9 +6405,13 @@ static void setScreenTimeout(int screenTimeout, boolean forceSet, Context contex case 9: // 30 minutes //removeScreenTimeoutAlwaysOnView(context); //if ((PPApplication.lockDeviceActivity != null) && (!forceSet)) - if (PPApplication.lockDeviceActivityDisplayed && (!forceSet)) + if (PPApplication.lockDeviceActivityDisplayed && (!forceSet)) { // in LockDeviceActivity.onDestroy() will be used this value to revert back system screen timeout - PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayed = 1800000; + if (PPApplication.lockDeviceActivityOnlyScreenOff) + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForScreenOff = 1800000; + else + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForDeviceLock = 1800000; + } else { if (PPApplication.deviceIsOppo || PPApplication.deviceIsRealme || PPApplication.deviceIsOnePlus) { if (ShizukuUtils.hasShizukuPermission()) { @@ -6229,18 +6469,11 @@ public void run() { static void showKeepScreenOnNotificaiton(Context context) { String nTitle = "\"" + context.getString(R.string.profile_preferences_deviceScreenOnPermanent) + "\"=" + "\"" +context.getString(R.string.profile_preferences_deviceScreenTimeoutAndKeepScreenOnInfo_summary_0_On) + "\""; - String nText = "\"" + context.getString(R.string.profile_preferences_deviceScreenOnPermanent) + "\"" + - " " + context.getString(R.string.keep_screen_on_active_notification_title_1) + " " + - "\"" +context.getString(R.string.profile_preferences_deviceScreenTimeoutAndKeepScreenOnInfo_summary_0_On) + "\". " + - context.getString(R.string.keep_screen_on_active_notification_decription_1) + - " \"" +context.getString(R.string.profile_preferences_deviceScreenTimeoutAndKeepScreenOnInfo_summary_0_Off) + "\", " + - context.getString(R.string.keep_screen_on_active_notification_decription_2) + - " \"" + context.getString(R.string.profile_preferences_deviceScreenOnPermanent) + "\"=" + - "\"" + context.getString(R.string.array_pref_hardwareModeArray_off) + "\"."; + String nText = context.getString(R.string.keep_screen_on_active_notification_description); PPApplicationStatic.createKeepScreenOnNotificationChannel(context.getApplicationContext(), false); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context.getApplicationContext(), PPApplication.KEEP_SCREEN_ON_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.information_color)) + .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.informationColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_information_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(context.getApplicationContext().getResources(), R.drawable.ic_information_notification)) .setContentTitle(nTitle) // title for notification @@ -6390,6 +6623,15 @@ static void removeKeepScreenOnView(Context context) //} } + private static void setScreenOnPermanent(Profile profile, Context context) { + if (Permissions.checkProfileScreenOnPermanent(context, profile, null)) { + if (profile._screenOnPermanent == 1) + createKeepScreenOnView(context); + else if (profile._screenOnPermanent == 2) + removeKeepScreenOnView(context); + } + } + static boolean isAirplaneMode(Context context) { return Settings.Global.getInt(context.getApplicationContext().getContentResolver(), Settings.Global.AIRPLANE_MODE_ON, 0) != 0; @@ -6769,7 +7011,8 @@ static void setWifi(Context appContext, boolean enable) { //else WifiManager wifiManager = (WifiManager) appContext.getSystemService(Context.WIFI_SERVICE); - wifiManager.setWifiEnabled(enable); + if (wifiManager != null) + wifiManager.setWifiEnabled(enable); //if (isPPPPutSettingsInstalled(appContext) > 0) { @@ -7383,7 +7626,7 @@ private static void setPowerSaveMode(Profile _profile, final Context context, Sh if (/*(appContext != null) &&*/ (profile != null) && (executedProfileSharedPreferences != null)) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_POWER_SAVE_MODE, null, executedProfileSharedPreferences, false, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_POWER_SAVE_MODE, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { PowerManager powerManager = (PowerManager) appContext.getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wakeLock = null; @@ -7499,6 +7742,7 @@ private static void lockDevice(Profile _profile, final Context context) { if (Permissions.checkLockDevice(appContext) && (!PPApplication.lockDeviceActivityDisplayed)) { try { Intent intent = new Intent(appContext, LockDeviceActivity.class); + intent.putExtra(LockDeviceActivity.EXTRA_ONLY_SCREEN_OFF, false); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK); intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); @@ -7586,7 +7830,7 @@ private static void lockDevice(Profile _profile, final Context context) { @SuppressLint("WrongConstant") private static void setScreenDarkMode(Context appContext, final int value, SharedPreferences executedProfileSharedPreferences) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_DARK_MODE, null, executedProfileSharedPreferences, false, appContext).allowed + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_DARK_MODE, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (Build.VERSION.SDK_INT >= 29) { boolean G1OK = false; @@ -8243,7 +8487,7 @@ public void commandOutput(int id, String line) { private static void setCameraFlash(Context appContext, Profile profile, SharedPreferences executedProfileSharedPreferences) { if (profile._cameraFlash != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_CAMERA_FLASH, null, executedProfileSharedPreferences, true, appContext).allowed + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_CAMERA_FLASH, null, executedProfileSharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (Permissions.checkProfileCameraFlash(appContext, profile, null)) { switch (profile._cameraFlash) { @@ -8347,7 +8591,7 @@ static void setVPN(Context context, Profile profile, SharedPreferences executedP try { int vpnApplication = Integer.parseInt(splits[0]); if (vpnApplication > 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_VPN, null, executedProfileSharedPreferences, true, context).allowed + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_VPN, null, executedProfileSharedPreferences, true, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { boolean enableVPN = splits[1].equals("0"); @@ -8385,40 +8629,46 @@ static void setVPN(Context context, Profile profile, SharedPreferences executedP Intent intent = null; switch (vpnApplication) { case 1: - intent = new Intent(); - intent.setComponent(new ComponentName("net.openvpn.openvpn", "net.openvpn.unified.MainActivity")); - if (enableVPN) { - intent.setAction("net.openvpn.openvpn.CONNECT"); - String keyValue = "AS " + profileName; - intent.putExtra("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", keyValue); - intent.putExtra("net.openvpn.openvpn.AUTOCONNECT", StringConstants.TRUE_STRING); - } else { - intent.setAction("net.openvpn.openvpn.DISCONNECT"); - intent.putExtra("net.openvpn.openvpn.STOP", StringConstants.TRUE_STRING); + if (Permissions.checkProfileVPN(context, profile, null)) { + intent = new Intent(); + intent.setComponent(new ComponentName("net.openvpn.openvpn", "net.openvpn.unified.MainActivity")); + if (enableVPN) { + intent.setAction("net.openvpn.openvpn.CONNECT"); + String keyValue = "AS " + profileName; + intent.putExtra("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", keyValue); + intent.putExtra("net.openvpn.openvpn.AUTOCONNECT", StringConstants.TRUE_STRING); + } else { + intent.setAction("net.openvpn.openvpn.DISCONNECT"); + intent.putExtra("net.openvpn.openvpn.STOP", StringConstants.TRUE_STRING); + } } break; case 2: - intent = new Intent(); - intent.setComponent(new ComponentName("net.openvpn.openvpn", "net.openvpn.unified.MainActivity")); - if (enableVPN) { - intent.setAction("net.openvpn.openvpn.CONNECT"); - String keyValue = "PC " + profileName; - intent.putExtra("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", keyValue); - intent.putExtra("net.openvpn.openvpn.AUTOCONNECT", StringConstants.TRUE_STRING); - } else { - intent.setAction("net.openvpn.openvpn.DISCONNECT"); - intent.putExtra("net.openvpn.openvpn.STOP", StringConstants.TRUE_STRING); + if (Permissions.checkProfileVPN(context, profile, null)) { + intent = new Intent(); + intent.setComponent(new ComponentName("net.openvpn.openvpn", "net.openvpn.unified.MainActivity")); + if (enableVPN) { + intent.setAction("net.openvpn.openvpn.CONNECT"); + String keyValue = "PC " + profileName; + intent.putExtra("net.openvpn.openvpn.AUTOSTART_PROFILE_NAME", keyValue); + intent.putExtra("net.openvpn.openvpn.AUTOCONNECT", StringConstants.TRUE_STRING); + } else { + intent.setAction("net.openvpn.openvpn.DISCONNECT"); + intent.putExtra("net.openvpn.openvpn.STOP", StringConstants.TRUE_STRING); + } } break; case 3: - intent = new Intent(); - if (enableVPN) { - intent.setComponent(new ComponentName("de.blinkt.openvpn", "de.blinkt.openvpn.api.ConnectVPN")); - } else { - intent.setComponent(new ComponentName("de.blinkt.openvpn", "de.blinkt.openvpn.api.DisconnectVPN")); + if (Permissions.checkProfileVPN(context, profile, null)) { + intent = new Intent(); + if (enableVPN) { + intent.setComponent(new ComponentName("de.blinkt.openvpn", "de.blinkt.openvpn.api.ConnectVPN")); + } else { + intent.setComponent(new ComponentName("de.blinkt.openvpn", "de.blinkt.openvpn.api.DisconnectVPN")); + } + intent.setAction("android.intent.action.MAIN"); + intent.putExtra("de.blinkt.openvpn.api.profileName", profileName); } - intent.setAction("android.intent.action.MAIN"); - intent.putExtra("de.blinkt.openvpn.api.profileName", profileName); break; case 4: if (Permissions.checkProfileWireGuard(context, profile, null)) { @@ -8432,8 +8682,10 @@ static void setVPN(Context context, Profile profile, SharedPreferences executedP if (intent != null) { if (vpnApplication < 4) { try { - intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - context.startActivity(intent); + if (Settings.canDrawOverlays(context)) { + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(intent); + } } catch (ActivityNotFoundException | SecurityException ee) { PPApplicationStatic.addActivityLog(context, PPApplication.ALTYPE_PROFILE_ERROR_SET_VPN, null, profileName, ""); @@ -8490,7 +8742,7 @@ static void generateNotifiction(Context appContext, Profile profile) { mBuilder.setSmallIcon(R.drawable.ic_ppp_notification); else mBuilder.setSmallIcon(R.drawable.ic_information_notify); - mBuilder.setColor(ContextCompat.getColor(appContext, R.color.information_color)); + mBuilder.setColor(ContextCompat.getColor(appContext, R.color.informationColor)); if (showLargeIcon) mBuilder.setLargeIcon(BitmapFactory.decodeResource(appContext.getResources(), R.drawable.ic_information_notification)); break; @@ -8499,7 +8751,7 @@ static void generateNotifiction(Context appContext, Profile profile) { mBuilder.setSmallIcon(R.drawable.ic_ppp_notification); else mBuilder.setSmallIcon(R.drawable.ic_exclamation_notify); - mBuilder.setColor(ContextCompat.getColor(appContext, R.color.error_color)); + mBuilder.setColor(ContextCompat.getColor(appContext, R.color.errorColor)); if (showLargeIcon) mBuilder.setLargeIcon(BitmapFactory.decodeResource(appContext.getResources(), R.drawable.ic_exclamation_notification)); break; @@ -8667,50 +8919,724 @@ static void generateNotifiction(Context appContext, Profile profile) { } } - static void getRingerVolume(Context context) - { -// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.getRingerVolume", "PPApplication.profileActivationMutex"); - synchronized (PPApplication.profileActivationMutex) { - ApplicationPreferences.prefRingerVolume = ApplicationPreferences. - getSharedPreferences(context).getInt(PREF_RINGER_VOLUME, -999); - //return prefRingerVolume; - } - } - static void setRingerVolume(Context context, int volume) - { -// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.setRingerVolume", "PPApplication.profileActivationMutex"); - synchronized (PPApplication.profileActivationMutex) { - final AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); - int systemZenMode = getSystemZenMode(context/*, -1*/); - if (isAudibleSystemRingerMode(audioManager, systemZenMode/*, appContext*/)) { - SharedPreferences.Editor editor = ApplicationPreferences.getEditor(context); - editor.putInt(PREF_RINGER_VOLUME, volume); - editor.apply(); - ApplicationPreferences.prefRingerVolume = volume; - } - } - } + static void sendSMS(final Context appContext, Profile profile, + SharedPreferences executedProfileSharedPreferences, + final boolean forRestartEvents) { + if (PPApplication.blockProfileEventActions) + // not send sms when are blocked profile ections (for example at start of PPP) + return; +// Log.e("ActivateProfileHelper.sendSMS", "11111111111"); + if (forRestartEvents) + // do not send sms for restart events + return; +// Log.e("ActivateProfileHelper.sendSMS", "222222222222222"); - static void getNotificationVolume(Context context) - { -// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.getNotificationVolume", "PPApplication.profileActivationMutex"); - synchronized (PPApplication.profileActivationMutex) { - ApplicationPreferences.prefNotificationVolume = ApplicationPreferences. - getSharedPreferences(context).getInt(PREF_NOTIFICATION_VOLUME, -999); - //return prefNotificationVolume; - } - } - static void setNotificationVolume(Context context, int volume) - { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS, null, executedProfileSharedPreferences, true, appContext).preferenceAllowed + == PreferenceAllowed.PREFERENCE_ALLOWED) { + + long oldActivatedProfileId = PPApplication.prefProfileBeforeActivation; +// Log.e("ActivateProfileHelper.sendSMS", "profile._id="+profile._id); +// Log.e("ActivateProfileHelper.sendSMS", "oldActivatedProfileId="+oldActivatedProfileId); + if (profile._id != oldActivatedProfileId) { + + try { + + List usedTelNumbers = new ArrayList<>(); + + if (profile._sendSMSSendSMS && (profile._sendSMSSMSText != null) && (!profile._sendSMSSMSText.isEmpty())) { +// Log.e("ActivateProfileHelper.sendSMS", "xxxxxxxxxxxxxxxx"); + + if (Permissions.checkSendSMS(appContext)) { + if (/*(profile._sendSMSContactListType == Profile.CONTACT_LIST_TYPE_NOT_USE) ||*/ + ((profile._sendSMSContacts != null) && (!profile._sendSMSContacts.isEmpty())) || + ((profile._sendSMSContactGroups != null) && (!profile._sendSMSContactGroups.isEmpty()))) { + +// PPApplicationStatic.logE("[CONTACTS_CACHE] ActivateProfileHelper.sendSMS", "PPApplicationStatic.getContactsCache()"); + ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); + List contactList = null; + if (contactsCache != null) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] ActivateProfileHelper.sendSMS", "contactsCache.getList()"); + contactList = contactsCache.getList(/*false*/); + } + + // send sms for configured contect groups + String[] splits = profile._sendSMSContactGroups.split(StringConstants.STR_SPLIT_REGEX); + for (String split : splits) { + if (!split.isEmpty()) { + synchronized (PPApplication.contactsCacheMutex) { + if (contactList != null) { + for (Contact contact : contactList) { + if (contact.groups != null) { + long groupId = contact.groups.indexOf(Long.valueOf(split)); + if (groupId != -1) { + // group found in contact + if (contact.phoneId != 0) { + String _phoneNumber = contact.phoneNumber; + // send sms + if (!usedTelNumbers.contains(_phoneNumber)) { + // not sent, send it + try { + SmsManager smsManager = SmsManager.getDefault(); + smsManager.sendTextMessage(_phoneNumber, null, profile._sendSMSSMSText, null, null); + usedTelNumbers.add(_phoneNumber); + } catch ( + Exception e) { + PPApplicationStatic.recordException(e); + } + } + } + } + } + } + } + } + } + } + + // send sms for configured contacts + splits = (profile._sendSMSContacts.split(StringConstants.STR_SPLIT_REGEX)); + for (String split : splits) { + String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX); + + if ((!split.isEmpty()) && + (splits2.length == 3) && + (!splits2[0].isEmpty()) && + (!splits2[1].isEmpty()) && + (!splits2[2].isEmpty())) { + String contactPhoneNumber = splits2[1]; + // send sms + if (!usedTelNumbers.contains(contactPhoneNumber)) { + // not sent, send it + try { + SmsManager smsManager = SmsManager.getDefault(); + smsManager.sendTextMessage(contactPhoneNumber, null, profile._sendSMSSMSText, null, null); + usedTelNumbers.add(contactPhoneNumber); + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } + } + } + } + } + } + } + } catch (Exception e) { + PPApplicationStatic.addActivityLog(appContext, PPApplication.ALTYPE_PROFILE_ERROR_SEND_SMS, + null, profile._name, ""); + } + } + + } + } + + static void clearNotificaitons(final Context appContext, Profile profile, + SharedPreferences executedProfileSharedPreferences, + final boolean forRestartEvents) { + if (PPApplication.blockProfileEventActions) + // not clear notifications when are blocked profile ections (for example at start of PPP) + return; + if (forRestartEvents) + // do not clear notifications for restart events + return; + + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED, null, executedProfileSharedPreferences, true, appContext).preferenceAllowed + == PreferenceAllowed.PREFERENCE_ALLOWED) { + + if (PPNotificationListenerService.isNotificationListenerServiceEnabled(appContext, true)) { + if (profile._clearNotificationEnabled && (profile._clearNotificationApplications != null) + && (!profile._clearNotificationApplications.isEmpty())) { + PPNotificationListenerService service = PPNotificationListenerService.getInstance(); + if (service != null) { + try { + StatusBarNotification[] statusBarNotifications = service.getActiveNotifications(); + //noinspection RedundantLengthCheck + if ((statusBarNotifications != null) && (statusBarNotifications.length > 0)) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] ActivateProfileHelper.clearNotificaitons", "PPApplicationStatic.getContactsCache()"); + ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); + if (contactsCache != null) { + List contactList; +// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.isNotificationVisible", "PPApplication.contactsCacheMutex"); +// PPApplicationStatic.logE("[CONTACTS_CACHE] ActivateProfileHelper.clearNotificaitons", "contactCache.getList()"); + contactList = contactsCache.getList(/*false*/); + + for (StatusBarNotification statusBarNotification : statusBarNotifications) { + + // ignore PPP notification + if (statusBarNotification.getPackageName().equals(PPApplication.PACKAGE_NAME_PP)) + continue; + if (statusBarNotification.getPackageName().equals(PPApplication.PACKAGE_NAME)) + continue; + if (statusBarNotification.getPackageName().equals(PPApplication.PACKAGE_NAME_PP)) + continue; + if (statusBarNotification.getPackageName().equals(PPApplication.PACKAGE_NAME_EXTENDER)) + continue; + + String[] splits = profile._clearNotificationApplications.split(StringConstants.STR_SPLIT_REGEX); + for (String split : splits) { + // get only package name = remove activity + String packageName = Application.getPackageName(split); + // search for package name in saved package names + StatusBarNotification activeNotification = isNotificationActive(profile, + statusBarNotification, + packageName, + contactList); + if (activeNotification != null) { + if (!activeNotification.isOngoing()) { + String key = activeNotification.getKey(); + try { + service.cancelNotification(key); + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } + } + } + } + } + + if (contactList != null) + contactList.clear(); + } + } + } catch (Exception e) { + //Log.e("ActivateProfileHelper.isNotificationVisible", Log.getStackTraceString(e)); + + // Hm: java.lang.RuntimeException: Could not read bitmap blob. + // in StatusBarNotification[] statusBarNotifications = service.getActiveNotifications(); + //PPApplicationStatic.recordException(e); + } + } + } + } + } + } + // test statusBarNotification for event parameters + private static StatusBarNotification isNotificationActive(Profile profile, + StatusBarNotification statusBarNotification, + String packageName, + List contactList) { + try { + String packageNameFromNotification = statusBarNotification.getPackageName(); +// Log.e("EventPreferencesNotification.isNotificationActive", "packageNameFromNotification="+packageNameFromNotification); + + boolean packageNameFound = false; + if (packageNameFromNotification.equals(packageName)) { + packageNameFound = true; + } + + if (packageNameFound) { + + boolean testText = false; + + String notificationTicker = ""; + String notificationTitle = ""; + String notificationText = ""; + + if (profile._clearNotificationCheckContacts || profile._clearNotificationCheckText) { + if (statusBarNotification.getNotification().tickerText != null) { + notificationTicker = statusBarNotification.getNotification().tickerText.toString(); + testText = true; + } + Bundle extras = statusBarNotification.getNotification().extras; + if (extras != null) { + String _text1 = extras.getString("android.title"); + if (_text1 != null) { + notificationTitle = _text1; + testText = true; + } + CharSequence _text2 = extras.getCharSequence("android.text"); + if (_text2 != null) { + notificationText = _text2.toString(); + testText = true; + } + } + } + + boolean textFound = false; + if (testText) { + // title or text or ticker is set in notification + + if (profile._clearNotificationCheckContacts) { + boolean phoneNumberFound = false; + if (!notificationTitle.isEmpty()) + phoneNumberFound = isContactConfigured(profile, notificationTitle, contactList); + if (!notificationText.isEmpty() && (!phoneNumberFound)) + phoneNumberFound = isContactConfigured(profile, notificationText, contactList); + if (!notificationTicker.isEmpty() && (!phoneNumberFound)) + phoneNumberFound = isContactConfigured(profile, notificationTicker, contactList); + + textFound = phoneNumberFound; + } + if (profile._clearNotificationCheckText) { + String searchText = ""; + for (int whatTest = 0; whatTest < 3; whatTest++) { + // test in loop title (0), text(1), ticker(2) + if (whatTest == 0) { + if (!notificationTitle.isEmpty()) + searchText = notificationTitle; + else + continue; + } + if (whatTest == 1) { + if (!notificationText.isEmpty()) + searchText = notificationText; + else + continue; + } + if (whatTest == 2) { + if (!notificationTicker.isEmpty()) + searchText = notificationTicker; + else + continue; + } + + String[] textSplits = profile._clearNotificationText.split(StringConstants.STR_SPLIT_REGEX); + + String[] positiveList = new String[textSplits.length]; + String[] negativeList = new String[textSplits.length]; + int argsId; + + // positive strings + boolean positiveExists = false; + argsId = 0; + for (String split : textSplits) { + if (!split.isEmpty()) { + String searchPattern = split; + + if (searchPattern.startsWith("!")) { + // only positive + continue; + } + + // trim leading and trailing spaces + searchPattern = searchPattern.trim(); + + // when in searchPattern are not wildcards add % + if (!(searchPattern.contains("%") || searchPattern.contains("_"))) + searchPattern = "%" + searchPattern + "%"; + + searchPattern = searchPattern.replace("\\%", "{^^}"); + searchPattern = searchPattern.replace("\\_", "[^^]"); + + searchPattern = searchPattern.replace("%", "(.*)"); + searchPattern = searchPattern.replace("_", "(.)"); + + searchPattern = searchPattern.replace("{^^}", "\\%"); + searchPattern = searchPattern.replace("[^^]", "\\_"); + + //if (!searchPattern.startsWith("(.*)")) + // searchPattern = searchPattern + "^"; + //if (!searchPattern.endsWith("(.*)")) + // searchPattern = searchPattern + "$"; + + positiveList[argsId] = searchPattern; + + positiveExists = true; + + ++argsId; + + } + } + + // negative strings + boolean negativeExists = false; + argsId = 0; + for (String split : textSplits) { + if (!split.isEmpty()) { + String searchPattern = split; + + if (!searchPattern.startsWith("!")) { + // only negative + continue; + } + + // remove ! + searchPattern = searchPattern.substring(1); + + // trim leading and trailing spaces + searchPattern = searchPattern.trim(); + + // when in searchPattern are not wildcards add % + if (!(searchPattern.contains("%") || searchPattern.contains("_"))) + searchPattern = "%" + searchPattern + "%"; + + searchPattern = searchPattern.replace("\\%", "{^^}"); + searchPattern = searchPattern.replace("\\_", "[^^]"); + + searchPattern = searchPattern.replace("%", "(.*)"); + searchPattern = searchPattern.replace("_", "(.)"); + + searchPattern = searchPattern.replace("{^^}", "\\%"); + searchPattern = searchPattern.replace("[^^]", "\\_"); + + //if (!searchPattern.startsWith("(.*)")) + // searchPattern = searchPattern + "^"; + //if (!searchPattern.endsWith("(.*)")) + // searchPattern = searchPattern + "$"; + + negativeList[argsId] = searchPattern; + + negativeExists = true; + + ++argsId; + + } + } + + boolean foundPositive = false; + if (positiveExists) { + for (String _positiveText : positiveList) { + if ((_positiveText != null) && (!_positiveText.isEmpty())) { + if (searchText.toLowerCase().matches(_positiveText.toLowerCase())) { + foundPositive = true; + break; + } + } + } + } + boolean foundNegative = true; + if (negativeExists) { + for (String _negativeText : negativeList) { + if ((_negativeText != null) && (!_negativeText.isEmpty())) { + if (searchText.toLowerCase().matches(_negativeText.toLowerCase())) { + foundNegative = false; + break; + } + } + } + } + + textFound = foundPositive && foundNegative; + + if (textFound) + break; + } + } + } + + if (testText) { + // is configured test text (_checkContacts or _checkText = true) + if (textFound) + return statusBarNotification; + else + return null; + } else { + // is not configured test text (_checkContacts and _checkText = false) + return statusBarNotification; + } + } + } catch (Exception e) { + //Log.e("EventPreferencesNotification.isNotificationActive", Log.getStackTraceString(e)); + PPApplicationStatic.recordException(e); + } + // package name not found + return null; + } + private static boolean isContactConfigured(Profile profile, String text, List contactList) { + boolean phoneNumberFound = false; + + // find phone number in groups + String[] splits = profile._clearNotificationContactGroups.split(StringConstants.STR_SPLIT_REGEX); + for (String split : splits) { + if (!split.isEmpty()) { +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesNotification.isContactConfigured", "PPApplication.contactsCacheMutex"); + synchronized (PPApplication.contactsCacheMutex) { + if (contactList != null) { + for (Contact contact : contactList) { + if (contact.groups != null) { + long groupId = contact.groups.indexOf(Long.valueOf(split)); + if (groupId != -1) { + // group found in contact + String _contactName = contact.name; + if (text.toLowerCase().contains(_contactName.toLowerCase())) { + phoneNumberFound = true; + break; + } + } + } + } + } + } + } + + if (phoneNumberFound) + break; + } + + if (!phoneNumberFound) { + // find phone number in contacts + // contactId#phoneId|... + splits = profile._clearNotificationContacts.split(StringConstants.STR_SPLIT_REGEX); + for (String split : splits) { + String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX); + + if ((!split.isEmpty()) && + (splits2.length == 3) && + (!splits2[0].isEmpty()) && + (!splits2[1].isEmpty()) && + (!splits2[2].isEmpty())) { + String contactName = splits2[0]; + if (text.toLowerCase().contains(contactName.toLowerCase())) { + // phone number is in sensor configured + phoneNumberFound = true; + break; + } + } + } + } + + return phoneNumberFound; + } + + private static void setScreenNightLight(Context appContext, final Profile profile, SharedPreferences executedProfileSharedPreferences) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT, null, executedProfileSharedPreferences, false, appContext).preferenceAllowed + == PreferenceAllowed.PREFERENCE_ALLOWED) { + + if (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) { + boolean startBLFService = false; + /*try { + if (profile._screenNightLight == 1) { + if (Settings.System.getInt(appContext.getContentResolver(), + SETTINGS_BLUE_LIGHT_FILTER, -1) != 1) + Settings.System.putInt(appContext.getContentResolver(), SETTINGS_BLUE_LIGHT_FILTER, 1); + } else { + if (Settings.System.getInt(appContext.getContentResolver(), + SETTINGS_BLUE_LIGHT_FILTER, -1) != 0) + Settings.System.putInt(appContext.getContentResolver(), SETTINGS_BLUE_LIGHT_FILTER, 0); + } + startBLFService = true; + } catch (Exception ee) { + //Log.e("ActivateProfileHelper.setScreenNightLight", Log.getStackTraceString(ee));*/ + + int ppppsVersion = isPPPPutSettingsInstalled(appContext); + + if (ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { + // WARNING: PPPPS do not change SETTINGS_BLUE_LIGHT_FILTER in Settings.System + // Why? I do not know. Exception is not generated in PPPPS. :-( + // But Shizuku, root working good. + +// Log.e("ActivateProfileHelper.setScreenNightLight", "PPPPS"); + if (profile._screenNightLight == 1) + putSettingsParameter(appContext, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_BLUE_LIGHT_FILTER, "1"); + else + putSettingsParameter(appContext, ppppsVersion, PPPPS_SETTINGS_TYPE_SYSTEM, SETTINGS_BLUE_LIGHT_FILTER, "0"); + startBLFService = true; + } + else if (ShizukuUtils.hasShizukuPermission() && RootUtils.settingsBinaryExists(false)) { +// Log.e("ActivateProfileHelper.setScreenNightLight", "Shizuku"); + synchronized (PPApplication.rootMutex) { + try { + String command1; + if (profile._screenNightLight == 1) + command1 = COMMAND_SETTINGS_PUT_SYSTEM + SETTINGS_BLUE_LIGHT_FILTER + " 1"; + else + command1 = COMMAND_SETTINGS_PUT_SYSTEM + SETTINGS_BLUE_LIGHT_FILTER + " 0"; + ShizukuUtils.executeCommand(command1); + startBLFService = true; + } catch (Exception e) { + //Log.e("ActivateProfileHelper.setMobileData", Log.getStackTraceString(e)); + //PPApplicationStatic.logException("ActivateProfileHelper.setScreenNightLight", Log.getStackTraceString(e)); + } + } + } else { + if ((!ApplicationPreferences.applicationNeverAskForGrantRoot) && + (RootUtils.isRooted() && RootUtils.settingsBinaryExists(false))) { +// Log.e("ActivateProfileHelper.setScreenNightLight", "root"); + +// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.setScreenNightLight", "PPApplication.rootMutex"); + synchronized (PPApplication.rootMutex) { + String command1; + if (profile._screenNightLight == 1) + command1 = COMMAND_SETTINGS_PUT_SYSTEM + SETTINGS_BLUE_LIGHT_FILTER + " 1"; + else + command1 = COMMAND_SETTINGS_PUT_SYSTEM + SETTINGS_BLUE_LIGHT_FILTER + " 0"; + + Command command = new Command(0, command1); //, command2); + try { + RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command); + RootUtils.commandWait(command, RootCommandWaitCalledFromConstants.ROOT_COMMAND_WAIT_CALLED_FROM_SCREEN_NIGHT_LIGHT); + startBLFService = true; + } catch (Exception e) { + // com.stericson.rootshell.exceptions.RootDeniedException: Root Access Denied + //Log.e("ActivateProfileHelper.setVibrateWhenRinging", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } + } + } + } + //} + if (startBLFService) { + // must be started sthis service + // read: https://github.com/henrichg/PhoneProfilesPlus/issues/81#issuecomment-2343379766 + Runnable runnable = () -> { + try { + Intent intent = new Intent(); + intent.setComponent(new ComponentName("com.samsung.android.bluelightfilter", "com.samsung.android.bluelightfilter.BlueLightFilterService")); + intent.putExtra("BLUE_LIGHT_FILTER_SERVICE_TYPE", (profile._screenNightLight == 1) ? 24 : 25); + appContext.startService(intent); + } catch (Exception eee) { + //Log.e("ActivateProfileHelper.setScreenNightLight", Log.getStackTraceString(eee)); + PPApplicationStatic.logException("ActivateProfileHelper.setScreenNightLight", Log.getStackTraceString(eee)); + } + }; + PPApplicationStatic.createDelayedProfileActivationExecutor(); + // 1000 ms, because is delayed change of SETTINGS_BLUE_LIGHT_FILTER in PPPPS, Shizuku root + PPApplication.delayedProfileActivationExecutor.schedule(runnable, 1000, TimeUnit.MILLISECONDS); + } + } + else + if (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) { + // Shizuku, root is required !!! + if (ShizukuUtils.hasShizukuPermission() && RootUtils.settingsBinaryExists(false)) { + synchronized (PPApplication.rootMutex) { + try { + String command1; + if (profile._screenNightLight == 1) + command1 = COMMAND_SETTINGS_PUT_SYSTEM + SETTINGS_SCREEN_PAPER_MODE_ENABLED + " 1"; + else + command1 = COMMAND_SETTINGS_PUT_SYSTEM + SETTINGS_SCREEN_PAPER_MODE_ENABLED + " 0"; + ShizukuUtils.executeCommand(command1); + } catch (Exception e) { + //Log.e("ActivateProfileHelper.setMobileData", Log.getStackTraceString(e)); + //PPApplicationStatic.logException("ActivateProfileHelper.setScreenNightLight", Log.getStackTraceString(e)); + } + } + } else { + if ((!ApplicationPreferences.applicationNeverAskForGrantRoot) && + (RootUtils.isRooted() && RootUtils.settingsBinaryExists(false))) { +// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.setScreenNightLight", "PPApplication.rootMutex"); + synchronized (PPApplication.rootMutex) { + String command1; + if (profile._screenNightLight == 1) + command1 = COMMAND_SETTINGS_PUT_SYSTEM + SETTINGS_SCREEN_PAPER_MODE_ENABLED + " 1"; + else + command1 = COMMAND_SETTINGS_PUT_SYSTEM + SETTINGS_SCREEN_PAPER_MODE_ENABLED + " 0"; + + Command command = new Command(0, command1); //, command2); + try { + RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command); + RootUtils.commandWait(command, RootCommandWaitCalledFromConstants.ROOT_COMMAND_WAIT_CALLED_FROM_SCREEN_NIGHT_LIGHT); + } catch (Exception e) { + // com.stericson.rootshell.exceptions.RootDeniedException: Root Access Denied + //Log.e("ActivateProfileHelper.setVibrateWhenRinging", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } + } + } + } + } + else + if (PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) { + if (Permissions.checkProfileScreenNightLight(appContext, profile, null)) { + try { + if (profile._screenNightLight == 1) { + if (Settings.System.getInt(appContext.getContentResolver(), + SETTINGS_EYES_PROTECTION_MODE, -1) != 1) { + Settings.System.putInt(appContext.getContentResolver(), SETTINGS_EYES_PROTECTION_MODE, 1); + } + } else { + if (Settings.System.getInt(appContext.getContentResolver(), + SETTINGS_EYES_PROTECTION_MODE, -1) != 0) { + Settings.System.putInt(appContext.getContentResolver(), SETTINGS_EYES_PROTECTION_MODE, 0); + } + } + } catch (Exception e2) { + //PPApplicationStatic.logException("ActivateProfileHelper.setScreenNightLight", Log.getStackTraceString(e2)); + } + } + } else { + boolean G1OK = false; + if (Permissions.hasPermission(appContext, Manifest.permission.WRITE_SECURE_SETTINGS)) { + try { + if (profile._screenNightLight == 1) { + if (Settings.Secure.getInt(appContext.getContentResolver(), + SETTINGS_NIGHT_DISPLAY_ACTIVATED, -1) != 1) + Settings.Secure.putInt(appContext.getContentResolver(), SETTINGS_NIGHT_DISPLAY_ACTIVATED, 1); + } else { + if (Settings.Secure.getInt(appContext.getContentResolver(), + SETTINGS_NIGHT_DISPLAY_ACTIVATED, -1) != 0) + Settings.Secure.putInt(appContext.getContentResolver(), SETTINGS_NIGHT_DISPLAY_ACTIVATED, 0); + } + G1OK = true; + } catch (Exception e2) { + PPApplicationStatic.logException("ActivateProfileHelper.setScreenNightLight", Log.getStackTraceString(e2)); + //PPApplicationStatic.recordException(e2); + } + } + if (!G1OK) { + if ((!ApplicationPreferences.applicationNeverAskForGrantRoot) && + (RootUtils.isRooted() && RootUtils.settingsBinaryExists(false))) { +// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.setScreenDarkMode", "PPApplication.rootMutex"); + synchronized (PPApplication.rootMutex) { + String command1 = COMMAND_SETTINGS_PUT_SECURE + SETTINGS_NIGHT_DISPLAY_ACTIVATED; + if (profile._screenNightLight == 1) + command1 = command1 + " 1"; + else + command1 = command1 + " 0"; + Command command = new Command(0, /*false,*/ command1); + try { + RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command); + RootUtils.commandWait(command, RootCommandWaitCalledFromConstants.ROOT_COMMAND_WAIT_CALLED_FROM_SET_SCREEN_DARK_MODE); + } catch (Exception ee) { + // com.stericson.rootshell.exceptions.RootDeniedException: Root Access Denied + //Log.e("ActivateProfileHelper.setScreenDarkMode", Log.getStackTraceString(ee)); + //PPApplicationStatic.recordException(e); + } + } + } + } + } + } + } + + + static void getRingerVolume(Context context) + { +// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.getRingerVolume", "PPApplication.profileActivationMutex"); + synchronized (PPApplication.profileActivationMutex) { + ApplicationPreferences.prefRingerVolume = ApplicationPreferences. + getSharedPreferences(context).getInt(PREF_RINGER_VOLUME, -999); + //return prefRingerVolume; + } + } + static void setRingerVolume(Context context, int volume) + { +// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.setRingerVolume", "PPApplication.profileActivationMutex"); + synchronized (PPApplication.profileActivationMutex) { + final AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); + if (audioManager != null) { + int systemZenMode = getSystemZenMode(context/*, -1*/); + if (isAudibleSystemRingerMode(audioManager, systemZenMode/*, appContext*/)) { + SharedPreferences.Editor editor = ApplicationPreferences.getEditor(context); + editor.putInt(PREF_RINGER_VOLUME, volume); + editor.apply(); + ApplicationPreferences.prefRingerVolume = volume; + } + } + } + } + + static void getNotificationVolume(Context context) + { +// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.getNotificationVolume", "PPApplication.profileActivationMutex"); + synchronized (PPApplication.profileActivationMutex) { + ApplicationPreferences.prefNotificationVolume = ApplicationPreferences. + getSharedPreferences(context).getInt(PREF_NOTIFICATION_VOLUME, -999); + //return prefNotificationVolume; + } + } + static void setNotificationVolume(Context context, int volume) + { // PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.setNotificationVolume", "PPApplication.profileActivationMutex"); synchronized (PPApplication.profileActivationMutex) { final AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); - int systemZenMode = getSystemZenMode(context/*, -1*/); - if (isAudibleSystemRingerMode(audioManager, systemZenMode/*, appContext*/)) { - SharedPreferences.Editor editor = ApplicationPreferences.getEditor(context); - editor.putInt(PREF_NOTIFICATION_VOLUME, volume); - editor.apply(); - ApplicationPreferences.prefNotificationVolume = volume; + if (audioManager != null) { + int systemZenMode = getSystemZenMode(context/*, -1*/); + if (isAudibleSystemRingerMode(audioManager, systemZenMode/*, appContext*/)) { + SharedPreferences.Editor editor = ApplicationPreferences.getEditor(context); + editor.putInt(PREF_NOTIFICATION_VOLUME, volume); + editor.apply(); + ApplicationPreferences.prefNotificationVolume = volume; + } } } } @@ -8879,21 +9805,58 @@ static String getPPPPutSettingsVersionName(Context context) { } static void putSettingsParameter(Context context, + int ppppsVersion, @SuppressWarnings("SameParameterValue") String settingsType, String parameterName, String parameterValue) { - // startActivity from background: Android 10 (API level 29) - // Exception: - // - The app is granted the SYSTEM_ALERT_WINDOW permission by the user. - if ((Build.VERSION.SDK_INT < 29) || (Settings.canDrawOverlays(context))) { + if (ppppsVersion <= PPApplication.VERSION_CODE_PPPPS_LATEST_WITHOUT_SERVICE) { + // in version <= 70 service not exists in PPPPS + + // startActivity from background: Android 10 (API level 29) + // Exception: + // - The app is granted the SYSTEM_ALERT_WINDOW permission by the user. + if ((Build.VERSION.SDK_INT < 29) || (Settings.canDrawOverlays(context))) { + try { + // !!! Activity with action not working good. + // Because if is started first PPPPS, closed and then activated profile, + // PPPPS MainActivity is started :-( + // Must by used activity with android:launchMode="singleInstance". + + // singleIstance -> this activity is in its own task, thus, after finish it, + // is not get back MainActivity, because MainActivity is in another task. + // Then singleIstance is good launchMode for PutSettingsParameterActivity. + + //PackageInfo pInfo = context.getPackageManager().getPackageInfo(PPApplication.PACKAGE_NAME_PPPPS, 0); + //long verCode = PPApplicationStatic.getVersionCode(pInfo); + //Log.e("ActivateProfileHelper.putSettingsParameter", "verCode="+verCode); + + Intent intent; + intent = new Intent(); + intent.setComponent(new ComponentName(PPApplication.PACKAGE_NAME_PPPPS, PPApplication.PACKAGE_NAME_PPPPS+".PutSettingsParameterActivity")); + intent.putExtra("extra_put_setting_parameter_type", settingsType); + intent.putExtra("extra_put_setting_parameter_name", parameterName); + intent.putExtra("extra_put_setting_parameter_value", parameterValue); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK /*| Intent.FLAG_ACTIVITY_CLEAR_TOP*/); + context.startActivity(intent); + } catch (Exception e) { + PPApplicationStatic.logException("ActivateProfileHelper.putSettingsParameter", Log.getStackTraceString(e)); + } + // WARNING: do not remove this sleep !!! + // Is required to set time space between two calls of this method. + GlobalUtils.sleep(500); + } + } else { + // start PPPPS service try { - Intent intent = new Intent(); - intent.setComponent(new ComponentName("sk.henrichg.pppputsettings", "sk.henrichg.pppputsettings.PutSettingsParameterActivity")); +// Log.e("ActivateProfileHelper.putSettingsParameter", "XXXXXXXX"); + Intent intent; + intent = new Intent(); + intent.setComponent(new ComponentName(PPApplication.PACKAGE_NAME_PPPPS, PPApplication.PACKAGE_NAME_PPPPS + ".PutSettingsParameterService")); intent.putExtra("extra_put_setting_parameter_type", settingsType); intent.putExtra("extra_put_setting_parameter_name", parameterName); intent.putExtra("extra_put_setting_parameter_value", parameterValue); - intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP); - context.startActivity(intent); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK /*| Intent.FLAG_ACTIVITY_CLEAR_TOP*/); + context.startService(intent); } catch (Exception e) { PPApplicationStatic.logException("ActivateProfileHelper.putSettingsParameter", Log.getStackTraceString(e)); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatedProfileEventBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatedProfileEventBroadcastReceiver.java index 33cb21018e..4254e365db 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatedProfileEventBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatedProfileEventBroadcastReceiver.java @@ -77,6 +77,7 @@ private void doWork(long _profileId, Context context) { if (oldRunning != _event._eventPreferencesActivatedProfile._running) { // running was changed, call EventsHandler +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] ActivatedProfileEventBroadcastReceiver.doWork", "SENSOR_TYPE_ACTIVATED_PROFILE"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_ACTIVATED_PROFILE}); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatorActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatorActivity.java index f2aed29379..0881e62bc8 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatorActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatorActivity.java @@ -158,6 +158,7 @@ protected void onCreate(Bundle savedInstanceState) { getSupportActionBar().setTitle(R.string.title_activity_activator); eventsRunStopIndicator = findViewById(R.id.act_prof_run_stop_indicator); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(eventsRunStopIndicator, getString(R.string.editor_activity_targetHelps_trafficLightIcon_title)); eventsRunStopIndicator.setOnClickListener(view -> { if (!isFinishing()) { @@ -273,7 +274,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { // PPApplicationStatic.logE("[PPP_NOTIFICATION] ActivatorActivity.onActivityResult", "call of PPAppNotification.drawNotification"); ImportantInfoNotification.showInfoNotification(appContext); ProfileListNotification.drawNotification(true, appContext); - DrawOverAppsPermissionNotification.showNotification(appContext, true); + //DrawOverAppsPermissionNotification.showNotification(appContext, true); IgnoreBatteryOptimizationNotification.showNotification(appContext, true); DNDPermissionNotification.showNotification(appContext, true); PPAppNotification.drawNotification(true, appContext); @@ -573,18 +574,10 @@ private void showTargetHelps() { editor.apply(); ApplicationPreferences.prefActivatorActivityStartTargetHelps = false; - //String appTheme = ApplicationPreferences.applicationTheme(getApplicationContext(), true); int outerCircleColor = R.color.tabTargetHelpOuterCircleColor; -// if (appTheme.equals("dark")) -// outerCircleColor = R.color.tabTargetHelpOuterCircleColor_dark; int targetCircleColor = R.color.tabTargetHelpTargetCircleColor; -// if (appTheme.equals("dark")) -// targetCircleColor = R.color.tabTargetHelpTargetCircleColor_dark; int titleTextColor = R.color.tabTargetHelpTitleTextColor; int descriptionTextColor = R.color.tabTargetHelpDescriptionTextColor; -// if (appTheme.equals("dark")) -// textColor = R.color.tabTargetHelpTextColor_dark; - //boolean tintTarget = !appTheme.equals("white"); final TapTargetSequence sequence = new TapTargetSequence(ActivatorTargetHelpsActivity.activity); List targets = new ArrayList<>(); @@ -592,12 +585,16 @@ private void showTargetHelps() { int id = 1; try { View editorActionView = toolbar.findViewById(R.id.menu_edit_profiles); + //noinspection DataFlowIssue targets.add( TapTarget.forView(editorActionView, getString(R.string.activator_activity_targetHelps_editor_title), getString(R.string.activator_activity_targetHelps_editor_description_ppp)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -609,12 +606,16 @@ private void showTargetHelps() { } try { View restartEventsActionView = toolbar.findViewById(R.id.menu_restart_events); + //noinspection DataFlowIssue targets.add( TapTarget.forView(restartEventsActionView, getString(R.string.editor_activity_targetHelps_restartEvents_title), getString(R.string.editor_activity_targetHelps_restartEvents_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -631,12 +632,16 @@ private void showTargetHelps() { int id = 1; try { View editorActionView = toolbar.findViewById(R.id.menu_edit_profiles); + //noinspection DataFlowIssue targets.add( TapTarget.forView(editorActionView, getString(R.string.activator_activity_targetHelps_editor_title), getString(R.string.activator_activity_targetHelps_editor_description_ppp)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -736,12 +741,6 @@ public void onSequenceCanceled(TapTarget lastTarget) { Intent intent = new Intent(ACTION_SHOW_ACTIVATOR_TARGET_HELPS_BROADCAST_RECEIVER); intent.putExtra(ActivatorActivity.EXTRA_SHOW_TARGET_HELPS_FOR_ACTIVITY, false); LocalBroadcastManager.getInstance(appContext).sendBroadcast(intent); - /*if (ActivatorActivity.getInstance() != null) { - Fragment fragment = ActivatorActivity.getInstance().getFragmentManager().findFragmentById(R.id.activate_profile_list); - if (fragment != null) { - ((ActivatorListFragment) fragment).showTargetHelps(); - } - }*/ }, 500); } } @@ -758,7 +757,6 @@ public void onSequenceCanceled(TapTarget lastTarget) { PPApplicationStatic.recordException(e); } ActivatorTargetHelpsActivity.activity = null; - //ActivatorTargetHelpsActivity.activatorActivity = null; } }, 500); } @@ -822,7 +820,7 @@ public void finishActivityFromListener(Intent intent) { if (action != null) { if (action.equals(PPApplication.ACTION_FINISH_ACTIVITY)) { String what = intent.getStringExtra(PPApplication.EXTRA_WHAT_FINISH); - if (what.equals(StringConstants.EXTRA_ACTIVATOR)) { + if ((what != null) && what.equals(StringConstants.EXTRA_ACTIVATOR)) { try { setResult(Activity.RESULT_CANCELED); finishAffinity(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatorListAdapter.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatorListAdapter.java index e466a14dc5..ec99a82ba5 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatorListAdapter.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatorListAdapter.java @@ -288,13 +288,10 @@ public View getView(int position, View convertView, ViewGroup parent) return vi; } - void showTargetHelps(final Activity activity, /*final ActivatorListFragment fragment,*/ final View listItemView) { + void showTargetHelps(final Activity activity, final View listItemView) { if (ActivatorTargetHelpsActivity.activity == null) return; - //if (fragment.targetHelpsSequenceStarted) - // return; - boolean startTargetHelpsFinished = ApplicationPreferences.prefActivatorActivityStartTargetHelpsFinished && ApplicationPreferences.prefActivatorFragmentStartTargetHelpsFinished; if (!startTargetHelpsFinished) { @@ -310,7 +307,6 @@ void showTargetHelps(final Activity activity, /*final ActivatorListFragment frag Rect profileItemTarget = new Rect(0, 0, listItemView.getHeight(), listItemView.getHeight()); int[] screenLocation = new int[2]; listItemView.getLocationOnScreen(screenLocation); - //listItemView.getLocationInWindow(screenLocation); if (ApplicationPreferences.applicationActivatorGridLayout) profileItemTarget.offset(screenLocation[0] + listItemView.getWidth() / 2 - listItemView.getHeight() / 2, screenLocation[1]); else @@ -318,18 +314,10 @@ void showTargetHelps(final Activity activity, /*final ActivatorListFragment frag final TapTargetSequence sequence = new TapTargetSequence(ActivatorTargetHelpsActivity.activity); - //String appTheme = ApplicationPreferences.applicationTheme(activity, true); int outerCircleColor = R.color.tabTargetHelpOuterCircleColor; -// if (appTheme.equals("dark")) -// outerCircleColor = R.color.tabTargetHelpOuterCircleColor_dark; int targetCircleColor = R.color.tabTargetHelpTargetCircleColor; -// if (appTheme.equals("dark")) -// targetCircleColor = R.color.tabTargetHelpTargetCircleColor_dark; int titleTextColor = R.color.tabTargetHelpTitleTextColor; int descriptionTextColor = R.color.tabTargetHelpDescriptionTextColor; -// if (appTheme.equals("dark")) -// textColor = R.color.tabTargetHelpTextColor_dark; - //boolean tintTarget = !appTheme.equals("white"); sequence.targets( TapTarget.forBounds(profileItemTarget, activity.getString(R.string.activator_activity_targetHelps_activateProfile_title), activity.getString(R.string.activator_activity_targetHelps_activateProfile_description)) @@ -338,6 +326,9 @@ void showTargetHelps(final Activity activity, /*final ActivatorListFragment frag .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -348,14 +339,10 @@ void showTargetHelps(final Activity activity, /*final ActivatorListFragment frag // to the sequence @Override public void onSequenceFinish() { - //targetHelpsSequenceStarted = false; - SharedPreferences.Editor editor = ApplicationPreferences.getEditor(activity.getApplicationContext()); editor.putBoolean(PPApplication.PREF_ACTIVATOR_LIST_FRAGMENT_START_TARGET_HELPS_FINISHED, true); - //editor.putBoolean(ActivatorListAdapter.PREF_START_TARGET_HELPS_FINISHED, true); editor.apply(); ApplicationPreferences.prefActivatorFragmentStartTargetHelpsFinished = true; - //ApplicationPreferences.prefActivatorAdapterStartTargetHelpsFinished = true; final Handler handler = new Handler(activity.getMainLooper()); handler.postDelayed(() -> { @@ -369,7 +356,6 @@ public void onSequenceFinish() { PPApplicationStatic.recordException(e); } ActivatorTargetHelpsActivity.activity = null; - //ActivatorTargetHelpsActivity.activatorActivity = null; } }, 500); } @@ -414,19 +400,12 @@ public void onSequenceCanceled(TapTarget lastTarget) { PPApplicationStatic.recordException(e); } ActivatorTargetHelpsActivity.activity = null; - //ActivatorTargetHelpsActivity.activatorActivity = null; } }, 500); } }); sequence.continueOnCancel(true) .considerOuterCircleCanceled(true); - //targetHelpsSequenceStarted = true; - - //editor = ApplicationPreferences.getEditor(activity.getApplicationContext()); - //editor.putBoolean(ActivatorListAdapter.PREF_START_TARGET_HELPS_FINISHED, false); - //editor.apply(); - //ApplicationPreferences.prefActivatorAdapterStartTargetHelpsFinished = false; sequence.start(); } @@ -443,7 +422,6 @@ public void onSequenceCanceled(TapTarget lastTarget) { PPApplicationStatic.recordException(e); } ActivatorTargetHelpsActivity.activity = null; - //ActivatorTargetHelpsActivity.activatorActivity = null; } }, 500); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatorListFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatorListFragment.java index 054ac78c97..d08d8214d6 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatorListFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivatorListFragment.java @@ -125,6 +125,7 @@ private void doOnViewCreated(View view/*, Bundle savedInstanceState*/) else { gridView = view.findViewById(R.id.act_prof_profiles_grid); try { + //noinspection DataFlowIssue gridView.setNumColumns(Integer.parseInt(ApplicationPreferences.applicationActivatorNumColums)); } catch (Exception e) { gridView.setNumColumns(3); @@ -159,9 +160,10 @@ private void doOnViewCreated(View view/*, Bundle savedInstanceState*/) //absListView.setRemoveListener(onRemove); activatedProfileHeader = view.findViewById(R.id.act_prof_header); - if (activatedProfileHeader != null) { - final LayoutTransition layoutTransition = ((ViewGroup) view.findViewById(R.id.layout_activator_list_fragment)) - .getLayoutTransition(); + if ((activatedProfileHeader != null) && (!applicationActivatorGridLayout)) { + ViewGroup activateListFragment = view.findViewById(R.id.layout_activator_list_fragment); + //noinspection DataFlowIssue + final LayoutTransition layoutTransition = activateListFragment.getLayoutTransition(); layoutTransition.enableTransitionType(LayoutTransition.CHANGING); absListView.setOnScrollListener(new HidingAbsListViewScrollListener() { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivityLogActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivityLogActivity.java index 35fd67dc36..33afd4e98c 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivityLogActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivityLogActivity.java @@ -1,11 +1,13 @@ package sk.henrichg.phoneprofilesplus; +import android.annotation.SuppressLint; import android.app.ActivityManager; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.database.Cursor; +import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; @@ -14,6 +16,7 @@ import android.view.Menu; import android.view.MenuItem; import android.view.View; +import android.widget.AdapterView; import android.widget.LinearLayout; import android.widget.ListView; import android.widget.TextView; @@ -21,6 +24,8 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.AlertDialog; import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.AppCompatSpinner; +import androidx.appcompat.widget.Toolbar; import androidx.core.content.ContextCompat; import java.lang.ref.WeakReference; @@ -33,6 +38,9 @@ public class ActivityLogActivity extends AppCompatActivity private LinearLayout progressLinearLayout; private ActivityLogAdapter activityLogAdapter; private TextView addedNewLogsText; + AppCompatSpinner filterSpinner; + + private int selectedFilter = 0; private SetAdapterAsyncTask setAdapterAsyncTask = null; @@ -60,9 +68,10 @@ public void onReceive( Context context, Intent intent ) { } private AddedActivityLogBroadcastReceiver addedActivityLogBroadcastReceiver; + @SuppressLint("RestrictedApi") @Override protected void onCreate(Bundle savedInstanceState) { - GlobalGUIRoutines.setTheme(this, false, false, false, false, false, false); // must by called before super.onCreate() + GlobalGUIRoutines.setTheme(this, false, true, false, false, false, false); // must by called before super.onCreate() //GlobalGUIRoutines.setLanguage(this); super.onCreate(savedInstanceState); @@ -70,6 +79,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_ppp_activity_log); setTaskDescription(new ActivityManager.TaskDescription(getString(R.string.ppp_app_name))); + Toolbar toolbar = findViewById(R.id.activity_log_toolbar); + setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -77,13 +88,105 @@ protected void onCreate(Bundle savedInstanceState) { getSupportActionBar().setElevation(0/*GlobalGUIRoutines.dpToPx(1)*/); } + filterSpinner = findViewById(R.id.activity_log_filter_spinner); + String[] filterItems = new String[] { + getString(R.string.activity_log_filter_all), + getString(R.string.activity_log_filter_blocked_calls), + getString(R.string.activity_log_filter_errors), + getString(R.string.activity_log_filter_event_start), + getString(R.string.activity_log_filter_event_end), + getString(R.string.activity_log_filter_event_stop), + getString(R.string.activity_log_filter_restart_events), + getString(R.string.activity_log_filter_profile_activations), + }; + PPSpinnerAdapter filterSpinnerAdapter = new PPSpinnerAdapter( + this, + R.layout.ppp_spinner_filter, + filterItems); + filterSpinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); + filterSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background); + //filterSpinner.setSupportBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all_editor)); +/* switch (appTheme) { + case "dark": + filterSpinner.setSupportBackgroundTintList(ContextCompat.getColorStateList(getBaseContext(), R.color.editorFilterTitleColor_dark)); + //filterSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background_dark); + break; + case "white": + filterSpinner.setSupportBackgroundTintList(ContextCompat.getColorStateList(getBaseContext(), R.color.editorFilterTitleColor_white)); + //filterSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background_white); + break; +// case "dlight": +// filterSpinner.setSupportBackgroundTintList(ContextCompat.getColorStateList(getBaseContext(), R.color.editorFilterTitleColor)); +// filterSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background_dlight); +// break; + default: + filterSpinner.setSupportBackgroundTintList(ContextCompat.getColorStateList(getBaseContext(), R.color.editorFilterTitleColor)); + //filterSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background_white); + break; + }*/ + //filterInitialized = false; + filterSpinner.setAdapter(filterSpinnerAdapter); +// filterSpinner.setEnabled(false); + filterSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { + + public void onItemSelected(AdapterView parent, View view, int position, long id) { + //if (!filterInitialized) { + // filterInitialized = true; + // return; + //} + if (filterSpinner.getAdapter() != null) { + //if (filterSpinner.getAdapter().getCount() <= position) + // position = 0; + ((PPSpinnerAdapter) filterSpinner.getAdapter()).setSelection(position); + } + + int selectedFilter; + switch (position) { + case 0: + //noinspection DuplicateBranchesInSwitch + selectedFilter = PPApplication.ALFILTER_ALL; + break; + case 1: + selectedFilter = PPApplication.ALFILTER_CALL_SCREENING_BLOCKED_CALL; + break; + case 2: + selectedFilter = PPApplication.ALFITER_ERRORS; + break; + case 3: + selectedFilter = PPApplication.ALFILTER_EVENT_START; + break; + case 4: + selectedFilter = PPApplication.ALFILTER_EVENT_END; + break; + case 5: + selectedFilter = PPApplication.ALFILTER_EVENT_STOP; + break; + case 6: + selectedFilter = PPApplication.ALFILTER_RESTART_EVENTS; + break; + case 7: + selectedFilter = PPApplication.ALFITER_PROFILE_ACTIVATION; + break; + default: + selectedFilter = PPApplication.ALFILTER_ALL; + } + selectFilterItem(selectedFilter); + } + + public void onNothingSelected(AdapterView parent) { + } + }); + + //addedNewLogs = false; addedNewLogsText = findViewById(R.id.activity_log_header_added_new_logs); + //noinspection DataFlowIssue addedNewLogsText.setVisibility(View.GONE); //dataWrapper = new DataWrapper(getApplicationContext(), false, 0, false, DataWrapper.IT_FOR_EDITOR, 0, 0f); listView = findViewById(R.id.activity_log_list); + //noinspection DataFlowIssue listView.setEmptyView(findViewById(R.id.activity_log_list_empty)); progressLinearLayout = findViewById(R.id.activity_log_linla_progress); listView.setVisibility(View.GONE); @@ -108,7 +211,7 @@ protected void onStart() { super.onStart(); setAdapterAsyncTask = - new SetAdapterAsyncTask(this, getApplicationContext()); + new SetAdapterAsyncTask(selectedFilter, this, getApplicationContext()); setAdapterAsyncTask.execute(); } @@ -153,7 +256,7 @@ public boolean onOptionsItemSelected(MenuItem item) { if (itemId == R.id.menu_activity_log_reload) { //addedNewLogs = false; addedNewLogsText.setVisibility(View.GONE); - activityLogAdapter.reload(getApplicationContext()/*dataWrapper*/); + activityLogAdapter.reload(getApplicationContext(), selectedFilter); listView.setSelection(0); return true; } @@ -169,7 +272,7 @@ public boolean onOptionsItemSelected(MenuItem item) { //addedNewLogs = false; addedNewLogsText.setVisibility(View.GONE); DatabaseHandler.getInstance(getApplicationContext()).clearActivityLog(); - activityLogAdapter.reload(getApplicationContext()/*dataWrapper*/); + activityLogAdapter.reload(getApplicationContext(), selectedFilter); }, null, null, @@ -178,6 +281,7 @@ public boolean onOptionsItemSelected(MenuItem item) { true, true, false, false, true, + false, this ); @@ -193,7 +297,7 @@ public boolean onOptionsItemSelected(MenuItem item) { PPApplicationStatic.setActivityLogEnabled(getApplicationContext(), !enabled); if (!enabled) PPApplicationStatic.addActivityLog(getApplicationContext(), PPApplication.ALTYPE_STARTED_LOGGING, null, null, ""); - activityLogAdapter.reload(getApplicationContext()/*dataWrapper*/); + activityLogAdapter.reload(getApplicationContext(), selectedFilter); listView.setSelection(0); invalidateOptionsMenu(); return true; @@ -215,37 +319,37 @@ public boolean onOptionsItemSelected(MenuItem item) { _value.append(StringConstants.TAG_BOLD_START_HTML).append(getString(R.string.activity_log_help_message_colors)).append(":").append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.TAG_BREAK_HTML); - int color = ContextCompat.getColor(this, R.color.altype_profile); + int color = ContextCompat.getColor(this, R.color.altypeProfileColor); String colorString = String.format(StringConstants.STR_FORMAT_INT, color).substring(2); // !!strip alpha value!! _value.append(String.format(StringConstants.TAG_FONT_COLOR_HTML, colorString, StringConstants.CHAR_SQUARE_HTML)); _value.append(StringConstants.CHAR_HARD_SPACE_HTML).append(StringConstants.CHAR_HARD_SPACE_HTML).append(getString(R.string.activity_log_help_message_colors_profile_activation)).append(StringConstants.TAG_BREAK_HTML); - color = ContextCompat.getColor(this, R.color.altype_eventStart); + color = ContextCompat.getColor(this, R.color.altypeEventStartColor); colorString = String.format(StringConstants.STR_FORMAT_INT, color).substring(2); // !!strip alpha value!! _value.append(String.format(StringConstants.TAG_FONT_COLOR_HTML, colorString, StringConstants.CHAR_SQUARE_HTML)); _value.append(StringConstants.CHAR_HARD_SPACE_HTML).append(StringConstants.CHAR_HARD_SPACE_HTML).append(getString(R.string.activity_log_help_message_colors_event_start)).append(StringConstants.TAG_BREAK_HTML); - color = ContextCompat.getColor(this, R.color.altype_eventEnd); + color = ContextCompat.getColor(this, R.color.altypeEventEndColor); colorString = String.format(StringConstants.STR_FORMAT_INT, color).substring(2); // !!strip alpha value!! _value.append(String.format(StringConstants.TAG_FONT_COLOR_HTML, colorString, StringConstants.CHAR_SQUARE_HTML)); _value.append(StringConstants.CHAR_HARD_SPACE_HTML).append(StringConstants.CHAR_HARD_SPACE_HTML).append(getString(R.string.activity_log_help_message_colors_event_end)).append(StringConstants.TAG_BREAK_HTML); - color = ContextCompat.getColor(this, R.color.altype_restartEvents); + color = ContextCompat.getColor(this, R.color.altypeRestartEventsColor); colorString = String.format(StringConstants.STR_FORMAT_INT, color).substring(2); // !!strip alpha value!! _value.append(String.format(StringConstants.TAG_FONT_COLOR_HTML, colorString, StringConstants.CHAR_SQUARE_HTML)); _value.append(StringConstants.CHAR_HARD_SPACE_HTML).append(StringConstants.CHAR_HARD_SPACE_HTML).append(getString(R.string.activity_log_help_message_colors_restart_events)).append(StringConstants.TAG_BREAK_HTML); - color = ContextCompat.getColor(this, R.color.altype_eventDelayStartEnd); + color = ContextCompat.getColor(this, R.color.altypeEventDelayStartEndColor); colorString = String.format(StringConstants.STR_FORMAT_INT, color).substring(2); // !!strip alpha value!! _value.append(String.format(StringConstants.TAG_FONT_COLOR_HTML, colorString, StringConstants.CHAR_SQUARE_HTML)); _value.append(StringConstants.CHAR_HARD_SPACE_HTML).append(StringConstants.CHAR_HARD_SPACE_HTML).append(getString(R.string.activity_log_help_message_colors_event_delay_start_end)).append(StringConstants.TAG_BREAK_HTML); - color = ContextCompat.getColor(this, R.color.altype_error); + color = ContextCompat.getColor(this, R.color.altypeErrorColor); colorString = String.format(StringConstants.STR_FORMAT_INT, color).substring(2); // !!strip alpha value!! _value.append(String.format(StringConstants.TAG_FONT_COLOR_HTML, colorString, StringConstants.CHAR_SQUARE_HTML)); _value.append(StringConstants.CHAR_HARD_SPACE_HTML).append(StringConstants.CHAR_HARD_SPACE_HTML).append(getString(R.string.activity_log_help_message_colors_error)).append(StringConstants.TAG_BREAK_HTML); - color = ContextCompat.getColor(this, R.color.altype_other); + color = ContextCompat.getColor(this, R.color.altypeOtherColor); colorString = String.format(StringConstants.STR_FORMAT_INT, color).substring(2); // !!strip alpha value!! _value.append(String.format(StringConstants.TAG_FONT_COLOR_HTML, colorString, StringConstants.CHAR_SQUARE_HTML)); _value.append(StringConstants.CHAR_HARD_SPACE_HTML).append(StringConstants.CHAR_HARD_SPACE_HTML).append(getString(R.string.activity_log_help_message_colors_others)); @@ -289,6 +393,7 @@ public boolean onOptionsItemSelected(MenuItem item) { _value.append(getString(R.string.activity_log_help_message_data_otherEventDataTypes)).append(":").append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.TAG_BREAK_HTML); _value.append(getString(R.string.activity_log_help_message_data_eventName_otherDataTypes)).append(StringConstants.TAG_LIST_END_LAST_ITEM_HTML); + //noinspection DataFlowIssue infoTextView.setText(StringFormatUtils.fromHtml(_value.toString(), true, false, 0, 0, true)); infoTextView.setClickable(true); @@ -342,17 +447,30 @@ protected void onDestroy() */ } + private void selectFilterItem(int selectedFilter) { + this.selectedFilter = selectedFilter; + + setAdapterAsyncTask = + new SetAdapterAsyncTask(selectedFilter, this, getApplicationContext()); + setAdapterAsyncTask.execute(); + + filterSpinner.setSelection(selectedFilter); + } + private static class SetAdapterAsyncTask extends AsyncTask { private final WeakReference contextWeakReference; private final WeakReference activityWeakReference; + final int _selectedFilter; Cursor activityLogCursor = null; - public SetAdapterAsyncTask(final ActivityLogActivity activity, + public SetAdapterAsyncTask(final int selectedFilter, + final ActivityLogActivity activity, final Context context) { this.contextWeakReference = new WeakReference<>(context); this.activityWeakReference = new WeakReference<>(activity); + this._selectedFilter = selectedFilter; } @Override @@ -360,7 +478,8 @@ protected Void doInBackground(Void... params) { Context context = contextWeakReference.get(); if (context != null) { - activityLogCursor = DatabaseHandler.getInstance(context.getApplicationContext()).getActivityLogCursor(); + activityLogCursor = + DatabaseHandler.getInstance(context.getApplicationContext()).getActivityLogCursor(_selectedFilter); } return null; @@ -379,9 +498,32 @@ protected void onPostExecute(Void result) { // Attach cursor adapter to the ListView activity.listView.setAdapter(activity.activityLogAdapter); + activity.activityLogAdapter.notifyDataSetChanged(); activity.progressLinearLayout.setVisibility(View.GONE); activity.listView.setVisibility(View.VISIBLE); + + activity.listView.setOnItemClickListener((parent, view, position, id) -> { + ActivityLogAdapter adapter = (ActivityLogAdapter) parent.getAdapter(); + Cursor cursor = adapter.getCursor(); + cursor.moveToPosition(position); + int logTypeIndex = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_LOG_TYPE); + int logType = cursor.getInt(logTypeIndex); + + if (logType == PPApplication.ALTYPE_CALL_SCREENING_BLOCKED_CALL) { +// Log.e("ActivityLogActivity.onItemClick", "blocked call"); + int telNumberIndex = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_PROFILE_NAME); + String telNumber = cursor.getString(telNumberIndex); +// Log.e("ActivityLogActivity.onItemClick", "telNumber="+telNumber); + if (!telNumber.isEmpty()) { + Intent intent = new Intent(Intent.ACTION_DIAL); + intent.setData(Uri.parse("tel:" + telNumber)); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + parent.getContext().startActivity(intent); +// Log.e("ActivityLogActivity.onItemClick", "dialer started"); + } + } + }); } } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivityLogAdapter.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivityLogAdapter.java index 7e18931121..b3b60f7a00 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivityLogAdapter.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivityLogAdapter.java @@ -3,6 +3,7 @@ import android.content.Context; import android.database.Cursor; import android.graphics.Color; +import android.graphics.Typeface; import android.util.SparseIntArray; import android.view.LayoutInflater; import android.view.View; @@ -17,14 +18,14 @@ class ActivityLogAdapter extends CursorAdapter { - private final int KEY_AL_ID; - private final int KEY_AL_LOG_DATE_TIME; - private final int KEY_AL_LOG_TYPE; - private final int KEY_AL_EVENT_NAME; - private final int KEY_AL_PROFILE_NAME; - //private final int KEY_AL_PROFILE_ICON; - //private final int KEY_AL_DURATION_DELAY; - private final int KEY_AL_PROFILE_EVENT_COUNT; + private final int KEY_AL_ID_COLUMN_IDX; + private final int KEY_AL_LOG_DATE_TIME_COLUMN_IDX; + private final int KEY_AL_LOG_TYPE_COLUMN_IDX; + private final int KEY_AL_EVENT_NAME_COLUMN_IDX; + private final int KEY_AL_PROFILE_NAME_COLUMN_IDX; + //private final int KEY_AL_PROFILE_ICON_COLUMN_IDX; + //private final int KEY_AL_DURATION_DELAY_COLUMN_IDX; + private final int KEY_AL_PROFILE_EVENT_COUNT_COLUMN_IDX; private final SparseIntArray activityTypeStrings = new SparseIntArray(); private final SparseIntArray activityTypeColors = new SparseIntArray(); @@ -32,14 +33,14 @@ class ActivityLogAdapter extends CursorAdapter { ActivityLogAdapter(Context context, Cursor cursor) { super(context, cursor, 0); - KEY_AL_ID = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_ID); - KEY_AL_LOG_DATE_TIME = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_LOG_DATE_TIME); - KEY_AL_LOG_TYPE = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_LOG_TYPE); - KEY_AL_EVENT_NAME = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_EVENT_NAME); - KEY_AL_PROFILE_NAME = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_PROFILE_NAME); + KEY_AL_ID_COLUMN_IDX = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_ID); + KEY_AL_LOG_DATE_TIME_COLUMN_IDX = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_LOG_DATE_TIME); + KEY_AL_LOG_TYPE_COLUMN_IDX = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_LOG_TYPE); + KEY_AL_EVENT_NAME_COLUMN_IDX = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_EVENT_NAME); + KEY_AL_PROFILE_NAME_COLUMN_IDX = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_PROFILE_NAME); //KEY_AL_PROFILE_ICON = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_PROFILE_ICON); //KEY_AL_DURATION_DELAY = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_DURATION_DELAY); - KEY_AL_PROFILE_EVENT_COUNT = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_PROFILE_EVENT_COUNT); + KEY_AL_PROFILE_EVENT_COUNT_COLUMN_IDX = cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_AL_PROFILE_EVENT_COUNT); //activityTypeStrings.put(PPApplication.ALTYPE_LOG_TOP, R.string.altype_logTop); activityTypeStrings.put(PPApplication.ALTYPE_PROFILE_ACTIVATION, R.string.altype_profileActivation); @@ -87,6 +88,7 @@ class ActivityLogAdapter extends CursorAdapter { activityTypeStrings.put(PPApplication.ALTYPE_PROFILE_ERROR_WIFI, R.string.altype_profileError_wifi); activityTypeStrings.put(PPApplication.ALTYPE_PROFILE_ERROR_WIFIAP, R.string.altype_profileError_wifiAP); activityTypeStrings.put(PPApplication.ALTYPE_PROFILE_ERROR_CLOSE_ALL_APPLICATIONS, R.string.altype_profileError_closeAllApplications); + activityTypeStrings.put(PPApplication.ALTYPE_PROFILE_ERROR_SEND_SMS, R.string.altype_profileError_sendSMS); activityTypeStrings.put(PPApplication.ALTYPE_DATA_EXPORT, R.string.altype_dataExport); activityTypeStrings.put(PPApplication.ALTYPE_ACTION_FROM_EXTERNAL_APP_PROFILE_ACTIVATION, R.string.altype_actionFromExternalApp_profileActivation); activityTypeStrings.put(PPApplication.ALTYPE_ACTION_FROM_EXTERNAL_APP_RESTART_EVENTS, R.string.altype_actionFromExternalApp_restartEvents); @@ -105,6 +107,8 @@ class ActivityLogAdapter extends CursorAdapter { activityTypeStrings.put(PPApplication.ALTYPE_EXTENDER_ACCESSIBILITY_SERVICE_ENABLED, R.string.altype_extender_accessibility_service_enabled); activityTypeStrings.put(PPApplication.ALTYPE_EXTENDER_ACCESSIBILITY_SERVICE_NOT_ENABLED, R.string.altype_extender_accessibility_service_not_enabled); activityTypeStrings.put(PPApplication.ALTYPE_EXTENDER_ACCESSIBILITY_SERVICE_UNBIND, R.string.altype_extender_accessibility_service_unbind); + activityTypeStrings.put(PPApplication.ALTYPE_CALL_SCREENING_BLOCKED_CALL, R.string.altype_callScreening_blockedCall); + activityTypeStrings.put(PPApplication.ALTYPE_APPLICATION_INSTALLATION, R.string.altype_applicationInstallation); //int otherColor = R.color.altype_other; /* @@ -120,7 +124,7 @@ class ActivityLogAdapter extends CursorAdapter { break; }*/ - int color = shiftColor(ContextCompat.getColor(context, R.color.altype_profile), context); + int color = shiftColor(ContextCompat.getColor(context, R.color.altypeProfileColor), context); activityTypeColors.put(PPApplication.ALTYPE_PROFILE_ACTIVATION, color); activityTypeColors.put(PPApplication.ALTYPE_MERGED_PROFILE_ACTIVATION, color); activityTypeColors.put(PPApplication.ALTYPE_AFTER_DURATION_UNDO_PROFILE, color); @@ -131,12 +135,12 @@ class ActivityLogAdapter extends CursorAdapter { activityTypeColors.put(PPApplication.ALTYPE_AFTER_END_OF_ACTIVATION_DEFAULT_PROFILE, color); activityTypeColors.put(PPApplication.ALTYPE_AFTER_END_OF_ACTIVATION_RESTART_EVENTS, color); activityTypeColors.put(PPApplication.ALTYPE_AFTER_END_OF_ACTIVATION_SPECIFIC_PROFILE, color); - color = shiftColor(ContextCompat.getColor(context, R.color.altype_eventStart), context); + color = shiftColor(ContextCompat.getColor(context, R.color.altypeEventStartColor), context); activityTypeColors.put(PPApplication.ALTYPE_EVENT_START, color); - color = shiftColor(ContextCompat.getColor(context, R.color.altype_eventDelayStartEnd), context); + color = shiftColor(ContextCompat.getColor(context, R.color.altypeEventDelayStartEndColor), context); activityTypeColors.put(PPApplication.ALTYPE_EVENT_START_DELAY, color); activityTypeColors.put(PPApplication.ALTYPE_EVENT_END_DELAY, color); - color = shiftColor(ContextCompat.getColor(context, R.color.altype_eventEnd), context); + color = shiftColor(ContextCompat.getColor(context, R.color.altypeEventEndColor), context); activityTypeColors.put(PPApplication.ALTYPE_EVENT_END_NONE, color); activityTypeColors.put(PPApplication.ALTYPE_EVENT_END_ACTIVATE_PROFILE, color); activityTypeColors.put(PPApplication.ALTYPE_EVENT_END_UNDO_PROFILE, color); @@ -144,10 +148,10 @@ class ActivityLogAdapter extends CursorAdapter { activityTypeColors.put(PPApplication.ALTYPE_EVENT_END_RESTART_EVENTS, color); activityTypeColors.put(PPApplication.ALTYPE_EVENT_END_ACTIVATE_PROFILE_RESTART_EVENTS, color); activityTypeColors.put(PPApplication.ALTYPE_EVENT_STOP, color); - color = shiftColor(ContextCompat.getColor(context, R.color.altype_restartEvents), context); + color = shiftColor(ContextCompat.getColor(context, R.color.altypeRestartEventsColor), context); activityTypeColors.put(PPApplication.ALTYPE_RESTART_EVENTS, color); activityTypeColors.put(PPApplication.ALTYPE_MANUAL_RESTART_EVENTS, color); - color = ContextCompat.getColor(context, R.color.altype_error); + color = ContextCompat.getColor(context, R.color.altypeErrorColor); activityTypeColors.put(PPApplication.ALTYPE_PROFILE_ERROR_RUN_APPLICATION_APPLICATION, color); activityTypeColors.put(PPApplication.ALTYPE_PROFILE_ERROR_RUN_APPLICATION_SHORTCUT, color); activityTypeColors.put(PPApplication.ALTYPE_PROFILE_ERROR_RUN_APPLICATION_INTENT, color); @@ -160,9 +164,10 @@ class ActivityLogAdapter extends CursorAdapter { activityTypeColors.put(PPApplication.ALTYPE_PROFILE_ERROR_WIFI, color); activityTypeColors.put(PPApplication.ALTYPE_PROFILE_ERROR_WIFIAP, color); activityTypeColors.put(PPApplication.ALTYPE_PROFILE_ERROR_CLOSE_ALL_APPLICATIONS, color); + activityTypeColors.put(PPApplication.ALTYPE_PROFILE_ERROR_SEND_SMS, color); activityTypeColors.put(PPApplication.ALTYPE_EXTENDER_ACCESSIBILITY_SERVICE_NOT_ENABLED, color); activityTypeColors.put(PPApplication.ALTYPE_EXTENDER_ACCESSIBILITY_SERVICE_UNBIND, color); - color = shiftColor(ContextCompat.getColor(context, R.color.altype_other), context); + color = shiftColor(ContextCompat.getColor(context, R.color.altypeOtherColor), context); //activityTypeColors.put(PPApplication.ALTYPE_LOG_TOP, color); activityTypeColors.put(PPApplication.ALTYPE_RUN_EVENTS_DISABLE, color); activityTypeColors.put(PPApplication.ALTYPE_RUN_EVENTS_ENABLE, color); @@ -191,10 +196,24 @@ class ActivityLogAdapter extends CursorAdapter { activityTypeColors.put(PPApplication.ALTYPE_EVENT_ADDED, color); activityTypeColors.put(PPApplication.ALTYPE_TIMEZONE_CHANGED, color); activityTypeColors.put(PPApplication.ALTYPE_EXTENDER_ACCESSIBILITY_SERVICE_ENABLED, color); + activityTypeColors.put(PPApplication.ALTYPE_CALL_SCREENING_BLOCKED_CALL, color); + activityTypeColors.put(PPApplication.ALTYPE_APPLICATION_INSTALLATION, color); } private void setRowData(MyRowViewHolder rowData, Cursor cursor, Context context) { - if (cursor.getInt(KEY_AL_ID) == -1) { + int logType = cursor.getInt(KEY_AL_LOG_TYPE_COLUMN_IDX); + + if (logType == PPApplication.ALTYPE_CALL_SCREENING_BLOCKED_CALL) { + rowData.logDateTime.setTypeface(null, Typeface.BOLD); + rowData.logType.setTypeface(null, Typeface.BOLD); + rowData.logData.setTypeface(null, Typeface.BOLD); + } else { + rowData.logDateTime.setTypeface(null, Typeface.NORMAL); + rowData.logType.setTypeface(null, Typeface.NORMAL); + rowData.logData.setTypeface(null, Typeface.NORMAL); + } + + if (cursor.getInt(KEY_AL_ID_COLUMN_IDX) == -1) { //Log.e("ActivityLogAdapter.setRowData", "KEY_AL_ID=-1"); rowData.logTypeColor.setBackgroundResource(R.color.activityBackgroundColor); rowData.logTypeColor.setAlpha(0); @@ -202,19 +221,21 @@ private void setRowData(MyRowViewHolder rowData, Cursor cursor, Context context) } else { //Log.e("ActivityLogAdapter.setRowData", "color="+activityTypeColors.get(cursor.getInt(KEY_AL_LOG_TYPE))); - rowData.logTypeColor.setBackgroundColor(activityTypeColors.get(cursor.getInt(KEY_AL_LOG_TYPE))); + rowData.logTypeColor.setBackgroundColor(activityTypeColors.get(cursor.getInt(KEY_AL_LOG_TYPE_COLUMN_IDX))); rowData.logTypeColor.setAlpha(1); - rowData.logDateTime.setText(StringFormatUtils.formatDateTime(context, cursor.getString(KEY_AL_LOG_DATE_TIME))); + rowData.logDateTime.setText(StringFormatUtils.formatDateTime(context, cursor.getString(KEY_AL_LOG_DATE_TIME_COLUMN_IDX))); } - int logType = cursor.getInt(KEY_AL_LOG_TYPE); String logTypeText; - if (cursor.getInt(KEY_AL_ID) == -1) { + if (cursor.getInt(KEY_AL_ID_COLUMN_IDX) == -1) { logTypeText = "---"; } else { logTypeText = context.getString(activityTypeStrings.get(logType)); + if (logType == PPApplication.ALTYPE_CALL_SCREENING_BLOCKED_CALL) { + logTypeText = "*** " + logTypeText + " ***"; + } if (logType == PPApplication.ALTYPE_MERGED_PROFILE_ACTIVATION) { - String profileEventCount = cursor.getString(KEY_AL_PROFILE_EVENT_COUNT); + String profileEventCount = cursor.getString(KEY_AL_PROFILE_EVENT_COUNT_COLUMN_IDX); if (profileEventCount != null) logTypeText = logTypeText + " " + profileEventCount; } @@ -222,14 +243,19 @@ private void setRowData(MyRowViewHolder rowData, Cursor cursor, Context context) rowData.logType.setText(logTypeText); String logData = ""; - String event_name = cursor.getString(KEY_AL_EVENT_NAME); - String profile_name = cursor.getString(KEY_AL_PROFILE_NAME); - if (event_name != null) - logData = logData + event_name; - if (profile_name != null) { - if (!logData.isEmpty()) - logData = logData + " "; - logData = logData + profile_name; + if (logType == PPApplication.ALTYPE_CALL_SCREENING_BLOCKED_CALL) { + logData = context.getString(R.string.activityLog_blockedCall_telNumber) + " " + + cursor.getString(KEY_AL_PROFILE_NAME_COLUMN_IDX); // in profile name is blocked tel. number + } else { + String event_name = cursor.getString(KEY_AL_EVENT_NAME_COLUMN_IDX); + String profile_name = cursor.getString(KEY_AL_PROFILE_NAME_COLUMN_IDX); + if (event_name != null) + logData = logData + event_name; + if (profile_name != null) { + if (!logData.isEmpty()) + logData = logData + " "; + logData = logData + profile_name; + } } rowData.logData.setText(logData); //rowData.eventName.setText(cursor.getString(KEY_AL_EVENT_NAME)); @@ -274,8 +300,9 @@ private static class MyRowViewHolder { //TextView profileName; } - void reload(Context context/*DataWrapper dataWrapper*/) { - changeCursor(DatabaseHandler.getInstance(/*dataWrapper.*/context.getApplicationContext()).getActivityLogCursor()); + void reload(Context context, int selectedFilter) { + changeCursor(DatabaseHandler.getInstance( + /*dataWrapper.*/context.getApplicationContext()).getActivityLogCursor(selectedFilter)); } private int shiftColor(int color, Context context) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AddEventAdapter.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AddEventAdapter.java index 72a59da8d3..6e828b2818 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AddEventAdapter.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AddEventAdapter.java @@ -237,7 +237,7 @@ public View getView(int position, View convertView, ViewGroup parent) String profileName = profileStartNamesArray[position]; if (position > 0) { profileName = "⊛ " + profileName; - holder.profileStartName.setTextColor(ContextCompat.getColor(context, R.color.error_color)); + holder.profileStartName.setTextColor(ContextCompat.getColor(context, R.color.errorColor)); } else holder.profileStartName.setTextColor(defaultColor); @@ -344,7 +344,7 @@ else if (event._atEndDo == Event.EATENDDO_RESTART_EVENTS) profileName = "⊛ " + StringConstants.STR_MANUAL_SPACE + profileName; else profileName = "⊛ " + profileName; - holder.profileEndName.setTextColor(ContextCompat.getColor(context, R.color.error_color)); + holder.profileEndName.setTextColor(ContextCompat.getColor(context, R.color.errorColor)); } else holder.profileEndName.setTextColor(defaultColor); //} diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AddEventDialog.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AddEventDialog.java index ddb7845c8f..c315146d00 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AddEventDialog.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AddEventDialog.java @@ -70,6 +70,7 @@ class AddEventDialog listView = layout.findViewById(R.id.event_pref_dlg_listview); help = layout.findViewById(R.id.event_pref_dlg_help); + //noinspection DataFlowIssue listView.setOnItemClickListener((parent, item, position, id) -> { AddEventViewHolder viewHolder = (AddEventViewHolder) item.getTag(); if (viewHolder != null) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AddProfileDialog.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AddProfileDialog.java index abf80477e5..8b9bbf3f74 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AddProfileDialog.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AddProfileDialog.java @@ -65,6 +65,7 @@ class AddProfileDialog listView = layout.findViewById(R.id.profile_pref_dlg_listview); + //noinspection DataFlowIssue listView.setOnItemClickListener((parent, item, position, id) -> { AddProfileViewHolder viewHolder = (AddProfileViewHolder) item.getTag(); if (viewHolder != null) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AlarmClockBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AlarmClockBroadcastReceiver.java index affcb09ef5..3ff2c601d7 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AlarmClockBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AlarmClockBroadcastReceiver.java @@ -41,7 +41,7 @@ public void onReceive(Context context, Intent intent) { wakeLock.acquire(10 * 60 * 1000); } -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] AlarmClockBroadcastReceiver.onReceive", "sensorType=SENSOR_TYPE_ALARM_CLOCK"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] AlarmClockBroadcastReceiver.onReceive", "SENSOR_TYPE_ALARM_CLOCK"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.setEventAlarmClockParameters(_time, alarmPackageName); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_ALARM_CLOCK}); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Application.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Application.java index 9440a5af95..3385051350 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Application.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Application.java @@ -259,7 +259,7 @@ public void writeToParcel(Parcel dest, int flags) { dest.writeInt(this.startApplicationDelay); } - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public static final Parcelable.Creator CREATOR = new Parcelable.Creator<>() { public Application createFromParcel(Parcel source) { return new Application(source); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationPreferences.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationPreferences.java index e805875e37..c5c0f69aa5 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationPreferences.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationPreferences.java @@ -51,6 +51,10 @@ class ApplicationPreferences { static volatile boolean prefEventRoamingDataInSIMSlot1; static volatile boolean prefEventRoamingNetworkInSIMSlot2; static volatile boolean prefEventRoamingDataInSIMSlot2; + //static volatile boolean prefEventCallScreeningActive; + static volatile long prefEventCallScreeningTime; + static volatile String prefEventCallScreeningPhoneNumber; + static volatile int prefEventCallScreeningCallDirection; static volatile boolean applicationEventNeverAskForEnableRun; static volatile boolean applicationNeverAskForGrantRoot; @@ -2030,43 +2034,51 @@ static void applicationIncreaseBrightnessForProfileIcon(Context context) { } */ - static final String PREF_APPLICATION_WIDGET_ICON_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE = "#fffcfcfc"; + static String PREF_APPLICATION_WIDGET_ICON_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE; static void applicationWidgetIconBackgroundColorNightModeOff(Context context) { + PREF_APPLICATION_WIDGET_ICON_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE = String.valueOf(context.getColor(R.color.widgetLightBackgroundColor)); applicationWidgetIconBackgroundColorNightModeOff = getSharedPreferences(context).getString(PREF_APPLICATION_WIDGET_ICON_BACKGROUND_COLOR_NIGHT_MODE_OFF, PREF_APPLICATION_WIDGET_ICON_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE); } - static final String PREF_APPLICATION_WIDGET_ICON_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE = "#ff1b1b1b"; + static String PREF_APPLICATION_WIDGET_ICON_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE; static void applicationWidgetIconBackgroundColorNightModeOn(Context context) { + PREF_APPLICATION_WIDGET_ICON_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE = String.valueOf(context.getColor(R.color.widgetDarkBackgroundColor)); applicationWidgetIconBackgroundColorNightModeOn = getSharedPreferences(context).getString(PREF_APPLICATION_WIDGET_ICON_BACKGROUND_COLOR_NIGHT_MODE_ON, PREF_APPLICATION_WIDGET_ICON_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE); } - static final String PREF_APPLICATION_WIDGET_ONE_ROW_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE = "#fffcfcfc"; + static String PREF_APPLICATION_WIDGET_ONE_ROW_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE; static void applicationWidgetOneRowBackgroundColorNightModeOff(Context context) { + PREF_APPLICATION_WIDGET_ONE_ROW_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE = String.valueOf(context.getColor(R.color.widgetLightBackgroundColor)); applicationWidgetOneRowBackgroundColorNightModeOff = getSharedPreferences(context).getString(PREF_APPLICATION_WIDGET_ONE_ROW_BACKGROUND_COLOR_NIGHT_MODE_OFF, PREF_APPLICATION_WIDGET_ONE_ROW_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE); } - static final String PREF_APPLICATION_WIDGET_ONE_ROW_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE = "#ff1b1b1b"; + static String PREF_APPLICATION_WIDGET_ONE_ROW_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE; static void applicationWidgetOneRowBackgroundColorNightModeOn(Context context) { + PREF_APPLICATION_WIDGET_ONE_ROW_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE = String.valueOf(context.getColor(R.color.widgetDarkBackgroundColor)); applicationWidgetOneRowBackgroundColorNightModeOn = getSharedPreferences(context).getString(PREF_APPLICATION_WIDGET_ONE_ROW_BACKGROUND_COLOR_NIGHT_MODE_ON, PREF_APPLICATION_WIDGET_ONE_ROW_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE); } - static final String PREF_APPLICATION_WIDGET_LIST_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE = "#fffcfcfc"; + static String PREF_APPLICATION_WIDGET_LIST_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE; static void applicationWidgetListBackgroundColorNightModeOff(Context context) { + PREF_APPLICATION_WIDGET_LIST_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE = String.valueOf(context.getColor(R.color.widgetLightBackgroundColor)); applicationWidgetListBackgroundColorNightModeOff = getSharedPreferences(context).getString(PREF_APPLICATION_WIDGET_LIST_BACKGROUND_COLOR_NIGHT_MODE_OFF, PREF_APPLICATION_WIDGET_LIST_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE); } - static final String PREF_APPLICATION_WIDGET_LIST_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE = "#ff1b1b1b"; + static String PREF_APPLICATION_WIDGET_LIST_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE; static void applicationWidgetListBackgroundColorNightModeOn(Context context) { + PREF_APPLICATION_WIDGET_LIST_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE = String.valueOf(context.getColor(R.color.widgetDarkBackgroundColor)); applicationWidgetListBackgroundColorNightModeOn = getSharedPreferences(context).getString(PREF_APPLICATION_WIDGET_LIST_BACKGROUND_COLOR_NIGHT_MODE_ON, PREF_APPLICATION_WIDGET_LIST_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE); } - static final String PREF_APPLICATION_SAMSUNG_EDGE_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE = "#fffcfcfc"; + static String PREF_APPLICATION_SAMSUNG_EDGE_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE; static void applicationSamsungEdgeBackgroundColorNightModeOff(Context context) { + PREF_APPLICATION_SAMSUNG_EDGE_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE = String.valueOf(context.getColor(R.color.widgetLightBackgroundColor)); applicationSamsungEdgeBackgroundColorNightModeOff = getSharedPreferences(context).getString(PREF_APPLICATION_SAMSUNG_EDGE_BACKGROUND_COLOR_NIGHT_MODE_OFF, PREF_APPLICATION_SAMSUNG_EDGE_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE); } - static final String PREF_APPLICATION_SAMSUNG_EDGE_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE = "#ff1b1b1b"; + static String PREF_APPLICATION_SAMSUNG_EDGE_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE; static void applicationSamsungEdgeBackgroundColorNightModeOn(Context context) { + PREF_APPLICATION_SAMSUNG_EDGE_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE = String.valueOf(context.getColor(R.color.widgetDarkBackgroundColor)); applicationSamsungEdgeBackgroundColorNightModeOn = getSharedPreferences(context).getString(PREF_APPLICATION_SAMSUNG_EDGE_BACKGROUND_COLOR_NIGHT_MODE_ON, PREF_APPLICATION_SAMSUNG_EDGE_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE); } @@ -2192,13 +2204,15 @@ static void applicationWidgetOneRowProfileListUseDynamicColors(Context context) applicationWidgetOneRowProfileListUseDynamicColors = getSharedPreferences(context).getBoolean(PREF_APPLICATION_WIDGET_ONE_ROW_PROFILE_LIST_USE_DYNAMIC_COLORS, PREF_APPLICATION_WIDGET_ONE_ROW_PROFILE_LIST_USE_DYNAMIC_COLORS_DEFAULT_VALUE); } - static final String PREF_APPLICATION_WIDGET_ONE_ROW_PROFILE_LIST_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE = "#fffcfcfc"; + static String PREF_APPLICATION_WIDGET_ONE_ROW_PROFILE_LIST_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE; static void applicationWidgetOneRowProfileListBackgroundColorNightModeOff(Context context) { + PREF_APPLICATION_WIDGET_ONE_ROW_PROFILE_LIST_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE = String.valueOf(context.getColor(R.color.widgetLightBackgroundColor)); applicationWidgetOneRowProfileListBackgroundColorNightModeOff = getSharedPreferences(context).getString(PREF_APPLICATION_WIDGET_ONE_ROW_PROFILE_LIST_BACKGROUND_COLOR_NIGHT_MODE_OFF, PREF_APPLICATION_WIDGET_ONE_ROW_PROFILE_LIST_BACKGROUND_COLOR_NIGHT_MODE_OFF_DEFAULT_VALUE); } - static final String PREF_APPLICATION_WIDGET_ONE_ROW_PROFILE_LIST_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE = "#ff1b1b1b"; + static String PREF_APPLICATION_WIDGET_ONE_ROW_PROFILE_LIST_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE; static void applicationWidgetOneRowProfileListBackgroundColorNightModeOn(Context context) { + PREF_APPLICATION_WIDGET_ONE_ROW_PROFILE_LIST_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE = String.valueOf(context.getColor(R.color.widgetDarkBackgroundColor)); applicationWidgetOneRowProfileListBackgroundColorNightModeOn = getSharedPreferences(context).getString(PREF_APPLICATION_WIDGET_ONE_ROW_PROFILE_LIST_BACKGROUND_COLOR_NIGHT_MODE_ON, PREF_APPLICATION_WIDGET_ONE_ROW_PROFILE_LIST_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsCache.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsCache.java index e8fb920288..1701d87bce 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsCache.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsCache.java @@ -248,7 +248,7 @@ void setApplicationIcon(Context context, Application application) if (activityName.isEmpty()) { try { ApplicationInfo app = packageManager.getApplicationInfo(application.packageName, PackageManager.MATCH_ALL); - if (app != null) + //if (app != null) dIcon = packageManager.getApplicationIcon(app); } catch (Exception ignored) {} } else { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsMultiSelectDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsMultiSelectDialogPreference.java index 1744fcf569..df46b2c5ed 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsMultiSelectDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsMultiSelectDialogPreference.java @@ -135,7 +135,8 @@ void getValueAMSDP() if ( application.packageName.equals(PPApplication.PACKAGE_NAME_PP) || application.packageName.equals(PPApplication.PACKAGE_NAME) || - application.packageName.equals(PPApplication.PACKAGE_NAME_EXTENDER) + application.packageName.equals(PPApplication.PACKAGE_NAME_EXTENDER) || + application.packageName.equals(PPApplication.PACKAGE_NAME_PPPPS) ) { applicationList.remove(i); continue; @@ -228,7 +229,7 @@ static String getSummaryForPreferenceCategory(String value, String systemSetting ApplicationInfo app; try { app = packageManager.getApplicationInfo(splits[0], PackageManager.MATCH_ALL); - if (app != null) + //if (app != null) prefDataSummary = packageManager.getApplicationLabel(app).toString(); } catch (PackageManager.NameNotFoundException e) { //PPApplicationStatic.recordException(e); @@ -252,9 +253,9 @@ static String getSummaryForPreferenceCategory(String value, String systemSetting private String getSummaryAMSDP() { - String prefDataSummary = getSummaryForPreferenceCategory(value, systemSettings, _context, true); - setSummary(prefDataSummary); - return prefDataSummary; + return /*String prefDataSummary =*/ getSummaryForPreferenceCategory(value, systemSettings, _context, true); + //setSummary(prefDataSummary); + //return prefDataSummary; } void setSummaryAMSDP() @@ -312,20 +313,22 @@ private void setIcons() { //int disabledColor = ContextCompat.getColor(_context, R.color.activityDisabledTextColor); - String[] splits = value.split(StringConstants.STR_SPLIT_REGEX); - if (splits.length == 1) { - packageIcon.setVisibility(View.VISIBLE); - packageIcon1.setImageResource(R.drawable.ic_empty); - packageIcon1.setAlpha(1f); - packageIcon2.setImageResource(R.drawable.ic_empty); - packageIcon2.setAlpha(1f); - packageIcon3.setImageResource(R.drawable.ic_empty); - packageIcon3.setAlpha(1f); - packageIcon4.setImageResource(R.drawable.ic_empty); - packageIcon4.setAlpha(1f); - packageIcons.setVisibility(View.GONE); - - boolean _setEnabled = false; + if (value != null) { + String[] splits = value.split(StringConstants.STR_SPLIT_REGEX); + + if ((value != null) && (splits.length == 1)) { + packageIcon.setVisibility(View.VISIBLE); + packageIcon1.setImageResource(R.drawable.ic_empty); + packageIcon1.setAlpha(1f); + packageIcon2.setImageResource(R.drawable.ic_empty); + packageIcon2.setAlpha(1f); + packageIcon3.setImageResource(R.drawable.ic_empty); + packageIcon3.setAlpha(1f); + packageIcon4.setImageResource(R.drawable.ic_empty); + packageIcon4.setAlpha(1f); + packageIcons.setVisibility(View.GONE); + + boolean _setEnabled = false; /*if (Application.isShortcut(splits[0])) { Intent intent = new Intent(); intent.setClassName(Application.getPackageName(splits[0]), Application.getActivityName(splits[0])); @@ -340,58 +343,55 @@ private void setIcons() { else if (Application.isIntent(splits[0])) { } - else*/ { - String activityName = Application.getActivityName(splits[0]); - if (activityName.isEmpty()) { - try { - app = packageManager.getApplicationInfo(splits[0], PackageManager.MATCH_ALL); - if (app != null) { - Drawable icon = packageManager.getApplicationIcon(app); - //CharSequence name = packageManager.getApplicationLabel(app); - packageIcon.setImageDrawable(icon); - _setEnabled = true; - } else { + else*/ + { + String activityName = Application.getActivityName(splits[0]); + if (activityName.isEmpty()) { + try { + app = packageManager.getApplicationInfo(splits[0], PackageManager.MATCH_ALL); + //if (app != null) { + Drawable icon = packageManager.getApplicationIcon(app); + //CharSequence name = packageManager.getApplicationLabel(app); + packageIcon.setImageDrawable(icon); + _setEnabled = true; + //} else { + // packageIcon.setImageResource(R.drawable.ic_empty); + //} + } catch (Exception e) { packageIcon.setImageResource(R.drawable.ic_empty); } - } catch (Exception e) { - packageIcon.setImageResource(R.drawable.ic_empty); + } else { + Intent intent = new Intent(); + intent.setClassName(Application.getPackageName(splits[0]), activityName); + ActivityInfo info = intent.resolveActivityInfo(packageManager, 0); + if (info != null) { + packageIcon.setImageDrawable(info.loadIcon(packageManager)); + _setEnabled = true; + } else + packageIcon.setImageResource(R.drawable.ic_empty); } } - else { - Intent intent = new Intent(); - intent.setClassName(Application.getPackageName(splits[0]), activityName); - ActivityInfo info = intent.resolveActivityInfo(packageManager, 0); - if (info != null) { - packageIcon.setImageDrawable(info.loadIcon(packageManager)); - _setEnabled = true; - } + if (_setEnabled) { + if (!isEnabled()) + packageIcon.setAlpha(0.35f); else - packageIcon.setImageResource(R.drawable.ic_empty); - } - } - if (_setEnabled) { - if (!isEnabled()) - packageIcon.setAlpha(0.35f); - else + packageIcon.setAlpha(1f); + } else packageIcon.setAlpha(1f); - } else + } else { + packageIcon.setVisibility(View.GONE); + packageIcons.setVisibility(View.VISIBLE); + packageIcon.setImageResource(R.drawable.ic_empty); packageIcon.setAlpha(1f); - } - else { - packageIcon.setVisibility(View.GONE); - packageIcons.setVisibility(View.VISIBLE); - packageIcon.setImageResource(R.drawable.ic_empty); - packageIcon.setAlpha(1f); - ImageView packIcon = packageIcon1; - for (int i = 0; i < 4; i++) - { - //if (i == 0) packIcon = packageIcon1; - if (i == 1) packIcon = packageIcon2; - if (i == 2) packIcon = packageIcon3; - if (i == 3) packIcon = packageIcon4; - if (i < splits.length) { - boolean _setEnabled = false; + ImageView packIcon = packageIcon1; + for (int i = 0; i < 4; i++) { + //if (i == 0) packIcon = packageIcon1; + if (i == 1) packIcon = packageIcon2; + if (i == 2) packIcon = packageIcon3; + if (i == 3) packIcon = packageIcon4; + if (i < splits.length) { + boolean _setEnabled = false; /*if (Application.isShortcut(splits[i])) { Intent intent = new Intent(); intent.setClassName(Application.getPackageName(splits[i]), Application.getActivityName(splits[i])); @@ -405,49 +405,52 @@ private void setIcons() { } else if (Application.isIntent(splits[i])) { - } else*/ { - String activityName = Application.getActivityName(splits[i]); - if (activityName.isEmpty()) { - try { - app = packageManager.getApplicationInfo(splits[i], PackageManager.MATCH_ALL); - if (app != null) { - Drawable icon = packageManager.getApplicationIcon(app); - //CharSequence name = packageManager.getApplicationLabel(app); - packIcon.setImageDrawable(icon); + } else*/ + { + String activityName = Application.getActivityName(splits[i]); + if (activityName.isEmpty()) { + try { + app = packageManager.getApplicationInfo(splits[i], PackageManager.MATCH_ALL); + //if (app != null) { + Drawable icon = packageManager.getApplicationIcon(app); + //CharSequence name = packageManager.getApplicationLabel(app); + packIcon.setImageDrawable(icon); + _setEnabled = true; + //} else { + // packIcon.setImageResource(R.drawable.ic_empty); + //} + } catch (Exception e) { + packIcon.setImageResource(R.drawable.ic_empty); + } + } else { + Intent intent = new Intent(); + intent.setClassName(Application.getPackageName(splits[i]), activityName); + ActivityInfo info = intent.resolveActivityInfo(packageManager, 0); + + if (info != null) { + packIcon.setImageDrawable(info.loadIcon(packageManager)); _setEnabled = true; } else { packIcon.setImageResource(R.drawable.ic_empty); } - } catch (Exception e) { - packIcon.setImageResource(R.drawable.ic_empty); } } - else { - Intent intent = new Intent(); - intent.setClassName(Application.getPackageName(splits[i]), activityName); - ActivityInfo info = intent.resolveActivityInfo(packageManager, 0); - - if (info != null) { - packIcon.setImageDrawable(info.loadIcon(packageManager)); - _setEnabled = true; - } else { - packIcon.setImageResource(R.drawable.ic_empty); - } - } - } - if (_setEnabled) { - if (!isEnabled()) - packIcon.setAlpha(0.35f); - else + if (_setEnabled) { + if (!isEnabled()) + packIcon.setAlpha(0.35f); + else + packIcon.setAlpha(1f); + } else packIcon.setAlpha(1f); - } else + } else { + packIcon.setImageResource(R.drawable.ic_empty); packIcon.setAlpha(1f); - } - else { - packIcon.setImageResource(R.drawable.ic_empty); - packIcon.setAlpha(1f); + } } } + } else { + packageIcon.setVisibility(View.GONE); + packageIcons.setVisibility(View.GONE); } } @@ -519,7 +522,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public ApplicationsMultiSelectDialogPreference.SavedState createFromParcel(Parcel in) { return new ApplicationsMultiSelectDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsMultiSelectDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsMultiSelectDialogPreferenceFragment.java index a453724b1e..8c81a06518 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsMultiSelectDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsMultiSelectDialogPreferenceFragment.java @@ -53,6 +53,7 @@ protected void onBindDialogView(@NonNull View view) { RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext()); FastScrollRecyclerView listView = view.findViewById(R.id.applications_multiselect_pref_dlg_listview); + //noinspection DataFlowIssue listView.setLayoutManager(layoutManager); listView.setHasFixedSize(true); @@ -67,6 +68,7 @@ protected void onBindDialogView(@NonNull View view) { */ final Button unselectAllButton = view.findViewById(R.id.applications_multiselect_pref_dlg_unselect_all); + //noinspection DataFlowIssue unselectAllButton.setOnClickListener(v -> { preference.value=""; refreshListView(false); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsMultiSelectDialogPreferenceViewHolder.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsMultiSelectDialogPreferenceViewHolder.java index 7f3f97e242..1539e55cbd 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsMultiSelectDialogPreferenceViewHolder.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ApplicationsMultiSelectDialogPreferenceViewHolder.java @@ -28,6 +28,7 @@ class ApplicationsMultiSelectDialogPreferenceViewHolder extends RecyclerView.Vie checkBox = itemView.findViewById(R.id.applications_multiselect_pref_dlg_item_checkbox); // If CheckBox is toggled, update the Application it is tagged with. + //noinspection DataFlowIssue checkBox.setOnClickListener(v -> { CheckBox cb = (CheckBox) v; Application application = (Application) cb.getTag(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AskForDurationActivateProfileDialog.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AskForDurationActivateProfileDialog.java index a55092eda7..03cf6c0908 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AskForDurationActivateProfileDialog.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AskForDurationActivateProfileDialog.java @@ -70,6 +70,7 @@ class AskForDurationActivateProfileDialog listView = layout.findViewById(R.id.profile_pref_dlg_listview); emptyList = layout.findViewById(R.id.profile_pref_dlg_empty); + //noinspection DataFlowIssue listView.setOnItemClickListener((parent, v, position, id) -> doOnItemSelected(position)); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AskForDurationDialog.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AskForDurationDialog.java index f199a24aa5..8920023163 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AskForDurationDialog.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AskForDurationDialog.java @@ -88,8 +88,10 @@ class AskForDurationDialog implements SeekBar.OnSeekBarChangeListener{ @SuppressLint("InflateParams") View titleView = layoutInflater.inflate(R.layout.custom_dialog_title_wtih_subtitle, null); TextView titleText = titleView.findViewById(R.id.custom_dialog_title); + //noinspection DataFlowIssue titleText.setText(activity.getString(R.string.profile_string_0) + StringConstants.STR_COLON_WITH_SPACE + profile._name); TextView subtitleText = titleView.findViewById(R.id.custom_dialog_subtitle); + //noinspection DataFlowIssue subtitleText.setText(activity.getString(R.string.profile_preferences_duration)); dialogBuilder.setCustomTitle(titleView); @@ -104,8 +106,11 @@ class AskForDurationDialog implements SeekBar.OnSeekBarChangeListener{ public void onClick(DialogInterface dialog, int which) { updateEndsTimer = null; + //noinspection DataFlowIssue int hours = mSeekBarHours.getProgress(); + //noinspection DataFlowIssue int minutes = mSeekBarMinutes.getProgress(); + //noinspection DataFlowIssue int seconds = mSeekBarSeconds.getProgress(); int iValue = (hours * 3600 + minutes * 60 + seconds); @@ -200,11 +205,13 @@ public void onClick(DialogInterface dialog, int which) { // }); afterDurationLabel = layout.findViewById(R.id.ask_for_duration_dlg_after_do_label); + //noinspection DataFlowIssue afterDurationLabel.setText(activity.getString(R.string.profile_preferences_afterDurationDo) + ":"); TextView mTextViewRange = layout.findViewById(R.id.duration_pref_dlg_range); mValue = layout.findViewById(R.id.duration_pref_dlg_value); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(mValue, activity.getString(R.string.duration_pref_dlg_edit_duration_tooltip)); mSeekBarHours = layout.findViewById(R.id.duration_pref_dlg_hours); mSeekBarMinutes = layout.findViewById(R.id.duration_pref_dlg_minutes); @@ -223,14 +230,17 @@ public void onClick(DialogInterface dialog, int which) { //minutes = (mMax % 3600) / 60; //seconds = mMax % 60; final String sMax = StringFormatUtils.getDurationString(mMax); + //noinspection DataFlowIssue mSeekBarHours.setMax(hours); //if (hours == 0) // mSeekBarMinutes.setMax(minutes); //else + //noinspection DataFlowIssue mSeekBarMinutes.setMax(59); //if ((hours == 0) && (minutes == 0)) // mSeekBarSeconds.setMax(seconds); //else + //noinspection DataFlowIssue mSeekBarSeconds.setMax(59); final String sMin = StringFormatUtils.getDurationString(mMin); int iValue = mProfile._duration; @@ -242,6 +252,7 @@ public void onClick(DialogInterface dialog, int which) { mSeekBarSeconds.setProgress(seconds); mValue.setText(StringFormatUtils.getDurationString(iValue)); + //noinspection DataFlowIssue mEnds.setText(StringFormatUtils.getEndsAsString(iValue)); mValueDialog = new TimeDurationPickerDialog(activity, (view, duration) -> { @@ -283,16 +294,18 @@ public void onClick(DialogInterface dialog, int which) { mSeekBarMinutes.setOnSeekBarChangeListener(this); mSeekBarSeconds.setOnSeekBarChangeListener(this); + //noinspection DataFlowIssue mTextViewRange.setText(sMin + " - " + sMax); afterDoSpinner = layout.findViewById(R.id.ask_for_duration_dlg_after_do_spinner); - HighlightedSpinnerAdapter spinnerAdapter = new HighlightedSpinnerAdapter( + PPSpinnerAdapter spinnerAdapter = new PPSpinnerAdapter( mActivity, - R.layout.spinner_highlighted, + R.layout.ppp_spinner, mActivity.getResources().getStringArray(R.array.afterProfileDurationDoArray)); - spinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + spinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); + //noinspection DataFlowIssue afterDoSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background); - afterDoSpinner.setBackgroundTintList(ContextCompat.getColorStateList(mActivity/*.getBaseContext()*/, R.color.highlighted_spinner_all)); +// afterDoSpinner.setBackgroundTintList(ContextCompat.getColorStateList(mActivity/*.getBaseContext()*/, R.color.spinner_control_color)); /*switch (ApplicationPreferences.applicationTheme(mActivity, true)) { case "dark": afterDoSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background_dark); @@ -316,7 +329,7 @@ public void onClick(DialogInterface dialog, int which) { afterDoSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View view, int position, long id) { - ((HighlightedSpinnerAdapter)afterDoSpinner.getAdapter()).setSelection(position); + ((PPSpinnerAdapter)afterDoSpinner.getAdapter()).setSelection(position); mAfterDo = Integer.parseInt(afterDoValues[position]); updateProfileView(); @@ -350,12 +363,15 @@ public void run() { profileView = layout.findViewById(R.id.ask_for_duration_dlg_profile); profileLabel = layout.findViewById(R.id.ask_for_duration_dlg_profile_label); + //noinspection DataFlowIssue profileLabel.setText(mActivity.getString(R.string.profile_preferences_afterDurationProfile) + ":"); profileName = layout.findViewById(R.id.ask_for_duration_dlg_profile_name); profileIcon = layout.findViewById(R.id.ask_for_duration_dlg_profile_icon); profileIndicators = layout.findViewById(R.id.ask_for_duration_dlg_profile_pref_indicator); if (!ApplicationPreferences.applicationEditorPrefIndicator) + //noinspection DataFlowIssue profileIndicators.setVisibility(View.GONE); + //noinspection DataFlowIssue profileView.setOnClickListener(v -> { AskForDurationActivateProfileDialog dialog = new AskForDurationActivateProfileDialog(mActivity, AskForDurationDialog.this); if (!mActivity.isFinishing()) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AutostartPermissionActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AutostartPermissionActivity.java index 180cec7c1d..0a1a6276cc 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AutostartPermissionActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/AutostartPermissionActivity.java @@ -1,15 +1,10 @@ package sk.henrichg.phoneprofilesplus; -import android.annotation.SuppressLint; -import android.content.Context; -import android.content.Intent; -import android.os.Bundle; - import androidx.appcompat.app.AppCompatActivity; -//import me.drakeet.support.toast.ToastCompat; public class AutostartPermissionActivity extends AppCompatActivity { +/* private boolean activityStarted = false; @SuppressLint("MissingPermission") @@ -86,6 +81,7 @@ protected void onStart() false, false, false, false, false, + false, this ); @@ -103,7 +99,7 @@ protected void onStart() // private boolean showNotStartedToast() { // boolean applicationStarted = PPApplicationStatic.getApplicationStarted(true); -// boolean fullyStarted = PPApplication.applicationFullyStarted /*&& (!PPApplication.applicationPackageReplaced)*/; +// boolean fullyStarted = PPApplication.applicationFullyStarted /*&& (!PPApplication.applicationPackageReplaced); // if (!applicationStarted) { // String text = getString(R.string.ppp_app_name) + " " + getString(R.string.application_is_not_started); // PPApplication.showToast(getApplicationContext(), text, Toast.LENGTH_SHORT); @@ -132,5 +128,5 @@ public void finish() super.finish(); overridePendingTransition(0, 0); } - +*/ } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BetterNumberPickerPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BetterNumberPickerPreference.java index def17f4433..cf368c1b51 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BetterNumberPickerPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BetterNumberPickerPreference.java @@ -136,7 +136,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public BetterNumberPickerPreference.SavedState createFromParcel(Parcel in) { return new BetterNumberPickerPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BetterNumberPickerPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BetterNumberPickerPreferenceFragment.java index df59f39959..dc0cc9336a 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BetterNumberPickerPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BetterNumberPickerPreferenceFragment.java @@ -36,6 +36,7 @@ protected void onBindDialogView(@NonNull View view) { mNumberPicker = view.findViewById(R.id.better_number_picker); // Initialize state + //noinspection DataFlowIssue mNumberPicker.setMin(BigDecimal.valueOf(preference.mMin)); mNumberPicker.setMax(BigDecimal.valueOf(preference.mMax)); mNumberPicker.setPlusMinusVisibility(View.INVISIBLE); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BitmapManipulator.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BitmapManipulator.java index cb9aba0fe3..c167b134a9 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BitmapManipulator.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BitmapManipulator.java @@ -350,10 +350,15 @@ static Bitmap recolorBitmap(Bitmap bitmap, int color/*, Context context*/) if (bitmap == null) return null; - Bitmap colorBitmap = Bitmap.createBitmap(bitmap.getWidth(), - bitmap.getHeight(), - bitmap.getConfig()); - //Config.ARGB_8888); + Bitmap colorBitmap; + if (bitmap.getConfig() == null) + colorBitmap = Bitmap.createBitmap(bitmap.getWidth(), + bitmap.getHeight(), + Bitmap.Config.ARGB_8888); + else + colorBitmap = Bitmap.createBitmap(bitmap.getWidth(), + bitmap.getHeight(), + bitmap.getConfig()); Canvas canvas = new Canvas(colorBitmap); Paint paint = new Paint(); @@ -429,9 +434,16 @@ static Bitmap grayScaleBitmap(Bitmap bitmap) if (bitmap == null) return null; - Bitmap monochromeBitmap = Bitmap.createBitmap(bitmap.getWidth(), - bitmap.getHeight(), - bitmap.getConfig()); + Bitmap monochromeBitmap; + if (bitmap.getConfig() == null) + monochromeBitmap = Bitmap.createBitmap(bitmap.getWidth(), + bitmap.getHeight(), + Bitmap.Config.ARGB_8888); + else + monochromeBitmap = Bitmap.createBitmap(bitmap.getWidth(), + bitmap.getHeight(), + bitmap.getConfig()); + Canvas canvas = new Canvas(monochromeBitmap); Paint paint = new Paint(); ColorMatrix colorMatrix = new ColorMatrix(); @@ -454,9 +466,16 @@ static Bitmap setBitmapBrightness(Bitmap bitmap, float brightness) 0, 0, 1f, 0, brightness, 0, 0, 0, 1f, 0}; - Bitmap newBitmap = Bitmap.createBitmap(bitmap.getWidth(), - bitmap.getHeight(), - bitmap.getConfig()); + Bitmap newBitmap; + if (bitmap.getConfig() == null) + newBitmap = Bitmap.createBitmap(bitmap.getWidth(), + bitmap.getHeight(), + Bitmap.Config.ARGB_8888); + else + newBitmap = Bitmap.createBitmap(bitmap.getWidth(), + bitmap.getHeight(), + bitmap.getConfig()); + Canvas canvas = new Canvas(newBitmap); Paint paint = new Paint(); ColorMatrix colorMatrix = new ColorMatrix(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectedDevicesDetector.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectedDevicesDetector.java index 983945a69d..58ff3fe45b 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectedDevicesDetector.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectedDevicesDetector.java @@ -1,22 +1,34 @@ package sk.henrichg.phoneprofilesplus; +import android.Manifest; import android.annotation.SuppressLint; import android.bluetooth.BluetoothA2dp; import android.bluetooth.BluetoothAdapter; import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothGatt; import android.bluetooth.BluetoothGattServer; +import android.bluetooth.BluetoothHapClient; import android.bluetooth.BluetoothHeadset; import android.bluetooth.BluetoothHealth; import android.bluetooth.BluetoothHearingAid; -import android.bluetooth.BluetoothManager; +import android.bluetooth.BluetoothHidDevice; +import android.bluetooth.BluetoothLeAudio; import android.bluetooth.BluetoothProfile; +import android.bluetooth.BluetoothSap; import android.content.Context; import android.os.Build; +import android.util.Log; +import androidx.work.ExistingWorkPolicy; +import androidx.work.OneTimeWorkRequest; +import androidx.work.WorkManager; + +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.Calendar; import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; class BluetoothConnectedDevicesDetector { @@ -26,25 +38,31 @@ class BluetoothConnectedDevicesDetector { private static volatile BluetoothHearingAid bluetoothHearingAid = null; private static volatile BluetoothGatt bluetoothGatt = null; private static volatile BluetoothGattServer bluetoothGattServer = null; + private static volatile BluetoothHapClient bluetoothHapClient = null; + private static volatile BluetoothHidDevice bluetoothHidDevice = null; + private static volatile BluetoothLeAudio bluetoothLeAudio = null; + private static volatile BluetoothSap bluetoothSap = null; private static volatile BluetoothProfile.ServiceListener profileListener = null; + private static Context appContext = null; + @SuppressLint("MissingPermission") - static void getConnectedDevices(final Context context/*, final boolean _callEventHandler*/) { + static void getConnectedDevices(final Context context, final boolean _callEventHandler) { final BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); //BluetoothScanWorker.getBluetoothAdapter(context); if (bluetoothAdapter != null) { - if (!bluetoothAdapter.isEnabled()) { + appContext = context.getApplicationContext(); - final Context appContext = context.getApplicationContext(); - - BluetoothConnectionBroadcastReceiver.clearConnectedDevices(/*appContext, false*/); + if (!bluetoothAdapter.isEnabled()) { + List connectedDevices = BluetoothConnectionBroadcastReceiver.getConnectedDevices(appContext); + BluetoothConnectionBroadcastReceiver.clearConnectedDevices(connectedDevices/*appContext, false*/); // this also clears shared preferences - BluetoothConnectionBroadcastReceiver.saveConnectedDevices(appContext); - //if (_callEventHandler) - // callEventHandler(appContext); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); + if (_callEventHandler) + callEventHandler(); -// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.getConnectedDevices", "(xxx) END of getConnectedDevices"); +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.getConnectedDevices", "(BT not enabled) END of getConnectedDevices"); return; } @@ -55,25 +73,28 @@ static void getConnectedDevices(final Context context/*, final boolean _callEven profileListener = new BluetoothProfile.ServiceListener() { public void onServiceConnected(int profile, BluetoothProfile proxy) { -// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.getConnectedDevices", "[1] start of onServiceConnected"); +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "[1] start of onServiceConnected"); + + final List connectedDevices = BluetoothConnectionBroadcastReceiver.getConnectedDevices(appContext); + //BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); if (profile == BluetoothProfile.HEADSET) { // PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "BluetoothProfile.HEADSET"); bluetoothHeadset = (BluetoothHeadset) proxy; // PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "bluetoothHeadset="+bluetoothHeadset); - final Context appContext = context.getApplicationContext(); + //final Context appContext = context.getApplicationContext(); if (bluetoothHeadset != null) { try { - List devices = bluetoothHeadset.getConnectedDevices(); - final List connectedDevices = new ArrayList<>(); -// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "devices="+devices); - addConnectedDevices(devices, connectedDevices); - BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices); - BluetoothConnectionBroadcastReceiver.saveConnectedDevices(appContext); - //if (_callEventHandler) - // callEventHandler(appContext); + List detectedDevices = bluetoothHeadset.getConnectedDevices(); + final List connectedDevicesToAdd = new ArrayList<>(); +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "detectedDevices="+detectedDevices); + addConnectedDevices(detectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); + if (_callEventHandler && (!detectedDevices.isEmpty())) + callEventHandler(); } catch (Exception e) { // not log this, profile may not exists //Log.e("BluetoothConnectedDevicesDetector.getConnectedDevices", Log.getStackTraceString(e)); @@ -87,19 +108,19 @@ public void onServiceConnected(int profile, BluetoothProfile proxy) { bluetoothHealth = (BluetoothHealth) proxy; // PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "bluetoothHealth="+bluetoothHealth); - final Context appContext = context.getApplicationContext(); + //final Context appContext = context.getApplicationContext(); if (bluetoothHealth != null) { try { @SuppressWarnings("deprecation") - List devices = bluetoothHealth.getConnectedDevices(); - final List connectedDevices = new ArrayList<>(); -// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "devices="+devices); - addConnectedDevices(devices, connectedDevices); - BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices); - BluetoothConnectionBroadcastReceiver.saveConnectedDevices(appContext); - //if (_callEventHandler) - // callEventHandler(appContext); + List detectedDevices = bluetoothHealth.getConnectedDevices(); + final List connectedDevicesToAdd = new ArrayList<>(); +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "detectedDevices="+detectedDevices); + addConnectedDevices(detectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); + if (_callEventHandler && (!detectedDevices.isEmpty())) + callEventHandler(); } catch (Exception e) { // not log this, profile may not exists //Log.e("BluetoothConnectedDevicesDetector.getConnectedDevices", Log.getStackTraceString(e)); @@ -113,18 +134,18 @@ public void onServiceConnected(int profile, BluetoothProfile proxy) { bluetoothA2dp = (BluetoothA2dp) proxy; // PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "bluetoothA2dp="+bluetoothA2dp); - final Context appContext = context.getApplicationContext(); + //final Context appContext = context.getApplicationContext(); if (bluetoothA2dp != null) { try { - List devices = bluetoothA2dp.getConnectedDevices(); - final List connectedDevices = new ArrayList<>(); -// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "devices="+devices); - addConnectedDevices(devices, connectedDevices); - BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices); - BluetoothConnectionBroadcastReceiver.saveConnectedDevices(appContext); - //if (_callEventHandler) - // callEventHandler(appContext); + List detectedDevices = bluetoothA2dp.getConnectedDevices(); + final List connectedDevicesToAdd = new ArrayList<>(); +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "detectedDevices="+detectedDevices); + addConnectedDevices(detectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); + if (_callEventHandler && (!detectedDevices.isEmpty())) + callEventHandler(); } catch (Exception e) { // not log this, profile may not exists //Log.e("BluetoothConnectedDevicesDetector.getConnectedDevices", Log.getStackTraceString(e)); @@ -139,18 +160,18 @@ public void onServiceConnected(int profile, BluetoothProfile proxy) { bluetoothHearingAid = (BluetoothHearingAid) proxy; // PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "bluetoothHearingAid=" + bluetoothHearingAid); - final Context appContext = context.getApplicationContext(); + //final Context appContext = context.getApplicationContext(); if (bluetoothHearingAid != null) { try { - List devices = bluetoothHearingAid.getConnectedDevices(); - final List connectedDevices = new ArrayList<>(); -// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "devices=" + devices); - addConnectedDevices(devices, connectedDevices); - BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices); - BluetoothConnectionBroadcastReceiver.saveConnectedDevices(appContext); - //if (_callEventHandler) - // callEventHandler(appContext); + List detectedDevices = bluetoothHearingAid.getConnectedDevices(); + final List connectedDevicesToAdd = new ArrayList<>(); +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "detectedDevices="+detectedDevices); + addConnectedDevices(detectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); + if (_callEventHandler && (!detectedDevices.isEmpty())) + callEventHandler(); } catch (Exception e) { // not log this, profile may not exists //Log.e("BluetoothConnectedDevicesDetector.getConnectedDevices", Log.getStackTraceString(e)); @@ -165,19 +186,19 @@ public void onServiceConnected(int profile, BluetoothProfile proxy) { bluetoothGatt = (BluetoothGatt) proxy; // PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "bluetoothGatt=" + bluetoothGatt); - final Context appContext = context.getApplicationContext(); + //final Context appContext = context.getApplicationContext(); if (bluetoothGatt != null) { try { //noinspection deprecation - List devices = bluetoothGatt.getConnectedDevices(); - final List connectedDevices = new ArrayList<>(); -// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "devices=" + devices); - addConnectedDevices(devices, connectedDevices); - BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices); - BluetoothConnectionBroadcastReceiver.saveConnectedDevices(appContext); - //if (_callEventHandler) - // callEventHandler(appContext); + List detectedDevices = bluetoothGatt.getConnectedDevices(); + final List connectedDevicesToAdd = new ArrayList<>(); +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "detectedDevices="+detectedDevices); + addConnectedDevices(detectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); + if (_callEventHandler && (!detectedDevices.isEmpty())) + callEventHandler(); } catch (Exception e) { // not log this, profile may not exists //Log.e("BluetoothConnectedDevicesDetector.getConnectedDevices", Log.getStackTraceString(e)); @@ -191,18 +212,18 @@ public void onServiceConnected(int profile, BluetoothProfile proxy) { bluetoothGattServer = (BluetoothGattServer) proxy; // PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "bluetoothGattServer=" + bluetoothGattServer); - final Context appContext = context.getApplicationContext(); + //final Context appContext = context.getApplicationContext(); if (bluetoothGattServer != null) { try { - List devices = bluetoothGattServer.getConnectedDevices(); - final List connectedDevices = new ArrayList<>(); -// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "devices=" + devices); - addConnectedDevices(devices, connectedDevices); - BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices); - BluetoothConnectionBroadcastReceiver.saveConnectedDevices(appContext); - //if (_callEventHandler) - // callEventHandler(appContext); + List detectedDevices = bluetoothGattServer.getConnectedDevices(); + final List connectedDevicesToAdd = new ArrayList<>(); +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "detectedDevices="+detectedDevices); + addConnectedDevices(detectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); + if (_callEventHandler && (!detectedDevices.isEmpty())) + callEventHandler(); } catch (Exception e) { // not log this, profile may not exists //Log.e("BluetoothConnectedDevicesDetector.getConnectedDevices", Log.getStackTraceString(e)); @@ -211,6 +232,113 @@ public void onServiceConnected(int profile, BluetoothProfile proxy) { bluetoothAdapter.closeProfileProxy(BluetoothProfile.GATT_SERVER, bluetoothGattServer); } } + if (Build.VERSION.SDK_INT >= 33) { + if (profile == BluetoothProfile.HAP_CLIENT) { +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "BluetoothProfile.HAP_CLIENT"); + bluetoothHapClient = (BluetoothHapClient) proxy; +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "bluetoothHapClient=" + bluetoothHapClient); + + //final Context appContext = context.getApplicationContext(); + + if (bluetoothHapClient != null) { + try { + List detectedDevices = bluetoothHapClient.getConnectedDevices(); + final List connectedDevicesToAdd = new ArrayList<>(); +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "detectedDevices="+detectedDevices); + addConnectedDevices(detectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); + if (_callEventHandler && (!detectedDevices.isEmpty())) + callEventHandler(); + } catch (Exception e) { + // not log this, profile may not exists + //Log.e("BluetoothConnectedDevicesDetector.getConnectedDevices", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } + bluetoothAdapter.closeProfileProxy(BluetoothProfile.HAP_CLIENT, bluetoothHapClient); + } + } + } + if (Build.VERSION.SDK_INT >= 28) { + if (profile == BluetoothProfile.HID_DEVICE) { +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "BluetoothProfile.HID_DEVICE"); + bluetoothHidDevice = (BluetoothHidDevice) proxy; +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "bluetoothHidDevice=" + bluetoothHidDevice); + + //final Context appContext = context.getApplicationContext(); + + if (bluetoothHidDevice != null) { + try { + List detectedDevices = bluetoothHidDevice.getConnectedDevices(); + final List connectedDevicesToAdd = new ArrayList<>(); +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "detectedDevices="+detectedDevices); + addConnectedDevices(detectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); + if (_callEventHandler && (!detectedDevices.isEmpty())) + callEventHandler(); + } catch (Exception e) { + // not log this, profile may not exists + //Log.e("BluetoothConnectedDevicesDetector.getConnectedDevices", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } + bluetoothAdapter.closeProfileProxy(BluetoothProfile.HID_DEVICE, bluetoothHidDevice); + } + } + } + if (Build.VERSION.SDK_INT >= 33) { + if (profile == BluetoothProfile.LE_AUDIO) { +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "BluetoothProfile.LE_AUDIO"); + bluetoothLeAudio = (BluetoothLeAudio) proxy; +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "bluetoothLeAudio=" + bluetoothLeAudio); + + //final Context appContext = context.getApplicationContext(); + + if (bluetoothLeAudio != null) { + try { + List detectedDevices = bluetoothLeAudio.getConnectedDevices(); + final List connectedDevicesToAdd = new ArrayList<>(); +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "detectedDevices="+detectedDevices); + addConnectedDevices(detectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); + if (_callEventHandler && (!detectedDevices.isEmpty())) + callEventHandler(); + } catch (Exception e) { + // not log this, profile may not exists + //Log.e("BluetoothConnectedDevicesDetector.getConnectedDevices", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } + bluetoothAdapter.closeProfileProxy(BluetoothProfile.LE_AUDIO, bluetoothLeAudio); + } + } + } + if (profile == BluetoothProfile.SAP) { +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "BluetoothProfile.SAP"); + bluetoothSap = (BluetoothSap) proxy; +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "bluetoothSap=" + bluetoothSap); + + //final Context appContext = context.getApplicationContext(); + + if (bluetoothSap != null) { + try { + List detectedDevices = bluetoothSap.getConnectedDevices(); + final List connectedDevicesToAdd = new ArrayList<>(); +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.onServiceConnected", "detectedDevices="+detectedDevices); + addConnectedDevices(detectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); + if (_callEventHandler && (!detectedDevices.isEmpty())) + callEventHandler(); + } catch (Exception e) { + // not log this, profile may not exists + //Log.e("BluetoothConnectedDevicesDetector.getConnectedDevices", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } + bluetoothAdapter.closeProfileProxy(BluetoothProfile.SAP, bluetoothSap); + } + } + } public void onServiceDisconnected(int profile) { @@ -232,6 +360,18 @@ public void onServiceDisconnected(int profile) { if (profile == BluetoothProfile.GATT_SERVER) { bluetoothGattServer = null; } + if (profile == BluetoothProfile.HAP_CLIENT) { + bluetoothHapClient = null; + } + if (profile == BluetoothProfile.HID_DEVICE) { + bluetoothHidDevice = null; + } + if (profile == BluetoothProfile.LE_AUDIO) { + bluetoothLeAudio = null; + } + if (profile == BluetoothProfile.SAP) { + bluetoothSap = null; + } } }; } @@ -243,45 +383,72 @@ public void onServiceDisconnected(int profile) { bluetoothHearingAid = null; bluetoothGatt = null; bluetoothGattServer = null; + bluetoothHapClient = null; + bluetoothHidDevice = null; + bluetoothLeAudio = null; + bluetoothSap = null; - final Context appContext = context.getApplicationContext(); + //final Context appContext = context.getApplicationContext(); - BluetoothConnectionBroadcastReceiver.clearConnectedDevices(/*appContext, false*/); + List _connectedDevices = new ArrayList<>(); + BluetoothConnectionBroadcastReceiver.clearConnectedDevices(_connectedDevices/*appContext, false*/); // this also clears shared preferences - BluetoothConnectionBroadcastReceiver.saveConnectedDevices(appContext); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(_connectedDevices, appContext); //if (_callEventHandler) // callEventHandler(appContext); - bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.A2DP); - bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.HEADSET); - if (Build.VERSION.SDK_INT < 29) { - bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.HEALTH); - } - if (Build.VERSION.SDK_INT >= 29) { - bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.HEARING_AID); - } - bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.GATT); - bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.GATT_SERVER); - - final BluetoothManager bluetoothManager = (BluetoothManager) context.getSystemService(Context.BLUETOOTH_SERVICE); - if (bluetoothManager != null) { - final List connectedDevices = new ArrayList<>(); - //final Context appContext = context.getApplicationContext(); - List devices; +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.getConnectedDevices", "*** start of profilelisener ***"); - devices = bluetoothManager.getConnectedDevices(BluetoothProfile.GATT); - addConnectedDevices(devices, connectedDevices); + if (Permissions.hasPermission(context, Manifest.permission.BLUETOOTH)) { + if (bluetoothAdapter.getState() == BluetoothAdapter.STATE_ON) { - devices = bluetoothManager.getConnectedDevices(BluetoothProfile.GATT_SERVER); - addConnectedDevices(devices, connectedDevices); + // workaround for check connection status of bounded devices + // working also for BLE devices + @SuppressLint("MissingPermission") + Set boundedDevices = bluetoothAdapter.getBondedDevices(); + if (boundedDevices != null) { + boolean deviceDetected = false; + for (BluetoothDevice boundedDevice : boundedDevices) { + try { + Method m = BluetoothDevice.class.getMethod("isConnected"); + Boolean o = (Boolean) m.invoke(boundedDevice); + if ((o != null) && o) { + deviceDetected = true; +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.getConnectedDevices", "(****) device connected=" + boundedDevice.getName()); +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.getConnectedDevices", "(****) address=" + boundedDevice.getAddress()); + final List connectedDevicesToAdd = new ArrayList<>(); + List detectedDevices = new ArrayList<>(); + detectedDevices.add(boundedDevice); + addConnectedDevices(detectedDevices, connectedDevicesToAdd); + final List connectedDevices = BluetoothConnectionBroadcastReceiver.getConnectedDevices(appContext); + BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices, connectedDevicesToAdd); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); + } + } catch (Exception e) { + Log.e("BluetoothConnectedDevicesDetector.getConnectedDevices", Log.getStackTraceString(e)); + } + } + if (_callEventHandler && deviceDetected) + callEventHandler(); + } -// devices = bluetoothManager.getConnectedDevices(BluetoothProfile.SAP); -// addConnectedDevices(devices, connectedDevices); + bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.A2DP); + bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.HEADSET); + //if (Build.VERSION.SDK_INT < 29) + bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.HEALTH); + if (Build.VERSION.SDK_INT >= 29) + bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.HEARING_AID); + bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.GATT); + bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.GATT_SERVER); + if (Build.VERSION.SDK_INT >= 33) + bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.HAP_CLIENT); + if (Build.VERSION.SDK_INT >= 28) + bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.HID_DEVICE); + if (Build.VERSION.SDK_INT >= 33) + bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.LE_AUDIO); + bluetoothAdapter.getProfileProxy(context, profileListener, BluetoothProfile.SAP); - BluetoothConnectionBroadcastReceiver.addConnectedDeviceData(connectedDevices); - BluetoothConnectionBroadcastReceiver.saveConnectedDevices(appContext); - //if (_callEventHandler) - // callEventHandler(appContext); + } } // PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.getConnectedDevices", "[1] END of getConnectedDevices"); @@ -297,29 +464,23 @@ public void onServiceDisconnected(int profile) { private static void addConnectedDevices(List detectedDevices, List connectedDevices) { //synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { - for (BluetoothDevice detecedDevice : detectedDevices) { -// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.addConnectedDevices", "detecedDevice.name="+detecedDevice.getName()); -// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.addConnectedDevices", "detecedDevice.address="+detecedDevice.getAddress()); -// Log.e("BluetoothConnectedDevicesDetector.addConnectedDevices", "[1] detecedDevice.name="+detecedDevice.getName()); -// Log.e("BluetoothConnectedDevicesDetector.addConnectedDevices", "[1] detecedDevice.address="+detecedDevice.getAddress()); - + for (BluetoothDevice detectedDevice : detectedDevices) { boolean found = false; - String detectedName = detecedDevice.getAddress(); - if (!detectedName.isEmpty()) { + String detectedName = detectedDevice.getName(); + String detectedAddress = detectedDevice.getAddress(); + if (!detectedAddress.isEmpty()) { // do not add device without name - String detectedAddress = detecedDevice.getAddress(); - if (!detectedAddress.isEmpty()) { - for (BluetoothDeviceData connectedDevice : connectedDevices) { - if ((!connectedDevice.getAddress().isEmpty()) && - connectedDevice.getAddress().equals(detectedAddress)) { - found = true; - break; - } + //String detectedAddress = detecedDevice.getAddress(); + for (BluetoothDeviceData connectedDevice : connectedDevices) { + if ((!connectedDevice.getAddress().isEmpty()) && + connectedDevice.getAddress().equals(detectedAddress)) { + found = true; + break; } } - if (!found) { + if ((!found) && (detectedName != null) && (!detectedName.isEmpty())){ for (BluetoothDeviceData connectedDevice : connectedDevices) { String connectedName = connectedDevice.getName(); if ((!connectedName.isEmpty()) && @@ -333,54 +494,56 @@ private static void addConnectedDevices(List detectedDevices, L int gmtOffset = 0; //TimeZone.getDefault().getRawOffset(); Calendar now = Calendar.getInstance(); long timestamp = now.getTimeInMillis() - gmtOffset; - connectedDevices.add(new BluetoothDeviceData(detecedDevice.getName(), detecedDevice.getAddress(), - BluetoothScanWorker.getBluetoothType(detecedDevice), false, timestamp, false, false)); + connectedDevices.add(new BluetoothDeviceData(detectedName, detectedAddress, + BluetoothScanWorker.getBluetoothType(detectedDevice), false, timestamp, false, false)); } } } //} } - /* - static boolean isBluetoothConnected(List connectedDevices, BluetoothDeviceData deviceData, String sensorDeviceName) - { - //synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { - if ((deviceData == null) && sensorDeviceName.isEmpty()) - return (connectedDevices != null) && (connectedDevices.size() > 0); - else { - if (connectedDevices != null) { - if (deviceData != null) { - boolean found = false; - for (BluetoothDeviceData _device : connectedDevices) { - if (_device.address.equals(deviceData.getAddress())) { - found = true; - break; - } - } - if (!found) { - for (BluetoothDeviceData _device : connectedDevices) { - if (_device.getName().equalsIgnoreCase(deviceData.getName())) { - found = true; - break; - } - } - } - return found; - } - else { - for (BluetoothDeviceData _device : connectedDevices) { - String device = _device.getName().toUpperCase(); - String _adapterName = sensorDeviceName.toUpperCase(); - if (Wildcard.match(device, _adapterName, '_', '%', true)) { - return true; - } - } - } - } - return false; + private static void callEventHandler() { +// PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.callEventHandler", "xxxxxxxxxxxxxxxxxxxx"); +// PPApplicationStatic.logE("[MAIN_WORKER_CALL] BluetoothConnectedDevicesDetector.callEventHandler", "xxxxxxxxxxxxxxxxxxxx"); + + if (ApplicationPreferences.prefEventBluetoothScanRequest || + ApplicationPreferences.prefEventBluetoothLEScanRequest || + ApplicationPreferences.prefEventBluetoothWaitForResult || + ApplicationPreferences.prefEventBluetoothLEWaitForResult || + ApplicationPreferences.prefEventBluetoothEnabledForScan) + PhoneProfilesServiceStatic.cancelBluetoothWorker(appContext, true, false); + +// Log.e("BluetoothConnectedDevicesDetector.callEventHandler", "[1] enqueue MainWorker"); + + OneTimeWorkRequest worker = + new OneTimeWorkRequest.Builder(MainWorker.class) + .addTag(MainWorker.HANDLE_EVENTS_BLUETOOTH_CONNECTION_WORK_TAG) + //.setInputData(workData) + .setInitialDelay(10, TimeUnit.SECONDS) + //.keepResultsForAtLeast(PPApplication.WORK_PRUNE_DELAY_MINUTES, TimeUnit.MINUTES) + .build(); + try { +// if (PPApplicationStatic.getApplicationStarted(true, true)) { + WorkManager workManager = PPApplication.getWorkManagerInstance(); + if (workManager != null) { + + // //if (PPApplicationStatic.logEnabled()) { + // ListenableFuture> statuses; + // statuses = workManager.getWorkInfosForUniqueWork(MainWorker.HANDLE_EVENTS_VOLUMES_WORK_TAG); + // try { + // List workInfoList = statuses.get(); + // } catch (Exception ignored) { + // } + // //} + // +// PPApplicationStatic.logE("[WORKER_CALL] BluetoothConnectionBroadcastReceiver.callEventHandler", "xxx"); + //workManager.enqueue(worker); + workManager.enqueueUniqueWork(MainWorker.HANDLE_EVENTS_BLUETOOTH_CONNECTION_WORK_TAG, ExistingWorkPolicy.REPLACE, worker); +// } } - //} + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } } - */ } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java index 7350ae04d8..63c79dff7b 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java @@ -9,21 +9,16 @@ import android.os.PowerManager; import android.os.SystemClock; -import androidx.work.ExistingWorkPolicy; -import androidx.work.OneTimeWorkRequest; -import androidx.work.WorkManager; - import com.google.gson.Gson; import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Calendar; import java.util.List; -import java.util.concurrent.TimeUnit; public class BluetoothConnectionBroadcastReceiver extends BroadcastReceiver { - private static volatile List connectedDevices = null; + //private static volatile List connectedDevices = null; @SuppressLint("MissingPermission") @Override @@ -47,20 +42,20 @@ public void onReceive(Context context, Intent intent) { action.equals(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED)) { // BluetoothConnectionBroadcastReceiver -// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "action="+action); +// PPApplicationStatic.logE("[BLUETOOTH_CONNECT] BluetoothConnectionBroadcastReceiver.onReceive", "action="+action); // Log.e("BluetoothConnectionBroadcastReceiver.onReceive", "[2] action="+action); BluetoothDevice _device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); -// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "device="+_device); +// PPApplicationStatic.logE("[BLUETOOTH_CONNECT] BluetoothConnectionBroadcastReceiver.onReceive", "device="+_device); // if (_device != null) -// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "device="+_device.getName()); +// PPApplicationStatic.logE("[BLUETOOTH_CONNECT] BluetoothConnectionBroadcastReceiver.onReceive", "device="+_device.getName()); //if (device == null) // return; //final boolean connected = action.equals(BluetoothDevice.ACTION_ACL_CONNECTED); final String newName = intent.getStringExtra(BluetoothDevice.EXTRA_NAME); -// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "newName="+newName); +// PPApplicationStatic.logE("[BLUETOOTH_CONNECT] BluetoothConnectionBroadcastReceiver.onReceive", "newName="+newName); // this is important, because ACTION_NAME_CHANGED is called very often if (action.equals(BluetoothDevice.ACTION_NAME_CHANGED)) { @@ -77,11 +72,13 @@ public void onReceive(Context context, Intent intent) { } // if (_device != null) { -// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "[2] device.name=" + _device.getName()); -// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "[2] device.address=" + _device.getAddress()); +// PPApplicationStatic.logE("[BLUETOOTH_CONNECT] BluetoothConnectionBroadcastReceiver.onReceive", "[2] device.name=" + _device.getName()); +// PPApplicationStatic.logE("[BLUETOOTH_CONNECT] BluetoothConnectionBroadcastReceiver.onReceive", "[2] device.address=" + _device.getAddress()); // } + //noinspection ExtractMethodRecommender final Context appContext = context.getApplicationContext(); + final WeakReference deviceWeakRef = new WeakReference<>(_device); Runnable runnable = () -> { // PPApplicationStatic.logE("[IN_EXECUTOR] PPApplication.startHandlerThread", "START run - from=BluetoothConnectionBroadcastReceiver.onReceive"); @@ -101,30 +98,34 @@ public void onReceive(Context context, Intent intent) { if (EventStatic.getGlobalEventsRunning(appContext)) { - getConnectedDevices(appContext); + /* + List connectedDevices = getConnectedDevices(appContext); try { switch (action) { case BluetoothDevice.ACTION_ACL_CONNECTED: - addConnectedDevice(device); + addConnectedDevice(connectedDevices, device); break; case BluetoothDevice.ACTION_NAME_CHANGED: //noinspection ConstantConditions if (newName != null) { - changeDeviceName(device, newName); + changeDeviceName(connectedDevices, device, newName); } break; default: - removeConnectedDevice(device); + removeConnectedDevice(connectedDevices, device); break; } } catch (Exception e) { PPApplicationStatic.recordException(e); } - saveConnectedDevices(appContext); + saveConnectedDevices(connectedDevices, appContext); + */ + + //callEventHandler(appContext); + BluetoothConnectedDevicesDetector.getConnectedDevices(appContext, true); - callEventHandler(appContext); } } catch (Exception e) { @@ -150,14 +151,15 @@ public void onReceive(Context context, Intent intent) { private static final String PREF_CONNECTED_DEVICES_DEVICE = "device"; @SuppressLint("MissingPermission") - static void getConnectedDevices(Context context) + static List getConnectedDevices(Context context) { // PPApplicationStatic.logE("[SYNCHRONIZED] BluetoothConnectionBroadcastReceiver.getConnectedDevices", "PPApplication.bluetoothConnectionChangeStateMutex"); synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { - if (connectedDevices == null) - connectedDevices = new ArrayList<>(); + //if (connectedDevices == null) + // connectedDevices = new ArrayList<>(); + //connectedDevices.clear(); - connectedDevices.clear(); + List connectedDevices = new ArrayList<>(); SharedPreferences preferences = context.getSharedPreferences(PPApplication.BLUETOOTH_CONNECTED_DEVICES_PREFS_NAME, Context.MODE_PRIVATE); @@ -180,10 +182,12 @@ static void getConnectedDevices(Context context) } } } + + return connectedDevices; } } - static void saveConnectedDevices(Context context) + static void saveConnectedDevices(List connectedDevices, Context context) { // PPApplicationStatic.logE("[SYNCHRONIZED] BluetoothConnectionBroadcastReceiver.saveConnectedDevices", "PPApplication.bluetoothConnectionChangeStateMutex"); synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { @@ -210,61 +214,75 @@ static void saveConnectedDevices(Context context) } } - + /* @SuppressLint("MissingPermission") - private static void addConnectedDevice(BluetoothDevice device) + private static void addConnectedDevice(List connectedDevices, BluetoothDevice device) { // PPApplicationStatic.logE("[SYNCHRONIZED] BluetoothConnectionBroadcastReceiver.addConnectedDevice", "PPApplication.bluetoothConnectionChangeStateMutex"); if (device == null) return; - synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { - boolean found = false; - if (device.getAddress() != null) { + //synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { + boolean found = false; + if (device.getAddress() != null) { + for (BluetoothDeviceData _device : connectedDevices) { + if ((_device.getAddress() != null) && + _device.getAddress().equals(device.getAddress())) { + found = true; + break; + } + } + } + if (!found) { + if (device.getName() != null) { for (BluetoothDeviceData _device : connectedDevices) { - if ((_device.getAddress() != null) && - _device.getAddress().equals(device.getAddress())) { + if ((_device.getName() != null) && + _device.getName().equalsIgnoreCase(device.getName())) { found = true; break; } } } - if (!found) { - if (device.getName() != null) { - for (BluetoothDeviceData _device : connectedDevices) { - if ((_device.getName() != null) && - _device.getName().equalsIgnoreCase(device.getName())) { - found = true; - break; - } - } - } - } - if (!found) { - int gmtOffset = 0; //TimeZone.getDefault().getRawOffset(); - Calendar now = Calendar.getInstance(); - long timestamp = now.getTimeInMillis() - gmtOffset; - connectedDevices.add(new BluetoothDeviceData(device.getName(), device.getAddress(), - BluetoothScanWorker.getBluetoothType(device), false, timestamp, false, false)); - } } + if (!found) { + int gmtOffset = 0; //TimeZone.getDefault().getRawOffset(); + Calendar now = Calendar.getInstance(); + long timestamp = now.getTimeInMillis() - gmtOffset; + connectedDevices.add(new BluetoothDeviceData(device.getName(), device.getAddress(), + BluetoothScanWorker.getBluetoothType(device), false, timestamp, false, false)); + } + //} } - + */ + /* @SuppressLint("MissingPermission") - private static void removeConnectedDevice(BluetoothDevice device) + private static void removeConnectedDevice(List connectedDevices, BluetoothDevice device) { // PPApplicationStatic.logE("[SYNCHRONIZED] BluetoothConnectionBroadcastReceiver.removeConnectedDevice", "PPApplication.bluetoothConnectionChangeStateMutex"); if (device == null) return; - synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { - //int index = 0; - BluetoothDeviceData deviceToRemove = null; - boolean found = false; - if (device.getAddress() != null) { + //synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { + //int index = 0; + BluetoothDeviceData deviceToRemove = null; + boolean found = false; + if (device.getAddress() != null) { + for (BluetoothDeviceData _device : connectedDevices) { + if ((_device.getAddress() != null) && + _device.getAddress().equals(device.getAddress())) { + found = true; + deviceToRemove = _device; + break; + } + //++index; + } + } + if (!found) { + //index = 0; + if (device.getName() != null) { for (BluetoothDeviceData _device : connectedDevices) { - if ((_device.getAddress() != null) && - _device.getAddress().equals(device.getAddress())) { + if ((_device.getName() != null) && + _device.getName().equalsIgnoreCase(device.getName())) { found = true; deviceToRemove = _device; break; @@ -272,35 +290,23 @@ private static void removeConnectedDevice(BluetoothDevice device) //++index; } } - if (!found) { - //index = 0; - if (device.getName() != null) { - for (BluetoothDeviceData _device : connectedDevices) { - if ((_device.getName() != null) && - _device.getName().equalsIgnoreCase(device.getName())) { - found = true; - deviceToRemove = _device; - break; - } - //++index; - } - } - } -// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.removeConnectedDevice", "device="+device.getName()); - if (found) - //connectedDevices.remove(index); - connectedDevices.remove(deviceToRemove); } +// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.removeConnectedDevice", "device="+device.getName()); + if (found) + //connectedDevices.remove(index); + connectedDevices.remove(deviceToRemove); + //} } + */ - static void clearConnectedDevices(/*Context context, boolean onlyOld*/) + static void clearConnectedDevices(List connectedDevices/*Context context, boolean onlyOld*/) { //if (onlyOld) { // getConnectedDevices(context); //} // PPApplicationStatic.logE("[SYNCHRONIZED] BluetoothConnectionBroadcastReceiver.clearConnectedDevices", "PPApplication.bluetoothConnectionChangeStateMutex"); - synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { + //synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { if (connectedDevices != null) { /*if (onlyOld) { int gmtOffset = 0; //TimeZone.getDefault().getRawOffset(); @@ -317,50 +323,51 @@ static void clearConnectedDevices(/*Context context, boolean onlyOld*/) else*/ connectedDevices.clear(); } - } + //} } - + /* @SuppressLint("MissingPermission") - private static void changeDeviceName(BluetoothDevice device, String deviceName) + private static void changeDeviceName(List connectedDevices, BluetoothDevice device, String deviceName) { // PPApplicationStatic.logE("[SYNCHRONIZED] BluetoothConnectionBroadcastReceiver.changeDeviceName", "PPApplication.bluetoothConnectionChangeStateMutex"); if (device == null) return; - synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { - boolean found = false; - if (device.getAddress() != null) { + //synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { + boolean found = false; + if (device.getAddress() != null) { + for (BluetoothDeviceData _device : connectedDevices) { + if ((_device.getAddress() != null) && + _device.getAddress().equals(device.getAddress()) && + !deviceName.isEmpty()) { + _device.setName(deviceName); + found = true; + break; + } + } + } + if (!found) { + if (device.getName() != null) { for (BluetoothDeviceData _device : connectedDevices) { - if ((_device.getAddress() != null) && - _device.getAddress().equals(device.getAddress()) && + if ((_device.getName() != null) && + _device.getName().equalsIgnoreCase(device.getName()) && !deviceName.isEmpty()) { _device.setName(deviceName); - found = true; break; } } } - if (!found) { - if (device.getName() != null) { - for (BluetoothDeviceData _device : connectedDevices) { - if ((_device.getName() != null) && - _device.getName().equalsIgnoreCase(device.getName()) && - !deviceName.isEmpty()) { - _device.setName(deviceName); - break; - } - } - } - } } + //} } + */ - static void addConnectedDeviceData(List newConnectedDevices) + static void addConnectedDeviceData(List connectedDevices, List connectedDevicesToAdd) { // PPApplicationStatic.logE("[SYNCHRONIZED] BluetoothConnectionBroadcastReceiver.addConnectedDeviceData", "PPApplication.bluetoothConnectionChangeStateMutex"); - synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { - for (BluetoothDeviceData newDevice : newConnectedDevices) { + //synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { + for (BluetoothDeviceData newDevice : connectedDevicesToAdd) { boolean found = false; String newName = newDevice.getName(); @@ -392,13 +399,13 @@ static void addConnectedDeviceData(List newConnectedDevices } } } - } + //} } - static boolean isBluetoothConnected(BluetoothDeviceData deviceData, String sensorDeviceName) + static boolean isBluetoothConnected(List connectedDevices, BluetoothDeviceData deviceData, String sensorDeviceName) { // PPApplicationStatic.logE("[SYNCHRONIZED] BluetoothConnectionBroadcastReceiver.isBluetoothConnected", "PPApplication.bluetoothConnectionChangeStateMutex"); - synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { + //synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { if ((deviceData == null) && sensorDeviceName.isEmpty()) { // is device connected to any external bluetooth device ??? @@ -406,10 +413,11 @@ static boolean isBluetoothConnected(BluetoothDeviceData deviceData, String senso } else { if (connectedDevices != null) { - if (deviceData != null) { - // is device connected to deviceData ??? + if ((deviceData != null) && sensorDeviceName.isEmpty()) { + // is deviceData connected ??? - String deviceDataName = deviceData.getName().trim(); + // deviceData is from bounded devices and bounded devices are with address + String deviceDataName = deviceData.getName().trim().toUpperCase(); if (!deviceDataName.isEmpty()) { // device without empty name is not supported @@ -418,21 +426,30 @@ static boolean isBluetoothConnected(BluetoothDeviceData deviceData, String senso String deviceDataAddress = deviceData.getAddress(); if (!deviceDataAddress.isEmpty()) { for (BluetoothDeviceData connectedDevice : connectedDevices) { - if ((!connectedDevice.getAddress().isEmpty()) && - connectedDevice.getAddress().equals(deviceDataAddress)) { + String connectedDeviceAddress = connectedDevice.getAddress(); + if ((!connectedDeviceAddress.isEmpty()) && + connectedDeviceAddress.equals(deviceDataAddress)) { found = true; break; } } } if (!found) { - for (BluetoothDeviceData connectedDevice : connectedDevices) { - String connectedName = connectedDevice.getName().trim(); + /*for (BluetoothDeviceData connectedDevice : connectedDevices) { + String connectedName = connectedDevice.getName().trim().toUpperCase(); if ((!connectedName.isEmpty()) && connectedName.equalsIgnoreCase(deviceDataName)) { found = true; break; } + }*/ + for (BluetoothDeviceData connectedDevice : connectedDevices) { + String connectedName = connectedDevice.getName().trim().toUpperCase(); + if ((!connectedName.isEmpty()) && + Wildcard.match(connectedName, deviceDataName, '_', '%', true)) { + found = true; + break; + } } } @@ -440,26 +457,59 @@ static boolean isBluetoothConnected(BluetoothDeviceData deviceData, String senso } } else { - // is device connected to sensorDeviceName ??? - // for this do not check for address + // is sensorDeviceName connected ??? - String sensorName = sensorDeviceName.trim().toUpperCase(); - if (!sensorName.isEmpty()) { - for (BluetoothDeviceData connectedDevice : connectedDevices) { + // get connected device by address + // deviceData is from bounded devices and bounded devices are with address + BluetoothDeviceData connectedDevice = null; + if (deviceData != null) { + String deviceDataAddress = deviceData.getAddress(); + if (!deviceDataAddress.isEmpty()) { + for (BluetoothDeviceData _connectedDevice : connectedDevices) { + String _connectedDeviceAddress = _connectedDevice.getAddress(); + if ((!_connectedDeviceAddress.isEmpty()) && + _connectedDeviceAddress.equals(deviceDataAddress)) { + connectedDevice = _connectedDevice; + break; + } + } + } + } + + //noinspection IfStatementWithIdenticalBranches + if (connectedDevice != null) { + // configured device in system is connected + String sensorName = sensorDeviceName.trim().toUpperCase(); + if (!sensorName.isEmpty()) { String connectedName = connectedDevice.getName().trim().toUpperCase(); if ((!connectedName.isEmpty()) && Wildcard.match(connectedName, sensorName, '_', '%', true)) { + // configured connected device in system is sensorDeviceName return true; } } + } else { + // check only by device name + String sensorName = sensorDeviceName.trim().toUpperCase(); + if (!sensorName.isEmpty()) { + for (BluetoothDeviceData _connectedDevice : connectedDevices) { + String connectedName = _connectedDevice.getName().trim().toUpperCase(); + if ((!connectedName.isEmpty()) && + Wildcard.match(connectedName, sensorName, '_', '%', true)) { + // connected device in system is sensorDeviceName + return true; + } + } + } } } } return false; } - } + //} } + /* private void callEventHandler(final Context appContext) { // PPApplicationStatic.logE("[IN_LISTENER] BluetoothConnectedDevicesDetector.callEventHandler", "xxxxxxxxxxxxxxxxxxxx"); // PPApplicationStatic.logE("[MAIN_WORKER_CALL] BluetoothConnectedDevicesDetector.callEventHandler", "xxxxxxxxxxxxxxxxxxxx"); @@ -503,6 +553,7 @@ private void callEventHandler(final Context appContext) { PPApplicationStatic.recordException(e); } } + */ /* private static abstract class PPHandlerThreadRunnable implements Runnable { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothDeviceData.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothDeviceData.java index 58b8ee1ed8..c683abe116 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothDeviceData.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothDeviceData.java @@ -1,5 +1,7 @@ package sk.henrichg.phoneprofilesplus; +import java.util.Objects; + class BluetoothDeviceData { private String name; @@ -25,17 +27,11 @@ class BluetoothDeviceData { } String getName() { - if (name != null) - return name; - else - return ""; + return Objects.requireNonNullElse(name, ""); } String getAddress() { - if (address != null) - return address; - else - return ""; + return Objects.requireNonNullElse(address, ""); } void setName(String name) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothNamePreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothNamePreference.java index 666e423f04..63d5a37175 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothNamePreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothNamePreference.java @@ -222,7 +222,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public BluetoothNamePreference.SavedState createFromParcel(Parcel in) { return new BluetoothNamePreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothNamePreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothNamePreferenceFragment.java index 3ae184b30e..df1dcf14c8 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothNamePreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothNamePreferenceFragment.java @@ -90,6 +90,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { dataLinearLayout = layout.findViewById(R.id.bluetooth_name_pref_dlg_linla_data); addIcon = layout.findViewById(R.id.bluetooth_name_pref_dlg_addIcon); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(addIcon, getString(R.string.bluetooth_name_pref_dlg_add_button_tooltip)); addIcon.setOnClickListener(v -> { String btName = bluetoothName.getText().toString(); @@ -108,7 +109,8 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { }); bluetoothName = layout.findViewById(R.id.bluetooth_name_pref_dlg_bt_name); - bluetoothName.setBackgroundTintList(ContextCompat.getColorStateList(prefContext, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + bluetoothName.setBackgroundTintList(ContextCompat.getColorStateList(prefContext, R.color.edit_text_color)); bluetoothName.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -121,12 +123,12 @@ public void onTextChanged(CharSequence s, int start, int before, int count) { @Override public void afterTextChanged(Editable s) { GlobalGUIRoutines.setImageButtonEnabled(!bluetoothName.getText().toString().isEmpty(), - addIcon, prefContext.getApplicationContext()); + addIcon, prefContext); } }); GlobalGUIRoutines.setImageButtonEnabled(!bluetoothName.getText().toString().isEmpty(), - addIcon, prefContext.getApplicationContext()); + addIcon, prefContext); bluetoothListView = layout.findViewById(R.id.bluetooth_name_pref_dlg_listview); emptyList = layout.findViewById(R.id.bluetooth_name_pref_dlg_empty); @@ -156,6 +158,7 @@ public void afterTextChanged(Editable s) { */ final ImageView helpIcon = layout.findViewById(R.id.bluetooth_name_pref_dlg_helpIcon); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(helpIcon, getString(R.string.help_button_tooltip)); helpIcon.setOnClickListener(v -> { String helpString = getString(R.string.event_preference_bluetooth_btName_type)+StringConstants.STR_DOUBLE_NEWLINE+ @@ -170,6 +173,7 @@ public void afterTextChanged(Editable s) { ImageView changeSelectionIcon = layout.findViewById(R.id.bluetooth_name_pref_dlg_changeSelection); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(changeSelectionIcon, getString(R.string.bluetooth_name_pref_dlg_select_button_tooltip)); changeSelectionIcon.setOnClickListener(view1 -> { if (getActivity() != null) @@ -207,6 +211,7 @@ public void afterTextChanged(Editable s) { }); rescanButton = layout.findViewById(R.id.bluetooth_name_pref_dlg_rescanButton); + //noinspection DataFlowIssue rescanButton.setOnClickListener(v -> { if (Permissions.grantBluetoothScanDialogPermissions(prefContext)) refreshListView(true, ""); @@ -215,6 +220,7 @@ public void afterTextChanged(Editable s) { locationSystemSettingsRelLa = layout.findViewById(R.id.bluetooth_name_pref_dlg_locationSystemSettingsRelLa); locationEnabledStatusTextView = layout.findViewById(R.id.bluetooth_name_pref_dlg_locationEnableStatus); locationSystemSettingsButton = layout.findViewById(R.id.bluetooth_name_pref_dlg_locationSystemSettingsButton); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(locationSystemSettingsButton, getString(R.string.location_settings_button_tooltip)); mDialog.setOnShowListener(dialog -> { @@ -452,6 +458,7 @@ void setLocationEnableStatus() { true, true, false, false, true, + false, getActivity() ); @@ -580,6 +587,7 @@ void showEditMenu(View view, BluetoothDeviceData bluetoothDevice) { true, true, false, false, true, + false, getActivity() ); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothScanWorker.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothScanWorker.java index b4240ae02c..47845766d1 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothScanWorker.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothScanWorker.java @@ -60,7 +60,7 @@ public Result doWork() { // application is not started return Result.success(); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, context).allowed != + if (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, false, context).preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { cancelWork(context, false/*, null*/); // PPApplicationStatic.logE("[IN_WORKER] BluetoothScanWorker.doWork", "---------------------------------------- END - not enabled bluetooth"); @@ -233,7 +233,7 @@ private static void _scheduleWork(final Context context, final boolean shortInte // shortInterval = true is called only from PPService.scheduleBluetoothWorker static void scheduleWork(Context context, boolean shortInterval) { - if (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, context).allowed + if (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (shortInterval) { _cancelWork(context, false); @@ -422,7 +422,7 @@ static void initialize(Context context, boolean clearScanResult) setWaitForLEResults(context, false); setScanKilled(context, false); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, context).allowed != + if (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, false, context).preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) return; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothScanner.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothScanner.java index d70572ceda..312402d269 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothScanner.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothScanner.java @@ -80,7 +80,7 @@ void doScan(/*boolean fromDialog*/) { //synchronized (PPApplication.radioChangeStateMutex) { - if (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { //dataWrapper = new DataWrapper(context.getApplicationContext(), false, 0, false); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothStateChangedBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothStateChangedBroadcastReceiver.java index ce1e5505c4..77418c37d4 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothStateChangedBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothStateChangedBroadcastReceiver.java @@ -6,6 +6,8 @@ import android.content.Intent; import android.os.PowerManager; +import java.util.List; + public class BluetoothStateChangedBroadcastReceiver extends BroadcastReceiver { @Override @@ -23,6 +25,8 @@ public void onReceive(Context context, Intent intent) { if ((action != null) && action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) { // BluetoothStateChangedBroadcastReceiver +// PPApplicationStatic.logE("[BLUETOOTH_CONNECT] BluetoothStateChangedBroadcastReceiver.onReceive", "action="+action); + final int bluetoothState = intent.getIntExtra(BluetoothAdapter.EXTRA_STATE, BluetoothAdapter.ERROR); final Context appContext = context.getApplicationContext(); @@ -42,31 +46,38 @@ public void onReceive(Context context, Intent intent) { // remove connected devices list if (bluetoothState == BluetoothAdapter.STATE_OFF) { - BluetoothConnectionBroadcastReceiver.clearConnectedDevices(/*appContext, false*/); +// PPApplicationStatic.logE("[BLUETOOTH_CONNECT] BluetoothStateChangedBroadcastReceiver.onReceive", "bluetoothState=STATE_OFF"); + + List connectedDevices = BluetoothConnectionBroadcastReceiver.getConnectedDevices(appContext); + BluetoothConnectionBroadcastReceiver.clearConnectedDevices(connectedDevices/*appContext, false*/); // this also clears shared preferences - BluetoothConnectionBroadcastReceiver.saveConnectedDevices(appContext); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); + } + if (bluetoothState == BluetoothAdapter.STATE_ON) { +// PPApplicationStatic.logE("[BLUETOOTH_CONNECT] BluetoothStateChangedBroadcastReceiver.onReceive", "bluetoothState=STATE_ON"); + + //if ((!dataWrapper.getIsManualProfileActivation()) || PPApplication.getForceOneBluetoothScan(appContext)) + //{ + //if (ApplicationPreferences.prefEventBluetoothScanRequest) { + // BluetoothScanWorker.startCLScan(appContext); + //} else if (ApplicationPreferences.prefEventBluetoothLEScanRequest) { + // BluetoothScanWorker.startLEScan(appContext); + //} else + if (!(ApplicationPreferences.prefEventBluetoothWaitForResult || + ApplicationPreferences.prefEventBluetoothLEWaitForResult)) { + // refresh bounded devices + BluetoothScanWorker.fillBoundedDevicesList(appContext); + } + //} + +// PPApplicationStatic.logE("BluetoothStateChangedBroadcastReceiver.onReceive", "BT==ON, call od Detector"); + BluetoothConnectedDevicesDetector.getConnectedDevices(appContext, false); } if (EventStatic.getGlobalEventsRunning(appContext)) { if ((bluetoothState == BluetoothAdapter.STATE_ON) || (bluetoothState == BluetoothAdapter.STATE_OFF)) { - if (bluetoothState == BluetoothAdapter.STATE_ON) { - //if ((!dataWrapper.getIsManualProfileActivation()) || PPApplication.getForceOneBluetoothScan(appContext)) - //{ - //if (ApplicationPreferences.prefEventBluetoothScanRequest) { - // BluetoothScanWorker.startCLScan(appContext); - //} else if (ApplicationPreferences.prefEventBluetoothLEScanRequest) { - // BluetoothScanWorker.startLEScan(appContext); - //} else - if (!(ApplicationPreferences.prefEventBluetoothWaitForResult || - ApplicationPreferences.prefEventBluetoothLEWaitForResult)) { - // refresh bounded devices - BluetoothScanWorker.fillBoundedDevicesList(appContext); - } - //} - } - if (ApplicationPreferences.prefEventBluetoothScanRequest || ApplicationPreferences.prefEventBluetoothLEScanRequest || ApplicationPreferences.prefEventBluetoothWaitForResult || @@ -77,7 +88,8 @@ public void onReceive(Context context, Intent intent) { // start events handler -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] BluetoothStateChangedBroadcastReceiver.onReceive", "sensorType=SENSOR_TYPE_RADIO_SWITCH"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] BluetoothStateChangedBroadcastReceiver.onReceive", "SENSOR_TYPE_RADIO_SWITCH,SENSOR_TYPE_BLUETOOTH_STATE,SENSOR_TYPE_BLUETOOTH_CONNECTION"); +// PPApplicationStatic.logE("[BLUETOOTH_CONNECT] BluetoothStateChangedBroadcastReceiver.onReceive", "call of handle events"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{ EventsHandler.SENSOR_TYPE_RADIO_SWITCH, @@ -85,7 +97,6 @@ public void onReceive(Context context, Intent intent) { EventsHandler.SENSOR_TYPE_BLUETOOTH_CONNECTION}); PPApplicationStatic.restartBluetoothScanner(appContext); - } } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BootUpReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BootUpReceiver.java index 2a148719e0..24df45a24c 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BootUpReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BootUpReceiver.java @@ -108,7 +108,7 @@ public void onReceive(Context context, Intent intent) { if (EventStatic.getGlobalEventsRunning(appContext)) { -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] BootUpReceiver.onReceive", "sensorType=SENSOR_TYPE_BOOT_COMPLETED"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] BootUpReceiver.onReceive", "SENSOR_TYPE_BOOT_COMPLETED"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_BOOT_COMPLETED}); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BrightnessDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BrightnessDialogPreference.java index 720ff23d3a..cb92dd10eb 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BrightnessDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BrightnessDialogPreference.java @@ -281,8 +281,8 @@ public void writeToParcel(Parcel dest, int flags) super(superState); } - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator<>() { public BrightnessDialogPreference.SavedState createFromParcel(Parcel in) { return new BrightnessDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarEventExistsCheckBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarEventExistsCheckBroadcastReceiver.java index 994bf6d222..8bd43b6fd0 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarEventExistsCheckBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarEventExistsCheckBroadcastReceiver.java @@ -40,7 +40,7 @@ private void doWork(/*boolean useHandler,*/ Context context) { } -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] CalendarEventExistsCheckBroadcastReceiver.doWork", "sensorType=SENSOR_TYPE_CALENDAR_EVENT_EXISTS_CHECK"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] CalendarEventExistsCheckBroadcastReceiver.doWork", "SENSOR_TYPE_CALENDAR_EVENT_EXISTS_CHECK"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_CALENDAR_EVENT_EXISTS_CHECK}); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarsMultiSelectDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarsMultiSelectDialogPreference.java index ecb98264c7..582e8b7521 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarsMultiSelectDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarsMultiSelectDialogPreference.java @@ -191,7 +191,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public CalendarsMultiSelectDialogPreference.SavedState createFromParcel(Parcel in) { return new CalendarsMultiSelectDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarsMultiSelectDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarsMultiSelectDialogPreferenceFragment.java index a71b3c2e32..8c98321b20 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarsMultiSelectDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarsMultiSelectDialogPreferenceFragment.java @@ -78,6 +78,7 @@ protected void onBindDialogView(@NonNull View view) { }); final Button unselectAllButton = view.findViewById(R.id.calendars_multiselect_pref_dlg_unselect_all); + //noinspection DataFlowIssue unselectAllButton.setOnClickListener(v -> { preference.value=""; refreshListView(false); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarsMultiSelectPreferenceAdapter.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarsMultiSelectPreferenceAdapter.java index 18e5b24cbe..aea9237e2c 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarsMultiSelectPreferenceAdapter.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CalendarsMultiSelectPreferenceAdapter.java @@ -71,6 +71,7 @@ public View getView(int position, View convertView, ViewGroup parent) convertView.setTag(new CalendarViewHolder(calendarColor, textViewDisplayName, checkBox)); // If CheckBox is toggled, update the Contact it is tagged with. + //noinspection DataFlowIssue checkBox.setOnClickListener(v -> { CheckBox cb = (CheckBox) v; CalendarEvent calendar1 = (CalendarEvent) cb.getTag(); @@ -94,7 +95,9 @@ public View getView(int position, View convertView, ViewGroup parent) checkBox.setTag(calendar); // Display Contact data + //noinspection DataFlowIssue calendarColor.setBackgroundColor(/*0xff000000*/ + calendar.color); + //noinspection DataFlowIssue textViewDisplayName.setText(calendar.name); //Log.d("CalendarsMultiSelectPreferenceAdapter.getView","calendar.checked="+calendar.checked); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CallScreeningEventEndBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CallScreeningEventEndBroadcastReceiver.java new file mode 100644 index 0000000000..4059d4a7a9 --- /dev/null +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CallScreeningEventEndBroadcastReceiver.java @@ -0,0 +1,33 @@ +package sk.henrichg.phoneprofilesplus; + +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; + +public class CallScreeningEventEndBroadcastReceiver extends BroadcastReceiver { + + @Override + public void onReceive(Context context, Intent intent) { +// PPApplicationStatic.logE("[IN_BROADCAST] SMSEventEndBroadcastReceiver.onReceive", "xxx"); +// PPApplicationStatic.logE("[IN_BROADCAST_ALARM] SMSEventEndBroadcastReceiver.onReceive", "xxx"); + + String action = intent.getAction(); + if (action != null) { + doWork(/*true,*/ context); + } + } + + private void doWork(/*boolean useHandler,*/ Context context) { + if (!PPApplicationStatic.getApplicationStarted(true, true)) + // application is not started + return; + + if (EventStatic.getGlobalEventsRunning(context)) { + final Context appContext = context.getApplicationContext(); + PPExecutors.handleEvents(appContext, + new int[]{EventsHandler.SENSOR_TYPE_CALL_SCREENING_EVENT_END}, + PPExecutors.SENSOR_NAME_SENSOR_TYPE_CALL_SCREENING_EVENT_END, 0); + } + } + +} diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckCriticalPPPReleasesBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckCriticalPPPReleasesBroadcastReceiver.java index eac7a8f92d..5c73b66627 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckCriticalPPPReleasesBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckCriticalPPPReleasesBroadcastReceiver.java @@ -318,7 +318,7 @@ private static void showNotification(Context appContext, nText = appContext.getString(R.string.normal_github_release_notification); } mBuilder = new NotificationCompat.Builder(appContext, PPApplication.NEW_RELEASE_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(appContext, R.color.information_color)) + .setColor(ContextCompat.getColor(appContext, R.color.informationColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_information_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(appContext.getResources(), R.drawable.ic_information_notification)) .setContentTitle(nTitle) // title for notification diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckCriticalPPPReleasesDisableActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckCriticalPPPReleasesDisableActivity.java index 1e3a077595..353c980603 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckCriticalPPPReleasesDisableActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckCriticalPPPReleasesDisableActivity.java @@ -92,6 +92,7 @@ protected void onStart() true, true, false, false, false, + false, this ); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckLatestPPPPSReleasesBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckLatestPPPPSReleasesBroadcastReceiver.java index f29ed11bdc..bd511300dc 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckLatestPPPPSReleasesBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckLatestPPPPSReleasesBroadcastReceiver.java @@ -210,7 +210,7 @@ private static void showNotification(Context appContext) { nText = appContext.getString(R.string.latest_pppps_release_notification); mBuilder = new NotificationCompat.Builder(appContext, PPApplication.NEW_RELEASE_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(appContext, R.color.information_color)) + .setColor(ContextCompat.getColor(appContext, R.color.informationColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_information_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(appContext.getResources(), R.drawable.ic_information_notification)) .setContentTitle(nTitle) // title for notification diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckPPPReleasesActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckPPPReleasesActivity.java index 4368d81782..b9fc281efe 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckPPPReleasesActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckPPPReleasesActivity.java @@ -313,6 +313,7 @@ private void checkInGitHub(final Activity activity, final boolean refreshOpenedD TextView text; text = alertDialogLayout.findViewById(R.id.install_ppp_pppe_from_github_dialog_info_text); message = message.replace(StringConstants.CHAR_NEW_LINE, StringConstants.TAG_BREAK_HTML); + //noinspection DataFlowIssue text.setText(StringFormatUtils.fromHtml(message, false, false, 0, 0, true)); final String ASSETS = " \"Assets\"?"; @@ -320,6 +321,7 @@ private void checkInGitHub(final Activity activity, final boolean refreshOpenedD text = alertDialogLayout.findViewById(R.id.install_ppp_pppe_from_github_dialog_github_releases); if (newVersionDataExists) { Button button = alertDialogLayout.findViewById(R.id.install_ppp_pppe_from_github_dialog_showAssets); + //noinspection DataFlowIssue button.setText(activity.getString(R.string.install_extender_where_is_assets_button) + ASSETS); button.setVisibility(View.GONE); @@ -348,15 +350,18 @@ public void onClick(@NonNull View textView) { }; sbt.setSpan(clickableSpan, str1.length() + 1, str2.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); //sbt.setSpan(new UnderlineSpan(), str1.length()+1, str2.length(), 0); + //noinspection DataFlowIssue text.setText(sbt); text.setMovementMethod(LinkMovementMethod.getInstance()); text.setVisibility(View.VISIBLE); } else { + //noinspection DataFlowIssue text.setVisibility(View.GONE); Button button = alertDialogLayout.findViewById(R.id.install_ppp_pppe_from_github_dialog_showAssets); + //noinspection DataFlowIssue button.setText(activity.getString(R.string.install_extender_where_is_assets_button) + ASSETS); button.setVisibility(View.VISIBLE); button.setOnClickListener(v -> { @@ -368,6 +373,7 @@ public void onClick(@NonNull View textView) { if (Build.VERSION.SDK_INT >= 33) { TextView text2 = alertDialogLayout.findViewById(R.id.install_ppp_pppe_from_github_dialog_apk_installation); + //noinspection DataFlowIssue text2.setVisibility(View.VISIBLE); String str = activity.getString(R.string.check_releases_install_from_apk_note1) + " " + activity.getString(R.string.install_ppp_store_droidify) + @@ -508,6 +514,7 @@ private void checkInFDroid(final Activity activity) { TextView text; text = layout.findViewById(R.id.dialog_for_fdroid_info_text); message = message.replace(StringConstants.CHAR_NEW_LINE, StringConstants.TAG_BREAK_HTML); + //noinspection DataFlowIssue text.setText(StringFormatUtils.fromHtml(message, false, false, 0, 0, true)); text = layout.findViewById(R.id.dialog_for_fdroid_fdroid_application); @@ -543,6 +550,7 @@ public void onClick(@NonNull View textView) { if (Build.VERSION.SDK_INT >= 33) { TextView text2 = layout.findViewById(R.id.dialog_for_fdroid_apk_installation); + //noinspection DataFlowIssue text2.setVisibility(View.VISIBLE); String str = activity.getString(R.string.check_releases_install_from_apk_note1) + " " + activity.getString(R.string.install_ppp_store_fdroid) + @@ -580,6 +588,7 @@ public void onClick(@NonNull View textView) { }; sbt.setSpan(clickableSpan, str1.length()+1, str2.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); //sbt.setSpan(new UnderlineSpan(), str1.length()+1, str2.length(), 0); + //noinspection DataFlowIssue text.setText(sbt); text.setMovementMethod(LinkMovementMethod.getInstance()); @@ -591,7 +600,7 @@ public void onClick(@NonNull View textView) { sbt.setSpan(new StyleSpan(android.graphics.Typeface.NORMAL), 0, str1.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); clickableSpan = new ClickableSpan() { @Override - public void updateDrawState(TextPaint ds) { + public void updateDrawState(@NonNull TextPaint ds) { ds.setColor(ds.linkColor); // you can use custom color ds.setUnderlineText(false); // this remove the underline } @@ -1039,6 +1048,7 @@ private void checkInAPKPure(final Activity activity) { TextView text; text = layout.findViewById(R.id.dialog_for_apkpure_info_text); message = message.replace(StringConstants.CHAR_NEW_LINE, StringConstants.TAG_BREAK_HTML); + //noinspection DataFlowIssue text.setText(StringFormatUtils.fromHtml(message, false, false, 0, 0, true)); //dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert); @@ -1054,7 +1064,9 @@ private void checkInAPKPure(final Activity activity) { text = layout.findViewById(R.id.dialog_for_apkpure_appkpure_application); View buttonsDivider = layout.findViewById(R.id.dialog_for_apkpure_buttonsDivider); if (!apkPureInstalled) { + //noinspection DataFlowIssue text.setVisibility(View.VISIBLE); + //noinspection DataFlowIssue buttonsDivider.setVisibility(View.VISIBLE); CharSequence str1 = activity.getString(R.string.check_releases_apkpure_ppp_release); @@ -1087,6 +1099,7 @@ public void onClick(@NonNull View textView) { if (Build.VERSION.SDK_INT >= 33) { TextView text2 = layout.findViewById(R.id.dialog_for_apkpure_apk_installation); + //noinspection DataFlowIssue text2.setVisibility(View.VISIBLE); String str = activity.getString(R.string.check_releases_install_from_apk_note1) + " " + activity.getString(R.string.install_ppp_store_apkpure) + @@ -1094,6 +1107,7 @@ public void onClick(@NonNull View textView) { text2.setText(str); } } else { + //noinspection DataFlowIssue text.setVisibility(View.GONE); //buttonsDivider.setVisibility(View.GONE); } @@ -1186,6 +1200,7 @@ private void checkInDroidIfy(final Activity activity, boolean forGitHub) { message = message + StringConstants.TAG_DOUBLE_BREAK_HTML + activity.getString(R.string.check_releases_github_download_not_supported); } + //noinspection DataFlowIssue text.setText(StringFormatUtils.fromHtml(message, false, false, 0, 0, true)); //dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert); @@ -1201,7 +1216,9 @@ private void checkInDroidIfy(final Activity activity, boolean forGitHub) { text = layout.findViewById(R.id.dialog_for_droidify_droidify_application); View buttonsDivider = layout.findViewById(R.id.dialog_for_droidify_buttonsDivider); if (!droidifyInstalled) { + //noinspection DataFlowIssue text.setVisibility(View.VISIBLE); + //noinspection DataFlowIssue buttonsDivider.setVisibility(View.VISIBLE); CharSequence str1 = activity.getString(R.string.check_releases_droidify_ppp_release); @@ -1234,6 +1251,7 @@ public void onClick(@NonNull View textView) { if (Build.VERSION.SDK_INT >= 33) { TextView text2 = layout.findViewById(R.id.dialog_for_droidify_apk_installation); + //noinspection DataFlowIssue text2.setVisibility(View.VISIBLE); String str = activity.getString(R.string.check_releases_install_from_apk_note1) + " " + activity.getString(R.string.install_ppp_store_droidify) + @@ -1241,6 +1259,7 @@ public void onClick(@NonNull View textView) { text2.setText(str); } } else { + //noinspection DataFlowIssue text.setVisibility(View.GONE); //buttonsDivider.setVisibility(View.GONE); } @@ -1329,6 +1348,7 @@ private void checkInNeoStore(final Activity activity) { text = layout.findViewById(R.id.dialog_for_neostore_info_text); message = message.replace(StringConstants.CHAR_NEW_LINE, StringConstants.TAG_BREAK_HTML); + //noinspection DataFlowIssue text.setText(StringFormatUtils.fromHtml(message, false, false, 0, 0, true)); //dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert); @@ -1344,7 +1364,9 @@ private void checkInNeoStore(final Activity activity) { text = layout.findViewById(R.id.dialog_for_neostore_neostore_application); View buttonsDivider = layout.findViewById(R.id.dialog_for_neostore_buttonsDivider); if (!neostoreInstalled) { + //noinspection DataFlowIssue text.setVisibility(View.VISIBLE); + //noinspection DataFlowIssue buttonsDivider.setVisibility(View.VISIBLE); CharSequence str1 = activity.getString(R.string.check_releases_neostore_ppp_release); @@ -1377,6 +1399,7 @@ public void onClick(@NonNull View textView) { if (Build.VERSION.SDK_INT >= 33) { TextView text2 = layout.findViewById(R.id.dialog_for_neostore_apk_installation); + //noinspection DataFlowIssue text2.setVisibility(View.VISIBLE); String str = activity.getString(R.string.check_releases_install_from_apk_note1) + " " + activity.getString(R.string.install_ppp_store_neostore) + @@ -1384,6 +1407,7 @@ public void onClick(@NonNull View textView) { text2.setText(str); } } else { + //noinspection DataFlowIssue text.setVisibility(View.GONE); //buttonsDivider.setVisibility(View.GONE); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckPPPReleasesBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckPPPReleasesBroadcastReceiver.java index b7689685d7..05f17e401e 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckPPPReleasesBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckPPPReleasesBroadcastReceiver.java @@ -233,7 +233,7 @@ private static void showNotification(Context appContext, String nTitle = appContext.getString(R.string.ppp_app_name) + StringConstants.STR_COLON_WITH_SPACE + appContext.getString(R.string.menu_check_github_releases); String nText = appContext.getString(R.string.check_ppp_releases_notification); mBuilder = new NotificationCompat.Builder(appContext, PPApplication.NEW_RELEASE_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(appContext, R.color.information_color)) + .setColor(ContextCompat.getColor(appContext, R.color.informationColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_information_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(appContext.getResources(), R.drawable.ic_information_notification)) .setContentTitle(nTitle) // title for notification diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckRequiredExtenderReleasesBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckRequiredExtenderReleasesBroadcastReceiver.java index 325c653c86..6b6002a157 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckRequiredExtenderReleasesBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CheckRequiredExtenderReleasesBroadcastReceiver.java @@ -209,7 +209,7 @@ private static void showNotification(Context appContext) { nText = appContext.getString(R.string.required_extender_release_notification); mBuilder = new NotificationCompat.Builder(appContext, PPApplication.NEW_RELEASE_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(appContext, R.color.information_color)) + .setColor(ContextCompat.getColor(appContext, R.color.informationColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_information_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(appContext.getResources(), R.drawable.ic_information_notification)) .setContentTitle(nTitle) // title for notification diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ChooseLanguageDialog.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ChooseLanguageDialog.java index 18c0297656..e00f5d5276 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ChooseLanguageDialog.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ChooseLanguageDialog.java @@ -59,6 +59,7 @@ class ChooseLanguageDialog listView = layout.findViewById(R.id.choose_language_dlg_listview); help = layout.findViewById(R.id.choose_language_dlg_help); + //noinspection DataFlowIssue listView.setOnItemClickListener((parent, item, position, id) -> { ChooseLanguageViewHolder viewHolder = (ChooseLanguageViewHolder) item.getTag(); if (viewHolder != null) @@ -92,6 +93,7 @@ public void onClick(@NonNull View textView) { }; sbt.setSpan(clickableSpan, str1.length()+1, str2.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); //sbt.setSpan(new UnderlineSpan(), str1.length()+1, str2.length(), 0); + //noinspection DataFlowIssue help.setText(sbt); help.setMovementMethod(LinkMovementMethod.getInstance()); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CmdNfc.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CmdNfc.java index bbf29e2ec5..4d4b8469f3 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CmdNfc.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CmdNfc.java @@ -24,7 +24,7 @@ private static boolean run(boolean enable) { static boolean setNFC(boolean enable) { try { INfcAdapter adapter = INfcAdapter.Stub.asInterface(ServiceManager.getService("nfc")); // service list | grep INfcAdapter - return enable ? adapter.enable() : adapter.disable(true); + return enable ? adapter.enable(PPApplication.PACKAGE_NAME) : adapter.disable(true, PPApplication.PACKAGE_NAME); } catch (Throwable e) { PPApplicationStatic.logException("CmdNfc.setNFC", Log.getStackTraceString(e)); //PPApplicationStatic.recordException(e); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ColorChooserPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ColorChooserPreference.java index 8d9328f554..1b03f57423 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ColorChooserPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ColorChooserPreference.java @@ -136,24 +136,9 @@ Drawable createSelector(int color) { }*/ String applicationTheme = ApplicationPreferences.applicationTheme(context, true); - /*if (GlobalGUIRoutines.isNightModeEnabled(context.getApplicationContext())) - applicationTheme = "dark"; - else - applicationTheme = "white";*/ - /*int nightModeFlags = - context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - switch (nightModeFlags) { - case Configuration.UI_MODE_NIGHT_YES: - applicationTheme = "dark"; - break; - case Configuration.UI_MODE_NIGHT_NO: - case Configuration.UI_MODE_NIGHT_UNDEFINED: - applicationTheme = "white"; - break; - }*/ - final String COLOR1 = "#6E6E6E"; - final String COLOR2 = "#AEAEAE"; +// final String COLOR1 = "#6E6E6E"; +// final String COLOR2 = "#AEAEAE"; GradientDrawable coloredCircle = new GradientDrawable(); coloredCircle.setColor(color); @@ -163,13 +148,15 @@ Drawable createSelector(int color) { //if (position == 2) // dark gray color // coloredCircle.setStroke(2, Color.parseColor("#6E6E6E")); //else - coloredCircle.setStroke(1, Color.parseColor(COLOR1)); +// coloredCircle.setStroke(1, Color.parseColor(COLOR1)); + coloredCircle.setStroke(1, context.getColor(R.color.pppColorChooserColor1)); } else { //if (position == 0) // white color // coloredCircle.setStroke(2, Color.parseColor("#AEAEAE")); //else - coloredCircle.setStroke(1, Color.parseColor(COLOR1)); +// coloredCircle.setStroke(1, Color.parseColor(COLOR1)); + coloredCircle.setStroke(1, context.getColor(R.color.pppColorChooserColor1)); } GradientDrawable darkerCircle = new GradientDrawable(); @@ -179,13 +166,15 @@ Drawable createSelector(int color) { //if (position == 2) // dark gray color // coloredCircle.setStroke(2, Color.parseColor("#6E6E6E")); //else - coloredCircle.setStroke(2, Color.parseColor(COLOR1)); +// coloredCircle.setStroke(2, Color.parseColor(COLOR1)); + coloredCircle.setStroke(2, context.getColor(R.color.pppColorChooserColor1)); } else { //if (position == 0) // white color // darkerCircle.setStroke(2, Color.parseColor("#AEAEAE")); //else - darkerCircle.setStroke(2, Color.parseColor(COLOR2)); +// darkerCircle.setStroke(2, Color.parseColor(COLOR2)); + darkerCircle.setStroke(2, context.getColor(R.color.pppColorChooserColor2)); } StateListDrawable stateListDrawable = new StateListDrawable(); @@ -252,7 +241,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public ColorChooserPreference.SavedState createFromParcel(Parcel in) { return new ColorChooserPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ColorChooserPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ColorChooserPreferenceFragment.java index facafc071d..6b0d552af6 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ColorChooserPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ColorChooserPreferenceFragment.java @@ -55,6 +55,7 @@ protected void onBindDialogView(@NonNull View view) { final FrameLayout customColorLayout = view.findViewById(R.id.dialog_color_chooser_custom_color); + //noinspection DataFlowIssue customColorLayout.setTag(-2); customColorLayout.setOnClickListener(this); @@ -84,6 +85,7 @@ protected void onBindDialogView(@NonNull View view) { preference.setBackgroundCompat(customColorLayout, new RippleDrawable(rippleColors, selector, null)); final TextView customColorLabel = view.findViewById(R.id.dialog_color_chooser_custom_color_label); + //noinspection DataFlowIssue customColorLabel.setTag(-2); customColorLabel.setOnClickListener(this); @@ -91,6 +93,7 @@ protected void onBindDialogView(@NonNull View view) { final GridLayout list = view.findViewById(R.id.dialog_color_chooser_grid); + //noinspection DataFlowIssue int count = list.getChildCount(); for (int i = 0; i < count; i++) { FrameLayout child = (FrameLayout) list.getChildAt(i); @@ -137,6 +140,7 @@ public void onClick(View v) { dialogBuilder.setView(layout); final ChromaColorView chromaColorView = layout.findViewById(R.id.custom_color_chroma_color_view); + //noinspection DataFlowIssue chromaColorView.setCurrentColor(ColorChooserPreference.parseValue(preference.value)); chromaColorView.setColorMode(ColorMode.values()[0]); chromaColorView.setIndicatorMode(IndicatorMode.values()[1]); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ConnectToSSIDDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ConnectToSSIDDialogPreference.java index e519d4e8f8..183c485a8e 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ConnectToSSIDDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ConnectToSSIDDialogPreference.java @@ -154,7 +154,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public ConnectToSSIDDialogPreference.SavedState createFromParcel(Parcel in) { return new ConnectToSSIDDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ConnectToSSIDDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ConnectToSSIDDialogPreferenceFragment.java index 93950149ad..9c5b14b1ec 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ConnectToSSIDDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ConnectToSSIDDialogPreferenceFragment.java @@ -65,6 +65,7 @@ protected void onBindDialogView(@NonNull View view) { listAdapter.notifyDataSetChanged(); }); + //noinspection DataFlowIssue helpTextView.setText(getString(R.string.connect_to_ssid_dialog_help) + StringConstants.STR_HARD_SPACE_DOUBLE_ARROW); helpTextView.setOnClickListener(v -> { boolean ok = false; @@ -94,6 +95,7 @@ protected void onBindDialogView(@NonNull View view) { true, true, false, false, true, + false, getActivity() ); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsCache.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsCache.java index 96ed71de49..d1dd44223c 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsCache.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsCache.java @@ -12,8 +12,8 @@ class ContactGroupsCache { private final ArrayList contactGroupList; - private boolean cached; - private boolean caching; + private volatile boolean cached; + private volatile boolean caching; //private boolean cancelled; ContactGroupsCache() @@ -45,6 +45,7 @@ void getContactGroupList(Context context/*, boolean fixEvents*//*, boolean force caching = true; //cancelled = false; +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsCache.getContactGroupList", "PPApplicationStatic.getContactsCache()"); ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); if (contactsCache == null) { caching = false; @@ -59,11 +60,10 @@ void getContactGroupList(Context context/*, boolean fixEvents*//*, boolean force List _contactList; // PPApplicationStatic.logE("[SYNCHRONIZED] ContactGroupsCache.getContactGroupList", "(1) PPApplication.contactsCacheMutex"); - synchronized (PPApplication.contactsCacheMutex) { - _contactList = contactsCache.getList(/*false*/); - if (_contactList == null) - _contactList = new ArrayList<>(); - } +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsCache.getContactGroupList", "contactsCache.getList()"); + _contactList = contactsCache.getList(/*false*/); + if (_contactList == null) + _contactList = new ArrayList<>(); // long kolegoviaGroupId = 0; @@ -117,7 +117,7 @@ void getContactGroupList(Context context/*, boolean fixEvents*//*, boolean force clearGroups(_contactList); //contactsCache.clearGroups(_contactListWithoutNumber); - List contactGroupIds = new ArrayList<>(); + //List contactGroupIds = new ArrayList<>(); String[] projection = new String[]{ ContactsContract.Groups._ID, @@ -142,15 +142,21 @@ void getContactGroupList(Context context/*, boolean fixEvents*//*, boolean force String accountType = mCursor.getString(mCursor.getColumnIndexOrThrow(ContactsContract.Groups.ACCOUNT_TYPE)); - int count = mCursor.getInt(mCursor.getColumnIndexOrThrow(ContactsContract.Groups.SUMMARY_COUNT)); +// int count = mCursor.getInt(mCursor.getColumnIndexOrThrow(ContactsContract.Groups.SUMMARY_COUNT)); +// if (name.startsWith("Pokus")) { +// Log.e("ContactGroupsCache.getContactGroupList", "name="+name); +// Log.e("ContactGroupsCache.getContactGroupList", "contactGroupId="+contactGroupId); +// Log.e("ContactGroupsCache.getContactGroupList", "accountType="+accountType); +// Log.e("ContactGroupsCache.getContactGroupList", "count="+count); +// } //if (count > 0) { - contactGroupIds.add(contactGroupId); + //contactGroupIds.add(contactGroupId); ContactGroup aContactGroup = new ContactGroup(); aContactGroup.groupId = contactGroupId; aContactGroup.name = name; - aContactGroup.count = count; + aContactGroup.count = 0; //count; aContactGroup.accountType = accountType; _contactGroupList.add(aContactGroup); @@ -167,6 +173,67 @@ void getContactGroupList(Context context/*, boolean fixEvents*//*, boolean force //if (cancelled) // return; + // get contacts for each group + for (ContactGroup contactGroup : _contactGroupList) { +// Log.e("ContactGroupsCache.getContactGroupList", "(2) name="+contactGroup.name); +// Log.e("ContactGroupsCache.getContactGroupList", "(2) contactGroupId="+contactGroup.groupId); +// Log.e("ContactGroupsCache.getContactGroupList", "(2) accountType="+contactGroup.accountType); + + contactGroup.count = 0; + Cursor groupCursor = null; + try { + String[] cProjection = { + ContactsContract.CommonDataKinds.GroupMembership.CONTACT_ID, + ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID + }; + + groupCursor = context.getContentResolver().query(ContactsContract.Data.CONTENT_URI, + cProjection, + ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID + "= ?" + " AND " + + ContactsContract.CommonDataKinds.GroupMembership.MIMETYPE + "='" + + ContactsContract.CommonDataKinds.GroupMembership.CONTENT_ITEM_TYPE + "'", + new String[] { String.valueOf(contactGroup.groupId) }, /*null*/ ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID); + + if (groupCursor != null) { + while (groupCursor.moveToNext()) { + long contactId = groupCursor.getLong(groupCursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.GroupMembership.CONTACT_ID)); + //Log.e("ContactGroupsCache.getContactGroupList", "found contactId="+contactId); + long contactGroupId = groupCursor.getLong(groupCursor.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID)); + //Log.e("ContactGroupsCache.getContactGroupList", "found contactGroupId="+contactGroupId); + + List _contactPhoneNumberInGroup = new ArrayList<>(); + for (Contact contact : _contactList) { + //Log.e("ContactGroupsCache.getContactGroupList", "inside query contact.contactId="+contact.contactId); + if (contact.contactId == contactId) { + if (!contact.phoneNumber.isEmpty()) { + if (contact.groups == null) + contact.groups = new ArrayList<>(); + if (!contact.groups.contains(contactGroupId)) { + if (!_contactPhoneNumberInGroup.contains(contact.phoneNumber)) { +// Log.e("ContactGroupsCache.getContactGroupList", "added contactId="+contactId+" phone=+"+contact.phoneNumber+" to contactGroupId="+contactGroupId); + contact.groups.add(contactGroupId); + _contactPhoneNumberInGroup.add(contact.phoneNumber); + ++contactGroup.count; + } + } + } + } + } +// Log.e("ContactGroupsCache.getContactGroupList", "count of contacts in group="+contactGroup.count); + //_contactListInGroup = null; + } + + groupCursor.close(); + } + } catch (Exception e) { + if (groupCursor != null) + groupCursor.close(); +// Log.e("ContactGroupsCache.getContactGroupListX", Log.getStackTraceString(e)); + PPApplicationStatic.recordException(e); + } + } + + /* String[] projectionGroup = new String[]{ ContactsContract.CommonDataKinds.GroupMembership.CONTACT_ID, ContactsContract.CommonDataKinds.GroupMembership.GROUP_ROW_ID//, @@ -182,15 +249,15 @@ void getContactGroupList(Context context/*, boolean fixEvents*//*, boolean force for (long contactGroupId : contactGroupIds) { if (groupRowId == contactGroupId) { // contact is in contactGroupId group - long contactId = mCursorGroup.getLong(mCursorGroup.getColumnIndexOrThrow(ContactsContract.CommonDataKinds.GroupMembership.CONTACT_ID)); - addGroupToContact(contactId, contactGroupId, _contactList); + addGroupToContact(contactId, contactGroupId, _contactList, _contactGroupList, context); //contactsCache.addGroup(contactId, contactGroupId, _contactListWithoutNumber); } } } mCursorGroup.close(); } + */ //_contactGroupList.sort(new ContactGroupsComparator()); @@ -313,7 +380,7 @@ int getLength() } */ - void updateContactGroups(List _contactGroupList) { + private void updateContactGroups(List _contactGroupList) { contactGroupList.clear(); contactGroupList.addAll(_contactGroupList); } @@ -340,6 +407,7 @@ List getList() } } +/* ContactGroup getContactGroup(int position) { // PPApplicationStatic.logE("[SYNCHRONIZED] ContactGroupsCache.getContactGroup", "PPApplication.contactsCacheMutex"); @@ -350,9 +418,10 @@ ContactGroup getContactGroup(int position) return null; } } + */ // called only from ContactGroupsCache - void clearGroups(List _contactList) { + private void clearGroups(List _contactList) { if (_contactList == null) return; @@ -366,8 +435,12 @@ void clearGroups(List _contactList) { } } + /* // called only from ContactGroupsCache - void addGroupToContact(long contactId, long contactGroupId, List _contactList) { + void addGroupToContact(long contactId, long contactGroupId, + List _contactList, List _contactGroupList, + Context context) { + if (_contactList == null) return; @@ -390,9 +463,27 @@ void addGroupToContact(long contactId, long contactGroupId, List _conta break; } } + boolean pokusGroup = (contactGroupId == 12) || (contactGroupId == 13) || (contactGroupId == 14) || + (contactGroupId == 36) || (contactGroupId == 37) || (contactGroupId == 38) || (contactGroupId == 39); if (!groupFound) { // group not found, add it + if (pokusGroup) { + Log.e("ContactGroupsCache.addGroupToContact", "contactGroupId="+contactGroupId); + Log.e("ContactGroupsCache.addGroupToContact", "added group to contact=" + contact.name); + } contact.groups.add(contactGroupId); + for (ContactGroup contactGroup : _contactGroupList) { + if (contactGroup.groupId == contactGroupId) { + if (pokusGroup) + Log.e("ContactGroupsCache.addGroupToContact", "increased group (2) " + contactGroup.name); + ++contactGroup.count; + } + } + } else { + if (pokusGroup) { + Log.e("ContactGroupsCache.addGroupToContact", "contactGroupId="+contactGroupId); + Log.e("ContactGroupsCache.addGroupToContact", "contact already added=" + contact.name); + } } } } @@ -401,6 +492,7 @@ void addGroupToContact(long contactId, long contactGroupId, List _conta break; } } + */ void clearCache() { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectDialogPreference.java index 69710be554..395b20bebb 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectDialogPreference.java @@ -44,20 +44,22 @@ protected void onSetInitialValue(Object defaultValue) setSummaryCMSDP(); } - void refreshListView(@SuppressWarnings("SameParameterValue") final boolean notForUnselect) { + void refreshListView(@SuppressWarnings("SameParameterValue") final boolean forUnselect) { if (fragment != null) - fragment.refreshListView(notForUnselect); + fragment.refreshListView(forUnselect); } void getValueCMSDP() { // change checked state by value +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreference.getValueCMSDP", "PPApplicationStatic.getContactGroupsCache()"); ContactGroupsCache contactGroupsCache = PPApplicationStatic.getContactGroupsCache(); if (contactGroupsCache == null) return; // PPApplicationStatic.logE("[SYNCHRONIZED] ContactGroupsMultiSelectDialogPreference.getValueCMSDP", "PPApplication.contactsCacheMutex"); synchronized (PPApplication.contactsCacheMutex) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreference.getValueCMSDP", "contactGroupsCache.getList()"); List localContactGroupList = contactGroupsCache.getList(); if (localContactGroupList != null) { contactGroupList = new ArrayList<>(); @@ -208,7 +210,7 @@ protected void onRestoreInstanceState(Parcelable state) //getValueCMSDP(); setSummaryCMSDP(); - refreshListView(true); + refreshListView(false); //notifyChanged(); } @@ -241,7 +243,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public ContactGroupsMultiSelectDialogPreference.SavedState createFromParcel(Parcel in) { return new ContactGroupsMultiSelectDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectDialogPreferenceFragment.java index 7e9c4def9a..dabf375518 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectDialogPreferenceFragment.java @@ -25,7 +25,7 @@ public class ContactGroupsMultiSelectDialogPreferenceFragment extends Preference // Layout widgets. ListView listView; private LinearLayout linlaProgress; - private LinearLayout rellaData; + private LinearLayout linlaData; RelativeLayout emptyList; private ContactGroupsMultiSelectPreferenceAdapter listAdapter; @@ -49,10 +49,13 @@ protected void onBindDialogView(@NonNull View view) { super.onBindDialogView(view); linlaProgress = view.findViewById(R.id.contact_groups_multiselect_pref_dlg_linla_progress); - rellaData = view.findViewById(R.id.contact_groups_multiselect_pref_dlg_rella_data); + linlaData = view.findViewById(R.id.contact_groups_multiselect_pref_dlg_linla_data); listView = view.findViewById(R.id.contact_groups_multiselect_pref_dlg_listview); emptyList = view.findViewById(R.id.contact_groups_multiselect_pref_dlg_empty); + listAdapter = new ContactGroupsMultiSelectPreferenceAdapter(prefContext, preference); + listView.setAdapter(listAdapter); + listView.setOnItemClickListener((parent, item, position, id) -> { ContactGroup contactGroup = (ContactGroup)listAdapter.getItem(position); if (contactGroup != null) { @@ -62,13 +65,11 @@ protected void onBindDialogView(@NonNull View view) { } }); - listAdapter = new ContactGroupsMultiSelectPreferenceAdapter(prefContext, preference); - listView.setAdapter(listAdapter); - final Button unselectAllButton = view.findViewById(R.id.contact_groups_multiselect_pref_dlg_unselect_all); + //noinspection DataFlowIssue unselectAllButton.setOnClickListener(v -> { preference.value=""; - refreshListView(false); + refreshListView(true); }); if (Permissions.grantContactGroupsDialogPermissions(prefContext)) { @@ -81,7 +82,7 @@ protected void onBindDialogView(@NonNull View view) { handler.postDelayed(() -> { ContactGroupsMultiSelectDialogPreferenceFragment fragment = fragmentWeakRef.get(); if (fragment != null) - fragment.refreshListView(true); + fragment.refreshListView(false); }, 200); } } @@ -106,22 +107,22 @@ public void onDialogClosed(boolean positiveResult) { preference.fragment = null; } - void refreshListView(final boolean notForUnselect) { - asyncTask = new RefreshListViewAsyncTask(notForUnselect, preference, this, prefContext); + void refreshListView(final boolean forUnselect) { + asyncTask = new RefreshListViewAsyncTask(forUnselect, preference, this, prefContext); asyncTask.execute(); } private static class RefreshListViewAsyncTask extends AsyncTask { - final boolean notForUnselect; + final boolean forUnselect; private final WeakReference preferenceWeakRef; private final WeakReference fragmentWeakRef; private final WeakReference prefContextWeakRef; - public RefreshListViewAsyncTask(final boolean notForUnselect, + public RefreshListViewAsyncTask(final boolean forUnselect, ContactGroupsMultiSelectDialogPreference preference, ContactGroupsMultiSelectDialogPreferenceFragment fragment, Context prefContext) { - this.notForUnselect = notForUnselect; + this.forUnselect = forUnselect; this.preferenceWeakRef = new WeakReference<>(preference); this.fragmentWeakRef = new WeakReference<>(fragment); this.prefContextWeakRef = new WeakReference<>(prefContext); @@ -133,8 +134,8 @@ protected void onPreExecute() { ContactGroupsMultiSelectDialogPreferenceFragment fragment = fragmentWeakRef.get(); if (fragment != null) { - if (notForUnselect) { - fragment.rellaData.setVisibility(View.GONE); + if (!forUnselect) { + fragment.linlaData.setVisibility(View.GONE); fragment.linlaProgress.setVisibility(View.VISIBLE); } } @@ -150,19 +151,24 @@ protected Void doInBackground(Void... params) { // EditorActivity.getContactGroupsCache().getContactGroupList(prefContext); // must be first +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreferenceFragment.doInBackground", "PPApplicationStatic.getContactsCache()"); ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); if (contactsCache == null) { // cache not created, create it +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreferenceFragment.doInBackground", "PPApplicationStatic.createContactsCache()"); PPApplicationStatic.createContactsCache(prefContext.getApplicationContext(), false, false/*, true*/); /*contactsCache = PPApplicationStatic.getContactsCache(); while (contactsCache.getCaching()) GlobalUtils.sleep(100);*/ } else { +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreferenceFragment.doInBackground", "contactsCache.getCaching()"); if (!contactsCache.getCaching()) { // caching not performed +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreferenceFragment.doInBackground", "contactsCache.getList()"); List contactList = contactsCache.getList(/*withoutNumbers*/); if (contactList == null) { // not cached, cache it +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreferenceFragment.doInBackground", "PPApplicationStatic.createContactsCache()"); PPApplicationStatic.createContactsCache(prefContext.getApplicationContext(), false, false/*, true*/); /*contactsCache = PPApplicationStatic.getContactsCache(); while (contactsCache.getCaching()) @@ -171,24 +177,30 @@ protected Void doInBackground(Void... params) { contactList.clear(); } else { // wait for cache end +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreferenceFragment.doInBackground", "contactsCache.getCaching()"); while (contactsCache.getCaching()) GlobalUtils.sleep(100); } } //must be seconds, this ads groups into contacts +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreferenceFragment.doInBackground", "PPApplicationStatic.getContactGroupsCache()"); ContactGroupsCache contactGroupsCache = PPApplicationStatic.getContactGroupsCache(); if (contactGroupsCache == null) { // cache not created, create it +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreferenceFragment.doInBackground", "PPApplicationStatic.createContactGroupsCache()"); PPApplicationStatic.createContactGroupsCache(prefContext.getApplicationContext(), false/*, false*//*, true*/); /*contactGroupsCache = PPApplicationStatic.getContactGroupsCache(); while (contactGroupsCache.getCaching()) GlobalUtils.sleep(100);*/ } else { +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreferenceFragment.doInBackground", "contactGroupsCache.getCaching()"); if (!contactGroupsCache.getCaching()) { // caching not performed +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreferenceFragment.doInBackground", "contactGroupsCache.getList()"); List contactGroupList = contactGroupsCache.getList(/*withoutNumbers*/); if (contactGroupList == null) { // not cached, cache it +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreferenceFragment.doInBackground", "PPApplicationStatic.createContactGroupsCache()"); PPApplicationStatic.createContactGroupsCache(prefContext.getApplicationContext(), false/*, false*//*, true*/); /*contactGroupsCache = PPApplicationStatic.getContactGroupsCache(); while (contactGroupsCache.getCaching()) @@ -196,6 +208,7 @@ protected Void doInBackground(Void... params) { } } else { // wait for cache end +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreferenceFragment.doInBackground", "contactGroupsCache.getCaching()"); while (contactGroupsCache.getCaching()) GlobalUtils.sleep(100); } @@ -214,32 +227,38 @@ protected void onPostExecute(Void result) { ContactGroupsMultiSelectDialogPreferenceFragment fragment = fragmentWeakRef.get(); ContactGroupsMultiSelectDialogPreference preference = preferenceWeakRef.get(); Context prefContext = prefContextWeakRef.get(); - final boolean _notForUnselect = notForUnselect; + final boolean _forUnselect = forUnselect; if ((fragment != null) && (preference != null) && (prefContext != null)) { - //if (!EditorActivity.getContactGroupsCache().cached) - // EditorActivity.getContactGroupsCache().clearCache(false); - fragment.linlaProgress.setVisibility(View.GONE); final Handler handler = new Handler(prefContext.getMainLooper()); handler.post(() -> { - fragment.rellaData.setVisibility(View.VISIBLE); - - fragment.listAdapter.notifyDataSetChanged(); - - if (_notForUnselect) { - ContactGroupsCache contactGroupsCache = PPApplicationStatic.getContactGroupsCache(); - if (contactGroupsCache != null) { - List contactGroupList = contactGroupsCache.getList(); - if ((contactGroupList != null) && (contactGroupList.isEmpty())) { - fragment.listView.setVisibility(View.GONE); - fragment.emptyList.setVisibility(View.VISIBLE); - } else { - fragment.emptyList.setVisibility(View.GONE); - fragment.listView.setVisibility(View.VISIBLE); - } + fragment.linlaData.setVisibility(View.VISIBLE); + + if (!_forUnselect) { + if (preference.contactGroupList.isEmpty()) { + fragment.listView.setVisibility(View.GONE); + fragment.emptyList.setVisibility(View.VISIBLE); + } else { + fragment.emptyList.setVisibility(View.GONE); + fragment.listView.setVisibility(View.VISIBLE); } +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreferenceFragment.onPostExecute", "PPApplicationStatic.getContactGroupsCache()"); +// ContactGroupsCache contactGroupsCache = PPApplicationStatic.getContactGroupsCache(); +// if (contactGroupsCache != null) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactGroupsMultiSelectDialogPreferenceFragment.onPostExecute", "contactGroupsCache.getList()"); +// List contactGroupList = contactGroupsCache.getList(); +// if ((contactGroupList != null) && (contactGroupList.isEmpty())) { +// fragment.listView.setVisibility(View.GONE); +// fragment.emptyList.setVisibility(View.VISIBLE); +// } else { +// fragment.emptyList.setVisibility(View.GONE); +// fragment.listView.setVisibility(View.VISIBLE); +// } +// } } + + fragment.listAdapter.notifyDataSetChanged(); }); } } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectPreferenceAdapter.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectPreferenceAdapter.java index 2022b1a6df..98540f3d33 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectPreferenceAdapter.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectPreferenceAdapter.java @@ -30,19 +30,13 @@ public int getCount() { return preference.contactGroupList.size(); else return 0; - /*ContactGroupsCache contactGroupsCache = PPApplicationStatic.getContactGroupsCache(); - if (contactGroupsCache != null) - return contactGroupsCache.getLength(); - else - return 0;*/ } public Object getItem(int position) { - ContactGroupsCache contactGroupsCache = PPApplicationStatic.getContactGroupsCache(); - if (contactGroupsCache != null) - return contactGroupsCache.getContactGroup(position); + if (preference.contactGroupList != null) + return preference.contactGroupList.get(position); else - return null; + return null; } public long getItemId(int position) { @@ -73,6 +67,7 @@ public View getView(int position, View convertView, ViewGroup parent) convertView.setTag(new ContactGroupViewHolder(textViewDisplayName, checkBox, textViewAccountType)); // If CheckBox is toggled, update the ContactGroup it is tagged with. + //noinspection DataFlowIssue checkBox.setOnClickListener(v -> { CheckBox cb = (CheckBox) v; ContactGroup contactGroup = (ContactGroup) cb.getTag(); @@ -103,6 +98,13 @@ public View getView(int position, View convertView, ViewGroup parent) checkBox.setTag(contactGroup); // Display ContactGroup data + if (contactGroup.count == 0) + //noinspection DataFlowIssue + textViewDisplayName.setTextColor(convertView.getContext().getColor(R.color.preferenceSummaryTextColor)); + else + //noinspection DataFlowIssue + textViewDisplayName.setTextColor(convertView.getContext().getColor(R.color.activityNormalTextColor)); + //noinspection DataFlowIssue textViewDisplayName.setText(contactGroup.name + " (" + contactGroup.count + ")"); boolean found = false; @@ -110,35 +112,26 @@ public View getView(int position, View convertView, ViewGroup parent) PackageManager packageManager = context.getPackageManager(); try { ApplicationInfo applicationInfo = packageManager.getApplicationInfo(contactGroup.accountType, PackageManager.MATCH_ALL); - if (applicationInfo != null) { + //if (applicationInfo != null) { accountType = packageManager.getApplicationLabel(applicationInfo).toString(); found = true; - } + //} } catch (Exception ignored) {} if (!found) { - if (contactGroup.accountType != null) { - if (contactGroup.accountType.equals("com.osp.app.signin")) - accountType = context.getString(R.string.contact_account_type_samsung_account); - if (contactGroup.accountType.equals("com.google")) - accountType = context.getString(R.string.contact_account_type_google_account); - if (contactGroup.accountType.equals("vnd.sec.contact.sim")) - accountType = context.getString(R.string.contact_account_type_sim_card); - if (contactGroup.accountType.equals("vnd.sec.contact.sim2")) - accountType = context.getString(R.string.contact_account_type_sim_card); - if (contactGroup.accountType.equals("vnd.sec.contact.phone")) - accountType = context.getString(R.string.contact_account_type_phone_application); - if (contactGroup.accountType.equals("org.thoughtcrime.securesms")) - accountType = "Signal"; - if (contactGroup.accountType.equals("com.google.android.apps.tachyon")) - accountType = "Duo"; - if (contactGroup.accountType.equals("com.whatsapp")) - accountType = "WhatsApp"; - } + if (contactGroup.accountType != null) + accountType = ContactsCache.getAccountName(contactGroup.accountType, context); } if (accountType.isEmpty()) accountType = contactGroup.accountType; contactGroup.displayedAccountType = accountType; + if (contactGroup.count == 0) + //noinspection DataFlowIssue + textViewAccountType.setTextColor(convertView.getContext().getColor(R.color.preferenceSummaryTextColor)); + else + //noinspection DataFlowIssue + textViewAccountType.setTextColor(convertView.getContext().getColor(R.color.activityNormalTextColor)); + //noinspection DataFlowIssue textViewAccountType.setText(contactGroup.displayedAccountType); checkBox.setChecked(contactGroup.checked); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsCache.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsCache.java index 8d3862a68c..511ddd762b 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsCache.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsCache.java @@ -11,8 +11,8 @@ class ContactsCache { private final ArrayList contactList; //private final ArrayList contactListWithoutNumber; - private boolean cached; - private boolean caching; + private volatile boolean cached; + private volatile boolean caching; //private boolean cancelled; ContactsCache() @@ -91,6 +91,7 @@ void getContactList(Context context, boolean fixEvents) if ((name != null) && (rawAccountType != null)) { //if (hasPhone > 0) { + try { projection = new String[]{ ContactsContract.CommonDataKinds.Phone._ID, ContactsContract.CommonDataKinds.Phone.NUMBER//, @@ -98,7 +99,7 @@ void getContactList(Context context, boolean fixEvents) }; Cursor phones = context.getContentResolver().query(ContactsContract.CommonDataKinds.Phone.CONTENT_URI, projection, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + "=" + contactId + " AND " + - ContactsContract.CommonDataKinds.Phone.ACCOUNT_TYPE_AND_DATA_SET + "=\"" + rawAccountType + "\"", + ContactsContract.CommonDataKinds.Phone.ACCOUNT_TYPE_AND_DATA_SET + "='" + rawAccountType + "'", null, null); if (phones != null) { if (phones.getCount() > 0) { @@ -127,8 +128,7 @@ void getContactList(Context context, boolean fixEvents) _contactList.add(aContact); //} } - } - else { + } else { Contact aContact = new Contact(); aContact.contactId = contactId; aContact.name = name; @@ -146,6 +146,14 @@ void getContactList(Context context, boolean fixEvents) } phones.close(); } + } catch (Exception ignored) { + // example of crash when contact is from WhatsApp: + // android.database.sqlite.SQLiteException: unrecognized token: ""whatsapp" (code 1 SQLITE_ERROR): , + // while compiling: SELECT _id, data1 FROM view_data data LEFT OUTER JOIN (SELECT 0 as STAT_DATA_ID,0 as x_times_used, 0 as x_last_time_used, + // 0 as times_used, 0 as last_time_used where 0) as data_usage_stat ON (STAT_DATA_ID=data._id) WHERE (1 AND mimetype_id=5 AND (1=1)) AND + // (contact_id=135200 AND account_type_and_data_set="whatsapp e") + } + //} /*else { Contact aContact = new Contact(); @@ -337,6 +345,57 @@ void getContactList(Context context, boolean fixEvents) } } + if (!event._eventPreferencesCallScreening._contacts.isEmpty()) { + String[] splits = event._eventPreferencesCallScreening._contacts.split(StringConstants.STR_SPLIT_REGEX); + String _split = splits[0]; + String[] _splits2 = _split.split("#"); + boolean oldData = false; + try { + //noinspection unused + long l = Long.parseLong(_splits2[0]); + oldData = true; + } catch (Exception ignored) { + } + if (oldData) { + StringBuilder newContacts = new StringBuilder(); + for (String split : splits) { + String[] splits2 = split.split("#"); + if (splits2.length != 3) { + // old data + splits2 = split.split("#"); + if (splits2.length != 2) + continue; + contactId = Long.parseLong(splits2[0]); + long phoneId = Long.parseLong(splits2[1]); + + boolean found = false; + for (Contact contact : contactList) { + if (phoneId != 0) { + if ((contact.contactId == contactId) && (contact.phoneId == phoneId)) + found = true; + } else { + if (contact.contactId == contactId) + found = true; + } + if (found) { + if (newContacts.length() > 0) + newContacts.append("|"); + newContacts + .append(contact.name) + .append(StringConstants.STR_SPLIT_CONTACTS_REGEX) + .append(contact.phoneNumber) + .append(StringConstants.STR_SPLIT_CONTACTS_REGEX) + .append(contact.accountType); + break; + } + } + } + } + event._eventPreferencesCallScreening._contacts = newContacts.toString(); + dataChanged = true; + } + } + if (dataChanged) DatabaseHandler.getInstance(appContext).updateEvent(event); } @@ -411,8 +470,8 @@ void updateContacts(List _contactList/*, boolean withoutNumber*/) { contactListWithoutNumber.addAll(_contactList); } else {*/ - contactList.clear(); - contactList.addAll(_contactList); + contactList.clear(); + contactList.addAll(_contactList); //} } @@ -559,4 +618,27 @@ private static class ContactsInEvent { } */ + static String getAccountName(String accountType, Context context) { + String accountName = ""; + + if (accountType.equals("com.osp.app.signin")) + accountName = context.getString(R.string.contact_account_type_samsung_account); + if (accountType.equals("com.google")) + accountName = context.getString(R.string.contact_account_type_google_account); + if (accountType.equals("vnd.sec.contact.sim")) + accountName = context.getString(R.string.contact_account_type_sim_card); + if (accountType.equals("vnd.sec.contact.sim2")) + accountName = context.getString(R.string.contact_account_type_sim_card); + if (accountType.equals("vnd.sec.contact.phone")) + accountName = context.getString(R.string.contact_account_type_phone_application); + if (accountType.equals("org.thoughtcrime.securesms")) + accountName = "Signal"; + if (accountType.equals("com.google.android.apps.tachyon")) + accountName = "Duo"; + if (accountType.equals("com.whatsapp")) + accountName = "WhatsApp"; + + return accountName; + } + } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsContentObserver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsContentObserver.java index f92b6acf28..2d5d960a95 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsContentObserver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsContentObserver.java @@ -68,6 +68,7 @@ static void enqueueContactsContentObserverWorker() { .build(); } // PPApplicationStatic.logE("[WORKER_CALL] ContactsContentObserver.enqueueContactsContentObserverWorker", "xxx"); +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] ContactsContentObserver.enqueueContactsContentObserverWorker", "call of workManager.enqueueUniqueWork()"); workManager.enqueueUniqueWork(ContactsContentObserverWorker.WORK_TAG, ExistingWorkPolicy.REPLACE, worker); } } @@ -84,15 +85,17 @@ public void onChange(boolean selfChange, Uri uri) { // PPApplicationStatic.logE("[IN_OBSERVER] ContactsContentObserver.onChange", "ContactsContract.Data.CONTENT_URI=" + ContactsContract.Data.CONTENT_URI); // } - if (PPApplication.blockContactContentObserver) - // observwer is blocked (for exmple by profile/event preferences activity) - return; +// if (PPApplication.blockContactContentObserver) +// // observwer is blocked (for exmple by profile/event preferences activity) +// return; +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] ContactsContentObserver.onChange", "call of enqueueContactsContentObserverWorker()"); enqueueContactsContentObserverWorker(); } @Override public void onChange(boolean selfChange) { +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] ContactsContentObserver.onChange", "onChange(boolean selfChange)"); onChange(selfChange, null); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsContentObserverWorker.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsContentObserverWorker.java index bb0e738efe..8e272e36ea 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsContentObserverWorker.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsContentObserverWorker.java @@ -22,9 +22,10 @@ public ContactsContentObserverWorker( @NonNull @Override public Result doWork() { - if (PPApplication.blockContactContentObserver) - // observwer is blocked (for exmple by profile/event preferences activity) - return Result.success(); +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] ContactsContentObserverWorker.doWork", "PPApplication.blockContactContentObserver="+PPApplication.blockContactContentObserver); +// if (PPApplication.blockContactContentObserver) +// // observwer is blocked (for exmple by profile/event preferences activity) +// return Result.success(); try { // long start = System.currentTimeMillis(); @@ -33,10 +34,13 @@ public Result doWork() { Context appContext = context.getApplicationContext(); // must be first +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] ContactsContentObserverWorker.doWork", "PPApplicationStatic.createContactsCache()"); PPApplicationStatic.createContactsCache(appContext, false, true/*, true*/); //must be seconds, this ads groups into contacts +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] ContactsContentObserverWorker.doWork", "PPApplicationStatic.createContactGroupsCache()"); PPApplicationStatic.createContactGroupsCache(appContext, false/*, true*//*, true*/); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] ContactsContentObserverWorker.doWork", "SENSOR_TYPE_CONTACTS_CACHE_CHANGED"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_CONTACTS_CACHE_CHANGED}); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsFilterDialog.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsFilterDialog.java index 41862003ec..eb579bf059 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsFilterDialog.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsFilterDialog.java @@ -84,6 +84,7 @@ class ContactsFilterDialog { rellaDialog = layout.findViewById(R.id.contacts_filter_dlg_rella_dialog); listAdapter = new ContactsFilterDialogAdapter(activity, this); + //noinspection DataFlowIssue contactsFilterListView.setAdapter(listAdapter); contactsFilterListView.setOnItemClickListener((parent, v, position, id) -> { @@ -131,19 +132,24 @@ protected Void doInBackground(Void... params) { ContactsFilterDialog dialog = dialogWeakRef.get(); Activity activity = activityWeakReference.get(); if ((dialog != null) && (activity != null)) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsFilterDialog.doInBackground", "PPApplicationStatic.getContactsCache()"); ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); if (contactsCache == null) { // cache not created, create it +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsFilterDialog.doInBackground", "PPApplicationStatic.createContactsCache()"); PPApplicationStatic.createContactsCache(activity.getApplicationContext(), false, false/*, true*/); /*contactsCache = PPApplicationStatic.getContactsCache(); while (contactsCache.getCaching()) GlobalUtils.sleep(100);*/ } else { +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsFilterDialog.doInBackground", "contactsCache.getCaching()"); if (!contactsCache.getCaching()) { // caching not performed +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsFilterDialog.doInBackground", "contactsCache.getList()"); List contactList = contactsCache.getList(/*withoutNumbers*/); if (contactList == null) { // not cached, cache it +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsFilterDialog.doInBackground", "PPApplicationStatic.createContactsCache()"); PPApplicationStatic.createContactsCache(activity.getApplicationContext(), false, false/*, true*/); /*contactsCache = PPApplicationStatic.getContactsCache(); while (contactsCache.getCaching()) @@ -153,6 +159,7 @@ protected Void doInBackground(Void... params) { contactList.clear(); } else { // wait for cache end +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsFilterDialog.doInBackground", "contactsCache.getCaching()"); while (contactsCache.getCaching()) GlobalUtils.sleep(100); } @@ -163,6 +170,7 @@ protected Void doInBackground(Void... params) { // PPApplicationStatic.logE("[SYNCHRONIZED] ContactsFilterDialog.ShowDialogAsyncTask", "PPApplication.contactsCacheMutex"); synchronized (PPApplication.contactsCacheMutex) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsFilterDialog.doInBackground", "contactsCache.getList()"); List localContactList = contactsCache.getList(/*withoutNumbers*/); if (localContactList != null) { for (Contact contact : localContactList) { @@ -193,31 +201,15 @@ protected Void doInBackground(Void... params) { String newFilterName = ""; try { ApplicationInfo applicationInfo = packageManager.getApplicationInfo(filter.data, PackageManager.MATCH_ALL); - if (applicationInfo != null) { + //if (applicationInfo != null) { newFilterName = packageManager.getApplicationLabel(applicationInfo).toString(); found = true; - } + //} } catch (Exception ignored) { } if (!found) { - if (filter.data != null) { - if (filter.data.equals("com.osp.app.signin")) - newFilterName = activity.getString(R.string.contact_account_type_samsung_account); - if (filter.data.equals("com.google")) - newFilterName = activity.getString(R.string.contact_account_type_google_account); - if (filter.data.equals("vnd.sec.contact.sim")) - newFilterName = activity.getString(R.string.contact_account_type_sim_card); - if (filter.data.equals("vnd.sec.contact.sim2")) - newFilterName = activity.getString(R.string.contact_account_type_sim_card); - if (filter.data.equals("vnd.sec.contact.phone")) - newFilterName = activity.getString(R.string.contact_account_type_phone_application); - if (filter.data.equals("org.thoughtcrime.securesms")) - newFilterName = "Signal"; - if (filter.data.equals("com.google.android.apps.tachyon")) - newFilterName = "Duo"; - if (filter.data.equals("com.whatsapp")) - newFilterName = "WhatsApp"; - } + if (filter.data != null) + newFilterName = ContactsCache.getAccountName(filter.data, activity); } if (newFilterName.isEmpty()) newFilterName = filter.data; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreference.java index 457fe196c2..2dea866d2a 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreference.java @@ -68,9 +68,9 @@ protected void onSetInitialValue(Object defaultValue) setSummaryCMSDP(); // toto cita z databazy, ak je len jedne kontakt nastaveny } - void refreshListView(@SuppressWarnings("SameParameterValue") final boolean notForUnselect) { + void refreshListView(@SuppressWarnings("SameParameterValue") final boolean forUnselect) { if (fragment != null) - fragment.refreshListView(notForUnselect); + fragment.refreshListView(forUnselect); } void setContactsFilter(ContactFilter filter) { @@ -98,12 +98,14 @@ String getFilterNameText() { void getValueCMSDP() { // change checked state by value +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsMultiSelectDialogPreference.getValueCMSDP", "PPApplicationStatic.getContactsCache()"); ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); if (contactsCache == null) return; // PPApplicationStatic.logE("[SYNCHRONIZED] ContactsMultiSelectDialogPreference.getValueCMSDP", "PPApplication.contactsCacheMutex"); synchronized (PPApplication.contactsCacheMutex) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsMultiSelectDialogPreference.getValueCMSDP", "contactsCache.getList()"); List localContactList = contactsCache.getList(/*withoutNumbers*/); if (localContactList != null) { // PPApplicationStatic.logE("[CONTACTS_DIALOG] ContactsMultiSelectDialogPreference.getValueCMSDP", "localContactList.size()="+localContactList.size()); @@ -287,29 +289,13 @@ void getValueCMSDP() PackageManager packageManager = _context.getPackageManager(); try { ApplicationInfo applicationInfo = packageManager.getApplicationInfo(contact.accountType, PackageManager.MATCH_ALL); - if (applicationInfo != null) { + //if (applicationInfo != null) { accountType = packageManager.getApplicationLabel(applicationInfo).toString(); found = true; - } + //} } catch (Exception ignored) {} - if (!found) { - if (contact.accountType.equals("com.osp.app.signin")) - accountType = _context.getString(R.string.contact_account_type_samsung_account); - if (contact.accountType.equals("com.google")) - accountType = _context.getString(R.string.contact_account_type_google_account); - if (contact.accountType.equals("vnd.sec.contact.sim")) - accountType = _context.getString(R.string.contact_account_type_sim_card); - if (contact.accountType.equals("vnd.sec.contact.sim2")) - accountType = _context.getString(R.string.contact_account_type_sim_card); - if (contact.accountType.equals("vnd.sec.contact.phone")) - accountType = _context.getString(R.string.contact_account_type_phone_application); - if (contact.accountType.equals("org.thoughtcrime.securesms")) - accountType = "Signal"; - if (contact.accountType.equals("com.google.android.apps.tachyon")) - accountType = "Duo"; - if (contact.accountType.equals("com.whatsapp")) - accountType = "WhatsApp"; - } + if (!found) + accountType = ContactsCache.getAccountName(contact.accountType, _context); if ((!accountType.isEmpty()) && (!contact.accountType.equals("vnd.sec.contact.sim")) && (!contact.accountType.equals("vnd.sec.contact.sim2")) && @@ -446,7 +432,7 @@ protected void onRestoreInstanceState(Parcelable state) //getValueCMSDP(); setSummaryCMSDP(); - refreshListView(true); + refreshListView(false); //notifyChanged(); } @@ -479,7 +465,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public ContactsMultiSelectDialogPreference.SavedState createFromParcel(Parcel in) { return new ContactsMultiSelectDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreferenceFragment.java index 598df6fdbc..244a91a391 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreferenceFragment.java @@ -11,6 +11,7 @@ import android.view.View; import android.widget.Button; import android.widget.LinearLayout; +import android.widget.RelativeLayout; import android.widget.TextView; import androidx.annotation.NonNull; @@ -29,8 +30,10 @@ public class ContactsMultiSelectDialogPreferenceFragment extends PreferenceDialo private ContactsMultiSelectDialogPreference preference; // Layout widgets. + FastScrollRecyclerView listView; private LinearLayout linlaProgress; private LinearLayout linlaData; + RelativeLayout emptyList; private TextView contactsFilter; private ContactsFilterDialog mContactsFilterDialog; @@ -58,8 +61,13 @@ protected void onBindDialogView(@NonNull View view) { linlaProgress = view.findViewById(R.id.contacts_multiselect_pref_dlg_linla_progress); linlaData = view.findViewById(R.id.contacts_multiselect_pref_dlg_linla_data); + linlaProgress = view.findViewById(R.id.contacts_multiselect_pref_dlg_linla_progress); + linlaData = view.findViewById(R.id.contacts_multiselect_pref_dlg_linla_data); + emptyList = view.findViewById(R.id.contacts_multiselect_pref_dlg_empty); + RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext()); - FastScrollRecyclerView listView = view.findViewById(R.id.contacts_multiselect_pref_dlg_listview); + listView = view.findViewById(R.id.contacts_multiselect_pref_dlg_listview); + //noinspection DataFlowIssue listView.setLayoutManager(layoutManager); listView.setHasFixedSize(true); @@ -67,6 +75,7 @@ protected void onBindDialogView(@NonNull View view) { listView.setAdapter(listAdapter); final Button unselectAllButton = view.findViewById(R.id.contacts_multiselect_pref_dlg_unselect_all); + //noinspection DataFlowIssue unselectAllButton.setOnClickListener(v -> { // PPApplicationStatic.logE("[CONTACTS_DIALOG] ContactsMultiSelectDialogPreferenceFragment.onClick", "unselectAllButton click"); preference.value=""; @@ -74,7 +83,7 @@ protected void onBindDialogView(@NonNull View view) { for (Contact contact : preference.contactList) contact.checked = false; } - refreshListView(false); + refreshListView(true); }); if (Permissions.grantContactsDialogPermissions(prefContext)) { @@ -96,7 +105,7 @@ protected void onBindDialogView(@NonNull View view) { handler.postDelayed(() -> { ContactsMultiSelectDialogPreferenceFragment fragment = fragmentWeakRef.get(); if (fragment != null) - fragment.refreshListView(true); + fragment.refreshListView(false); }, 200); } @@ -105,9 +114,11 @@ protected void onBindDialogView(@NonNull View view) { //if (preference.value.isEmpty()) // cellFilter.setText(R.string.mobile_cell_names_dialog_item_show_all); //else + //noinspection DataFlowIssue contactsFilter.setText(R.string.contacts_filter_dialog_item_show_all); } else + //noinspection DataFlowIssue contactsFilter.setText(preference.contactsFilter.displayName); contactsFilter.addTextChangedListener(new TextWatcher() { @Override @@ -158,22 +169,22 @@ void setContactsFilter(ContactFilter filter) { contactsFilter.setText(filter.displayName); } - void refreshListView(final boolean notForUnselect) { - asyncTask = new RefreshListViewAsyncTask(notForUnselect, preference, this, prefContext); + void refreshListView(final boolean forUnselect) { + asyncTask = new RefreshListViewAsyncTask(forUnselect, preference, this, prefContext); asyncTask.execute(); } private static class RefreshListViewAsyncTask extends AsyncTask { - final boolean notForUnselect; + final boolean forUnselect; private final WeakReference preferenceWeakRef; private final WeakReference fragmentWeakRef; private final WeakReference prefContextWeakRef; - public RefreshListViewAsyncTask(final boolean notForUnselect, + public RefreshListViewAsyncTask(final boolean forUnselect, ContactsMultiSelectDialogPreference preference, ContactsMultiSelectDialogPreferenceFragment fragment, Context prefContext) { - this.notForUnselect = notForUnselect; + this.forUnselect = forUnselect; this.preferenceWeakRef = new WeakReference<>(preference); this.fragmentWeakRef = new WeakReference<>(fragment); this.prefContextWeakRef = new WeakReference<>(prefContext); @@ -185,7 +196,7 @@ protected void onPreExecute() { ContactsMultiSelectDialogPreferenceFragment fragment = fragmentWeakRef.get(); if (fragment != null) { - if (notForUnselect) { + if (!forUnselect) { fragment.linlaData.setVisibility(View.GONE); fragment.linlaProgress.setVisibility(View.VISIBLE); } @@ -202,19 +213,24 @@ protected Void doInBackground(Void... params) { // PhoneProfilesService.getContactsCache().getContactList(prefContext); // must be first +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsMultiSelectDialogPreferenceFragment.doInBackground", "PPApplicationStatic.getContactsCache()"); ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); if (contactsCache == null) { // cache not created, create it +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsMultiSelectDialogPreferenceFragment.doInBackground", "PPApplicationStatic.createContactsCache()"); PPApplicationStatic.createContactsCache(prefContext.getApplicationContext(), false, false/*, true*/); /*contactsCache = PPApplicationStatic.getContactsCache(); while (contactsCache.getCaching()) GlobalUtils.sleep(100);*/ } else { +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsMultiSelectDialogPreferenceFragment.doInBackground", "contactsCache.getCaching()"); if (!contactsCache.getCaching()) { // caching not performed +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsMultiSelectDialogPreferenceFragment.doInBackground", "contactsCache.getList()"); List contactList = contactsCache.getList(/*withoutNumbers*/); if (contactList == null) { // not cached, cache it +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsMultiSelectDialogPreferenceFragment.doInBackground", "PPApplicationStatic.createContactsCache()"); PPApplicationStatic.createContactsCache(prefContext.getApplicationContext(), false, false/*, true*/); /*contactsCache = PPApplicationStatic.getContactsCache(); while (contactsCache.getCaching()) @@ -223,24 +239,30 @@ protected Void doInBackground(Void... params) { contactList.clear(); } else { // wait for cache end +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsMultiSelectDialogPreferenceFragment.doInBackground", "contactsCache.getCaching()"); while (contactsCache.getCaching()) GlobalUtils.sleep(100); } } //must be seconds, this ads groups into contacts +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsMultiSelectDialogPreferenceFragment.doInBackground", "PPApplicationStatic.getContactGroupsCache()"); ContactGroupsCache contactGroupsCache = PPApplicationStatic.getContactGroupsCache(); if (contactGroupsCache == null) { // cache not created, create it +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactMultiSelectDialogPreferenceFragment.doInBackground", "PPApplicationStatic.createContactGroupsCache()"); PPApplicationStatic.createContactGroupsCache(prefContext.getApplicationContext(), false/*, false*//*, true*/); /*contactGroupsCache = PPApplicationStatic.getContactGroupsCache(); while (contactGroupsCache.getCaching()) GlobalUtils.sleep(100);*/ } else { +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactMultiSelectDialogPreferenceFragment.doInBackground", "contactGroupsCache.getCaching()"); if (!contactGroupsCache.getCaching()) { // caching not performed +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactMultiSelectDialogPreferenceFragment.doInBackground", "contactGroupsCache.getList()"); List contactGroupList = contactGroupsCache.getList(/*withoutNumbers*/); if (contactGroupList == null) { // not cached, cache it +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactMultiSelectDialogPreferenceFragment.doInBackground", "PPApplicationStatic.createContactGroupsCache()"); PPApplicationStatic.createContactGroupsCache(prefContext.getApplicationContext(), false/*, false*//*, true*/); /*contactGroupsCache = PPApplicationStatic.getContactGroupsCache(); while (contactGroupsCache.getCaching()) @@ -248,6 +270,7 @@ protected Void doInBackground(Void... params) { } } else { // wait for cache end +// PPApplicationStatic.logE("[CONTACTS_CACHE] ContactMultiSelectDialogPreferenceFragment.doInBackground", "contactGroupsCache.getCaching()"); while (contactGroupsCache.getCaching()) GlobalUtils.sleep(100); } @@ -267,15 +290,23 @@ protected void onPostExecute(Void result) { ContactsMultiSelectDialogPreferenceFragment fragment = fragmentWeakRef.get(); ContactsMultiSelectDialogPreference preference = preferenceWeakRef.get(); Context prefContext = prefContextWeakRef.get(); + final boolean _forUnselect = forUnselect; if ((fragment != null) && (preference != null) && (prefContext != null)) { - //if (!EditorActivity.getContactsCache().cached) - // EditorActivity.getContactsCache().clearCache(false); - fragment.linlaProgress.setVisibility(View.GONE); final Handler handler = new Handler(prefContext.getMainLooper()); handler.post(() -> { - if (notForUnselect) { + fragment.linlaData.setVisibility(View.VISIBLE); + + if (!_forUnselect) { + if (preference.contactList.isEmpty()) { + fragment.listView.setVisibility(View.GONE); + fragment.emptyList.setVisibility(View.VISIBLE); + } else { + fragment.emptyList.setVisibility(View.GONE); + fragment.listView.setVisibility(View.VISIBLE); + } + fragment.linlaData.setVisibility(View.VISIBLE); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreferenceViewHolder.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreferenceViewHolder.java index ecf83c5b33..d581038d52 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreferenceViewHolder.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreferenceViewHolder.java @@ -33,6 +33,7 @@ class ContactsMultiSelectDialogPreferenceViewHolder extends RecyclerView.ViewHol textViewAccountType = itemView.findViewById(R.id.contacts_multiselect_pref_dlg_item_account_type); // If CheckBox is toggled, update the Contact it is tagged with. + //noinspection DataFlowIssue checkBox.setOnClickListener(v -> { CheckBox cb = (CheckBox) v; Contact contact = (Contact) cb.getTag(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomACRAEmailSender.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomACRAEmailSender.java index d93ed2f2e0..cd3f9de987 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomACRAEmailSender.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomACRAEmailSender.java @@ -62,70 +62,116 @@ public void send(@NotNull Context context, @NotNull CrashReportData errorContent MailSenderConfiguration mailConfig = (MailSenderConfiguration) plugin; - String emailAddress = mailConfig.getMailTo(); - Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts( - StringConstants.INTENT_DATA_MAIL_TO, emailAddress, null)); + if (Build.VERSION.SDK_INT >= 35) { + Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE); + emailIntent.setType("message/rfc822"); // only email apps should handle this + //emailIntent.setData(Uri.parse(StringConstants.INTENT_DATA_MAIL_TO_COLON)); - emailIntent.putExtra(Intent.EXTRA_SUBJECT, mailConfig.getSubject()); - - emailIntent.putExtra(Intent.EXTRA_TEXT, mailConfig.getBody()); - emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + String reportText; + try { + reportText = coreConfiguration.getReportFormat().toFormattedString(errorContent, coreConfiguration.getReportContent(), StringConstants.CHAR_NEW_LINE, "\n\t", false); + } catch (Exception e) { + throw new ReportSenderException("Failed to convert Report to text", e); + } - ArrayList attachments = new ArrayList<>(); + ArrayList attachments = new ArrayList<>(); + Uri report = createAttachmentFromString(context, mailConfig.getReportFileName(), reportText); + if (report != null) { + /*try { + ContentResolver contentResolver = context.getContentResolver(); + context.grantUriPermission(PPApplication.PACKAGE_NAME, report, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); + contentResolver.takePersistableUriPermission(report, Intent.FLAG_GRANT_READ_URI_PERMISSION); + } catch (Exception e) { + // java.lang.SecurityException: UID 10157 does not have permission to + // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg + // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs + //Log.e("ActivateProfileHelper.setTones (1)", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + }*/ + attachments.add(report); + } - String reportText; - try { - reportText = coreConfiguration.getReportFormat().toFormattedString(errorContent, coreConfiguration.getReportContent(), StringConstants.CHAR_NEW_LINE, "\n\t", false); - } catch (Exception e) { - throw new ReportSenderException("Failed to convert Report to text", e); - } + emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments); + String emailAddress = mailConfig.getMailTo(); + emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{emailAddress}); - Uri report = createAttachmentFromString(context, mailConfig.getReportFileName(), reportText); - if (report != null) { - /*try { - ContentResolver contentResolver = context.getContentResolver(); - context.grantUriPermission(PPApplication.PACKAGE_NAME, report, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); - contentResolver.takePersistableUriPermission(report, Intent.FLAG_GRANT_READ_URI_PERMISSION); - } catch (Exception e) { - // java.lang.SecurityException: UID 10157 does not have permission to - // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg - // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs - //Log.e("ActivateProfileHelper.setTones (1)", Log.getStackTraceString(e)); - //PPApplicationStatic.recordException(e); - }*/ - attachments.add(report); - } + emailIntent.putExtra(Intent.EXTRA_SUBJECT, mailConfig.getSubject()); + emailIntent.putExtra(Intent.EXTRA_TEXT, mailConfig.getBody()); + emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - List resolveInfo = context.getPackageManager().queryIntentActivities(emailIntent, 0); -// Log.e("CustomACRAEmailSender.send", "resolveInfo.size()=" + resolveInfo.size()); - List intents = new ArrayList<>(); - for (ResolveInfo info : resolveInfo) { - Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); - intent.setComponent(new ComponentName(info.activityInfo.packageName, info.activityInfo.name)); - //if (!emailAddress.isEmpty()) - intent.putExtra(Intent.EXTRA_EMAIL, new String[]{emailAddress}); - intent.putExtra(Intent.EXTRA_SUBJECT, mailConfig.getSubject()); - intent.putExtra(Intent.EXTRA_TEXT, mailConfig.getBody()); - intent.setType(StringConstants.MINE_TYPE_ALL); // gmail will only match with type set - intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments); //ArrayList of attachment Uri's - intents.add(new LabeledIntent(intent, info.activityInfo.packageName, info.loadLabel(context.getPackageManager()), info.icon)); - } -// Log.e("CustomACRAEmailSender.send", "intents.size()="+intents.size()); - if (!intents.isEmpty()) { try { -// for (Intent _intent : intents) { -// Log.e("CustomACRAEmailSender.send", "intents.size()=" + _intent.getAction()); -// } - Intent chooser = Intent.createChooser(new Intent(Intent.ACTION_CHOOSER), context.getString(R.string.email_chooser)); - chooser.putExtra(Intent.EXTRA_INTENT, intents.get(0)); - chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new LabeledIntent[0])); - chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + Intent chooser = Intent.createChooser(emailIntent, context.getString(R.string.email_chooser)); + //chooser.putExtra(Intent.EXTRA_INTENT, intents.get(0)); + //chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new LabeledIntent[0])); context.startActivity(chooser); -// Log.e("CustomACRAEmailSender.send", "mail sent"); } catch (Exception e) { PPApplicationStatic.logException("CustomACRAEmailSender.send", Log.getStackTraceString(e)); } + } else { + String emailAddress = mailConfig.getMailTo(); + Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts( + StringConstants.INTENT_DATA_MAIL_TO, emailAddress, null)); + + emailIntent.putExtra(Intent.EXTRA_SUBJECT, mailConfig.getSubject()); + emailIntent.putExtra(Intent.EXTRA_TEXT, mailConfig.getBody()); + emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + + ArrayList attachments = new ArrayList<>(); + + String reportText; + try { + reportText = coreConfiguration.getReportFormat().toFormattedString(errorContent, coreConfiguration.getReportContent(), StringConstants.CHAR_NEW_LINE, "\n\t", false); + } catch (Exception e) { + throw new ReportSenderException("Failed to convert Report to text", e); + } + + Uri report = createAttachmentFromString(context, mailConfig.getReportFileName(), reportText); + if (report != null) { + /*try { + ContentResolver contentResolver = context.getContentResolver(); + context.grantUriPermission(PPApplication.PACKAGE_NAME, report, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); + contentResolver.takePersistableUriPermission(report, Intent.FLAG_GRANT_READ_URI_PERMISSION); + } catch (Exception e) { + // java.lang.SecurityException: UID 10157 does not have permission to + // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg + // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs + //Log.e("ActivateProfileHelper.setTones (1)", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + }*/ + attachments.add(report); + } + + List resolveInfo = context.getPackageManager().queryIntentActivities(emailIntent, 0); +// Log.e("CustomACRAEmailSender.send", "resolveInfo.size()=" + resolveInfo.size()); + List intents = new ArrayList<>(); + for (ResolveInfo info : resolveInfo) { + Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); + intent.setComponent(new ComponentName(info.activityInfo.packageName, info.activityInfo.name)); + //if (!emailAddress.isEmpty()) + intent.putExtra(Intent.EXTRA_EMAIL, new String[]{emailAddress}); + intent.putExtra(Intent.EXTRA_SUBJECT, mailConfig.getSubject()); + intent.putExtra(Intent.EXTRA_TEXT, mailConfig.getBody()); + intent.setType(StringConstants.MINE_TYPE_ALL); // gmail will only match with type set + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments); //ArrayList of attachment Uri's + intents.add(new LabeledIntent(intent, info.activityInfo.packageName, info.loadLabel(context.getPackageManager()), info.icon)); + } +// Log.e("CustomACRAEmailSender.send", "intents.size()="+intents.size()); + if (!intents.isEmpty()) { + try { +// for (Intent _intent : intents) { +// Log.e("CustomACRAEmailSender.send", "intents.size()=" + _intent.getAction()); +// } + Intent chooser = Intent.createChooser(new Intent(Intent.ACTION_CHOOSER), context.getString(R.string.email_chooser)); + chooser.putExtra(Intent.EXTRA_INTENT, intents.get(0)); + chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new LabeledIntent[0])); + chooser.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + context.startActivity(chooser); +// Log.e("CustomACRAEmailSender.send", "mail sent"); + } catch (Exception e) { + PPApplicationStatic.logException("CustomACRAEmailSender.send", Log.getStackTraceString(e)); + } + } } break; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomACRAReportingAdministrator.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomACRAReportingAdministrator.java index 5c2bcdd2fc..308b1576b7 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomACRAReportingAdministrator.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomACRAReportingAdministrator.java @@ -76,9 +76,15 @@ public boolean shouldStartCollecting(@NonNull final Context context, } else*/ //if ((PPApplication.lockDeviceActivity != null) && // (PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayed != 0)) - if (PPApplication.lockDeviceActivityDisplayed && - (PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayed != 0)) - Settings.System.putInt(context.getApplicationContext().getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayed); + if (PPApplication.lockDeviceActivityOnlyScreenOff && + (PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForScreenOff != 0)) { + Settings.System.putInt(context.getApplicationContext().getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForScreenOff); + } + else + if ((!PPApplication.lockDeviceActivityOnlyScreenOff) && + (PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForDeviceLock != 0)) { + Settings.System.putInt(context.getApplicationContext().getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForDeviceLock); + } } } } catch (Exception ee) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomColorDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomColorDialogPreference.java index 79fc32754e..63aac72106 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomColorDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomColorDialogPreference.java @@ -217,8 +217,8 @@ public void writeToParcel(Parcel dest, int flags) super(superState); } - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator<>() { public CustomColorDialogPreference.SavedState createFromParcel(Parcel in) { return new CustomColorDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomColorDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomColorDialogPreferenceFragment.java index 1a7f86f595..09b055fa4d 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomColorDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomColorDialogPreferenceFragment.java @@ -34,6 +34,7 @@ protected void onBindDialogView(@NonNull View view) { super.onBindDialogView(view); chromaColorView = view.findViewById(R.id.custom_color_chroma_color_view); + //noinspection DataFlowIssue chromaColorView.setCurrentColor(preference.value); chromaColorView.setColorMode(ColorMode.values()[preference.chromaColorMode]); chromaColorView.setIndicatorMode(IndicatorMode.values()[preference.chromaIndicatorMode]); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomSwitchPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomSwitchPreference.java new file mode 100644 index 0000000000..0c789d219d --- /dev/null +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/CustomSwitchPreference.java @@ -0,0 +1,45 @@ +package sk.henrichg.phoneprofilesplus; + +import android.content.Context; +import android.util.AttributeSet; + +import androidx.annotation.NonNull; +import androidx.appcompat.widget.SwitchCompat; +import androidx.preference.PreferenceViewHolder; +import androidx.preference.SwitchPreferenceCompat; + +/** @noinspection unused*/ +public class CustomSwitchPreference extends SwitchPreferenceCompat { + + //private SwitchCompat switchControl; + + public CustomSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + } + + public CustomSwitchPreference(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + } + + public CustomSwitchPreference(Context context, AttributeSet attrs) { + super(context, attrs); + } + + public CustomSwitchPreference(Context context) { + super(context); + } + + @Override + public void onBindViewHolder(@NonNull PreferenceViewHolder holder) + { + super.onBindViewHolder(holder); + + SwitchCompat switchControl = (SwitchCompat) holder.findViewById(R.id.switchControl); + switchControl.setChecked(isChecked()); + switchControl.setOnClickListener(v -> { + setChecked(!isChecked()); + persistBoolean(isChecked()); + }); + } + +} diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DNDPermissionNotification.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DNDPermissionNotification.java index c985be63d3..02c983a28f 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DNDPermissionNotification.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DNDPermissionNotification.java @@ -77,7 +77,7 @@ static void showNotification(Context context, boolean useHandler) { static private void showNotification(Context context, String title, String text) { PPApplicationStatic.createExclamationNotificationChannel(context.getApplicationContext(), false); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context.getApplicationContext(), PPApplication.EXCLAMATION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.error_color)) + .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.errorColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_exclamation_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(context.getApplicationContext().getResources(), R.drawable.ic_exclamation_notification)) .setContentTitle(title) // title for notification diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DataWrapper.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DataWrapper.java index eb68135250..690c0dfa5a 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DataWrapper.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DataWrapper.java @@ -981,15 +981,19 @@ void pauseAllEvents(boolean noSetSystemEvent, boolean blockEvents/*, boolean act Event event = it.next(); if (event != null) { int status = event.getStatusFromDB(context); +// Log.e("DataWrapper.pauseAllEvents", "event._name="+event._name); +// Log.e("DataWrapper.pauseAllEvents", "status="+status); if (status == Event.ESTATUS_RUNNING) { if (!(event._ignoreManualActivation && event._noPauseByManualActivation)) { +// Log.e("DataWrapper.pauseAllEvents", "pause event"); event.pauseEvent(this, false, true, noSetSystemEvent, true, null, false, false, false, true); } } setEventBlocked(event, false); if (blockEvents && (status == Event.ESTATUS_RUNNING) && event._ignoreManualActivation) { +// Log.e("DataWrapper.pauseAllEvents", "block event"); // block only running forceRun events if (!event._noPauseByManualActivation) // do not pause event, even when is running setEventBlocked(event, true); @@ -997,6 +1001,7 @@ void pauseAllEvents(boolean noSetSystemEvent, boolean blockEvents/*, boolean act if (!(event._ignoreManualActivation && event._noPauseByManualActivation)) { // for "push" events, set startTime to 0 +// Log.e("DataWrapper.pauseAllEvents", "clearSensorsStartTime"); clearSensorsStartTime(event, true); } } @@ -1500,7 +1505,7 @@ private void _activateProfile(Profile _profile, boolean merged, int startupSourc final boolean forRestartEvents, final boolean manualRestart) { // show notification when battery optimization is not enabled - DrawOverAppsPermissionNotification.showNotification(context, false); + //DrawOverAppsPermissionNotification.showNotification(context, false); IgnoreBatteryOptimizationNotification.showNotification(context, false); DNDPermissionNotification.showNotification(context, false); @@ -1508,8 +1513,34 @@ private void _activateProfile(Profile _profile, boolean merged, int startupSourc ProfileDurationAlarmBroadcastReceiver.removeAlarm(_profile, context); //Profile.setActivatedProfileForDuration(context, 0); - // get currently activated profile - //Profile oldActivatedProfile = getActivatedProfile(false, false); + /* + // get first profile from fifo + long oldActivatedProfileId; + boolean manualProfileActivation = + (startupSource == PPApplication.STARTUP_SOURCE_NOTIFICATION) || + (startupSource == PPApplication.STARTUP_SOURCE_WIDGET) || + (startupSource == PPApplication.STARTUP_SOURCE_SHORTCUT) || + (startupSource == PPApplication.STARTUP_SOURCE_ACTIVATOR) || + (startupSource == PPApplication.STARTUP_SOURCE_EDITOR) || + (startupSource == PPApplication.STARTUP_SOURCE_QUICK_TILE); + if (manualProfileActivation) { + oldActivatedProfileId = getActivatedProfileId(); + Log.e("DataWrapper._activateProfile", "(3) oldActivatedProfileId=" + oldActivatedProfileId); + } else { + List activateProfilesFIFO = fifoGetActivatedProfiles(); + if (!activateProfilesFIFO.isEmpty()) { + String fromFifo = activateProfilesFIFO.get(0); + String[] splits = fromFifo.split(StringConstants.STR_SPLIT_REGEX); + //oldActivatedProfileId = getActivatedProfileId(); + //Log.e("DataWrapper._activateProfile", "(1.1) oldActivatedProfileId=" + oldActivatedProfileId); + oldActivatedProfileId = Long.parseLong(splits[0]); + Log.e("DataWrapper._activateProfile", "(1.2) oldActivatedProfileId=" + oldActivatedProfileId); + } else { + oldActivatedProfileId = getActivatedProfileId(); + Log.e("DataWrapper._activateProfile", "(2) oldActivatedProfileId=" + oldActivatedProfileId); + } + } + */ if ((startupSource != PPApplication.STARTUP_SOURCE_EVENT) //&& //(startupSource != PPApplication.STARTUP_SOURCE_BOOT) && // on boot must set as manual activation @@ -1527,7 +1558,7 @@ private void _activateProfile(Profile _profile, boolean merged, int startupSourc } DatabaseHandler.getInstance(context).activateProfile(_profile); -// Log.e("DataWrapper._activateProfile", "profile="+_profile._name); +// Log.e("DataWrapper._activateProfile", "profile to db="+_profile._id); setProfileActive(_profile); // for STARTUP_SOURCE_EVENT, STARTUP_SOURCE_FOR_FIRST_START is mandatory @@ -1540,7 +1571,7 @@ private void _activateProfile(Profile _profile, boolean merged, int startupSourc (startupSource == PPApplication.STARTUP_SOURCE_SHORTCUT) || (startupSource == PPApplication.STARTUP_SOURCE_ACTIVATOR) || (startupSource == PPApplication.STARTUP_SOURCE_EDITOR) || - (startupSource == PPApplication.STARTUP_SOURCE_LAUNCHER) || + //(startupSource == PPApplication.STARTUP_SOURCE_LAUNCHER) || (startupSource == PPApplication.STARTUP_SOURCE_QUICK_TILE) || (startupSource == PPApplication.STARTUP_SOURCE_EVENT_MANUAL) || (startupSource == PPApplication.STARTUP_SOURCE_EXTERNAL_APP); @@ -1607,9 +1638,8 @@ private void _activateProfile(Profile _profile, boolean merged, int startupSourc // PPApplicationStatic.logE("[PPP_NOTIFICATION] DataWrapper._activateProfile", "call of updateGUI"); PPApplication.updateGUI(false, false, context); - if (_profile != null) { - ActivateProfileHelper.execute(context, _profile); - } + if (_profile != null) + ActivateProfileHelper.execute(context, _profile, forRestartEvents); if (/*(mappedProfile != null) &&*/ (!merged)) { PPApplicationStatic.addActivityLog(context, PPApplication.ALTYPE_PROFILE_ACTIVATION, @@ -1648,6 +1678,10 @@ void activateProfileFromMainThread(Profile _profile, final boolean merged, final final Context appContext = context.getApplicationContext(); final WeakReference dataWrapperWeakRef = new WeakReference<>(_dataWrapper); final WeakReference profileWeakRef = new WeakReference<>(_profile); + + PPApplicationStatic.getProfileBeforeActivation(appContext); +// Log.e("DataWrapper.activateProfileFromMainThread", "getProfileBeforeActivation="+PPApplication.prefProfileBeforeActivation); + Runnable runnable = () -> { // PPApplicationStatic.logE("[IN_EXECUTOR] PPApplication.startHandlerThread", "START run - from=DataWrapper.activateProfileFromMainThread"); @@ -1828,6 +1862,7 @@ private void activateProfileWithAlert(Profile profile, int startupSource, /*fina true, true, false, false, true, + false, activity ); @@ -1929,6 +1964,9 @@ void finishActivity(final int startupSource, boolean finishActivator, Activity a void activateProfile(final long profile_id, final int startupSource, final Activity activity, boolean testGrant) { + PPApplicationStatic.getProfileBeforeActivation(context.getApplicationContext()); +// Log.e("DataWrapper.activateProfile", "getProfileBeforeActivation="+PPApplication.prefProfileBeforeActivation); + Profile profile; // for activated profile is recommended update of activity @@ -1947,7 +1985,7 @@ void activateProfile(final long profile_id, final int startupSource, final Activ (startupSource == PPApplication.STARTUP_SOURCE_EDITOR) || (startupSource == PPApplication.STARTUP_SOURCE_EVENT) || (startupSource == PPApplication.STARTUP_SOURCE_EVENT_MANUAL) || - (startupSource == PPApplication.STARTUP_SOURCE_LAUNCHER) || + //(startupSource == PPApplication.STARTUP_SOURCE_LAUNCHER) || (startupSource == PPApplication.STARTUP_SOURCE_QUICK_TILE)) { // activation is invoked from shortcut, widget, Activator, Editor, service, @@ -2006,7 +2044,7 @@ void activateProfile(final long profile_id, final int startupSource, final Activ (startupSource == PPApplication.STARTUP_SOURCE_EDITOR) || (startupSource == PPApplication.STARTUP_SOURCE_EVENT) || //(startupSource == PPApplication.STARTUP_SOURCE_LAUNCHER_START) || - (startupSource == PPApplication.STARTUP_SOURCE_LAUNCHER) || + //(startupSource == PPApplication.STARTUP_SOURCE_LAUNCHER) || (startupSource == PPApplication.STARTUP_SOURCE_QUICK_TILE)) { if (profile_id == 0) @@ -2032,7 +2070,7 @@ void activateProfile(final long profile_id, final int startupSource, final Activ { if (profile != null) { DatabaseHandler.getInstance(context).activateProfile(profile); -// Log.e("DataWrapper.activateProfile", "profile="+profile._name); +// Log.e("DataWrapper.activateProfile", "profile to db="+profile._id); setProfileActive(profile); } @@ -2076,6 +2114,8 @@ void activateProfileAfterDuration(long profile_id, int startupSource) fifoSaveProfiles(activateProfilesFIFO); } + PPApplicationStatic.getProfileBeforeActivation(context.getApplicationContext()); +// Log.e("DataWrapper.activateProfileAfterDuration", "getProfileBeforeActivation="+PPApplication.prefProfileBeforeActivation); // activateProfileAfterDuration is already called from handlerThread _activateProfile(profile, false, startupSource, false, false); } @@ -2086,6 +2126,9 @@ void activateProfileAfterDuration(long profile_id, int startupSource) private void _restartEvents(final boolean unblockEventsRun, /*final boolean notClearActivatedProfile,*/ /*final boolean reactivateProfile,*/ final boolean manualRestart, final boolean logRestart) { + //PPApplicationStatic.geProfileBeforeActivation(context.getApplicationContext()); + //Log.e("DataWrapper._restartEvents", "getProfileBeforeActivation="+PPApplication.prefProfileBeforeActivation); + if (logRestart) { if (manualRestart) PPApplicationStatic.addActivityLog(context, PPApplication.ALTYPE_MANUAL_RESTART_EVENTS, null, null, ""); @@ -2096,7 +2139,7 @@ private void _restartEvents(final boolean unblockEventsRun, /*final boolean notC //if ((ApplicationPreferences.prefEventsBlocked && (!unblockEventsRun)) /*|| (!reactivateProfile)*/) { if ((EventStatic.getEventsBlocked(context) && (!unblockEventsRun)) /*|| (!reactivateProfile)*/) { -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] DataWrapper._restartEvents", "sensorType=SENSOR_TYPE_RESTART_EVENTS_NOT_UNBLOCK"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] DataWrapper._restartEvents", "SENSOR_TYPE_RESTART_EVENTS_NOT_UNBLOCK"); EventsHandler eventsHandler = new EventsHandler(context); // this do not perform restart, only SENSOR_TYPE_RESTART_EVENTS perform restart eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_RESTART_EVENTS_NOT_UNBLOCK}); @@ -2140,10 +2183,10 @@ private void _restartEvents(final boolean unblockEventsRun, /*final boolean notC EventsHandler eventsHandler = new EventsHandler(context); if (manualRestart) { -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] DataWrapper._restartEvents", "sensorType=SENSOR_TYPE_MANUAL_RESTART_EVENTS"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] DataWrapper._restartEvents", "SENSOR_TYPE_MANUAL_RESTART_EVENTS"); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_MANUAL_RESTART_EVENTS}); } else { -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] DataWrapper._restartEvents", "sensorType=SENSOR_TYPE_RESTART_EVENTS"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] DataWrapper._restartEvents", "SENSOR_TYPE_RESTART_EVENTS"); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_RESTART_EVENTS}); } // } @@ -2166,6 +2209,9 @@ private void restartEvents(final boolean unblockEventsRun, /*final boolean notCl } private void _restartEventsWithRescan(boolean alsoRescan, boolean unblockEventsRun, boolean manualRestart, boolean logRestart) { + //PPApplicationStatic.geProfileBeforeActivation(context.getApplicationContext()); + //Log.e("DataWrapper._restartEventsWithRescan", "getProfileBeforeActivation="+PPApplication.prefProfileBeforeActivation); + if (alsoRescan) { // remove all event delay alarms resetAllEventsInDelayStart(false); @@ -2198,7 +2244,7 @@ else if (ApplicationPreferences.applicationEventPeriodicScanningEnableScanning) } } - DrawOverAppsPermissionNotification.showNotification(context, false); + //DrawOverAppsPermissionNotification.showNotification(context, false); IgnoreBatteryOptimizationNotification.showNotification(context, false); DNDPermissionNotification.showNotification(context, false); } @@ -2374,6 +2420,7 @@ else if ((activity instanceof RestartEventsFromGUIActivity) || true, true, false, false, true, + false, activity ); @@ -2591,6 +2638,7 @@ void runStopEventsWithAlert(final Activity activity, final SwitchCompat checkBox true, true, false, false, true, + false, activity ); @@ -2640,6 +2688,7 @@ void runStopEventsFronGeneratedNotification(final Activity activity) { true, true, false, false, true, + false, activity ); @@ -2758,6 +2807,13 @@ private void clearSensorsStartTime(Event _event, boolean force) { _event._eventPreferencesDeviceBoot.removeAlarm(context); } + if (force || _event._eventPreferencesCallScreening._permanentRun) { + //Log.e("DataWrapper.clearSensorsStartTime", "*** _startTime = 0"); + _event._eventPreferencesCallScreening._startTime = 0; + DatabaseHandler.getInstance(context.getApplicationContext()).updateCallScreeningStartTime(_event); + _event._eventPreferencesCallScreening.removeAlarm(context); + } + if (force) { _event._eventPreferencesPeriodic._startTime = 0; DatabaseHandler.getInstance(context.getApplicationContext()).updatePeriodicStartTime(_event); @@ -2946,6 +3002,9 @@ boolean eventTypeExists(int eventType/*, boolean onlyRunning*/) { case DatabaseHandler.ETYPE_MUSIC: sensorEnabled = _event._eventPreferencesMusic._enabled; break; + case DatabaseHandler.ETYPE_CALL_SCREENING: + sensorEnabled = _event._eventPreferencesCallScreening._enabled; + break; case DatabaseHandler.ETYPE_ALL: default: sensorEnabled = true; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DataWrapperStatic.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DataWrapperStatic.java index 8cb194ec4a..baebe66cdc 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DataWrapperStatic.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DataWrapperStatic.java @@ -150,13 +150,22 @@ static Profile getNonInitializedProfile(String name, String icon, int order) Integer.parseInt(Profile.defaultValuesString.get(Profile.PREF_PROFILE_APPLICATION_LOCATION_UPDATE_INTERVAL)), Integer.parseInt(Profile.defaultValuesString.get(Profile.PREF_PROFILE_APPLICATION_ORIENTATION_SCAN_INTERVAL)), Integer.parseInt(Profile.defaultValuesString.get(Profile.PREF_PROFILE_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL)), - Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_CONTACTS), - Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS), - Integer.parseInt(Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE)), - Profile.defaultValuesBoolean.get(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS), - Profile.defaultValuesBoolean.get(Profile.PREF_PROFILE_PHONE_CALLS_SEND_SMS), - Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_SMS_TEXT), - Profile.defaultValuesString.get(Profile.PREF_PROFILE_DEVICE_WALLPAPER_LOCKSCREEN) + Profile.defaultValuesString.get(Profile.PREF_PROFILE_SEND_SMS_CONTACTS), + Profile.defaultValuesString.get(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS), + //Integer.parseInt(Profile.defaultValuesString.get(Profile.PREF_PROFILE_SEND_SMS_CONTACT_LIST_TYPE)), + Profile.defaultValuesBoolean.get(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS), + Profile.defaultValuesString.get(Profile.PREF_PROFILE_SEND_SMS_SMS_TEXT), + Profile.defaultValuesString.get(Profile.PREF_PROFILE_DEVICE_WALLPAPER_LOCKSCREEN), + Profile.defaultValuesBoolean.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED), + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS), + Profile.defaultValuesBoolean.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS), + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS), + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS), + Profile.defaultValuesBoolean.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT), + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_TEXT), + Integer.parseInt(Profile.defaultValuesString.get(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT)), + Integer.parseInt(Profile.defaultValuesString.get(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS)), + Integer.parseInt(Profile.defaultValuesString.get(Profile.PREF_PROFILE_SCREEN_ON_OFF)) ); } @@ -924,7 +933,7 @@ static boolean displayPreferencesErrorNotification(Profile profile, Event event, PPApplicationStatic.createGrantPermissionNotificationChannel(context.getApplicationContext(), false); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context.getApplicationContext(), PPApplication.GRANT_PERMISSION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.error_color)) + .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.errorColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_exclamation_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(context.getApplicationContext().getResources(), R.drawable.ic_exclamation_notification)) .setContentTitle(nTitle) // title for notification diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandler.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandler.java index 48d2ed2f74..ad193c9143 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandler.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandler.java @@ -22,7 +22,7 @@ public class DatabaseHandler extends SQLiteOpenHelper { final Context context; // Database Version - static final int DATABASE_VERSION = 2524; + static final int DATABASE_VERSION = 2538; // Database Name static final String DATABASE_NAME = "phoneProfilesManager"; @@ -103,6 +103,7 @@ public class DatabaseHandler extends SQLiteOpenHelper { static final int ETYPE_VPN = 44; static final int ETYPE_BRIGHTNESS = 45; static final int ETYPE_MUSIC = 46; + static final int ETYPE_CALL_SCREENING = 47; // Profiles Table Columns names static final String KEY_ID = "id"; @@ -227,6 +228,21 @@ public class DatabaseHandler extends SQLiteOpenHelper { static final String KEY_PHONE_CALLS_SEND_SMS = "phoneCallsSendSMS"; static final String KEY_PHONE_CALLS_SMS_TEXT = "phoneCallsSMSText"; static final String KEY_DEVICE_WALLPAPER_LOCKSCREEN = "deviceWallpaperLockScreen"; + static final String KEY_SEND_SMS_CONTACTS = "sendSMSContacts"; + static final String KEY_SEND_SMS_CONTACT_GROUPS = "sendSMSContactGroups"; + //static final String KEY_SEND_SMS_CONTACT_LIST_TYPE = "sendSMSContactListType"; + static final String KEY_SEND_SMS_SEND_SMS = "sendSMSSendSMS"; + static final String KEY_SEND_SMS_SMS_TEXT = "sendSMSSMSText"; + static final String KEY_CLEAR_NOTIFICATION_ENABLED = "clearNotificationEnabled"; + static final String KEY_CLEAR_NOTIFICATION_APPLICATIONS = "clearNotificationApplications"; + static final String KEY_CLEAR_NOTIFICATION_CHECK_CONTACTS = "clearNotificationCheckContacts"; + static final String KEY_CLEAR_NOTIFICATION_CONTACTS = "clearNotificationContacts"; + static final String KEY_CLEAR_NOTIFICATION_CONTACT_GROUPS = "clearNotificationContactGroups"; + static final String KEY_CLEAR_NOTIFICATION_CHECK_TEXT = "clearNotificationCheckText"; + static final String KEY_CLEAR_NOTIFICATION_TEXT = "clearNotificationText"; + static final String KEY_SCREEN_NIGHT_LIGHT = "screenNightLight"; + static final String KEY_SCREEN_NIGHT_LIGHT_PREFS = "screenNightLightPrefs"; + static final String KEY_SCREEN_ON_OFF = "screenOnOff"; // Events Table Columns names static final String KEY_E_ID = "id"; @@ -453,6 +469,21 @@ public class DatabaseHandler extends SQLiteOpenHelper { static final String KEY_E_MUSIC_SENSOR_PASSED = "musicSensorPassed"; static final String KEY_E_MUSIC_MUSIC_STATE = "musicMusicState"; static final String KEY_E_MUSIC_APPLICATIONS = "musicApplications"; + static final String KEY_E_CALL_SCREENING_ENABLED = "callScreeningEnabled"; + static final String KEY_E_CALL_SCREENING_SENSOR_PASSED = "callScreeningSensorPassed"; + static final String KEY_E_CALL_SCREENING_CONTACTS = "callScreeningContacts"; + static final String KEY_E_CALL_SCREENING_CONTACT_GROUPS = "callScreeningContactGroups"; + //static final String KEY_E_CALL_SCREENING_CONTACT_LIST_TYPE = "callScreeningContactListType"; + static final String KEY_E_CALL_SCREENING_NOT_IN_CONTACTS = "callScreeningNotInContacts"; + static final String KEY_E_CALL_SCREENING_BLOCK_CALLS = "callScreeningBlockCalls"; + static final String KEY_E_CALL_SCREENING_SEND_SMS = "callScreeningSendSMS"; + static final String KEY_E_CALL_SCREENING_SMS_TEXT = "callScreeningSMSText"; + static final String KEY_E_CALL_SCREENING_START_TIME = "callScreeningStartTime"; + static final String KEY_E_CALL_SCREENING_DURATION = "callScreeningDuration"; + static final String KEY_E_CALL_SCREENING_PERMANENT_RUN = "callScreeningPermanentRun"; + static final String KEY_E_CALL_SCREENING_CALL_DIRECTION = "callScreeningCallDirection"; + static final String KEY_E_CALL_SEND_SMS = "callSendSMS"; + static final String KEY_E_CALL_SMS_TEXT = "callSMSText"; // EventTimeLine Table Columns names static final String KEY_ET_ID = "id"; @@ -1139,6 +1170,16 @@ void getApplicationStartTime(Event event) DatabaseHandlerEvents.getApplicationStartTime(this, event); } + void updateCallScreeningStartTime(Event event) + { + DatabaseHandlerEvents.updateCallScreeningStartTime(this, event); + } + + void getCallScreeningStartTime(Event event) + { + DatabaseHandlerEvents.getCallScreeningStartTime(this, event); + } + void updateEventForceRun(Event event) { DatabaseHandlerEvents.updateEventForceRun(this, event); } @@ -1395,8 +1436,8 @@ void clearActivityLog() { DatabaseHandlerOthers.clearActivityLog(this); } - Cursor getActivityLogCursor() { - return DatabaseHandlerOthers.getActivityLogCursor(this); + Cursor getActivityLogCursor(int selectedFilter) { + return DatabaseHandlerOthers.getActivityLogCursor(this, selectedFilter); } // OTHERS ------------------------------------------------------------------------- @@ -1415,11 +1456,13 @@ int importDB(/*String applicationDataPath*/) { int exportDB(boolean deleteGeofences, boolean deleteWifiSSIDs, boolean deleteBluetoothNames, boolean deleteMobileCells, boolean deleteCall, boolean deleteSMS, boolean deleteNotification, - boolean deletePhoneCalls) + boolean deletePhoneCalls, boolean deleteCallScreening, + boolean deleteClearNotifications) { return DatabaseHandlerImportExport.exportDB(this, deleteGeofences, deleteWifiSSIDs, deleteBluetoothNames, deleteMobileCells, - deleteCall, deleteSMS, deleteNotification, deletePhoneCalls + deleteCall, deleteSMS, deleteNotification, deletePhoneCalls, deleteCallScreening, + deleteClearNotifications ); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerCreateUpdateDB.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerCreateUpdateDB.java index 9b965b5e29..04107e9655 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerCreateUpdateDB.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerCreateUpdateDB.java @@ -4,6 +4,7 @@ import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Build; +import android.util.Log; import java.util.ArrayList; import java.util.Calendar; @@ -140,7 +141,22 @@ static private String profileTableCreationString(String tableName) { + DatabaseHandler.KEY_PHONE_CALLS_CONTACT_LIST_TYPE + " " + DatabaseHandler.INTEGER_TYPE + "," + DatabaseHandler.KEY_PHONE_CALLS_SEND_SMS + " " + DatabaseHandler.INTEGER_TYPE + "," + DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT + " " + DatabaseHandler.TEXT_TYPE + "," - + DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN + " " + DatabaseHandler.TEXT_TYPE + + DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN + " " + DatabaseHandler.TEXT_TYPE + "," + + DatabaseHandler.KEY_SEND_SMS_CONTACTS + " " + DatabaseHandler.TEXT_TYPE + "," + + DatabaseHandler.KEY_SEND_SMS_CONTACT_GROUPS + " " + DatabaseHandler.TEXT_TYPE + "," + //+ DatabaseHandler.KEY_SEND_SMS_CONTACT_LIST_TYPE + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_SEND_SMS_SEND_SMS + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_SEND_SMS_SMS_TEXT + " " + DatabaseHandler.TEXT_TYPE + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_ENABLED + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_APPLICATIONS + " " + DatabaseHandler.TEXT_TYPE + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_CONTACTS + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS + " " + DatabaseHandler.TEXT_TYPE + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACT_GROUPS + " " + DatabaseHandler.TEXT_TYPE + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_TEXT + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_TEXT + " " + DatabaseHandler.TEXT_TYPE + "," + + DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT_PREFS + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_SCREEN_ON_OFF + " " + DatabaseHandler.INTEGER_TYPE// + "," + ")"; } @@ -373,7 +389,22 @@ static void createTables(SQLiteDatabase db) { + DatabaseHandler.KEY_E_MUSIC_ENABLED + " " + DatabaseHandler.INTEGER_TYPE + "," + DatabaseHandler.KEY_E_MUSIC_SENSOR_PASSED + " " + DatabaseHandler.INTEGER_TYPE + "," + DatabaseHandler.KEY_E_MUSIC_MUSIC_STATE + " " + DatabaseHandler.INTEGER_TYPE + "," - + DatabaseHandler.KEY_E_MUSIC_APPLICATIONS + " " + DatabaseHandler.TEXT_TYPE //+ "," + + DatabaseHandler.KEY_E_MUSIC_APPLICATIONS + " " + DatabaseHandler.TEXT_TYPE + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_ENABLED + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_CONTACTS + " " + DatabaseHandler.TEXT_TYPE + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_CONTACT_GROUPS + " " + DatabaseHandler.TEXT_TYPE + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_NOT_IN_CONTACTS + " " + DatabaseHandler.INTEGER_TYPE + "," + //+ DatabaseHandler.KEY_E_CALL_SCREENING_CONTACT_LIST_TYPE + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_BLOCK_CALLS + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_SEND_SMS + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_SMS_TEXT + " " + DatabaseHandler.TEXT_TYPE + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_SENSOR_PASSED + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_DURATION + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_PERMANENT_RUN + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_START_TIME + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_CALL_DIRECTION + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_E_CALL_SEND_SMS + " " + DatabaseHandler.INTEGER_TYPE + "," + + DatabaseHandler.KEY_E_CALL_SMS_TEXT + " " + DatabaseHandler.TEXT_TYPE //+ "," + ")"; db.execSQL(CREATE_EVENTS_TABLE); @@ -531,6 +562,7 @@ static void createIndexes(SQLiteDatabase db) { db.execSQL("CREATE INDEX IF NOT EXISTS IDX_STATUS__VPN_ENABLED ON " + DatabaseHandler.TABLE_EVENTS + " (" + DatabaseHandler.KEY_E_STATUS + "," + DatabaseHandler.KEY_E_VPN_ENABLED + ")"); db.execSQL("CREATE INDEX IF NOT EXISTS IDX_STATUS__BRIGHTNESS_ENABLED ON " + DatabaseHandler.TABLE_EVENTS + " (" + DatabaseHandler.KEY_E_STATUS + "," + DatabaseHandler.KEY_E_BRIGHTNESS_ENABLED + ")"); db.execSQL("CREATE INDEX IF NOT EXISTS IDX_STATUS__MUSIC_ENABLED ON " + DatabaseHandler.TABLE_EVENTS + " (" + DatabaseHandler.KEY_E_STATUS + "," + DatabaseHandler.KEY_E_MUSIC_ENABLED + ")"); + db.execSQL("CREATE INDEX IF NOT EXISTS IDX_STATUS__CALL_SCREENING_ENABLED ON " + DatabaseHandler.TABLE_EVENTS + " (" + DatabaseHandler.KEY_E_STATUS + "," + DatabaseHandler.KEY_E_CALL_SCREENING_ENABLED + ")"); //db.execSQL("CREATE INDEX IF NOT EXISTS IDX_STATUS__MOBILE_CELLS_ENABLED_WHEN_OUTSIDE ON " + DatabaseHandler.TABLE_EVENTS + " (" + DatabaseHandler.KEY_E_STATUS + "," + DatabaseHandler.KEY_E_MOBILE_CELLS_ENABLED + "," + DatabaseHandler.KEY_E_MOBILE_CELLS_WHEN_OUTSIDE + ")"); @@ -552,14 +584,14 @@ static private List getTableColums(SQLiteDatabase db, java.lang.String t //cursor = db.rawQuery("PRAGMA phoneProfilesManager.TABLE_info("+ table +")", null); cursor = db.rawQuery("select * from "+table + " LIMIT 1", null); - if (cursor != null) { + //if (cursor != null) { String[] _columns = cursor.getColumnNames(); Collections.addAll(columns, _columns); //while (cursor.moveToNext()) { // String name = cursor.getString(cursor.getColumnIndexOrThrow("name")); // columns.add(name); //} - } + //} } finally { if (cursor != null && !cursor.isClosed()) cursor.close(); @@ -693,6 +725,21 @@ static void createTableColumsWhenNotExists(SQLiteDatabase db, String table) { createColumnWhenNotExists(db, table, DatabaseHandler.KEY_PHONE_CALLS_SEND_SMS, DatabaseHandler.INTEGER_TYPE, columns); createColumnWhenNotExists(db, table, DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT, DatabaseHandler.TEXT_TYPE, columns); createColumnWhenNotExists(db, table, DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN, DatabaseHandler.TEXT_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_SEND_SMS_CONTACTS, DatabaseHandler.TEXT_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_SEND_SMS_CONTACT_GROUPS, DatabaseHandler.TEXT_TYPE, columns); + //createColumnWhenNotExists(db, table, DatabaseHandler.KEY_SEND_SMS_CONTACT_LIST_TYPE, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_SEND_SMS_SEND_SMS, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_SEND_SMS_SMS_TEXT, DatabaseHandler.TEXT_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_CLEAR_NOTIFICATION_ENABLED, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_CLEAR_NOTIFICATION_APPLICATIONS, DatabaseHandler.TEXT_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_CONTACTS, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS, DatabaseHandler.TEXT_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACT_GROUPS, DatabaseHandler.TEXT_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_TEXT, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_CLEAR_NOTIFICATION_TEXT, DatabaseHandler.TEXT_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT_PREFS, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_SCREEN_ON_OFF, DatabaseHandler.INTEGER_TYPE, columns); break; case DatabaseHandler.TABLE_EVENTS: createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_NAME, DatabaseHandler.TEXT_TYPE, columns); @@ -914,6 +961,21 @@ static void createTableColumsWhenNotExists(SQLiteDatabase db, String table) { createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_MUSIC_SENSOR_PASSED, DatabaseHandler.INTEGER_TYPE, columns); createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_MUSIC_MUSIC_STATE, DatabaseHandler.INTEGER_TYPE, columns); createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_MUSIC_APPLICATIONS, DatabaseHandler.TEXT_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SCREENING_ENABLED, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SCREENING_CONTACTS, DatabaseHandler.TEXT_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SCREENING_CONTACT_GROUPS, DatabaseHandler.TEXT_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SCREENING_NOT_IN_CONTACTS, DatabaseHandler.INTEGER_TYPE, columns); + //createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SCREENING_CONTACT_LIST_TYPE, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SCREENING_BLOCK_CALLS, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SCREENING_SEND_SMS, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SCREENING_SMS_TEXT, DatabaseHandler.TEXT_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SCREENING_SENSOR_PASSED, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SCREENING_DURATION, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SCREENING_PERMANENT_RUN, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SCREENING_START_TIME, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SCREENING_CALL_DIRECTION, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SEND_SMS, DatabaseHandler.INTEGER_TYPE, columns); + createColumnWhenNotExists(db, table, DatabaseHandler.KEY_E_CALL_SMS_TEXT, DatabaseHandler.TEXT_TYPE, columns); break; case DatabaseHandler.TABLE_EVENT_TIMELINE: createColumnWhenNotExists(db, table, DatabaseHandler.KEY_ET_EORDER, DatabaseHandler.INTEGER_TYPE, columns); @@ -1127,7 +1189,7 @@ static void afterUpdateDb(SQLiteDatabase db) { /* intentName = "[OpenVPN Connect - connect URL profile]"; cursorUpdateDB = db.rawQuery("SELECT " + DatabaseHandler.KEY_IN_NAME + " FROM " + DatabaseHandler.TABLE_INTENTS + - " WHERE " + DatabaseHandler.KEY_IN_NAME + "=\"" + intentName + "\"", + " WHERE " + DatabaseHandler.KEY_IN_NAME + "='" + intentName + "'", null); found = false; if (cursorUpdateDB.moveToFirst()) { @@ -1159,7 +1221,7 @@ static void afterUpdateDb(SQLiteDatabase db) { intentName = "[OpenVPN Connect - connect file profile]"; cursorUpdateDB = db.rawQuery("SELECT " + DatabaseHandler.KEY_IN_NAME + " FROM " + DatabaseHandler.TABLE_INTENTS + - " WHERE " + DatabaseHandler.KEY_IN_NAME + "=\"" + intentName + "\"", + " WHERE " + DatabaseHandler.KEY_IN_NAME + "='" + intentName + "'", null); found = false; if (cursorUpdateDB.moveToFirst()) { @@ -1192,7 +1254,7 @@ static void afterUpdateDb(SQLiteDatabase db) { intentName = "[OpenVPN Connect - disconnect]"; cursorUpdateDB = db.rawQuery("SELECT " + DatabaseHandler.KEY_IN_NAME + " FROM " + DatabaseHandler.TABLE_INTENTS + - " WHERE " + DatabaseHandler.KEY_IN_NAME + "=\"" + intentName + "\"", + " WHERE " + DatabaseHandler.KEY_IN_NAME + "='" + intentName + "'", null); found = false; if (cursorUpdateDB.moveToFirst()) { @@ -1221,7 +1283,7 @@ static void afterUpdateDb(SQLiteDatabase db) { intentName = "[OpenVPN for Android - connect]"; cursorUpdateDB = db.rawQuery("SELECT " + DatabaseHandler.KEY_IN_NAME + " FROM " + DatabaseHandler.TABLE_INTENTS + - " WHERE " + DatabaseHandler.KEY_IN_NAME + "=\"" + intentName + "\"", + " WHERE " + DatabaseHandler.KEY_IN_NAME + "='" + intentName + "'", null); found = false; if (cursorUpdateDB.moveToFirst()) { @@ -1249,7 +1311,7 @@ static void afterUpdateDb(SQLiteDatabase db) { intentName = "[OpenVPN for Android - disconnect]"; cursorUpdateDB = db.rawQuery("SELECT " + DatabaseHandler.KEY_IN_NAME + " FROM " + DatabaseHandler.TABLE_INTENTS + - " WHERE " + DatabaseHandler.KEY_IN_NAME + "=\"" + intentName + "\"", + " WHERE " + DatabaseHandler.KEY_IN_NAME + "='" + intentName + "'", null); found = false; if (cursorUpdateDB.moveToFirst()) { @@ -1330,7 +1392,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 22) { db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_RUN_APPLICATION_CHANGE + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_RUN_APPLICATION_PACKAGE_NAME + "=\"-\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_RUN_APPLICATION_PACKAGE_NAME + "='-'"); } if (oldVersion < 24) @@ -1347,7 +1409,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion { db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_START_TIME + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_END_TIME + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_DAYS_OF_WEEK + "=\"#ALL#\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_DAYS_OF_WEEK + "='#ALL#'"); } if (oldVersion < 30) @@ -1391,7 +1453,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 1022) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_SOUND_START + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_SOUND_START + "=''"); } if (oldVersion < 1023) @@ -1438,7 +1500,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion { db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_ENABLED + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_EVENT + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_CONTACTS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_CONTACTS + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_CONTACT_LIST_TYPE + "=0"); } @@ -1507,9 +1569,9 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 1090) { db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALENDAR_ENABLED + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALENDAR_CALENDARS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALENDAR_CALENDARS + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALENDAR_SEARCH_FIELD + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALENDAR_SEARCH_STRING + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALENDAR_SEARCH_STRING + "=''"); } if (oldVersion < 1095) @@ -1530,7 +1592,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 1105) { db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_WIFI_ENABLED + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_WIFI_SSID + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_WIFI_SSID + "=''"); } if (oldVersion < 1106) @@ -1572,7 +1634,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 1130) { db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_BLUETOOTH_ENABLED + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_BLUETOOTH_ADAPTER_NAME + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_BLUETOOTH_ADAPTER_NAME + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_BLUETOOTH_CONNECTION_TYPE + "=0"); } @@ -1580,7 +1642,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion { db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_SMS_ENABLED + "=0"); //db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_SMS_EVENT + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_SMS_CONTACTS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_SMS_CONTACTS + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_SMS_CONTACT_LIST_TYPE + "=0"); } @@ -1627,7 +1689,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion brightness = Profile.BRIGHTNESS_ADAPTIVE_BRIGHTNESS_NOT_SET + "|" + splits[1] + "|" + splits[2] + "|0"; db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + - " SET " + DatabaseHandler.KEY_DEVICE_BRIGHTNESS + "=\"" + brightness + "\" " + + " SET " + DatabaseHandler.KEY_DEVICE_BRIGHTNESS + "='" + brightness + "' " + "WHERE " + DatabaseHandler.KEY_ID + "=" + id); } @@ -1681,7 +1743,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion brightness = percentage + "|" + splits[1] + "|" + splits[2] + "|0"; db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + - " SET " + DatabaseHandler.KEY_DEVICE_BRIGHTNESS + "=\"" + brightness + "\" " + + " SET " + DatabaseHandler.KEY_DEVICE_BRIGHTNESS + "='" + brightness + "' " + "WHERE " + DatabaseHandler.KEY_ID + "=" + id); } @@ -1719,8 +1781,8 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 1180) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_CONTACT_GROUPS + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_SMS_CONTACT_GROUPS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_CONTACT_GROUPS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_SMS_CONTACT_GROUPS + "=''"); } if (oldVersion < 1210) @@ -1855,9 +1917,9 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion String bluetoothAdapterName = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_BLUETOOTH_ADAPTER_NAME)).replace("%", "\\%").replace("_", "\\_"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + - " SET " + DatabaseHandler.KEY_E_CALENDAR_SEARCH_STRING + "=\"" + calendarSearchString + "\"," + - DatabaseHandler.KEY_E_WIFI_SSID + "=\"" + wifiSSID + "\"," + - DatabaseHandler.KEY_E_BLUETOOTH_ADAPTER_NAME + "=\"" + bluetoothAdapterName + "\"" + + " SET " + DatabaseHandler.KEY_E_CALENDAR_SEARCH_STRING + "='" + calendarSearchString + "'," + + DatabaseHandler.KEY_E_WIFI_SSID + "='" + wifiSSID + "'," + + DatabaseHandler.KEY_E_BLUETOOTH_ADAPTER_NAME + "='" + bluetoothAdapterName + "'" + " WHERE " + DatabaseHandler.KEY_E_ID + "=" + id); } while (cursor.moveToNext()); @@ -1875,7 +1937,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 1400) { db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_ENABLED + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_APPLICATIONS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_APPLICATIONS + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_START_TIME + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_DURATION + "=5"); } @@ -1899,7 +1961,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 1450) { db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_APPLICATION_ENABLED + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_APPLICATION_APPLICATIONS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_APPLICATION_APPLICATIONS + "=''"); } if (oldVersion < 1460) @@ -1964,18 +2026,18 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 1600) { db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_ORIENTATION_ENABLED + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_ORIENTATION_SIDES + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_ORIENTATION_SIDES + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_ORIENTATION_DISTANCE + "=0"); } if (oldVersion < 1610) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_ORIENTATION_DISPLAY + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_ORIENTATION_DISPLAY + "=''"); } if (oldVersion < 1620) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_ORIENTATION_IGNORE_APPLICATIONS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_ORIENTATION_IGNORE_APPLICATIONS + "=''"); } if (oldVersion < 1630) @@ -2000,7 +2062,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 1680) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_MOBILE_CELLS_CELLS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_MOBILE_CELLS_CELLS + "=''"); } if (oldVersion < 1700) @@ -2073,7 +2135,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 1770) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NFC_NFC_TAGS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NFC_NFC_TAGS + "=''"); } if (oldVersion < 1780) @@ -2127,8 +2189,8 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 1860) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_CONNECT_TO_SSID + "=\""+StringConstants.CONNECTTOSSID_JUSTANY+"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DEVICE_CONNECT_TO_SSID + "=\""+StringConstants.CONNECTTOSSID_JUSTANY+"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_CONNECT_TO_SSID + "='"+StringConstants.CONNECTTOSSID_JUSTANY+"'"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DEVICE_CONNECT_TO_SSID + "='"+StringConstants.CONNECTTOSSID_JUSTANY+"'"); } if (oldVersion < 1870) @@ -2200,10 +2262,10 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 1950) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DURATION_NOTIFICATION_SOUND + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DURATION_NOTIFICATION_SOUND + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DURATION_NOTIFICATION_VIBRATE + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DURATION_NOTIFICATION_VIBRATE + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DURATION_NOTIFICATION_VIBRATE + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DURATION_NOTIFICATION_VIBRATE + "=0"); } @@ -2281,7 +2343,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 2040) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_START_WHEN_ACTIVATED_PROFILE + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_START_WHEN_ACTIVATED_PROFILE + "=''"); try { final String selectQuery = "SELECT " + DatabaseHandler.KEY_E_ID + "," + @@ -2310,9 +2372,9 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 2050) { db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_FORCE_STOP_APPLICATION_CHANGE + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_FORCE_STOP_APPLICATION_PACKAGE_NAME + "=\"-\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_FORCE_STOP_APPLICATION_PACKAGE_NAME + "='-'"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DEVICE_FORCE_STOP_APPLICATION_CHANGE + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DEVICE_FORCE_STOP_APPLICATION_PACKAGE_NAME + "=\"-\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DEVICE_FORCE_STOP_APPLICATION_PACKAGE_NAME + "='-'"); } if (oldVersion < 2060) @@ -2382,7 +2444,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion } if (oldVersion < 2130) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_NFC_TAGS + " SET " + DatabaseHandler.KEY_NT_UID + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_NFC_TAGS + " SET " + DatabaseHandler.KEY_NT_UID + "=''"); } if (oldVersion < 2140) { @@ -2441,23 +2503,23 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 2180) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_SOUND_END + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_SOUND_END + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_VIBRATE_END + "=0"); } if (oldVersion < 2200) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_INTENTS + " SET " + DatabaseHandler.KEY_IN_NAME + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_INTENTS + " SET " + DatabaseHandler.KEY_IN_NAME + "=''"); } if (oldVersion < 2230) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_INTENTS + " SET " + DatabaseHandler.KEY_IN_ACTION + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_INTENTS + " SET " + DatabaseHandler.KEY_IN_ACTION + "=''"); } if (oldVersion < 2240) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_BATTERY_PLUGGED + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_BATTERY_PLUGGED + "=''"); } if (oldVersion < 2270) { @@ -2640,11 +2702,20 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion 15, "", "", - 0, + //0, + false, + "", + "-", false, + "", false, "", - "-" + "", + false, + "", + 0, + 0, + 0 ); // this change old, no longer used SHARED_PROFILE_VALUE to "Not used" value @@ -2758,16 +2829,16 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 2310) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_VOLUME_DTMF + "=\"-1|1|0\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_VOLUME_ACCESSIBILITY + "=\"-1|1|0\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_VOLUME_DTMF + "=\"-1|1|0\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_VOLUME_ACCESSIBILITY + "=\"-1|1|0\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_VOLUME_DTMF + "='-1|1|0'"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_VOLUME_ACCESSIBILITY + "='-1|1|0'"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_VOLUME_DTMF + "='-1|1|0'"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_VOLUME_ACCESSIBILITY + "='-1|1|0'"); } if (oldVersion < 2320) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_VOLUME_BLUETOOTH_SCO + "=\"-1|1|0\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_VOLUME_BLUETOOTH_SCO + "=\"-1|1|0\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_VOLUME_BLUETOOTH_SCO + "='-1|1|0'"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_VOLUME_BLUETOOTH_SCO + "='-1|1|0'"); } if (oldVersion < 2340) @@ -2802,12 +2873,12 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 2350) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MOBILE_CELLS + " SET " + DatabaseHandler.KEY_MC_LAST_RUNNING_EVENTS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MOBILE_CELLS + " SET " + DatabaseHandler.KEY_MC_LAST_RUNNING_EVENTS + "=''"); } if (oldVersion < 2360) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MOBILE_CELLS + " SET " + DatabaseHandler.KEY_MC_LAST_PAUSED_EVENTS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MOBILE_CELLS + " SET " + DatabaseHandler.KEY_MC_LAST_PAUSED_EVENTS + "=''"); } if (oldVersion < 2370) @@ -2885,10 +2956,10 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 2406) { db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_CHECK_CONTACTS + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_CONTACT_GROUPS + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_CONTACTS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_CONTACT_GROUPS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_CONTACTS + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_CHECK_TEXT + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_TEXT + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_NOTIFICATION_TEXT + "=''"); } if (oldVersion < 2407) { @@ -2903,7 +2974,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion } if (oldVersion < 2409) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_ACTIVITY_LOG + " SET " + DatabaseHandler.KEY_AL_PROFILE_EVENT_COUNT + "=\"1 [0]\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_ACTIVITY_LOG + " SET " + DatabaseHandler.KEY_AL_PROFILE_EVENT_COUNT + "='1 [0]'"); } if (oldVersion < 2410) { @@ -2944,12 +3015,12 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 2421) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_ALARM_CLOCK_APPLICATIONS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_ALARM_CLOCK_APPLICATIONS + "=''"); } if (oldVersion < 2422) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_ALARM_CLOCK_PACKAGE_NAME + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_ALARM_CLOCK_PACKAGE_NAME + "=''"); } if (oldVersion < 2423) @@ -3038,8 +3109,8 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 2441) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_GENERATE_NOTIFICATION + "=\"0|0||\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_GENERATE_NOTIFICATION + "=\"0|0||\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_GENERATE_NOTIFICATION + "='0|0||'"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_GENERATE_NOTIFICATION + "='0|0||'"); } if (oldVersion < 2442) @@ -3093,7 +3164,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 2448) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_ACCESSORY_TYPE + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_ACCESSORY_TYPE + "=''"); try { List columns = getTableColums(db, DatabaseHandler.TABLE_EVENTS); @@ -3110,7 +3181,7 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion int peripheralType = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_PERIPHERAL_TYPE)); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + - " SET " + DatabaseHandler.KEY_E_ACCESSORY_TYPE + "=\"" + peripheralType + "\"" + + " SET " + DatabaseHandler.KEY_E_ACCESSORY_TYPE + "='" + peripheralType + "'" + " WHERE " + DatabaseHandler.KEY_E_ID + "=" + id); } while (cursor.moveToNext()); @@ -3150,9 +3221,9 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 2453) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_DEFAULT_SIM_CARDS + "=\"0|0|0\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_DEFAULT_SIM_CARDS + "='0|0|0'"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DEVICE_DEFAULT_SIM_CARDS + "=\"0|0|0\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DEVICE_DEFAULT_SIM_CARDS + "='0|0|0'"); } if (oldVersion < 2454) @@ -3170,19 +3241,19 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_CHANGE_SIM2 + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_CHANGE_SIM1 + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_CHANGE_SIM2 + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM1 + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM2 + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM1 + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM2 + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM1 + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM2 + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM1 + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM2 + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_CHANGE_SIM1 + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_CHANGE_SIM2 + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_CHANGE_SIM1 + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_CHANGE_SIM2 + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM1 + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM2 + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM1 + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM2 + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM1 + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM2 + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM1 + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM2 + "=''"); } if (oldVersion < 2460) @@ -3216,21 +3287,21 @@ static void updateDb(DatabaseHandler instance, SQLiteDatabase db, int oldVersion if (oldVersion < 2466) { db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_SOUND_PROFILE_ENABLED + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_SOUND_PROFILE_RINGER_MODES + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_SOUND_PROFILE_ZEN_MODES + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_SOUND_PROFILE_RINGER_MODES + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_SOUND_PROFILE_ZEN_MODES + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_SOUND_PROFILE_SENSOR_PASSED + "=0"); } if (oldVersion < 2467) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_LIVE_WALLPAPER + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_LIVE_WALLPAPER + "=''"); } if (oldVersion < 2468) { db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_VIBRATE_NOTIFICATIONS + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DEVICE_LIVE_WALLPAPER + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DEVICE_LIVE_WALLPAPER + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_VIBRATE_NOTIFICATIONS + "=0"); } @@ -3521,9 +3592,9 @@ else if (cellNames.equals(cellName)) if (oldVersion < 2512) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_GEOFENCES + " SET " + DatabaseHandler.KEY_G_LATITUDE_T + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_GEOFENCES + " SET " + DatabaseHandler.KEY_G_LONGITUDE_T + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MOBILE_CELLS + " SET " + DatabaseHandler.KEY_MC_CELL_ID_T + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_GEOFENCES + " SET " + DatabaseHandler.KEY_G_LATITUDE_T + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_GEOFENCES + " SET " + DatabaseHandler.KEY_G_LONGITUDE_T + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MOBILE_CELLS + " SET " + DatabaseHandler.KEY_MC_CELL_ID_T + "=''"); } if (oldVersion < 2513) @@ -3537,7 +3608,7 @@ else if (cellNames.equals(cellName)) { db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_STOP_RINGING + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SEND_SMS + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SMS_TEXT + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SMS_TEXT + "=''"); } */ @@ -3548,10 +3619,10 @@ else if (cellNames.equals(cellName)) } if (oldVersion < 2517) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_PHONE_CALLS_CONTACTS + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_PHONE_CALLS_CONTACTS + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_PHONE_CALLS_CONTACTS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_PHONE_CALLS_CONTACTS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS + "=''"); } if (oldVersion < 2518) { @@ -3562,8 +3633,8 @@ else if (cellNames.equals(cellName)) { db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_PHONE_CALLS_SEND_SMS + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_PHONE_CALLS_SEND_SMS + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT + "=''"); } if (oldVersion < 2520) @@ -3589,7 +3660,148 @@ else if (cellNames.equals(cellName)) if (oldVersion < 2524) { - db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_MUSIC_APPLICATIONS + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_MUSIC_APPLICATIONS + "=''"); + } + + if (oldVersion < 2525) { + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SCREENING_ENABLED + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SCREENING_CONTACTS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SCREENING_CONTACT_GROUPS + "=''"); + //db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SCREENING_CONTACT_LIST_TYPE + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SCREENING_BLOCK_CALLS + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SCREENING_SEND_SMS + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SCREENING_SMS_TEXT + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SCREENING_SENSOR_PASSED + "=0"); + } + + if (oldVersion < 2526) { + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SCREENING_DURATION + "=5"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SCREENING_PERMANENT_RUN + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SCREENING_START_TIME + "=0"); + } + + if (oldVersion < 2527) { + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SCREENING_CALL_DIRECTION + "=0"); + } + + if (oldVersion < 2531) { + try { + int eventStartOrder = 0; + String countQuery = "SELECT MAX(" + DatabaseHandler.KEY_E_START_ORDER + ") FROM " + DatabaseHandler.TABLE_EVENTS; + Cursor cursorCount = db.rawQuery(countQuery, null); + if (cursorCount.getCount() > 0) { + if (cursorCount.moveToFirst()) { + eventStartOrder = cursorCount.getInt(0); + } + } + cursorCount.close(); + + final String selectQuery = "SELECT " + DatabaseHandler.KEY_ID + "," + + DatabaseHandler.KEY_NAME + "," + + DatabaseHandler.KEY_PHONE_CALLS_CONTACTS + "," + + DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS + "," + + DatabaseHandler.KEY_PHONE_CALLS_BLOCK_CALLS + "," + + DatabaseHandler.KEY_PHONE_CALLS_SEND_SMS + "," + + DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT + + " FROM " + DatabaseHandler.TABLE_PROFILES; + + Cursor cursor = db.rawQuery(selectQuery, null); + + if (cursor.moveToFirst()) { + do { + int blockCallsInProfile = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_BLOCK_CALLS)); + + if (blockCallsInProfile == 1) { + // block calls is enabled in profile + + ++eventStartOrder; + Event event = DataWrapperStatic.getNonInitializedEvent( + instance.context.getString(R.string.event_name_copy_from_profile_block_calls)+"-"+ + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_NAME)), + eventStartOrder); + event.setStatus(Event.ESTATUS_STOP); + event._atEndDo = Event.EATENDDO_NONE; + event._eventPreferencesCallScreening._enabled = true; + event._eventPreferencesCallScreening._callDirection = EventPreferencesCallScreening.CALL_DIRECTION_INCOMING; + event._eventPreferencesCallScreening._contacts = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_CONTACTS)); + event._eventPreferencesCallScreening._contactGroups = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS)); + event._eventPreferencesCallScreening._blockCalls = true; + event._eventPreferencesCallScreening._sendSMS = (cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_SEND_SMS)) == 1); + event._eventPreferencesCallScreening._smsText = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT)); + event._eventPreferencesCallScreening._duration = 5; + event._eventPreferencesCallScreening._permanentRun = false; + + DatabaseHandlerEvents.addEvent(event, db); + } + } while (cursor.moveToNext()); + } + + cursor.close(); + + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_PHONE_CALLS_BLOCK_CALLS + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_PHONE_CALLS_BLOCK_CALLS + "=0"); + + } catch (Exception e) { + Log.e("DatabaseHandlerCreateUpdateDB", Log.getStackTraceString(e)); + } + } + + if (oldVersion < 2532) + { + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SEND_SMS_CONTACTS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SEND_SMS_CONTACTS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SEND_SMS_CONTACT_GROUPS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SEND_SMS_CONTACT_GROUPS + "=''"); + //db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SEND_SMS_CONTACT_LIST_TYPE + "=0"); + //db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SEND_SMS_CONTACT_LIST_TYPE + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SEND_SMS_SEND_SMS + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SEND_SMS_SEND_SMS + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SEND_SMS_SMS_TEXT + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SEND_SMS_SMS_TEXT + "=''"); + } + + if (oldVersion < 2532) { + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SEND_SMS + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SMS_TEXT + "=''"); + } + + if (oldVersion < 2534) { + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_CLEAR_NOTIFICATION_ENABLED + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_CLEAR_NOTIFICATION_APPLICATIONS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_CONTACTS + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACT_GROUPS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_TEXT + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_CLEAR_NOTIFICATION_TEXT + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_CLEAR_NOTIFICATION_ENABLED + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_CLEAR_NOTIFICATION_APPLICATIONS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_CONTACTS + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACT_GROUPS + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_TEXT + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_CLEAR_NOTIFICATION_TEXT + "=''"); + } + + if (oldVersion < 2535) { + db.execSQL("UPDATE " + DatabaseHandler.TABLE_EVENTS + " SET " + DatabaseHandler.KEY_E_CALL_SCREENING_NOT_IN_CONTACTS + "=0"); + } + + if (oldVersion < 2536) + { + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT + "=0"); + } + if (oldVersion < 2537) + { + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT_PREFS + "=0"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT_PREFS + "=0"); + } + + if (oldVersion < 2538) + { + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SCREEN_ON_OFF + "=0"); + + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SCREEN_ON_OFF + "=0"); } } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerEvents.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerEvents.java index ca5bd54151..da3511ff08 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerEvents.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerEvents.java @@ -12,62 +12,66 @@ class DatabaseHandlerEvents { // Adding new event + static void addEvent(Event event, SQLiteDatabase db) { + ContentValues values = new ContentValues(); + values.put(DatabaseHandler.KEY_E_NAME, event._name); // Event Name + values.put(DatabaseHandler.KEY_E_START_ORDER, event._startOrder); // start order + values.put(DatabaseHandler.KEY_E_FK_PROFILE_START, event._fkProfileStart); // profile start + values.put(DatabaseHandler.KEY_E_FK_PROFILE_END, event._fkProfileEnd); // profile end + values.put(DatabaseHandler.KEY_E_STATUS, event.getStatus()); // event status + values.put(DatabaseHandler.KEY_E_NOTIFICATION_SOUND_START, event._notificationSoundStart); // notification sound + values.put(DatabaseHandler.KEY_E_NOTIFICATION_VIBRATE_START, event._notificationVibrateStart); // notification vibrate + values.put(DatabaseHandler.KEY_E_NOTIFICATION_SOUND_REPEAT_START, event._repeatNotificationStart); // repeat notification sound + values.put(DatabaseHandler.KEY_E_NOTIFICATION_SOUND_REPEAT_INTERVAL_START, event._repeatNotificationIntervalStart); // repeat notification sound interval + values.put(DatabaseHandler.KEY_E_NOTIFICATION_SOUND_END, event._notificationSoundEnd); // notification sound + values.put(DatabaseHandler.KEY_E_NOTIFICATION_VIBRATE_END, event._notificationVibrateEnd); // notification vibrate + values.put(DatabaseHandler.KEY_E_FORCE_RUN, event._ignoreManualActivation ? 1 : 0); // force run when manual profile activation + values.put(DatabaseHandler.KEY_E_BLOCKED, event._blocked ? 1 : 0); // temporary blocked + values.put(DatabaseHandler.KEY_E_PRIORITY, event._priority); // priority + values.put(DatabaseHandler.KEY_E_DELAY_START, event._delayStart); // delay for start + values.put(DatabaseHandler.KEY_E_IS_IN_DELAY_START, event._isInDelayStart ? 1 : 0); // event is in delay before start + values.put(DatabaseHandler.KEY_E_AT_END_DO, event._atEndDo); //at end of event do + values.put(DatabaseHandler.KEY_E_MANUAL_PROFILE_ACTIVATION, event._manualProfileActivation ? 1 : 0); // manual profile activation at start + values.put(DatabaseHandler.KEY_E_FK_PROFILE_START_WHEN_ACTIVATED, Profile.PROFILE_NO_ACTIVATE); + values.put(DatabaseHandler.KEY_E_DELAY_END, event._delayEnd); // delay for end + values.put(DatabaseHandler.KEY_E_IS_IN_DELAY_END, event._isInDelayEnd ? 1 : 0); // event is in delay after pause + values.put(DatabaseHandler.KEY_E_START_STATUS_TIME, event._startStatusTime); // time for status RUNNING + values.put(DatabaseHandler.KEY_E_PAUSE_STATUS_TIME, event._pauseStatusTime); // time for change status from RUNNING to PAUSE + values.put(DatabaseHandler.KEY_E_NO_PAUSE_BY_MANUAL_ACTIVATION, event._noPauseByManualActivation ? 1 : 0); // no pause event by manual profile activation + values.put(DatabaseHandler.KEY_E_START_WHEN_ACTIVATED_PROFILE, event._startWhenActivatedProfile); // start when profile is activated + //values.put(DatabaseHandler.KEY_E_AT_END_HOW_UNDO, event._atEndHowUndo); + values.put(DatabaseHandler.KEY_E_MANUAL_PROFILE_ACTIVATION_AT_END, event._manualProfileActivationAtEnd ? 1 : 0); // manual profile activation at end + values.put(DatabaseHandler.KEY_E_NOTIFICATION_SOUND_START_PLAY_ALSO_IN_SILENT_MODE, event._notificationSoundStartPlayAlsoInSilentMode ? 1 : 0); + values.put(DatabaseHandler.KEY_E_NOTIFICATION_SOUND_END_PLAY_ALSO_IN_SILENT_MODE, event._notificationSoundEndPlayAlsoInSilentMode ? 1 : 0); + + db.beginTransaction(); + + try { + // Inserting Row + event._id = db.insert(DatabaseHandler.TABLE_EVENTS, null, values); + updateEventPreferences(event, db); + + db.setTransactionSuccessful(); + + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } finally { + db.endTransaction(); + } + } + static void addEvent(DatabaseHandler instance, Event event) { instance.importExportLock.lock(); try { try { instance.startRunningCommand(); - int startOrder = getMaxEventStartOrder(instance) + 1; + event._startOrder = getMaxEventStartOrder(instance) + 1; //SQLiteDatabase db = this.getWritableDatabase(); SQLiteDatabase db = instance.getMyWritableDatabase(); - ContentValues values = new ContentValues(); - values.put(DatabaseHandler.KEY_E_NAME, event._name); // Event Name - values.put(DatabaseHandler.KEY_E_START_ORDER, startOrder); // start order - values.put(DatabaseHandler.KEY_E_FK_PROFILE_START, event._fkProfileStart); // profile start - values.put(DatabaseHandler.KEY_E_FK_PROFILE_END, event._fkProfileEnd); // profile end - values.put(DatabaseHandler.KEY_E_STATUS, event.getStatus()); // event status - values.put(DatabaseHandler.KEY_E_NOTIFICATION_SOUND_START, event._notificationSoundStart); // notification sound - values.put(DatabaseHandler.KEY_E_NOTIFICATION_VIBRATE_START, event._notificationVibrateStart); // notification vibrate - values.put(DatabaseHandler.KEY_E_NOTIFICATION_SOUND_REPEAT_START, event._repeatNotificationStart); // repeat notification sound - values.put(DatabaseHandler.KEY_E_NOTIFICATION_SOUND_REPEAT_INTERVAL_START, event._repeatNotificationIntervalStart); // repeat notification sound interval - values.put(DatabaseHandler.KEY_E_NOTIFICATION_SOUND_END, event._notificationSoundEnd); // notification sound - values.put(DatabaseHandler.KEY_E_NOTIFICATION_VIBRATE_END, event._notificationVibrateEnd); // notification vibrate - values.put(DatabaseHandler.KEY_E_FORCE_RUN, event._ignoreManualActivation ? 1 : 0); // force run when manual profile activation - values.put(DatabaseHandler.KEY_E_BLOCKED, event._blocked ? 1 : 0); // temporary blocked - values.put(DatabaseHandler.KEY_E_PRIORITY, event._priority); // priority - values.put(DatabaseHandler.KEY_E_DELAY_START, event._delayStart); // delay for start - values.put(DatabaseHandler.KEY_E_IS_IN_DELAY_START, event._isInDelayStart ? 1 : 0); // event is in delay before start - values.put(DatabaseHandler.KEY_E_AT_END_DO, event._atEndDo); //at end of event do - values.put(DatabaseHandler.KEY_E_MANUAL_PROFILE_ACTIVATION, event._manualProfileActivation ? 1 : 0); // manual profile activation at start - values.put(DatabaseHandler.KEY_E_FK_PROFILE_START_WHEN_ACTIVATED, Profile.PROFILE_NO_ACTIVATE); - values.put(DatabaseHandler.KEY_E_DELAY_END, event._delayEnd); // delay for end - values.put(DatabaseHandler.KEY_E_IS_IN_DELAY_END, event._isInDelayEnd ? 1 : 0); // event is in delay after pause - values.put(DatabaseHandler.KEY_E_START_STATUS_TIME, event._startStatusTime); // time for status RUNNING - values.put(DatabaseHandler.KEY_E_PAUSE_STATUS_TIME, event._pauseStatusTime); // time for change status from RUNNING to PAUSE - values.put(DatabaseHandler.KEY_E_NO_PAUSE_BY_MANUAL_ACTIVATION, event._noPauseByManualActivation ? 1 : 0); // no pause event by manual profile activation - values.put(DatabaseHandler.KEY_E_START_WHEN_ACTIVATED_PROFILE, event._startWhenActivatedProfile); // start when profile is activated - //values.put(DatabaseHandler.KEY_E_AT_END_HOW_UNDO, event._atEndHowUndo); - values.put(DatabaseHandler.KEY_E_MANUAL_PROFILE_ACTIVATION_AT_END, event._manualProfileActivationAtEnd ? 1 : 0); // manual profile activation at end - values.put(DatabaseHandler.KEY_E_NOTIFICATION_SOUND_START_PLAY_ALSO_IN_SILENT_MODE, event._notificationSoundStartPlayAlsoInSilentMode ? 1 : 0); - values.put(DatabaseHandler.KEY_E_NOTIFICATION_SOUND_END_PLAY_ALSO_IN_SILENT_MODE, event._notificationSoundEndPlayAlsoInSilentMode ? 1 : 0); - - db.beginTransaction(); - - try { - // Inserting Row - event._id = db.insert(DatabaseHandler.TABLE_EVENTS, null, values); - updateEventPreferences(event, db); - - db.setTransactionSuccessful(); - - } catch (Exception e) { - PPApplicationStatic.recordException(e); - } finally { - db.endTransaction(); - } + addEvent(event, db); //db.close(); // Closing database connection } catch (Exception e) { @@ -123,7 +127,7 @@ static Event getEvent(DatabaseHandler instance, long event_id) { DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event_id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -161,7 +165,7 @@ static Event getEvent(DatabaseHandler instance, long event_id) { } cursor.close(); - } + //} if (event != null) getEventPreferences(event, db); @@ -459,11 +463,13 @@ static void unlinkEventsFromProfile(DatabaseHandler instance, Profile profile) { String[] splits = oldFkProfiles.split(StringConstants.STR_SPLIT_REGEX); StringBuilder newFkProfiles = new StringBuilder(); for (String split : splits) { - long fkProfile = Long.parseLong(split); - if (fkProfile != profile._id) { - if (newFkProfiles.length() > 0) - newFkProfiles.append("|"); - newFkProfiles.append(split); + if (!split.isEmpty()) { + long fkProfile = Long.parseLong(split); + if (fkProfile != profile._id) { + if (newFkProfiles.length() > 0) + newFkProfiles.append("|"); + newFkProfiles.append(split); + } } } values = new ContentValues(); @@ -635,8 +641,7 @@ static private void getEventPreferencesTime(Event event, SQLiteDatabase db) { DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -688,7 +693,7 @@ static private void getEventPreferencesTime(Event event, SQLiteDatabase db) { eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_TIME_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesBattery(Event event, SQLiteDatabase db) { @@ -703,8 +708,7 @@ static private void getEventPreferencesBattery(Event event, SQLiteDatabase db) { }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -720,7 +724,7 @@ static private void getEventPreferencesBattery(Event event, SQLiteDatabase db) { eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_BATTERY_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesCall(Event event, SQLiteDatabase db) { @@ -735,15 +739,14 @@ static private void getEventPreferencesCall(Event event, SQLiteDatabase db) { DatabaseHandler.KEY_E_CALL_RUN_AFTER_CALL_END_TIME, DatabaseHandler.KEY_E_CALL_SENSOR_PASSED, DatabaseHandler.KEY_E_CALL_RUN_AFTER_CALL_END_FROM_SIM_SLOT, - DatabaseHandler.KEY_E_CALL_FOR_SIM_CARD//, + DatabaseHandler.KEY_E_CALL_FOR_SIM_CARD, // DatabaseHandler.KEY_E_CALL_STOP_RINGING, -// DatabaseHandler.KEY_E_CALL_SEND_SMS, -// DatabaseHandler.KEY_E_CALL_SMS_TEXT, + DatabaseHandler.KEY_E_CALL_SEND_SMS, + DatabaseHandler.KEY_E_CALL_SMS_TEXT }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -759,14 +762,14 @@ static private void getEventPreferencesCall(Event event, SQLiteDatabase db) { eventPreferences._runAfterCallEndPermanentRun = (cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_RUN_AFTER_CALL_END_PERMANENT_RUN)) == 1); eventPreferences._forSIMCard = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_FOR_SIM_CARD)); // eventPreferences._stopRinging = (cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_STOP_RINGING)) == 1); -// eventPreferences._sendSMS = (cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SEND_SMS)) == 1); -// eventPreferences._smsText = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SMS_TEXT)); + eventPreferences._sendSMS = (cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SEND_SMS)) == 1); + eventPreferences._smsText = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SMS_TEXT)); eventPreferences._runAfterCallEndTime = cursor.getLong(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_RUN_AFTER_CALL_END_TIME)); eventPreferences._runAfterCallEndFromSIMSlot = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_RUN_AFTER_CALL_END_FROM_SIM_SLOT)); eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesAccessory(Event event, SQLiteDatabase db) { @@ -777,8 +780,7 @@ static private void getEventPreferencesAccessory(Event event, SQLiteDatabase db) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -790,7 +792,7 @@ static private void getEventPreferencesAccessory(Event event, SQLiteDatabase db) eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ACCESSORY_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesCalendar(Event event, SQLiteDatabase db) { @@ -814,8 +816,7 @@ static private void getEventPreferencesCalendar(Event event, SQLiteDatabase db) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -840,7 +841,7 @@ static private void getEventPreferencesCalendar(Event event, SQLiteDatabase db) eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALENDAR_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesWifi(Event event, SQLiteDatabase db) { @@ -852,8 +853,7 @@ static private void getEventPreferencesWifi(Event event, SQLiteDatabase db) { }, DatabaseHandler.KEY_E_ID + "=?", new String[] { String.valueOf(event._id) }, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -866,7 +866,7 @@ static private void getEventPreferencesWifi(Event event, SQLiteDatabase db) { eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_WIFI_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesScreen(Event event, SQLiteDatabase db) { @@ -878,8 +878,7 @@ static private void getEventPreferencesScreen(Event event, SQLiteDatabase db) { }, DatabaseHandler.KEY_E_ID + "=?", new String[] { String.valueOf(event._id) }, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -892,7 +891,7 @@ static private void getEventPreferencesScreen(Event event, SQLiteDatabase db) { eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_SCREEN_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesBluetooth(Event event, SQLiteDatabase db) { @@ -905,8 +904,7 @@ static private void getEventPreferencesBluetooth(Event event, SQLiteDatabase db) }, DatabaseHandler.KEY_E_ID + "=?", new String[] { String.valueOf(event._id) }, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -920,7 +918,7 @@ static private void getEventPreferencesBluetooth(Event event, SQLiteDatabase db) eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_BLUETOOTH_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesSMS(Event event, SQLiteDatabase db) { @@ -939,8 +937,7 @@ static private void getEventPreferencesSMS(Event event, SQLiteDatabase db) { }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -961,7 +958,7 @@ static private void getEventPreferencesSMS(Event event, SQLiteDatabase db) { eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_SMS_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesNotification(Event event, SQLiteDatabase db) { @@ -984,8 +981,7 @@ static private void getEventPreferencesNotification(Event event, SQLiteDatabase }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1009,7 +1005,7 @@ static private void getEventPreferencesNotification(Event event, SQLiteDatabase eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_NOTIFICATION_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesApplication(Event event, SQLiteDatabase db) { @@ -1022,8 +1018,7 @@ static private void getEventPreferencesApplication(Event event, SQLiteDatabase d }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1037,7 +1032,7 @@ static private void getEventPreferencesApplication(Event event, SQLiteDatabase d eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_APPLICATION_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesLocation(Event event, SQLiteDatabase db) { @@ -1049,8 +1044,7 @@ static private void getEventPreferencesLocation(Event event, SQLiteDatabase db) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1064,7 +1058,7 @@ static private void getEventPreferencesLocation(Event event, SQLiteDatabase db) } cursor.close(); - } + //} } static private void getEventPreferencesOrientation(Event event, SQLiteDatabase db) { @@ -1081,8 +1075,7 @@ static private void getEventPreferencesOrientation(Event event, SQLiteDatabase d }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1100,7 +1093,7 @@ static private void getEventPreferencesOrientation(Event event, SQLiteDatabase d eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ORIENTATION_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesMobileCells(Event event, SQLiteDatabase db) { @@ -1113,8 +1106,7 @@ static private void getEventPreferencesMobileCells(Event event, SQLiteDatabase d }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1129,7 +1121,7 @@ static private void getEventPreferencesMobileCells(Event event, SQLiteDatabase d } cursor.close(); - } + //} } static private void getEventPreferencesNFC(Event event, SQLiteDatabase db) { @@ -1143,8 +1135,7 @@ static private void getEventPreferencesNFC(Event event, SQLiteDatabase db) { }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1159,7 +1150,7 @@ static private void getEventPreferencesNFC(Event event, SQLiteDatabase db) { eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_NFC_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesRadioSwitch(Event event, SQLiteDatabase db) { @@ -1178,8 +1169,7 @@ static private void getEventPreferencesRadioSwitch(Event event, SQLiteDatabase d }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1199,7 +1189,7 @@ static private void getEventPreferencesRadioSwitch(Event event, SQLiteDatabase d eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_RADIO_SWITCH_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesAlarmClock(Event event, SQLiteDatabase db) { @@ -1214,8 +1204,7 @@ static private void getEventPreferencesAlarmClock(Event event, SQLiteDatabase db }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1231,7 +1220,7 @@ static private void getEventPreferencesAlarmClock(Event event, SQLiteDatabase db eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ALARM_CLOCK_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesDeviceBoot(Event event, SQLiteDatabase db) { @@ -1244,8 +1233,7 @@ static private void getEventPreferencesDeviceBoot(Event event, SQLiteDatabase db }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1259,7 +1247,7 @@ static private void getEventPreferencesDeviceBoot(Event event, SQLiteDatabase db eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_DEVICE_BOOT_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesSoundProfile(Event event, SQLiteDatabase db) { @@ -1271,8 +1259,7 @@ static private void getEventPreferencesSoundProfile(Event event, SQLiteDatabase }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1285,7 +1272,7 @@ static private void getEventPreferencesSoundProfile(Event event, SQLiteDatabase eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_SOUND_PROFILE_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesPeriodic(Event event, SQLiteDatabase db) { @@ -1299,8 +1286,7 @@ static private void getEventPreferencesPeriodic(Event event, SQLiteDatabase db) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1315,7 +1301,7 @@ static private void getEventPreferencesPeriodic(Event event, SQLiteDatabase db) eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_PERIODIC_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesVolumes(Event event, SQLiteDatabase db) { @@ -1339,8 +1325,7 @@ static private void getEventPreferencesVolumes(Event event, SQLiteDatabase db) { }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1365,7 +1350,7 @@ static private void getEventPreferencesVolumes(Event event, SQLiteDatabase db) { eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_VOLUMES_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesActivatedProfile(Event event, SQLiteDatabase db) { @@ -1378,8 +1363,7 @@ static private void getEventPreferencesActivatedProfile(Event event, SQLiteDatab }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1393,7 +1377,7 @@ static private void getEventPreferencesActivatedProfile(Event event, SQLiteDatab eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ACTIVATED_PROFILE_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesRoaming(Event event, SQLiteDatabase db) { @@ -1406,8 +1390,7 @@ static private void getEventPreferencesRoaming(Event event, SQLiteDatabase db) { }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1421,7 +1404,7 @@ static private void getEventPreferencesRoaming(Event event, SQLiteDatabase db) { eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ROAMING_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesVPN(Event event, SQLiteDatabase db) { @@ -1432,8 +1415,7 @@ static private void getEventPreferencesVPN(Event event, SQLiteDatabase db) { }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1445,7 +1427,7 @@ static private void getEventPreferencesVPN(Event event, SQLiteDatabase db) { eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_VPN_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesBrightness(Event event, SQLiteDatabase db) { @@ -1459,8 +1441,7 @@ static private void getEventPreferencesBrightness(Event event, SQLiteDatabase db }, DatabaseHandler.KEY_E_ID + "=?", new String[] { String.valueOf(event._id) }, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1475,7 +1456,7 @@ static private void getEventPreferencesBrightness(Event event, SQLiteDatabase db eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_BRIGHTNESS_SENSOR_PASSED))); } cursor.close(); - } + //} } static private void getEventPreferencesMusic(Event event, SQLiteDatabase db) { @@ -1487,8 +1468,7 @@ static private void getEventPreferencesMusic(Event event, SQLiteDatabase db) { }, DatabaseHandler.KEY_E_ID + "=?", new String[] { String.valueOf(event._id) }, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -1501,7 +1481,50 @@ static private void getEventPreferencesMusic(Event event, SQLiteDatabase db) { eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_MUSIC_SENSOR_PASSED))); } cursor.close(); - } + //} + } + + static private void getEventPreferencesCallScreening(Event event, SQLiteDatabase db) { + Cursor cursor = db.query(DatabaseHandler.TABLE_EVENTS, + new String[]{DatabaseHandler.KEY_E_CALL_SCREENING_ENABLED, + DatabaseHandler.KEY_E_CALL_SCREENING_CALL_DIRECTION, + DatabaseHandler.KEY_E_CALL_SCREENING_CONTACTS, + //DatabaseHandler.KEY_E_CALL_SCREENING_CONTACT_LIST_TYPE, + DatabaseHandler.KEY_E_CALL_SCREENING_CONTACT_GROUPS, + DatabaseHandler.KEY_E_CALL_SCREENING_NOT_IN_CONTACTS, + DatabaseHandler.KEY_E_CALL_SCREENING_BLOCK_CALLS, + DatabaseHandler.KEY_E_CALL_SCREENING_SEND_SMS, + DatabaseHandler.KEY_E_CALL_SCREENING_SMS_TEXT, + DatabaseHandler.KEY_E_CALL_SCREENING_START_TIME, + DatabaseHandler.KEY_E_CALL_SCREENING_DURATION, + DatabaseHandler.KEY_E_CALL_SCREENING_PERMANENT_RUN, + DatabaseHandler.KEY_E_CALL_SCREENING_SENSOR_PASSED + }, + DatabaseHandler.KEY_E_ID + "=?", + new String[]{String.valueOf(event._id)}, null, null, null, null); + //if (cursor != null) { + cursor.moveToFirst(); + + if (cursor.getCount() > 0) + { + EventPreferencesCallScreening eventPreferences = event._eventPreferencesCallScreening; + + eventPreferences._enabled = (cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_ENABLED)) == 1); + eventPreferences._callDirection = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_CALL_DIRECTION)); + eventPreferences._contacts = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_CONTACTS)); + //eventPreferences._contactListType = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_CONTACT_LIST_TYPE)); + eventPreferences._contactGroups = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_CONTACT_GROUPS)); + eventPreferences._notInContacts = (cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_NOT_IN_CONTACTS)) == 1); + eventPreferences._blockCalls = (cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_BLOCK_CALLS)) == 1); + eventPreferences._sendSMS = (cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_SEND_SMS)) == 1); + eventPreferences._smsText = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_SMS_TEXT)); + eventPreferences._duration = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_DURATION)); + eventPreferences._permanentRun = (cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_PERMANENT_RUN)) == 1); + eventPreferences._startTime = cursor.getLong(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_START_TIME)); + eventPreferences.setSensorPassed(cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_SENSOR_PASSED))); + } + cursor.close(); + //} } // this is called only from getEvent and getAllEvents @@ -1533,6 +1556,7 @@ static private void getEventPreferences(Event event, SQLiteDatabase db) { getEventPreferencesVPN(event, db); getEventPreferencesBrightness(event, db); getEventPreferencesMusic(event, db); + getEventPreferencesCallScreening(event, db); } static private void updateEventPreferencesTime(Event event, SQLiteDatabase db) { @@ -1595,8 +1619,8 @@ static private void updateEventPreferencesCall(Event event, SQLiteDatabase db) { values.put(DatabaseHandler.KEY_E_CALL_SENSOR_PASSED, eventPreferences.getSensorPassed()); values.put(DatabaseHandler.KEY_E_CALL_FOR_SIM_CARD, eventPreferences._forSIMCard); // values.put(DatabaseHandler.KEY_E_CALL_STOP_RINGING, (eventPreferences._stopRinging) ? 1 : 0); -// values.put(DatabaseHandler.KEY_E_CALL_SEND_SMS, (eventPreferences._sendSMS) ? 1 : 0); -// values.put(DatabaseHandler.KEY_E_CALL_SMS_TEXT, eventPreferences._smsText); + values.put(DatabaseHandler.KEY_E_CALL_SEND_SMS, (eventPreferences._sendSMS) ? 1 : 0); + values.put(DatabaseHandler.KEY_E_CALL_SMS_TEXT, eventPreferences._smsText); values.put(DatabaseHandler.KEY_E_CALL_RUN_AFTER_CALL_END_TIME, eventPreferences._runAfterCallEndTime); values.put(DatabaseHandler.KEY_E_CALL_RUN_AFTER_CALL_END_FROM_SIM_SLOT, eventPreferences._runAfterCallEndFromSIMSlot); @@ -2018,6 +2042,30 @@ static private void updateEventPreferencesMusic(Event event, SQLiteDatabase db) new String[] { String.valueOf(event._id) }); } + static private void updateEventPreferencesCallScreening(Event event, SQLiteDatabase db) { + ContentValues values = new ContentValues(); + + EventPreferencesCallScreening eventPreferences = event._eventPreferencesCallScreening; + + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_ENABLED, (eventPreferences._enabled) ? 1 : 0); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_CALL_DIRECTION, eventPreferences._callDirection); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_CONTACTS, eventPreferences._contacts); + //values.put(DatabaseHandler.KEY_E_CALL_SCREENING_CONTACT_LIST_TYPE, eventPreferences._contactListType); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_CONTACT_GROUPS, eventPreferences._contactGroups); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_NOT_IN_CONTACTS, (eventPreferences._notInContacts) ? 1 : 0); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_BLOCK_CALLS, (eventPreferences._blockCalls) ? 1 : 0); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_SEND_SMS, (eventPreferences._sendSMS) ? 1 : 0); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_SMS_TEXT, eventPreferences._smsText); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_DURATION, eventPreferences._duration); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_PERMANENT_RUN, (eventPreferences._permanentRun) ? 1 : 0); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_START_TIME, eventPreferences._startTime); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_SENSOR_PASSED, eventPreferences.getSensorPassed()); + + // updating row + db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", + new String[] { String.valueOf(event._id) }); + } + // this is called only from addEvent and updateEvent. // for this is not needed to calling importExportLock.lock(); static private void updateEventPreferences(Event event, SQLiteDatabase db) { @@ -2047,6 +2095,7 @@ static private void updateEventPreferences(Event event, SQLiteDatabase db) { updateEventPreferencesVPN(event, db); updateEventPreferencesBrightness(event, db); updateEventPreferencesMusic(event, db); + updateEventPreferencesCallScreening(event, db); } @@ -2067,7 +2116,7 @@ static int getEventStatus(DatabaseHandler instance, Event event) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -2075,7 +2124,7 @@ static int getEventStatus(DatabaseHandler instance, Event event) } cursor.close(); - } + //} //db.close(); @@ -2259,7 +2308,7 @@ static long getEventIdByName(DatabaseHandler instance, String name) new String[]{DatabaseHandler.KEY_E_ID}, "trim(" + DatabaseHandler.KEY_E_NAME + ")=?", new String[]{name}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); int rc = cursor.getCount(); @@ -2269,7 +2318,7 @@ static long getEventIdByName(DatabaseHandler instance, String name) } cursor.close(); - } + //} //db.close(); @@ -2375,6 +2424,9 @@ static int getEventSensorPassed(DatabaseHandler instance, EventPreferences event case DatabaseHandler.ETYPE_MUSIC: sensorPassedField = DatabaseHandler.KEY_E_MUSIC_SENSOR_PASSED; break; + case DatabaseHandler.ETYPE_CALL_SCREENING: + sensorPassedField = DatabaseHandler.KEY_E_CALL_SCREENING_SENSOR_PASSED; + break; } Cursor cursor = db.query(DatabaseHandler.TABLE_EVENTS, @@ -2383,7 +2435,7 @@ static int getEventSensorPassed(DatabaseHandler instance, EventPreferences event }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(eventPreferences._event._id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -2391,7 +2443,7 @@ static int getEventSensorPassed(DatabaseHandler instance, EventPreferences event } cursor.close(); - } + //} //db.close(); @@ -2525,6 +2577,10 @@ static void updateEventSensorPassed(DatabaseHandler instance, Event event, int e sensorPassed = event._eventPreferencesMusic.getSensorPassed(); sensorPassedField = DatabaseHandler.KEY_E_MUSIC_SENSOR_PASSED; break; + case DatabaseHandler.ETYPE_CALL_SCREENING: + sensorPassed = event._eventPreferencesCallScreening.getSensorPassed(); + sensorPassedField = DatabaseHandler.KEY_E_CALL_SCREENING_SENSOR_PASSED; + break; } ContentValues values = new ContentValues(); values.put(sensorPassedField, sensorPassed); @@ -2783,6 +2839,8 @@ else if (eventType == DatabaseHandler.ETYPE_BRIGHTNESS) eventTypeChecked = eventTypeChecked + DatabaseHandler.KEY_E_BRIGHTNESS_ENABLED + "=1"; else if (eventType == DatabaseHandler.ETYPE_MUSIC) eventTypeChecked = eventTypeChecked + DatabaseHandler.KEY_E_MUSIC_ENABLED + "=1"; + else if (eventType == DatabaseHandler.ETYPE_CALL_SCREENING) + eventTypeChecked = eventTypeChecked + DatabaseHandler.KEY_E_CALL_SCREENING_ENABLED + "=1"; } countQuery = "SELECT count(*) FROM " + DatabaseHandler.TABLE_EVENTS + @@ -2793,11 +2851,11 @@ else if (eventType == DatabaseHandler.ETYPE_MUSIC) Cursor cursor = db.rawQuery(countQuery, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); r = cursor.getInt(0); cursor.close(); - } + //} //db.close(); @@ -2826,11 +2884,11 @@ static int getNotStoppedEventsCount(DatabaseHandler instance) { Cursor cursor = db.rawQuery(countQuery, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); r = cursor.getInt(0); cursor.close(); - } + //} //db.close(); @@ -2902,7 +2960,7 @@ static void setEventCalendarTimes(DatabaseHandler instance, Event event) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -2912,7 +2970,7 @@ static void setEventCalendarTimes(DatabaseHandler instance, Event event) } cursor.close(); - } + //} //db.close(); } catch (Exception e) { @@ -2979,7 +3037,7 @@ static boolean getEventInDelayStart(DatabaseHandler instance, Event event) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -2987,7 +3045,7 @@ static boolean getEventInDelayStart(DatabaseHandler instance, Event event) } cursor.close(); - } + //} //db.close(); @@ -3095,7 +3153,7 @@ static boolean getEventInDelayEnd(DatabaseHandler instance, Event event) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -3103,7 +3161,7 @@ static boolean getEventInDelayEnd(DatabaseHandler instance, Event event) } cursor.close(); - } + //} //db.close(); @@ -3213,7 +3271,7 @@ static void getSMSStartTime(DatabaseHandler instance, Event event) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -3223,7 +3281,7 @@ static void getSMSStartTime(DatabaseHandler instance, Event event) } cursor.close(); - } + //} //db.close(); } catch (Exception e) { @@ -3289,7 +3347,7 @@ static void getNFCStartTime(DatabaseHandler instance, Event event) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -3297,7 +3355,7 @@ static void getNFCStartTime(DatabaseHandler instance, Event event) } cursor.close(); - } + //} //db.close(); } catch (Exception e) { @@ -3365,7 +3423,7 @@ static void getCallRunAfterCallEndTime(DatabaseHandler instance, Event event) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -3374,7 +3432,7 @@ static void getCallRunAfterCallEndTime(DatabaseHandler instance, Event event) } cursor.close(); - } + //} //db.close(); } catch (Exception e) { @@ -3521,7 +3579,7 @@ static void getAlarmClockStartTime(DatabaseHandler instance, Event event) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -3530,7 +3588,7 @@ static void getAlarmClockStartTime(DatabaseHandler instance, Event event) } cursor.close(); - } + //} //db.close(); } catch (Exception e) { @@ -3596,7 +3654,7 @@ static void getDeviceBootStartTime(DatabaseHandler instance, Event event) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -3604,7 +3662,7 @@ static void getDeviceBootStartTime(DatabaseHandler instance, Event event) } cursor.close(); - } + //} //db.close(); } catch (Exception e) { @@ -3711,7 +3769,7 @@ static void getPeriodicStartTime(DatabaseHandler instance, Event event) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -3727,7 +3785,7 @@ static void getPeriodicStartTime(DatabaseHandler instance, Event event) } cursor.close(); - } + //} //db.close(); } catch (Exception e) { @@ -3793,7 +3851,7 @@ static void getApplicationStartTime(DatabaseHandler instance, Event event) }, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(event._id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -3801,6 +3859,45 @@ static void getApplicationStartTime(DatabaseHandler instance, Event event) } cursor.close(); + //} + + //db.close(); + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } + } finally { + instance.stopRunningCommand(); + } + } + + static void updateCallScreeningStartTime(DatabaseHandler instance, Event event) + { + instance.importExportLock.lock(); + try { + try { + instance.startRunningCommand(); + + //SQLiteDatabase db = this.getWritableDatabase(); + SQLiteDatabase db = instance.getMyWritableDatabase(); + + ContentValues values = new ContentValues(); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_START_TIME, event._eventPreferencesCallScreening._startTime); + + db.beginTransaction(); + + try { + // updating row + db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", + new String[]{String.valueOf(event._id)}); + + db.setTransactionSuccessful(); + + } catch (Exception e) { + //Error in between database transaction + //Log.e("DatabaseHandlerEvents.updateCallScreeningStartTimes", Log.getStackTraceString(e)); + PPApplicationStatic.recordException(e); + } finally { + db.endTransaction(); } //db.close(); @@ -3812,6 +3909,41 @@ static void getApplicationStartTime(DatabaseHandler instance, Event event) } } + static void getCallScreeningStartTime(DatabaseHandler instance, Event event) + { + instance.importExportLock.lock(); + try { + try { + instance.startRunningCommand(); + + //SQLiteDatabase db = this.getReadableDatabase(); + SQLiteDatabase db = instance.getMyWritableDatabase(); + + Cursor cursor = db.query(DatabaseHandler.TABLE_EVENTS, + new String[]{ + DatabaseHandler.KEY_E_CALL_SCREENING_START_TIME + }, + DatabaseHandler.KEY_E_ID + "=?", + new String[]{String.valueOf(event._id)}, null, null, null, null); + //if (cursor != null) { + cursor.moveToFirst(); + + if (cursor.getCount() > 0) { + event._eventPreferencesCallScreening._startTime = cursor.getLong(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_START_TIME)); + } + + cursor.close(); + //} + + //db.close(); + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } + } finally { + instance.stopRunningCommand(); + } + } + static void updateEventForceRun(DatabaseHandler instance, Event event) { instance.importExportLock.lock(); try { @@ -3870,11 +4002,11 @@ static int getOrientationWithLightSensorEventsCount(DatabaseHandler instance) Cursor cursor = db.rawQuery(countQuery, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); r = cursor.getInt(0); cursor.close(); - } + //} //db.close(); @@ -4218,7 +4350,7 @@ static Geofence getGeofence(DatabaseHandler instance, long geofenceId) { DatabaseHandler.KEY_G_ID + "=?", new String[]{String.valueOf(geofenceId)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -4231,7 +4363,7 @@ static Geofence getGeofence(DatabaseHandler instance, long geofenceId) { } cursor.close(); - } + //} //db.close(); @@ -4510,12 +4642,12 @@ static void checkGeofence(DatabaseHandler instance, String geofences, int check, " FROM " + DatabaseHandler.TABLE_GEOFENCES + " WHERE " + DatabaseHandler.KEY_G_ID + "=" + geofence; Cursor cursor = db.rawQuery(selectQuery, null); - if (cursor != null) { + //if (cursor != null) { if (cursor.moveToFirst()) // switch caeked state in db: 1,2 -> 0, 0 -> 1 _check = (cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_G_CHECKED)) == 0) ? 1 : 0; cursor.close(); - } + //} } if (_check != 2) { // save into db only check = 0, 1 = true check @@ -4591,11 +4723,11 @@ static String getGeofenceName(DatabaseHandler instance, long geofenceId) { Cursor cursor = db.rawQuery(countQuery, null); - if (cursor != null) { + //if (cursor != null) { if (cursor.moveToFirst()) r = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_G_NAME)); cursor.close(); - } + //} //db.close(); @@ -4625,7 +4757,7 @@ static String getCheckedGeofences(DatabaseHandler instance) { Cursor cursor = db.rawQuery(countQuery, null); - if (cursor != null) { + //if (cursor != null) { if (cursor.moveToFirst()) { do { if (cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_G_CHECKED)) == 1) { @@ -4639,7 +4771,7 @@ static String getCheckedGeofences(DatabaseHandler instance) { } while (cursor.moveToNext()); } cursor.close(); - } + //} //db.close(); @@ -4667,11 +4799,11 @@ static int getGeofenceCount(DatabaseHandler instance) { Cursor cursor = db.rawQuery(countQuery, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); r = cursor.getInt(0); cursor.close(); - } + //} //db.close(); @@ -4753,11 +4885,11 @@ static int getGeofenceTransition(DatabaseHandler instance, long geofenceId) { Cursor cursor = db.rawQuery(countQuery, null); - if (cursor != null) { + //if (cursor != null) { if (cursor.moveToFirst()) r = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_G_TRANSITION)); cursor.close(); - } + //} //db.close(); @@ -5130,37 +5262,39 @@ static String renameMobileCellsList(DatabaseHandler instance, List 0) - renamedCells.append("|"); - renamedCells.append(oldCellName); + if (!valueCell.isEmpty()) { + boolean updateCell = false; + long _valueCell = Long.parseLong(valueCell); + if (cell.cellId != Integer.MAX_VALUE) { + if (_valueCell == cell.cellId) + updateCell = true; + } else if (cell.cellIdLong != Long.MAX_VALUE) { + if (_valueCell == cell.cellIdLong) + updateCell = true; } + if (updateCell) { + String oldCellName = cell.name; + + cell.name = toCellName; + MobileCell mobileCell = new MobileCell(); + mobileCell._id = foundedDbId; + mobileCell._cellId = cell.cellId; + mobileCell._cellIdLong = cell.cellIdLong; + mobileCell._name = cell.name; + mobileCell._new = cell._new; + mobileCell._lastConnectedTime = cell.lastConnectedTime; + //mobileCell._lastRunningEvents = cell.lastRunningEvents; + //mobileCell._lastPausedEvents = cell.lastPausedEvents; + //mobileCell._doNotDetect = cell.doNotDetect; + updateMobileCell(instance, mobileCell); + + if ((oldCellName != null) && (!oldCellName.isEmpty())) { + if (renamedCells.length() > 0) + renamedCells.append("|"); + renamedCells.append(oldCellName); + } + } } } } @@ -5381,11 +5515,11 @@ static int getNewMobileCellsCount(DatabaseHandler instance) { Cursor cursor = db.rawQuery(selectQuery, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); r = cursor.getInt(0); cursor.close(); - } + //} //db.close(); } catch (Exception e) { @@ -5407,18 +5541,18 @@ static int getMobileCellNameCount(DatabaseHandler instance, String cellName) { // Select All Query final String selectQuery = "SELECT COUNT(*) " + " FROM " + DatabaseHandler.TABLE_MOBILE_CELLS + - " WHERE " + DatabaseHandler.KEY_MC_NAME + "=\"" + cellName + "\""; + " WHERE " + DatabaseHandler.KEY_MC_NAME + "='" + cellName + "'"; //SQLiteDatabase db = this.getReadableDatabase(); SQLiteDatabase db = instance.getMyWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); r = cursor.getInt(0); cursor.close(); - } + //} //db.close(); } catch (Exception e) { @@ -5480,7 +5614,7 @@ static boolean isMobileCellSaved(DatabaseHandler instance, int mobileCell, long instance.startRunningCommand(); // Select All Query - String selectQuery = ""; + String selectQuery = null; if (mobileCell != Integer.MAX_VALUE) selectQuery = "SELECT COUNT(*) " + " FROM " + DatabaseHandler.TABLE_MOBILE_CELLS + @@ -5491,17 +5625,17 @@ static boolean isMobileCellSaved(DatabaseHandler instance, int mobileCell, long " FROM " + DatabaseHandler.TABLE_MOBILE_CELLS + " WHERE " + DatabaseHandler.KEY_MC_CELL_ID_LONG + "=" + mobileCellLong; - if (!selectQuery.isEmpty()) { + if (selectQuery != null) { //SQLiteDatabase db = this.getReadableDatabase(); SQLiteDatabase db = instance.getMyWritableDatabase(); Cursor cursor = db.rawQuery(selectQuery, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); r = cursor.getInt(0); cursor.close(); - } + //} } //db.close(); @@ -5539,7 +5673,7 @@ static void loadMobileCellsSensorEvents(DatabaseHandler instance, Cursor cursor = db.rawQuery(countQuery, null); - if (cursor != null) { + //if (cursor != null) { if (cursor.moveToFirst()) { do { MobileCellsSensorEvent mobileCellsSensorEvent = new MobileCellsSensorEvent(); @@ -5550,7 +5684,7 @@ static void loadMobileCellsSensorEvents(DatabaseHandler instance, } while (cursor.moveToNext()); } cursor.close(); - } + //} //db.close(); @@ -5575,8 +5709,7 @@ static String getEventMobileCellsCells(DatabaseHandler instance, long eventId) { new String[]{DatabaseHandler.KEY_E_MOBILE_CELLS_CELLS}, DatabaseHandler.KEY_E_ID + "=?", new String[]{String.valueOf(eventId)}, null, null, null, null); - if (cursor != null) - { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) @@ -5584,7 +5717,7 @@ static String getEventMobileCellsCells(DatabaseHandler instance, long eventId) { cells = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_MOBILE_CELLS_CELLS)); } cursor.close(); - } + //} //db.close(); @@ -5677,12 +5810,12 @@ static void addNFCTag(DatabaseHandler instance, NFCTag tag) { Cursor cursor = db.rawQuery(selectQuery, null); - int r = 0; - if (cursor != null) { + int r;// = 0; + //if (cursor != null) { cursor.moveToFirst(); r = cursor.getInt(0); cursor.close(); - } + //} if (r == 0) { ContentValues values = new ContentValues(); @@ -5849,11 +5982,11 @@ static boolean eventExists(DatabaseHandler instance, long event_id) { Cursor cursor = db.rawQuery(selectQuery, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); r = cursor.getInt(0); cursor.close(); - } + //} //db.close(); } catch (Exception e) { @@ -5881,11 +6014,11 @@ static int getEventPriority(DatabaseHandler instance, long event_id) DatabaseHandler.KEY_E_ID + "=?", new String[]{Long.toString(event_id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { if (cursor.moveToFirst()) priority = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_PRIORITY)); cursor.close(); - } + //} //db.close(); } catch (Exception e) { @@ -5913,11 +6046,11 @@ static int getEventIgnoreManualActivation(DatabaseHandler instance, long event_i DatabaseHandler.KEY_E_ID + "=?", new String[]{Long.toString(event_id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { if (cursor.moveToFirst()) ignoreManualActivation = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_FORCE_RUN)); cursor.close(); - } + //} //db.close(); } catch (Exception e) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerImportExport.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerImportExport.java index d3194188ad..a6be8e8f58 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerImportExport.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerImportExport.java @@ -36,6 +36,12 @@ class DatabaseHandlerImportExport { static final String PREF_MAXIMUM_VOLUME_DTMF = "maximumVolume_dtmf"; static final String PREF_MAXIMUM_VOLUME_ACCESSIBILITY = "maximumVolume_accessibility"; static final String PREF_MAXIMUM_VOLUME_BLUETOOTH_SCO = "maximumVolume_bluetoothSCO"; + static final String PREF_MINIMUM_VIBRATION_INTENSITY_RINGING = "minimumVibrationIntensity_ringing"; + static final String PREF_MINIMUM_VIBRATION_INTENSITY_NOTIFICATION = "minimumVibrationIntensity_notificaitons"; + static final String PREF_MINIMUM_VIBRATION_INTENSITY_TOUCH_INTERACTION = "minimumVibrationIntensity_touchInteraction"; + static final String PREF_MAXIMUM_VIBRATION_INTENSITY_RINGING = "maximumVibrationIntensity_ringing"; + static final String PREF_MAXIMUM_VIBRATION_INTENSITY_NOTIFICATION = "maximumVibrationIntensity_notificaitons"; + static final String PREF_MAXIMUM_VIBRATION_INTENSITY_TOUCH_INTERACTION = "maximumVibrationIntensity_touchInteraction"; static private boolean tableExists(String tableName, SQLiteDatabase db) { @@ -46,13 +52,13 @@ static private boolean tableExists(String tableName, SQLiteDatabase db) { String query = "select DISTINCT tbl_name from sqlite_master where tbl_name = '"+tableName+"'"; try (Cursor cursor = db.rawQuery(query, null)) { - if(cursor!=null) { + //if(cursor!=null) { if (cursor.getCount()>0) { cursor.close(); return true; } cursor.close(); - } + //} return false; } /* @@ -84,7 +90,7 @@ static private void recalculateVolume(Cursor cursorImportDB, String volumeField, if (maximumVolumeFromSharedPrefs > 0) percentage = fVolume / maximumVolumeFromSharedPrefs * 100f; else - percentage = fVolume / audioManager.getStreamMaxVolume(volumeStream); + percentage = fVolume / audioManager.getStreamMaxVolume(volumeStream) * 100f; if (percentage > 100f) percentage = 100f; @@ -616,16 +622,22 @@ static private void afterImportDbContacts(DatabaseHandler instance, SQLiteDataba boolean contactsConverted = false; // Log.e("DatabaseHandlerImportExport.afterImportDb", "(1) convert contacts data to new format"); +// PPApplicationStatic.logE("[CONTACTS_CACHE] DatabaseHandlerImportExport.afterImportDbNonGrantedUri", "(1) PPApplicationStatic.getContactsCache()"); ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); // Log.e("DatabaseHandlerImportExport.afterImportDb", "(1.1) convert contacts data to new format"); if (contactsCache == null) { // Log.e("DatabaseHandlerImportExport.afterImportDb", "(1.2) convert contacts data to new format"); +// PPApplicationStatic.logE("[CONTACTS_CACHE] DatabaseHandlerImportExport.afterImportDbNonGrantedUri", "PPApplicationStatic.createContactsCache()"); PPApplicationStatic.createContactsCache(instance.context, false, false); +// PPApplicationStatic.logE("[CONTACTS_CACHE] DatabaseHandlerImportExport.afterImportDbNonGrantedUri", "PPApplicationStatic.createContactGroupsCache()"); + PPApplicationStatic.createContactGroupsCache(instance.context, false/*, true*//*, true*/); // Log.e("DatabaseHandlerImportExport.afterImportDb", "(1.3) convert contacts data to new format"); +// PPApplicationStatic.logE("[CONTACTS_CACHE] DatabaseHandlerImportExport.afterImportDbNonGrantedUri", "(2) PPApplicationStatic.getContactsCache()"); contactsCache = PPApplicationStatic.getContactsCache(); // Log.e("DatabaseHandlerImportExport.afterImportDb", "(1.4) convert contacts data to new format"); } // Log.e("DatabaseHandlerImportExport.afterImportDb", "(2) convert contacts data to new format"); +// PPApplicationStatic.logE("[CONTACTS_CACHE] DatabaseHandlerImportExport.afterImportDbNonGrantedUri", "contactsCache.getList()"); List contactList = contactsCache.getList(/*withoutNumbers*/); // Log.e("DatabaseHandlerImportExport.afterImportDb", "(3) convert contacts data to new format"); if (contactList != null) { @@ -829,7 +841,8 @@ static private void afterImportDbContacts(DatabaseHandler instance, SQLiteDataba DatabaseHandler.KEY_E_ID + "," + DatabaseHandler.KEY_E_CALL_CONTACTS + "," + DatabaseHandler.KEY_E_SMS_CONTACTS + "," + - DatabaseHandler.KEY_E_NOTIFICATION_CONTACTS + + DatabaseHandler.KEY_E_NOTIFICATION_CONTACTS + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_CONTACTS + " FROM " + DatabaseHandler.TABLE_EVENTS, null); if (cursorImportDB.moveToFirst()) { @@ -839,6 +852,7 @@ static private void afterImportDbContacts(DatabaseHandler instance, SQLiteDataba String callContacts = cursorImportDB.getString(cursorImportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_CONTACTS)); String smsContacts = cursorImportDB.getString(cursorImportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_E_SMS_CONTACTS)); String notificationContacts = cursorImportDB.getString(cursorImportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_E_NOTIFICATION_CONTACTS)); + String callScreeningContacts = cursorImportDB.getString(cursorImportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_CONTACTS)); String decryptedCallContacts; try { @@ -858,18 +872,26 @@ static private void afterImportDbContacts(DatabaseHandler instance, SQLiteDataba } catch (Exception e) { decryptedNotificationContacts = ""; } + String decryptedCallScreeningContacts; + try { + decryptedCallScreeningContacts = encryption.decryptOrNull(callScreeningContacts); + } catch (Exception e) { + decryptedCallScreeningContacts = ""; + } // Log.e("DatabaseHandlerImportExport.afterImportDb", "decryptedCallContacts="+decryptedCallContacts); // Log.e("DatabaseHandlerImportExport.afterImportDb", "decryptedSMSContacts="+decryptedSMSContacts); // Log.e("DatabaseHandlerImportExport.afterImportDb", "decryptedNotificationContacts="+decryptedNotificationContacts); +// Log.e("DatabaseHandlerImportExport.afterImportDb", "decryptedNotificationContacts="+decryptedCallScreeningContacts); if (decryptedCallContacts == null) decryptedCallContacts = ""; if (decryptedSMSContacts == null) decryptedSMSContacts = ""; - if (decryptedNotificationContacts == null) - decryptedNotificationContacts = ""; + if (decryptedNotificationContacts == null) decryptedNotificationContacts = ""; + if (decryptedCallScreeningContacts == null) decryptedCallScreeningContacts = ""; ContentValues values = new ContentValues(); values.put(DatabaseHandler.KEY_E_CALL_CONTACTS, decryptedCallContacts); values.put(DatabaseHandler.KEY_E_SMS_CONTACTS, decryptedSMSContacts); values.put(DatabaseHandler.KEY_E_NOTIFICATION_CONTACTS, decryptedNotificationContacts); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_CONTACTS, decryptedCallScreeningContacts); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", new String[]{String.valueOf(eventId)}); @@ -882,6 +904,7 @@ static private void afterImportDbContacts(DatabaseHandler instance, SQLiteDataba cursorImportDB.close(); } + /* try { cursorImportDB = db.rawQuery("SELECT " + DatabaseHandler.KEY_ID + "," + @@ -916,6 +939,53 @@ static private void afterImportDbContacts(DatabaseHandler instance, SQLiteDataba if ((cursorImportDB != null) && (!cursorImportDB.isClosed())) cursorImportDB.close(); } + */ + + try { + cursorImportDB = db.rawQuery("SELECT " + + DatabaseHandler.KEY_ID + "," + + DatabaseHandler.KEY_SEND_SMS_CONTACTS + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS + + " FROM " + DatabaseHandler.TABLE_PROFILES, null); + + if (cursorImportDB.moveToFirst()) { + do { + long profileId = cursorImportDB.getLong(cursorImportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_ID)); + + String sendSMSContacts = cursorImportDB.getString(cursorImportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_CONTACTS)); + String clearNotificationContacts = cursorImportDB.getString(cursorImportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS)); + + String decryptedSendSMSContacts; + try { + decryptedSendSMSContacts = encryption.decryptOrNull(sendSMSContacts); + } catch (Exception e) { + decryptedSendSMSContacts = ""; + } + String decryptedClearNotificationContacts; + try { + decryptedClearNotificationContacts = encryption.decryptOrNull(clearNotificationContacts); + } catch (Exception e) { + decryptedClearNotificationContacts = ""; + } + //Log.e("DatabaseHandlerImportExport.afterImportDb", "decryptedSendSMSContacts="+decryptedSendSMSContacts); + //Log.e("DatabaseHandlerImportExport.afterImportDb", "decryptedClearNotificationContacts="+decryptedClearNotificationContacts); + if (decryptedSendSMSContacts == null) decryptedSendSMSContacts = ""; + if (decryptedClearNotificationContacts == null) decryptedClearNotificationContacts = ""; + + ContentValues values = new ContentValues(); + values.put(DatabaseHandler.KEY_SEND_SMS_CONTACTS, decryptedSendSMSContacts); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS, decryptedClearNotificationContacts); + + db.update(DatabaseHandler.TABLE_PROFILES, values, DatabaseHandler.KEY_ID + " = ?", + new String[]{String.valueOf(profileId)}); + + } while (cursorImportDB.moveToNext()); + } + cursorImportDB.close(); + } finally { + if (/*(cursorImportDB != null) &&*/ (!cursorImportDB.isClosed())) + cursorImportDB.close(); + } } } @@ -1101,6 +1171,110 @@ static private void afterImportDbDecriptPrivateData(DatabaseHandler instance, SQ } } + static private void recalculateVibrationIntensity(Cursor cursorImportDB, String vibrationIntensityField, ContentValues values, + int minimumVibrationIntensityFromPref, int maximumVibrationIntensityFromPref, + int minimumVibrationIntensity, int maximumVibrationIntensity) { + try { + String value = cursorImportDB.getString(cursorImportDB.getColumnIndexOrThrow(vibrationIntensityField)); + if (value != null) { + String[] splits = value.split(StringConstants.STR_SPLIT_REGEX); + int vibrationIntensity = Integer.parseInt(splits[0]); + if (vibrationIntensity > 0) { // default value -1 + float fVibrationIntensity = vibrationIntensity; + + // get percentage of value from imported data + float percentage; + if ((maximumVibrationIntensityFromPref - minimumVibrationIntensityFromPref) > 0) + percentage = fVibrationIntensity / (maximumVibrationIntensityFromPref - minimumVibrationIntensityFromPref) * 100f; + else + percentage = fVibrationIntensity / (maximumVibrationIntensity - minimumVibrationIntensity) * 100f; + if (percentage > 100f) + percentage = 100f; + + // get value from percentage for actual system max volume + fVibrationIntensity = (maximumVibrationIntensity - minimumVibrationIntensity) / 100f * percentage; + vibrationIntensity = Math.round(fVibrationIntensity); + + if (splits.length == 3) + values.put(vibrationIntensityField, vibrationIntensity + "|" + splits[1] + "|" + splits[2]); + else + values.put(vibrationIntensityField, vibrationIntensity + "|" + splits[1]); + } + } + } catch (IllegalArgumentException e) { + // java.lang.IllegalArgumentException: Bad stream type X + //PPApplicationStatic.recordException(e); + } catch (Exception e) { + //Log.e("DatabaseHandlerImportExport.afterImportDb", Log.getStackTraceString(e)); + PPApplicationStatic.recordException(e); + } + } + + static private void afterImportDbVibrationIntensity(DatabaseHandler instance, SQLiteDatabase db) { + Cursor cursorImportDB = null; + + // update vibration intensity by device min, max value + try { + // these shared preferences are put during export of data, values are from: + // - VibrationIntensityPreference.getMinValue() + // - VibrationIntensityPreference.getMaxValue() + // for import, these data are values from source of imported data (may be from another device) + SharedPreferences sharedPreferences = ApplicationPreferences.getSharedPreferences(instance.context); + int maximumRingingVibrationIntensityFromSharedPref = sharedPreferences.getInt(PREF_MAXIMUM_VIBRATION_INTENSITY_RINGING, 0); + int maximumNotificationsVibrationIntensityFromSharedPref = sharedPreferences.getInt(PREF_MAXIMUM_VIBRATION_INTENSITY_NOTIFICATION, 0); + int maximumTouchInteractionVibrationIntensityFromSharedPref = sharedPreferences.getInt(PREF_MAXIMUM_VIBRATION_INTENSITY_TOUCH_INTERACTION, 0); + int minimumRingingVibrationIntensityFromSharedPref = sharedPreferences.getInt(PREF_MINIMUM_VIBRATION_INTENSITY_RINGING, 0); + int minimumNotificaitonsVibrationIntensityFromSharedPref = sharedPreferences.getInt(PREF_MINIMUM_VIBRATION_INTENSITY_NOTIFICATION, 0); + int minimumTouchInteractionVibrationIntensityFromSharedPref = sharedPreferences.getInt(PREF_MINIMUM_VIBRATION_INTENSITY_TOUCH_INTERACTION, 0); + + int maximumRingingVibrationIntensity = VibrationIntensityPreference.getMaxValue(VibrationIntensityPreference.RINGING_VYBRATION_INTENSITY_TYPE); + int maximumNotificationsVibrationIntensity = VibrationIntensityPreference.getMaxValue(VibrationIntensityPreference.NOTIFICATIONS_VYBRATION_INTENSITY_TYPE); + int maximumTouchInteractionVibrationIntensity = VibrationIntensityPreference.getMaxValue(VibrationIntensityPreference.TOUCHINTERACTION_VYBRATION_INTENSITY_TYPE); + int minimumRingingVibrationIntensity = VibrationIntensityPreference.getMinValue(VibrationIntensityPreference.RINGING_VYBRATION_INTENSITY_TYPE); + int minimumNotificaitonsVibrationIntensity = VibrationIntensityPreference.getMinValue(VibrationIntensityPreference.NOTIFICATIONS_VYBRATION_INTENSITY_TYPE); + int minimumTouchInteractionVibrationIntensity = VibrationIntensityPreference.getMinValue(VibrationIntensityPreference.TOUCHINTERACTION_VYBRATION_INTENSITY_TYPE); + + cursorImportDB = db.rawQuery("SELECT " + + DatabaseHandler.KEY_ID + ","+ + DatabaseHandler.KEY_VIBRATION_INTENSITY_RINGING + ","+ + DatabaseHandler.KEY_VIBRATION_INTENSITY_NOTIFICATIONS + ","+ + DatabaseHandler.KEY_VIBRATION_INTENSITY_TOUCH_INTERACTION + + " FROM " + DatabaseHandler.TABLE_PROFILES, null); + + if (cursorImportDB.moveToFirst()) { + do { + + long profileId = cursorImportDB.getLong(cursorImportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_ID)); + + ContentValues values = new ContentValues(); + + recalculateVibrationIntensity(cursorImportDB, DatabaseHandler.KEY_VIBRATION_INTENSITY_RINGING, values, + minimumRingingVibrationIntensityFromSharedPref, maximumRingingVibrationIntensityFromSharedPref, + minimumRingingVibrationIntensity, maximumRingingVibrationIntensity); + + recalculateVibrationIntensity(cursorImportDB, DatabaseHandler.KEY_VIBRATION_INTENSITY_NOTIFICATIONS, values, + minimumNotificaitonsVibrationIntensityFromSharedPref, maximumNotificationsVibrationIntensityFromSharedPref, + minimumNotificaitonsVibrationIntensity, maximumNotificationsVibrationIntensity); + + recalculateVibrationIntensity(cursorImportDB, DatabaseHandler.KEY_VIBRATION_INTENSITY_TOUCH_INTERACTION, values, + minimumTouchInteractionVibrationIntensityFromSharedPref, maximumTouchInteractionVibrationIntensityFromSharedPref, + minimumTouchInteractionVibrationIntensity, maximumTouchInteractionVibrationIntensity); + + // updating row + //noinspection SizeReplaceableByIsEmpty + if (values.size() > 0) + db.update(DatabaseHandler.TABLE_PROFILES, values, DatabaseHandler.KEY_ID + " = ?", + new String[]{String.valueOf(profileId)}); + } while (cursorImportDB.moveToNext()); + } + cursorImportDB.close(); + + } finally { + if ((cursorImportDB != null) && (!cursorImportDB.isClosed())) + cursorImportDB.close(); + } + } + static private void afterImportDb(DatabaseHandler instance, SQLiteDatabase db) { afterImportDbVolumes(instance, db); @@ -1123,8 +1297,8 @@ static private void afterImportDb(DatabaseHandler instance, SQLiteDatabase db) { //db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DEVICE_MOBILE_DATA_SIM1 + "=0"); //db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DEVICE_MOBILE_DATA_SIM2 + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_DEFAULT_SIM_CARDS + "=\"0|0|0\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DEVICE_DEFAULT_SIM_CARDS + "=\"0|0|0\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_DEFAULT_SIM_CARDS + "='0|0|0'"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_DEVICE_DEFAULT_SIM_CARDS + "='0|0|0'"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_ONOFF_SIM1 + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_DEVICE_ONOFF_SIM2 + "=0"); @@ -1135,19 +1309,19 @@ static private void afterImportDb(DatabaseHandler instance, SQLiteDatabase db) { db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_CHANGE_SIM2 + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_CHANGE_SIM1 + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_CHANGE_SIM2 + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM1 + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM2 + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM1 + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM2 + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM1 + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM2 + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM1 + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM2 + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_CHANGE_SIM1 + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_CHANGE_SIM2 + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_CHANGE_SIM1 + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_CHANGE_SIM2 + "=0"); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM1 + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM2 + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM1 + "=\"\""); - db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM2 + "=\"\""); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM1 + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_RINGTONE_SIM2 + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM1 + "=''"); + db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_NOTIFICATION_SIM2 + "=''"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_PROFILES + " SET " + DatabaseHandler.KEY_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS + "=0"); db.execSQL("UPDATE " + DatabaseHandler.TABLE_MERGED_PROFILE + " SET " + DatabaseHandler.KEY_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS + "=0"); @@ -1268,11 +1442,13 @@ static private void afterImportDb(DatabaseHandler instance, SQLiteDatabase db) { } cursorImportDB.close(); } finally { - if ((cursorImportDB != null) && (!cursorImportDB.isClosed())) + if (/*(cursorImportDB != null) &&*/ (!cursorImportDB.isClosed())) cursorImportDB.close(); } } + afterImportDbVibrationIntensity(instance, db); + // remove all not used non-named mobile cells DatabaseHandlerEvents.deleteNonNamedNotUsedCells(instance, true); @@ -1791,7 +1967,8 @@ static int exportDB(DatabaseHandler instance, boolean deleteGeofences, boolean deleteWifiSSIDs, boolean deleteBluetoothNames, boolean deleteMobileCells, boolean deleteCall, boolean deleteSMS, boolean deleteNotification, - boolean deletePhoneCalls) + boolean deletePhoneCalls, boolean deleteCallScreening, + boolean deleteClearNotifications) { instance.importExportLock.lock(); try { @@ -1873,7 +2050,8 @@ static int exportDB(DatabaseHandler instance, DatabaseHandler.KEY_E_ID + "," + DatabaseHandler.KEY_E_CALL_CONTACTS + "," + DatabaseHandler.KEY_E_SMS_CONTACTS + "," + - DatabaseHandler.KEY_E_NOTIFICATION_CONTACTS + + DatabaseHandler.KEY_E_NOTIFICATION_CONTACTS + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_CONTACTS + " FROM " + DatabaseHandler.TABLE_EVENTS, null); if (cursorExportDB.moveToFirst()) { @@ -1883,21 +2061,26 @@ static int exportDB(DatabaseHandler instance, String callContacts = cursorExportDB.getString(cursorExportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_CONTACTS)); String smsContacts = cursorExportDB.getString(cursorExportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_E_SMS_CONTACTS)); String notificationContacts = cursorExportDB.getString(cursorExportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_E_NOTIFICATION_CONTACTS)); + String callScreeningContacts = cursorExportDB.getString(cursorExportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_CONTACTS)); String encryptedCallContacts = encryption.encryptOrNull(callContacts); String encryptedSMSContacts = encryption.encryptOrNull(smsContacts); String encryptedNotificationContacts = encryption.encryptOrNull(notificationContacts); + String encryptedCallScreeningContacts = encryption.encryptOrNull(callScreeningContacts); // Log.e("DatabaseHandlerImportExport.exportedDB", "encryptedCallContacts="+encryptedCallContacts); // Log.e("DatabaseHandlerImportExport.exportedDB", "encryptedSMSContacts="+encryptedSMSContacts); // Log.e("DatabaseHandlerImportExport.exportedDB", "encryptedNotificationContacts="+encryptedNotificationContacts); +// Log.e("DatabaseHandlerImportExport.exportedDB", "encryptedCallScreeningContacts="+encryptedCallScreeningContacts); if (encryptedCallContacts == null) encryptedCallContacts=""; if (encryptedSMSContacts == null) encryptedSMSContacts=""; if (encryptedNotificationContacts == null) encryptedNotificationContacts=""; + if (encryptedCallScreeningContacts == null) encryptedCallScreeningContacts=""; ContentValues values = new ContentValues(); values.put(DatabaseHandler.KEY_E_CALL_CONTACTS, encryptedCallContacts); values.put(DatabaseHandler.KEY_E_SMS_CONTACTS, encryptedSMSContacts); values.put(DatabaseHandler.KEY_E_NOTIFICATION_CONTACTS, encryptedNotificationContacts); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_CONTACTS, encryptedCallScreeningContacts); exportedDBObj.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", new String[]{String.valueOf(eventId)}); @@ -1910,6 +2093,7 @@ static int exportDB(DatabaseHandler instance, cursorExportDB.close(); } + // encript it, because must be encripted evem when is not used cursorExportDB = null; try { cursorExportDB = exportedDBObj.rawQuery("SELECT " + @@ -1941,6 +2125,43 @@ static int exportDB(DatabaseHandler instance, cursorExportDB.close(); } + cursorExportDB = null; + try { + cursorExportDB = exportedDBObj.rawQuery("SELECT " + + DatabaseHandler.KEY_ID + "," + + DatabaseHandler.KEY_SEND_SMS_CONTACTS + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS + + " FROM " + DatabaseHandler.TABLE_PROFILES, null); + + if (cursorExportDB.moveToFirst()) { + do { + long profileId = cursorExportDB.getLong(cursorExportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_ID)); + + String sendSMSContacts = cursorExportDB.getString(cursorExportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_CONTACTS)); + String clearNotificationContacts = cursorExportDB.getString(cursorExportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS)); + + String encryptedSendSMSContacts = encryption.encryptOrNull(sendSMSContacts); + String encryptedClearNotificationContacts = encryption.encryptOrNull(clearNotificationContacts); + //Log.e("DatabaseHandlerImportExport.exportedDB", "encryptedSendSMSContacts="+encryptedSendSMSContacts); + //Log.e("DatabaseHandlerImportExport.exportedDB", "encryptedClearNotificationContacts="+encryptedClearNotificationContacts); + if (encryptedSendSMSContacts == null) encryptedSendSMSContacts=""; + if (encryptedClearNotificationContacts == null) encryptedClearNotificationContacts=""; + + ContentValues values = new ContentValues(); + values.put(DatabaseHandler.KEY_SEND_SMS_CONTACTS, encryptedSendSMSContacts); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS, encryptedClearNotificationContacts); + + exportedDBObj.update(DatabaseHandler.TABLE_PROFILES, values, DatabaseHandler.KEY_ID + " = ?", + new String[]{String.valueOf(profileId)}); + + } while (cursorExportDB.moveToNext()); + } + cursorExportDB.close(); + } finally { + if ((cursorExportDB != null) && (!cursorExportDB.isClosed())) + cursorExportDB.close(); + } + editor = ApplicationPreferences.getEditor(instance.context); editor.putBoolean(ApplicationPreferences.PREF_APPLICATION_LOCATIONS_IN_BACKUP_ENCRIPTED, true); editor.apply(); @@ -2116,6 +2337,20 @@ static int exportDB(DatabaseHandler instance, _values.put(DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS, ""); exportedDBObj.update(DatabaseHandler.TABLE_PROFILES, _values, null, null); } + if (deleteCallScreening) { + //Log.e("DatabaseHandlerImportExport.exportedDB", "deletePhoneCalls"); + ContentValues _values = new ContentValues(); + _values.put(DatabaseHandler.KEY_E_CALL_SCREENING_CONTACTS, encriptedEmptyStr); + _values.put(DatabaseHandler.KEY_E_CALL_SCREENING_CONTACT_GROUPS, ""); + exportedDBObj.update(DatabaseHandler.TABLE_EVENTS, _values, null, null); + } + if (deleteClearNotifications) { + //Log.e("DatabaseHandlerImportExport.exportedDB", "deletePhoneCalls"); + ContentValues _values = new ContentValues(); + _values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS, encriptedEmptyStr); + _values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACT_GROUPS, ""); + exportedDBObj.update(DatabaseHandler.TABLE_PROFILES, _values, null, null); + } } catch (Exception ee) { PPApplicationStatic.recordException(ee); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerOthers.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerOthers.java index b491cdf88b..785ae47695 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerOthers.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerOthers.java @@ -89,7 +89,7 @@ static void clearActivityLog(DatabaseHandler instance) { } } - static Cursor getActivityLogCursor(DatabaseHandler instance) { + static Cursor getActivityLogCursor(DatabaseHandler instance, int selectedFilter) { instance.importExportLock.lock(); try { Cursor cursor = null; @@ -100,6 +100,85 @@ static Cursor getActivityLogCursor(DatabaseHandler instance) { SQLiteDatabase db = instance.getMyWritableDatabase(); String countQuery = "SELECT COUNT(0) FROM " + DatabaseHandler.TABLE_ACTIVITY_LOG; + + String whereStr = ""; + switch (selectedFilter) { + case PPApplication.ALFILTER_CALL_SCREENING_BLOCKED_CALL: + whereStr = " WHERE " + DatabaseHandler.KEY_AL_LOG_TYPE+"="+ + PPApplication.ALTYPE_CALL_SCREENING_BLOCKED_CALL; + break; + case PPApplication.ALFITER_ERRORS: + whereStr = " WHERE " + DatabaseHandler.KEY_AL_LOG_TYPE+" IN ("+ + PPApplication.ALTYPE_PROFILE_ERROR_RUN_APPLICATION_APPLICATION + ", " + + PPApplication.ALTYPE_PROFILE_ERROR_RUN_APPLICATION_SHORTCUT + ", " + + PPApplication.ALTYPE_PROFILE_ERROR_RUN_APPLICATION_INTENT + ", " + + PPApplication.ALTYPE_PROFILE_ERROR_SET_TONE_RINGTONE + ", " + + PPApplication.ALTYPE_PROFILE_ERROR_SET_TONE_NOTIFICATION + ", " + + PPApplication.ALTYPE_PROFILE_ERROR_SET_TONE_ALARM + ", " + + PPApplication.ALTYPE_PROFILE_ERROR_SET_WALLPAPER + ", " + + PPApplication.ALTYPE_PROFILE_ERROR_SET_VPN + ", " + + PPApplication.ALTYPE_PROFILE_ERROR_CAMERA_FLASH + ", " + + PPApplication.ALTYPE_PROFILE_ERROR_WIFI + ", " + + PPApplication.ALTYPE_PROFILE_ERROR_WIFIAP + ", " + + PPApplication.ALTYPE_PROFILE_ERROR_CLOSE_ALL_APPLICATIONS + ", " + + PPApplication.ALTYPE_PROFILE_ERROR_SEND_SMS + ", " + + PPApplication.ALTYPE_EXTENDER_ACCESSIBILITY_SERVICE_NOT_ENABLED + ", " + + PPApplication.ALTYPE_EXTENDER_ACCESSIBILITY_SERVICE_UNBIND + + ")"; + break; + case PPApplication.ALFILTER_EVENT_START: + whereStr = " WHERE " + DatabaseHandler.KEY_AL_LOG_TYPE+" IN ("+ + PPApplication.ALTYPE_EVENT_START + ", " + + PPApplication.ALTYPE_EVENT_START_DELAY + + ")"; + break; + case PPApplication.ALFILTER_EVENT_END: + whereStr = " WHERE " + DatabaseHandler.KEY_AL_LOG_TYPE+" IN ("+ + PPApplication.ALTYPE_EVENT_END_NONE + ", " + + PPApplication.ALTYPE_EVENT_END_ACTIVATE_PROFILE + ", " + + PPApplication.ALTYPE_EVENT_END_UNDO_PROFILE + ", " + + PPApplication.ALTYPE_EVENT_END_ACTIVATE_PROFILE_UNDO_PROFILE + ", " + + PPApplication.ALTYPE_EVENT_END_RESTART_EVENTS + ", " + + PPApplication.ALTYPE_EVENT_END_ACTIVATE_PROFILE_RESTART_EVENTS + ", " + + PPApplication.ALTYPE_AFTER_END_OF_ACTIVATION_UNDO_PROFILE + ", " + + PPApplication.ALTYPE_AFTER_END_OF_ACTIVATION_DEFAULT_PROFILE + ", " + + PPApplication.ALTYPE_AFTER_END_OF_ACTIVATION_RESTART_EVENTS + ", " + + PPApplication.ALTYPE_AFTER_END_OF_ACTIVATION_SPECIFIC_PROFILE + ", " + + PPApplication.ALTYPE_EVENT_END_DELAY + ", " + + PPApplication.ALTYPE_ACTION_FROM_EXTERNAL_APP_PAUSE_EVENT + + ")"; + break; + case PPApplication.ALFILTER_EVENT_STOP: + whereStr = " WHERE " + DatabaseHandler.KEY_AL_LOG_TYPE+" IN ("+ + PPApplication.ALTYPE_EVENT_STOP + ", " + + PPApplication.ALTYPE_ACTION_FROM_EXTERNAL_APP_STOP_EVENT + + ")"; + break; + case PPApplication.ALFILTER_RESTART_EVENTS: + whereStr = " WHERE " + DatabaseHandler.KEY_AL_LOG_TYPE+" IN ("+ + PPApplication.ALTYPE_RESTART_EVENTS + ", " + + PPApplication.ALTYPE_MANUAL_RESTART_EVENTS + ", " + + PPApplication.ALTYPE_AFTER_DURATION_RESTART_EVENTS + ", " + + PPApplication.ALTYPE_EVENT_END_ACTIVATE_PROFILE_RESTART_EVENTS + ", " + + PPApplication.ALTYPE_AFTER_END_OF_ACTIVATION_RESTART_EVENTS + ", " + + PPApplication.ALTYPE_ACTION_FROM_EXTERNAL_APP_RESTART_EVENTS + + ")"; + break; + case PPApplication.ALFITER_PROFILE_ACTIVATION: + whereStr = " WHERE " + DatabaseHandler.KEY_AL_LOG_TYPE+" IN ("+ + PPApplication.ALTYPE_PROFILE_ACTIVATION + ", " + + PPApplication.ALTYPE_MERGED_PROFILE_ACTIVATION + ", " + + PPApplication.ALTYPE_AFTER_DURATION_UNDO_PROFILE + ", " + + PPApplication.ALTYPE_AFTER_DURATION_DEFAULT_PROFILE + ", " + + PPApplication.ALTYPE_AFTER_DURATION_SPECIFIC_PROFILE + ", " + + PPApplication.ALTYPE_AFTER_END_OF_ACTIVATION_UNDO_PROFILE + ", " + + PPApplication.ALTYPE_AFTER_END_OF_ACTIVATION_DEFAULT_PROFILE + ", " + + PPApplication.ALTYPE_AFTER_END_OF_ACTIVATION_SPECIFIC_PROFILE + ", " + + PPApplication.ALTYPE_ACTION_FROM_EXTERNAL_APP_PROFILE_ACTIVATION + + ")"; + break; + } + countQuery = countQuery + whereStr; cursor = db.rawQuery(countQuery, null); int count = 0; @@ -108,18 +187,20 @@ static Cursor getActivityLogCursor(DatabaseHandler instance) { } cursor.close(); + //noinspection ExtractMethodRecommender String selectQuery = ""; if (count > 0) selectQuery = "SELECT -1 AS " + DatabaseHandler.KEY_AL_ID + "," + "CURRENT_TIMESTAMP AS " + DatabaseHandler.KEY_AL_LOG_DATE_TIME + "," + PPApplication.ALTYPE_LOG_TOP + " AS " + DatabaseHandler.KEY_AL_LOG_TYPE + "," + - "\"\" AS " + DatabaseHandler.KEY_AL_EVENT_NAME + "," + - "\"\" AS " + DatabaseHandler.KEY_AL_PROFILE_NAME + "," + + "'' AS " + DatabaseHandler.KEY_AL_EVENT_NAME + "," + + "'' AS " + DatabaseHandler.KEY_AL_PROFILE_NAME + "," + //DatabaseHandler.KEY_AL_PROFILE_ICON + "," + //DatabaseHandler.KEY_AL_DURATION_DELAY + "," + - "\"\" AS " + DatabaseHandler.KEY_AL_PROFILE_EVENT_COUNT + + "'' AS " + DatabaseHandler.KEY_AL_PROFILE_EVENT_COUNT + " UNION ALL "; + selectQuery = selectQuery + "SELECT " + DatabaseHandler.KEY_AL_ID + "," + DatabaseHandler.KEY_AL_LOG_DATE_TIME + "," + @@ -130,6 +211,7 @@ static Cursor getActivityLogCursor(DatabaseHandler instance) { //DatabaseHandler.KEY_AL_DURATION_DELAY + "," + DatabaseHandler.KEY_AL_PROFILE_EVENT_COUNT + " FROM " + DatabaseHandler.TABLE_ACTIVITY_LOG + + whereStr + " ORDER BY " + DatabaseHandler.KEY_AL_LOG_DATE_TIME + " DESC"; cursor = db.rawQuery(selectQuery, null); @@ -197,7 +279,10 @@ static void disableNotAllowedPreferences(DatabaseHandler instance) DatabaseHandler.KEY_VIBRATION_INTENSITY_RINGING + "," + DatabaseHandler.KEY_VIBRATION_INTENSITY_NOTIFICATIONS + "," + DatabaseHandler.KEY_VIBRATION_INTENSITY_TOUCH_INTERACTION + "," + - DatabaseHandler.KEY_VOLUME_SPEAKER_PHONE + + DatabaseHandler.KEY_VOLUME_SPEAKER_PHONE + "," + + DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT + "," + + DatabaseHandler.KEY_DEVICE_KEYGUARD + "," + + DatabaseHandler.KEY_SCREEN_ON_OFF + " FROM " + DatabaseHandler.TABLE_PROFILES; final String selectEventsQuery = "SELECT " + DatabaseHandler.KEY_E_ID + "," + DatabaseHandler.KEY_E_WIFI_ENABLED + "," + @@ -225,9 +310,10 @@ static void disableNotAllowedPreferences(DatabaseHandler instance) DatabaseHandler.KEY_E_VOLUMES_VOICE_TO + "," + DatabaseHandler.KEY_E_VOLUMES_BLUETOOTHSCO_TO + "," + DatabaseHandler.KEY_E_VOLUMES_ACCESSIBILITY_TO + "," +*/ - DatabaseHandler.KEY_E_CALL_EVENT + "," + + DatabaseHandler.KEY_E_CALL_ENABLED + "," + DatabaseHandler.KEY_E_SMS_ENABLED + "," + - DatabaseHandler.KEY_E_ROAMING_ENABLED + + DatabaseHandler.KEY_E_ROAMING_ENABLED + "," + + DatabaseHandler.KEY_E_CALL_SCREENING_ENABLED + //"," + " FROM " + DatabaseHandler.TABLE_EVENTS; //SQLiteDatabase db = this.getWritableDatabase(); @@ -247,7 +333,7 @@ static void disableNotAllowedPreferences(DatabaseHandler instance) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_AIRPLANE_MODE)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -265,7 +351,7 @@ static void disableNotAllowedPreferences(DatabaseHandler instance) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_WIFI)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WIFI, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -282,7 +368,7 @@ static void disableNotAllowedPreferences(DatabaseHandler instance) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_BLUETOOTH)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_BLUETOOTH, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -299,7 +385,7 @@ static void disableNotAllowedPreferences(DatabaseHandler instance) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_MOBILE_DATA)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -349,7 +435,7 @@ static void disableNotAllowedPreferences(DatabaseHandler instance) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_MOBILE_DATA_PREFS)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_PREFS, null, sharedPreferences, true, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -366,7 +452,7 @@ static void disableNotAllowedPreferences(DatabaseHandler instance) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_GPS)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_GPS, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -401,7 +487,7 @@ else if (gps == 3) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_LOCATION_SERVICE_PREFS)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_LOCATION_SERVICE_PREFS, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -418,7 +504,7 @@ else if (gps == 3) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_NFC)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NFC, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -435,7 +521,7 @@ else if (gps == 3) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_WIFI_AP)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WIFI_AP, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -501,7 +587,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_POWER_SAVE_MODE)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_POWER_SAVE_MODE, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -518,7 +604,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_NETWORK_TYPE)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -534,7 +620,7 @@ else if (zenMode == 5) } if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_NETWORK_TYPE_SIM1)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM1, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -550,7 +636,7 @@ else if (zenMode == 5) } if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_NETWORK_TYPE_SIM2)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM2, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -567,7 +653,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_NOTIFICATION_LED)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_NOTIFICATION_LED, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -584,7 +670,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_VIBRATE_WHEN_RINGING)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATE_WHEN_RINGING, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -601,7 +687,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_VIBRATE_NOTIFICATIONS)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATE_NOTIFICATIONS, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -617,7 +703,7 @@ else if (zenMode == 5) } PreferenceAllowed _preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_CONNECT_TO_SSID, null, sharedPreferences, false, instance.context); - if ((_preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((_preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (_preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (_preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (_preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -633,7 +719,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_ENABLE_WIFI_SCANNING)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_WIFI_SCANNING, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -650,7 +736,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_ENABLE_BLUETOOTH_SCANNING)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_BLUETOOTH_SCANNING, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -667,7 +753,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_ENABLE_LOCATION_SCANNING)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_LOCATION_SCANNING, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -684,7 +770,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_ENABLE_MOBILE_CELL_SCANNING)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_MOBILE_CELL_SCANNING, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -701,7 +787,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_ENABLE_ORIENTATION_SCANNING)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_ORIENTATION_SCANNING, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -718,7 +804,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_ENABLE_NOTIFICATION_SCANNING)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_NOTIFICATION_SCANNING, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -735,7 +821,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_ENABLE_PERIODIC_SCANNING)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_PERIODIC_SCANNING, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -752,7 +838,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_WIFI_AP_PREFS)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WIFI_AP_PREFS, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -769,7 +855,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_HEADS_UP_NOTIFICATIONS)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_HEADS_UP_NOTIFICATIONS, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -786,7 +872,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_NETWORK_TYPE_PREFS)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_PREFS, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -803,7 +889,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_ALWAYS_ON_DISPLAY)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_ALWAYS_ON_DISPLAY, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -820,7 +906,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_LOCATION_MODE)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_LOCATION_MODE, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -837,7 +923,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CAMERA_FLASH)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_CAMERA_FLASH, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -854,7 +940,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_DEFAULT_SIM_CARDS)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -871,7 +957,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_ONOFF_SIM1)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -887,7 +973,7 @@ else if (zenMode == 5) } if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_ONOFF_SIM2)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -904,7 +990,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SOUND_RINGTONE_CHANGE_SIM1)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -920,7 +1006,7 @@ else if (zenMode == 5) } if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SOUND_RINGTONE_CHANGE_SIM2)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -936,7 +1022,7 @@ else if (zenMode == 5) } if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SOUND_NOTIFICATION_CHANGE_SIM1)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -952,7 +1038,7 @@ else if (zenMode == 5) } if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SOUND_NOTIFICATION_CHANGE_SIM2)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -968,7 +1054,7 @@ else if (zenMode == 5) } if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -985,7 +1071,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_VIBRATION_INTENSITY_RINGING)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATION_INTENSITY_RINGING, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -1001,7 +1087,7 @@ else if (zenMode == 5) } if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_VIBRATION_INTENSITY_NOTIFICATIONS)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -1017,7 +1103,7 @@ else if (zenMode == 5) } if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_VIBRATION_INTENSITY_TOUCH_INTERACTION)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -1034,7 +1120,7 @@ else if (zenMode == 5) if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_VOLUME_SPEAKER_PHONE)) != 0) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_SPEAKER_PHONE, null, sharedPreferences, false, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && @@ -1049,6 +1135,46 @@ else if (zenMode == 5) } } + if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT)) != 0) { + PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT, null, sharedPreferences, false, instance.context); + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && + (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && + (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && + (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED) && + (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD) && + (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_TWO_SIM_CARDS) && + (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS)) { + values.clear(); + values.put(DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT, 0); + db.update(DatabaseHandler.TABLE_PROFILES, values, DatabaseHandler.KEY_ID + " = ?", + new String[]{String.valueOf(profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_ID)))}); + } + } + + if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SCREEN_ON_OFF)) != 0) { + PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_ON_OFF, null, sharedPreferences, false, instance.context); + int deviceKeyguard = profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_KEYGUARD)); + if ((deviceKeyguard != 0) || + (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED)) { + values.clear(); + values.put(DatabaseHandler.KEY_DEVICE_KEYGUARD, 0); + db.update(DatabaseHandler.TABLE_PROFILES, values, DatabaseHandler.KEY_ID + " = ?", + new String[]{String.valueOf(profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_ID)))}); + } + } + if (profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_KEYGUARD)) != 0) { + PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_KEYGUARD, null, sharedPreferences, false, instance.context); + int deviceScreenOnOff = profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SCREEN_ON_OFF)); + if ((deviceScreenOnOff != 0) || + (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED)) { + values.clear(); + values.put(DatabaseHandler.KEY_SCREEN_ON_OFF, 0); + db.update(DatabaseHandler.TABLE_PROFILES, values, DatabaseHandler.KEY_ID + " = ?", + new String[]{String.valueOf(profilesCursor.getInt(profilesCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_ID)))}); + } + } + } while (profilesCursor.moveToNext()); } @@ -1057,21 +1183,21 @@ else if (zenMode == 5) if (eventsCursor.moveToFirst()) { do { if ((eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_WIFI_ENABLED)) != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { + (EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { values.clear(); values.put(DatabaseHandler.KEY_E_WIFI_ENABLED, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", new String[]{String.valueOf(eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ID)))}); } if ((eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_BLUETOOTH_ENABLED)) != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { + (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { values.clear(); values.put(DatabaseHandler.KEY_E_BLUETOOTH_ENABLED, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", new String[]{String.valueOf(eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ID)))}); } if ((eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_NOTIFICATION_ENABLED)) != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesNotification.PREF_EVENT_NOTIFICATION_ENABLED, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { + (EventStatic.isEventPreferenceAllowed(EventPreferencesNotification.PREF_EVENT_NOTIFICATION_ENABLED, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { values.clear(); values.put(DatabaseHandler.KEY_E_NOTIFICATION_ENABLED, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", @@ -1115,7 +1241,7 @@ else if (zenMode == 5) } if ((eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_MOBILE_CELLS_ENABLED)) != 0) && //(Event.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { - (EventStatic.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED_NO_CHECK_SIM, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { + (EventStatic.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED_NO_CHECK_SIM, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { values.clear(); values.put(DatabaseHandler.KEY_E_MOBILE_CELLS_ENABLED, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", @@ -1123,7 +1249,7 @@ else if (zenMode == 5) } if ((eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_NFC_ENABLED)) != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesNFC.PREF_EVENT_NFC_ENABLED, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { + (EventStatic.isEventPreferenceAllowed(EventPreferencesNFC.PREF_EVENT_NFC_ENABLED, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { values.clear(); values.put(DatabaseHandler.KEY_E_NFC_ENABLED, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", @@ -1131,50 +1257,50 @@ else if (zenMode == 5) } if (eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_RADIO_SWITCH_ENABLED)) != 0) { - if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_WIFI, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_WIFI, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { values.clear(); values.put(DatabaseHandler.KEY_E_RADIO_SWITCH_WIFI, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", new String[]{String.valueOf(eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ID)))}); } - if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_BLUETOOTH, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_BLUETOOTH, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { values.clear(); values.put(DatabaseHandler.KEY_E_RADIO_SWITCH_BLUETOOTH, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", new String[]{String.valueOf(eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ID)))}); } - if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_SIM_ON_OFF, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_SIM_ON_OFF, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { values.clear(); values.put(DatabaseHandler.KEY_E_RADIO_SWITCH_SIM_ON_OFF, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", new String[]{String.valueOf(eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ID)))}); } - if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { values.clear(); values.put(DatabaseHandler.KEY_E_RADIO_SWITCH_DEFAULT_SIM_FOR_CALLS, 0); values.put(DatabaseHandler.KEY_E_RADIO_SWITCH_DEFAULT_SIM_FOR_SMS, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", new String[]{String.valueOf(eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ID)))}); } - if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_MOBILE_DATA, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_MOBILE_DATA, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { values.clear(); values.put(DatabaseHandler.KEY_E_RADIO_SWITCH_MOBILE_DATA, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", new String[]{String.valueOf(eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ID)))}); } - if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_GPS, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_GPS, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { values.clear(); values.put(DatabaseHandler.KEY_E_RADIO_SWITCH_GPS, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", new String[]{String.valueOf(eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ID)))}); } - if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_NFC, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_NFC, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { values.clear(); values.put(DatabaseHandler.KEY_E_RADIO_SWITCH_NFC, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", new String[]{String.valueOf(eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ID)))}); } - if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_AIRPLANE_MODE, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_AIRPLANE_MODE, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { values.clear(); values.put(DatabaseHandler.KEY_E_RADIO_SWITCH_AIRPLANE_MODE, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", @@ -1183,7 +1309,7 @@ else if (zenMode == 5) } if ((eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_SOUND_PROFILE_ENABLED)) != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesSoundProfile.PREF_EVENT_SOUND_PROFILE_ENABLED, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { + (EventStatic.isEventPreferenceAllowed(EventPreferencesSoundProfile.PREF_EVENT_SOUND_PROFILE_ENABLED, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { values.clear(); values.put(DatabaseHandler.KEY_E_SOUND_PROFILE_ENABLED, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", @@ -1191,7 +1317,7 @@ else if (zenMode == 5) } if ((eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_VOLUMES_ENABLED)) != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesVolumes.PREF_EVENT_VOLUMES_ENABLED, instance.context).allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { + (EventStatic.isEventPreferenceAllowed(EventPreferencesVolumes.PREF_EVENT_VOLUMES_ENABLED, true, instance.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED)) { values.clear(); values.put(DatabaseHandler.KEY_E_VOLUMES_ENABLED, 0); db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", @@ -1342,9 +1468,9 @@ else if (zenMode == 5) } } - if (eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_EVENT)) != 0) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesCall.PREF_EVENT_CALL_ENABLED, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + if (eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_ENABLED)) != 0) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesCall.PREF_EVENT_CALL_ENABLED, true, instance.context); + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE)) { values.clear(); values.put(DatabaseHandler.KEY_E_CALL_ENABLED, 0); @@ -1354,8 +1480,8 @@ else if (zenMode == 5) } if (eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_SMS_ENABLED)) != 0) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesSMS.PREF_EVENT_SMS_ENABLED, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesSMS.PREF_EVENT_SMS_ENABLED, true, instance.context); + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE)) { values.clear(); values.put(DatabaseHandler.KEY_E_SMS_ENABLED, 0); @@ -1365,8 +1491,8 @@ else if (zenMode == 5) } if (eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ROAMING_ENABLED)) != 0) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesRoaming.PREF_EVENT_ROAMING_ENABLED, instance.context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesRoaming.PREF_EVENT_ROAMING_ENABLED, true, instance.context); + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE)) { values.clear(); values.put(DatabaseHandler.KEY_E_ROAMING_ENABLED, 0); @@ -1375,6 +1501,17 @@ else if (zenMode == 5) } } + if (eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_CALL_SCREENING_ENABLED)) != 0) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesCallScreening.PREF_EVENT_CALL_SCREENING_ENABLED, true, instance.context); + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE)) { + values.clear(); + values.put(DatabaseHandler.KEY_E_CALL_SCREENING_ENABLED, 0); + db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?", + new String[]{String.valueOf(eventsCursor.getInt(eventsCursor.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ID)))}); + } + } + } while (eventsCursor.moveToNext()); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerProfiles.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerProfiles.java index 3688760c59..50b82d2aac 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerProfiles.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerProfiles.java @@ -138,13 +138,22 @@ static void addProfile(DatabaseHandler instance, Profile profile, boolean merged values.put(DatabaseHandler.KEY_APPLICATION_LOCATION_UPDATE_INTERVAL, profile._applicationLocationScanInterval); values.put(DatabaseHandler.KEY_APPLICATION_ORIENTATION_SCAN_INTERVAL, profile._applicationOrientationScanInterval); values.put(DatabaseHandler.KEY_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL, profile._applicationPeriodicScanInterval); - values.put(DatabaseHandler.KEY_PHONE_CALLS_CONTACTS, profile._phoneCallsContacts); - values.put(DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS, profile._phoneCallsContactGroups); - values.put(DatabaseHandler.KEY_PHONE_CALLS_BLOCK_CALLS, (profile._phoneCallsBlockCalls) ? 1 : 0); - values.put(DatabaseHandler.KEY_PHONE_CALLS_CONTACT_LIST_TYPE, profile._phoneCallsContactListType); - values.put(DatabaseHandler.KEY_PHONE_CALLS_SEND_SMS, (profile._phoneCallsSendSMS) ? 1 : 0); - values.put(DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT, profile._phoneCallsSMSText); + values.put(DatabaseHandler.KEY_SEND_SMS_CONTACTS, profile._sendSMSContacts); + values.put(DatabaseHandler.KEY_SEND_SMS_CONTACT_GROUPS, profile._sendSMSContactGroups); + //values.put(DatabaseHandler.KEY_SEND_SMS_CONTACT_LIST_TYPE, profile._sendSMSContactListType); + values.put(DatabaseHandler.KEY_SEND_SMS_SEND_SMS, (profile._sendSMSSendSMS) ? 1 : 0); + values.put(DatabaseHandler.KEY_SEND_SMS_SMS_TEXT, profile._sendSMSSMSText); values.put(DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN, profile._deviceWallpaperLockScreen); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_ENABLED, (profile._clearNotificationEnabled) ? 1 : 0); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_APPLICATIONS, profile._clearNotificationApplications); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_CONTACTS, (profile._clearNotificationCheckContacts) ? 1 : 0); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS, profile._clearNotificationCheckText); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACT_GROUPS, profile._clearNotificationContactGroups); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_TEXT, (profile._clearNotificationCheckText) ? 1 : 0); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_TEXT, profile._clearNotificationText); + values.put(DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT, profile._screenNightLight); + values.put(DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT_PREFS, profile._screenNightLightPrefs); + values.put(DatabaseHandler.KEY_SCREEN_ON_OFF, profile._screenOnOff); // Insert Row if (!merged) { @@ -294,18 +303,27 @@ static Profile getProfile(DatabaseHandler instance, long profile_id, boolean mer DatabaseHandler.KEY_APPLICATION_LOCATION_UPDATE_INTERVAL, DatabaseHandler.KEY_APPLICATION_ORIENTATION_SCAN_INTERVAL, DatabaseHandler.KEY_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL, - DatabaseHandler.KEY_PHONE_CALLS_CONTACTS, - DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS, - DatabaseHandler.KEY_PHONE_CALLS_BLOCK_CALLS, - DatabaseHandler.KEY_PHONE_CALLS_CONTACT_LIST_TYPE, - DatabaseHandler.KEY_PHONE_CALLS_SEND_SMS, - DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT, - DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN + DatabaseHandler.KEY_SEND_SMS_CONTACTS, + DatabaseHandler.KEY_SEND_SMS_CONTACT_GROUPS, + //DatabaseHandler.KEY_SEND_SMS_CONTACT_LIST_TYPE, + DatabaseHandler.KEY_SEND_SMS_SEND_SMS, + DatabaseHandler.KEY_SEND_SMS_SMS_TEXT, + DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN, + DatabaseHandler.KEY_CLEAR_NOTIFICATION_ENABLED, + DatabaseHandler.KEY_CLEAR_NOTIFICATION_APPLICATIONS, + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_CONTACTS, + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS, + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACT_GROUPS, + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_TEXT, + DatabaseHandler.KEY_CLEAR_NOTIFICATION_TEXT, + DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT, + DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT_PREFS, + DatabaseHandler.KEY_SCREEN_ON_OFF }, DatabaseHandler.KEY_ID + "=?", new String[]{String.valueOf(profile_id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -423,18 +441,27 @@ static Profile getProfile(DatabaseHandler instance, long profile_id, boolean mer cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_LOCATION_UPDATE_INTERVAL)), cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_ORIENTATION_SCAN_INTERVAL)), cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL)), - cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_CONTACTS)), - cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS)), - cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_CONTACT_LIST_TYPE)), - cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_BLOCK_CALLS)) == 1, - cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_SEND_SMS)) == 1, - cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT)), - cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN)) + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_CONTACTS)), + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_CONTACT_GROUPS)), + //cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_CONTACT_LIST_TYPE)), + cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_SEND_SMS)) == 1, + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_SMS_TEXT)), + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN)), + cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_ENABLED)) == 1, + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_APPLICATIONS)), + cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_CONTACTS)) == 1, + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS)), + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACT_GROUPS)), + cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_TEXT)) == 1, + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_TEXT)), + cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT)), + cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT_PREFS)), + cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SCREEN_ON_OFF)) ); } cursor.close(); - } + //} //db.close(); @@ -572,13 +599,22 @@ static List getAllProfiles(DatabaseHandler instance) { DatabaseHandler.KEY_APPLICATION_LOCATION_UPDATE_INTERVAL + "," + DatabaseHandler.KEY_APPLICATION_ORIENTATION_SCAN_INTERVAL + "," + DatabaseHandler.KEY_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL + "," + - DatabaseHandler.KEY_PHONE_CALLS_CONTACTS + "," + - DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS + "," + - DatabaseHandler.KEY_PHONE_CALLS_CONTACT_LIST_TYPE + "," + - DatabaseHandler.KEY_PHONE_CALLS_BLOCK_CALLS + "," + - DatabaseHandler.KEY_PHONE_CALLS_SEND_SMS + "," + - DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT + "," + - DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN + + DatabaseHandler.KEY_SEND_SMS_CONTACTS + "," + + DatabaseHandler.KEY_SEND_SMS_CONTACT_GROUPS + "," + + //DatabaseHandler.KEY_SEND_SMS_CONTACT_LIST_TYPE + "," + + DatabaseHandler.KEY_SEND_SMS_SEND_SMS + "," + + DatabaseHandler.KEY_SEND_SMS_SMS_TEXT + "," + + DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_ENABLED + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_APPLICATIONS + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_CONTACTS + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACT_GROUPS + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_TEXT + "," + + DatabaseHandler.KEY_CLEAR_NOTIFICATION_TEXT + "," + + DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT + "," + + DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT_PREFS + "," + + DatabaseHandler.KEY_SCREEN_ON_OFF + " FROM " + DatabaseHandler.TABLE_PROFILES; //SQLiteDatabase db = this.getReadableDatabase(); @@ -704,13 +740,23 @@ static List getAllProfiles(DatabaseHandler instance) { profile._applicationLocationScanInterval = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_LOCATION_UPDATE_INTERVAL)); profile._applicationOrientationScanInterval = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_ORIENTATION_SCAN_INTERVAL)); profile._applicationPeriodicScanInterval = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL)); - profile._phoneCallsContacts = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_CONTACTS)); - profile._phoneCallsContactGroups = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS)); - profile._phoneCallsBlockCalls = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_BLOCK_CALLS)) == 1; - profile._phoneCallsContactListType = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_CONTACT_LIST_TYPE)); - profile._phoneCallsSendSMS = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_SEND_SMS)) == 1; - profile._phoneCallsSMSText = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT)); + profile._sendSMSContacts = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_CONTACTS)); + profile._sendSMSContactGroups = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_CONTACT_GROUPS)); + //profile._phoneCallsContactListType = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_CONTACT_LIST_TYPE)); + profile._sendSMSSendSMS = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_SEND_SMS)) == 1; + profile._sendSMSSMSText = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_SMS_TEXT)); profile._deviceWallpaperLockScreen = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN)); + profile._clearNotificationEnabled = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_ENABLED)) == 1; + profile._clearNotificationApplications = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_APPLICATIONS)); + profile._clearNotificationCheckContacts = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_CONTACTS)) == 1; + profile._clearNotificationContacts = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS)); + profile._clearNotificationContactGroups = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACT_GROUPS)); + profile._clearNotificationCheckText = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_TEXT)) == 1; + profile._clearNotificationText = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_TEXT)); + profile._screenNightLight = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT)); + profile._screenNightLightPrefs = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT_PREFS)); + profile._screenOnOff = cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SCREEN_ON_OFF)); + // Adding profile to list profileList.add(profile); } while (cursor.moveToNext()); @@ -854,13 +900,22 @@ static void updateProfile(DatabaseHandler instance, Profile profile) { values.put(DatabaseHandler.KEY_APPLICATION_LOCATION_UPDATE_INTERVAL, profile._applicationLocationScanInterval); values.put(DatabaseHandler.KEY_APPLICATION_ORIENTATION_SCAN_INTERVAL, profile._applicationOrientationScanInterval); values.put(DatabaseHandler.KEY_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL, profile._applicationPeriodicScanInterval); - values.put(DatabaseHandler.KEY_PHONE_CALLS_CONTACTS, profile._phoneCallsContacts); - values.put(DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS, profile._phoneCallsContactGroups); - values.put(DatabaseHandler.KEY_PHONE_CALLS_BLOCK_CALLS, (profile._phoneCallsBlockCalls) ? 1 : 0); - values.put(DatabaseHandler.KEY_PHONE_CALLS_CONTACT_LIST_TYPE, profile._phoneCallsContactListType); - values.put(DatabaseHandler.KEY_PHONE_CALLS_SEND_SMS, (profile._phoneCallsSendSMS) ? 1 : 0); - values.put(DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT, profile._phoneCallsSMSText); + values.put(DatabaseHandler.KEY_SEND_SMS_CONTACTS, profile._sendSMSContacts); + values.put(DatabaseHandler.KEY_SEND_SMS_CONTACT_GROUPS, profile._sendSMSContactGroups); + //values.put(DatabaseHandler.KEY_SEND_SMS_CONTACT_LIST_TYPE, profile._sendSMSContactListType); + values.put(DatabaseHandler.KEY_SEND_SMS_SEND_SMS, (profile._sendSMSSendSMS) ? 1 : 0); + values.put(DatabaseHandler.KEY_SEND_SMS_SMS_TEXT, profile._sendSMSSMSText); values.put(DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN, profile._deviceWallpaperLockScreen); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_ENABLED, (profile._clearNotificationEnabled) ? 1 : 0); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_APPLICATIONS, profile._clearNotificationApplications); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_CONTACTS, (profile._clearNotificationCheckContacts) ? 1 : 0); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS, profile._clearNotificationContacts); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACT_GROUPS, profile._clearNotificationContactGroups); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_TEXT, (profile._clearNotificationCheckText) ? 1 : 0); + values.put(DatabaseHandler.KEY_CLEAR_NOTIFICATION_TEXT, profile._clearNotificationText); + values.put(DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT, profile._screenNightLight); + values.put(DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT_PREFS, profile._screenNightLightPrefs); + values.put(DatabaseHandler.KEY_SCREEN_ON_OFF, profile._screenOnOff); // updating row db.update(DatabaseHandler.TABLE_PROFILES, values, DatabaseHandler.KEY_ID + " = ?", @@ -1220,17 +1275,26 @@ static Profile getActivatedProfile(DatabaseHandler instance) DatabaseHandler.KEY_APPLICATION_LOCATION_UPDATE_INTERVAL, DatabaseHandler.KEY_APPLICATION_ORIENTATION_SCAN_INTERVAL, DatabaseHandler.KEY_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL, - DatabaseHandler.KEY_PHONE_CALLS_CONTACTS, - DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS, - DatabaseHandler.KEY_PHONE_CALLS_BLOCK_CALLS, - DatabaseHandler.KEY_PHONE_CALLS_CONTACT_LIST_TYPE, - DatabaseHandler.KEY_PHONE_CALLS_SEND_SMS, - DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT, - DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN + DatabaseHandler.KEY_SEND_SMS_CONTACTS, + DatabaseHandler.KEY_SEND_SMS_CONTACT_GROUPS, + //DatabaseHandler.KEY_SEND_SMS_CONTACT_LIST_TYPE, + DatabaseHandler.KEY_SEND_SMS_SEND_SMS, + DatabaseHandler.KEY_SEND_SMS_SMS_TEXT, + DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN, + DatabaseHandler.KEY_CLEAR_NOTIFICATION_ENABLED, + DatabaseHandler.KEY_CLEAR_NOTIFICATION_APPLICATIONS, + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_CONTACTS, + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS, + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACT_GROUPS, + DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_TEXT, + DatabaseHandler.KEY_CLEAR_NOTIFICATION_TEXT, + DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT, + DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT_PREFS, + DatabaseHandler.KEY_SCREEN_ON_OFF }, DatabaseHandler.KEY_CHECKED + "=?", new String[]{"1"}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); int rc = cursor.getCount(); @@ -1351,18 +1415,27 @@ static Profile getActivatedProfile(DatabaseHandler instance) cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_LOCATION_UPDATE_INTERVAL)), cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_ORIENTATION_SCAN_INTERVAL)), cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL)), - cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_CONTACTS)), - cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_CONTACT_GROUPS)), - cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_CONTACT_LIST_TYPE)), - cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_BLOCK_CALLS)) == 1, - cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_SEND_SMS)) == 1, - cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_PHONE_CALLS_SMS_TEXT)), - cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN)) + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_CONTACTS)), + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_CONTACT_GROUPS)), + //cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_CONTACT_LIST_TYPE)), + cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_SEND_SMS)) == 1, + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SEND_SMS_SMS_TEXT)), + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_DEVICE_WALLPAPER_LOCKSCREEN)), + cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_ENABLED)) == 1, + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_APPLICATIONS)), + cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_CONTACTS)) == 1, + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACTS)), + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CONTACT_GROUPS)), + cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_CHECK_TEXT)) == 1, + cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_CLEAR_NOTIFICATION_TEXT)), + cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT)), + cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SCREEN_NIGHT_LIGHT_PREFS)), + cursor.getInt(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_SCREEN_ON_OFF)) ); } cursor.close(); - } + //} //db.close(); @@ -1391,7 +1464,7 @@ static long getActivatedProfileId(DatabaseHandler instance) }, DatabaseHandler.KEY_CHECKED + "=?", new String[]{"1"}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); int rc = cursor.getCount(); @@ -1401,7 +1474,7 @@ static long getActivatedProfileId(DatabaseHandler instance) } cursor.close(); - } + //} //db.close(); @@ -1429,7 +1502,7 @@ static long getProfileIdByName(DatabaseHandler instance, String name) new String[]{DatabaseHandler.KEY_ID}, "trim(" + DatabaseHandler.KEY_NAME + ")=?", new String[]{name}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); int rc = cursor.getCount(); @@ -1439,7 +1512,7 @@ static long getProfileIdByName(DatabaseHandler instance, String name) } cursor.close(); - } + //} //db.close(); @@ -1510,11 +1583,11 @@ static String getProfileName(DatabaseHandler instance, long profile_id) DatabaseHandler.KEY_ID + "=?", new String[]{Long.toString(profile_id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { if (cursor.moveToFirst()) name = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_NAME)); cursor.close(); - } + //} //db.close(); } catch (Exception e) { @@ -1541,11 +1614,11 @@ static void getProfileIcon(DatabaseHandler instance, Profile profile) DatabaseHandler.KEY_ID + "=?", new String[]{Long.toString(profile._id)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { if (cursor.moveToFirst()) profile._icon = cursor.getString(cursor.getColumnIndexOrThrow(DatabaseHandler.KEY_ICON)); cursor.close(); - } + //} //db.close(); } catch (Exception e) { @@ -1603,11 +1676,11 @@ static long getActivationByUserCount(DatabaseHandler instance, long profileId) { DatabaseHandler.KEY_ID + "=?", new String[]{Long.toString(profileId)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); r = cursor.getLong(0); cursor.close(); - } + //} //db.close(); } catch (Exception e) { @@ -1924,7 +1997,7 @@ static Shortcut getShortcut(DatabaseHandler instance, long shortcutId) { DatabaseHandler.KEY_S_ID + "=?", new String[]{String.valueOf(shortcutId)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -1935,7 +2008,7 @@ static Shortcut getShortcut(DatabaseHandler instance, long shortcutId) { } cursor.close(); - } + //} //db.close(); @@ -2327,7 +2400,7 @@ static PPIntent getIntent(DatabaseHandler instance, long intentId) { DatabaseHandler.KEY_IN_ID + "=?", new String[]{String.valueOf(intentId)}, null, null, null, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); if (cursor.getCount() > 0) { @@ -2378,7 +2451,7 @@ static PPIntent getIntent(DatabaseHandler instance, long intentId) { } cursor.close(); - } + //} //db.close(); @@ -2444,11 +2517,11 @@ static boolean profileExists(DatabaseHandler instance, long profile_id) { Cursor cursor = db.rawQuery(selectQuery, null); - if (cursor != null) { + //if (cursor != null) { cursor.moveToFirst(); r = cursor.getInt(0); cursor.close(); - } + //} //db.close(); } catch (Exception e) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DaysOfWeekPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DaysOfWeekPreference.java index a51ff5793a..4dd97ae182 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DaysOfWeekPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DaysOfWeekPreference.java @@ -228,7 +228,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public DaysOfWeekPreference.SavedState createFromParcel(Parcel in) { return new DaysOfWeekPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DaysOfWeekPreferenceAdapter.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DaysOfWeekPreferenceAdapter.java index f637d9439a..9e7af1a7b3 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DaysOfWeekPreferenceAdapter.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DaysOfWeekPreferenceAdapter.java @@ -64,6 +64,7 @@ public View getView(int position, View convertView, ViewGroup parent) convertView.setTag(new DayOfWeekViewHolder(textViewDisplayName, checkBox)); // If CheckBox is toggled, update the Contact it is tagged with. + //noinspection DataFlowIssue checkBox.setOnClickListener(v -> { CheckBox cb = (CheckBox) v; DayOfWeek dayOfWeek = (DayOfWeek) cb.getTag(); @@ -86,6 +87,7 @@ public View getView(int position, View convertView, ViewGroup parent) checkBox.setTag(calendar); // Display Contact data + //noinspection DataFlowIssue textViewDisplayName.setText(calendar.name); checkBox.setChecked(calendar.checked); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DaysOfWeekPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DaysOfWeekPreferenceFragment.java index 53108be98d..ac44fbc379 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DaysOfWeekPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DaysOfWeekPreferenceFragment.java @@ -35,6 +35,7 @@ protected void onBindDialogView(@NonNull View view) { ListView listView = view.findViewById(R.id.days_of_week_pref_dlg_listview); + //noinspection DataFlowIssue listView.setOnItemClickListener((parent, item, position, id) -> { DayOfWeek dayOfWeek = (DayOfWeek)listAdapter.getItem(position); dayOfWeek.toggleChecked(); @@ -48,6 +49,7 @@ protected void onBindDialogView(@NonNull View view) { preference.getValueDOWMDP(); final Button allNothingButton = view.findViewById(R.id.days_of_week_pref_dlg_button_all_nothing); + //noinspection DataFlowIssue allNothingButton.setOnClickListener(v -> { boolean allIsConfigured = false; boolean[] daySet = new boolean[7]; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DefaultSIMDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DefaultSIMDialogPreference.java index 0f9446ee95..f85ab36229 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DefaultSIMDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DefaultSIMDialogPreference.java @@ -180,8 +180,8 @@ public void writeToParcel(Parcel dest, int flags) super(superState); } - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator<>() { public DefaultSIMDialogPreference.SavedState createFromParcel(Parcel in) { return new DefaultSIMDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DefaultSIMDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DefaultSIMDialogPreferenceFragment.java index 4e6662c72b..50028fcec5 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DefaultSIMDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DefaultSIMDialogPreferenceFragment.java @@ -9,7 +9,6 @@ import androidx.annotation.NonNull; import androidx.appcompat.widget.AppCompatSpinner; -import androidx.core.content.ContextCompat; import androidx.preference.PreferenceDialogFragmentCompat; public class DefaultSIMDialogPreferenceFragment extends PreferenceDialogFragmentCompat { @@ -40,10 +39,13 @@ protected void onBindDialogView(@NonNull View view) { super.onBindDialogView(view); TextView text = view.findViewById(R.id.default_sim_voice_textView); + //noinspection DataFlowIssue text.setText(getString(R.string.default_sim_pref_dlg_voice)+":"); text = view.findViewById(R.id.default_sim_sms_textView); + //noinspection DataFlowIssue text.setText(getString(R.string.default_sim_pref_dlg_sms)+":"); text = view.findViewById(R.id.default_sim_data_textView); + //noinspection DataFlowIssue text.setText(getString(R.string.default_sim_pref_dlg_data)+":"); voiceSpinner = view.findViewById(R.id.default_sim_voice_spinner); @@ -72,18 +74,18 @@ protected void onBindDialogView(@NonNull View view) { //preference.dualSIMSupported = false; //if (transactionCodeVoice != -1) { - HighlightedSpinnerAdapter voiceSpinnerAdapter = new HighlightedSpinnerAdapter( + PPSpinnerAdapter voiceSpinnerAdapter = new PPSpinnerAdapter( (ProfilesPrefsActivity) context, - R.layout.spinner_highlighted, + R.layout.ppp_spinner, getResources().getStringArray(R.array.defaultSIMVoiceArray)); - voiceSpinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + voiceSpinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); voiceSpinner.setAdapter(voiceSpinnerAdapter); voiceSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background); - voiceSpinner.setBackgroundTintList(ContextCompat.getColorStateList(context/*getBaseContext()*/, R.color.highlighted_spinner_all)); +// voiceSpinner.setBackgroundTintList(ContextCompat.getColorStateList(context/*getBaseContext()*/, R.color.spinner_control_color)); voiceSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View view, int position, long id) { - ((HighlightedSpinnerAdapter) voiceSpinner.getAdapter()).setSelection(position); + ((PPSpinnerAdapter) voiceSpinner.getAdapter()).setSelection(position); // PPApplicationStatic.logE("[DEFAULT_SIM] DefaultSIMDialogPreferenceFragment.voiceSpinner.onItemSelected", "position="+position); preference.voiceValue = position; } @@ -102,18 +104,18 @@ public void onNothingSelected(AdapterView parent) { }*/ //if (transactionCodeSMS != -1) { - HighlightedSpinnerAdapter smsSpinnerAdapter = new HighlightedSpinnerAdapter( + PPSpinnerAdapter smsSpinnerAdapter = new PPSpinnerAdapter( (ProfilesPrefsActivity) context, - R.layout.spinner_highlighted, + R.layout.ppp_spinner, getResources().getStringArray(R.array.defaultSIMSMSArray)); - smsSpinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + smsSpinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); smsSpinner.setAdapter(smsSpinnerAdapter); smsSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background); - smsSpinner.setBackgroundTintList(ContextCompat.getColorStateList(context/*getBaseContext()*/, R.color.highlighted_spinner_all)); +// smsSpinner.setBackgroundTintList(ContextCompat.getColorStateList(context/*getBaseContext()*/, R.color.spinner_control_color)); smsSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View view, int position, long id) { - ((HighlightedSpinnerAdapter) smsSpinner.getAdapter()).setSelection(position); + ((PPSpinnerAdapter) smsSpinner.getAdapter()).setSelection(position); // PPApplicationStatic.logE("[DEFAULT_SIM] DefaultSIMDialogPreferenceFragment.smsSpinner.onItemSelected", "position="+position); preference.smsValue = position; } @@ -132,18 +134,18 @@ public void onNothingSelected(AdapterView parent) { }*/ //if (transactionCodeData != -1) { - HighlightedSpinnerAdapter dataSpinnerAdapter = new HighlightedSpinnerAdapter( + PPSpinnerAdapter dataSpinnerAdapter = new PPSpinnerAdapter( (ProfilesPrefsActivity) context, - R.layout.spinner_highlighted, + R.layout.ppp_spinner, getResources().getStringArray(R.array.defaultSIMDataArray)); - dataSpinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + dataSpinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); dataSpinner.setAdapter(dataSpinnerAdapter); dataSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background); - dataSpinner.setBackgroundTintList(ContextCompat.getColorStateList(context/*getBaseContext()*/, R.color.highlighted_spinner_all)); +// dataSpinner.setBackgroundTintList(ContextCompat.getColorStateList(context/*getBaseContext()*/, R.color.spinner_control_color)); dataSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View view, int position, long id) { - ((HighlightedSpinnerAdapter) dataSpinner.getAdapter()).setSelection(position); + ((PPSpinnerAdapter) dataSpinner.getAdapter()).setSelection(position); // PPApplicationStatic.logE("[DEFAULT_SIM] DefaultSIMDialogPreferenceFragment.dataSpinner.onItemSelected", "position="+position); preference.dataValue = position; } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DeviceIdleModeBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DeviceIdleModeBroadcastReceiver.java index 9ef99b03a3..d1b2f61131 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DeviceIdleModeBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DeviceIdleModeBroadcastReceiver.java @@ -36,7 +36,7 @@ public void onReceive(Context context, Intent intent) { } // start events handler -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] DeviceIdleModeBroadcastReceiver.onReceive", "sensorType=SENSOR_TYPE_DEVICE_IDLE_MODE"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] DeviceIdleModeBroadcastReceiver.onReceive", "SENSOR_TYPE_DEVICE_IDLE_MODE"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_DEVICE_IDLE_MODE}); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DialogHelpPopupWindow.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DialogHelpPopupWindow.java index db844979f8..fe8d8c8bb4 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DialogHelpPopupWindow.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DialogHelpPopupWindow.java @@ -30,11 +30,13 @@ private DialogHelpPopupWindow(int titleStringId, TextView textView = popupView.findViewById(R.id.dialog_help_popup_window_text); if (helpIsHtml) { + //noinspection DataFlowIssue textView.setText(StringFormatUtils.fromHtml(helpString, true, false, 0, 0, true)); textView.setClickable(true); textView.setMovementMethod(LinkMovementMethod.getInstance()); } else + //noinspection DataFlowIssue textView.setText(helpString); // setOnDismissListener(() -> { @@ -67,6 +69,7 @@ static void showPopup(ImageView helpIcon, int popupHeight = contentView.getMeasuredHeight(); ViewGroup activityView = activity.findViewById(android.R.id.content); + //noinspection DataFlowIssue int activityHeight = activityView.getHeight(); //int activityWidth = activityView.getWidth(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DonationBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DonationBroadcastReceiver.java index 52fef79cec..752a7b2334 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DonationBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DonationBroadcastReceiver.java @@ -245,7 +245,7 @@ private static void _doWork(Context appContext) { String nTitle = appContext.getString(R.string.about_application_donate_button); String nText = appContext.getString(R.string.donation_description); mBuilder = new NotificationCompat.Builder(appContext, PPApplication.DONATION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(appContext, R.color.information_color)) + .setColor(ContextCompat.getColor(appContext, R.color.informationColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_information_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(appContext.getResources(), R.drawable.ic_information_notification)) .setContentTitle(nTitle) // title for notification diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DonationPayPalActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DonationPayPalActivity.java index 23620670ec..116413d470 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DonationPayPalActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DonationPayPalActivity.java @@ -14,7 +14,7 @@ public class DonationPayPalActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { - GlobalGUIRoutines.setTheme(this, false, false, false, false, false, false); // must by called before super.onCreate() + GlobalGUIRoutines.setTheme(this, true, false, false, true, false, false); // must by called before super.onCreate() //GlobalGUIRoutines.setLanguage(this); super.onCreate(savedInstanceState); @@ -22,12 +22,14 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_paypal_donation); setTaskDescription(new ActivityManager.TaskDescription(getString(R.string.ppp_app_name))); + /* if (getSupportActionBar() != null) { getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setTitle(R.string.ppp_app_name); - getSupportActionBar().setElevation(0/*GlobalGUIRoutines.dpToPx(1)*/); + getSupportActionBar().setElevation(0); } + */ } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DonationPayPalFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DonationPayPalFragment.java index f37ad0d68c..c782177a61 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DonationPayPalFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DonationPayPalFragment.java @@ -108,6 +108,7 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { updateGUIAfterBillingConnected(); Button closeButton = view.findViewById(R.id.donation_paypal_activity_close); + //noinspection DataFlowIssue closeButton.setOnClickListener(v -> { if (getActivity() != null) getActivity().finish(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DrawOverAppsPermissionNotification.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DrawOverAppsPermissionNotification.java index 4d5d888025..8a404d9a84 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DrawOverAppsPermissionNotification.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DrawOverAppsPermissionNotification.java @@ -15,6 +15,7 @@ class DrawOverAppsPermissionNotification { + /** @noinspection SameParameterValue*/ static void showNotification(Context context, boolean useHandler) { if (Build.VERSION.SDK_INT >= 29) { // Must be granted because of: @@ -77,7 +78,7 @@ static void showNotification(Context context, boolean useHandler) { static private void showNotification(Context context, String title, String text) { PPApplicationStatic.createExclamationNotificationChannel(context.getApplicationContext(), false); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context.getApplicationContext(), PPApplication.EXCLAMATION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.error_color)) + .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.errorColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_exclamation_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(context.getApplicationContext().getResources(), R.drawable.ic_exclamation_notification)) .setContentTitle(title) // title for notification diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DurationDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DurationDialogPreference.java index d2745f2a68..7255b5b869 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DurationDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DurationDialogPreference.java @@ -138,7 +138,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public DurationDialogPreference.SavedState createFromParcel(Parcel in) { return new DurationDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DurationDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DurationDialogPreferenceFragment.java index 2541d02903..a458a58d0f 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DurationDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DurationDialogPreferenceFragment.java @@ -47,6 +47,7 @@ protected void onBindDialogView(@NonNull View view) TextView mTextViewRange = view.findViewById(R.id.duration_pref_dlg_range); mValue = view.findViewById(R.id.duration_pref_dlg_value); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(mValue, getString(R.string.duration_pref_dlg_edit_duration_tooltip)); mSeekBarHours = view.findViewById(R.id.duration_pref_dlg_hours); @@ -126,6 +127,7 @@ protected void onBindDialogView(@NonNull View view) mSeekBarMinutes.setOnSeekBarChangeListener(this); mSeekBarSeconds.setOnSeekBarChangeListener(this); + //noinspection DataFlowIssue mTextViewRange.setText(sMin + " - " + sMax); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DynamicTonalPaletteSamsung.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DynamicTonalPaletteSamsung.java new file mode 100644 index 0000000000..5d9747c88e --- /dev/null +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DynamicTonalPaletteSamsung.java @@ -0,0 +1,376 @@ +// do not used because some dynamic notification, widgets has its own laypouts and in it +// are colors configured = keep material componets lib to 1.10.0 +// +// This class is not tested !!! +package sk.henrichg.phoneprofilesplus; + +import android.content.Context; +import android.graphics.Color; +import android.os.Build; + +import androidx.annotation.RequiresApi; + +/** @noinspection unused*/ +class DynamicTonalPaletteSamsung { + + /** @noinspection InnerClassMayBeStatic*/ + private class TonalPalette { + // The neutral tonal range from the generated dynamic color palette. + int neutral100; + int neutral99; + int neutral95; + int neutral90; + int neutral80; + int neutral70; + int neutral60; + int neutral50; + int neutral40; + int neutral30; + int neutral20; + int neutral10; + int neutral0; + + // The neutral variant tonal range from the generated dynamic color palette. + int neutralVariant100; + int neutralVariant99; + int neutralVariant98; + int neutralVariant96; + int neutralVariant94; + int neutralVariant92; + int neutralVariant95; + int neutralVariant90; + int neutralVariant80; + int neutralVariant87; + int neutralVariant70; + int neutralVariant60; + int neutralVariant50; + int neutralVariant40; + int neutralVariant30; + int neutralVariant24; + int neutralVariant22; + int neutralVariant20; + int neutralVariant17; + int neutralVariant12; + int neutralVariant6; + int neutralVariant4; + int neutralVariant10; + int neutralVariant0; + + // The primary tonal range from the generated dynamic color palette. + int primary100; + int primary99; + int primary95; + int primary90; + int primary80; + int primary70; + int primary60; + int primary50; + int primary40; + int primary30; + int primary20; + int primary10; + int primary0; + + // The secondary tonal range from the generated dynamic color palette. + int secondary100; + int secondary99; + int secondary95; + int secondary90; + int secondary80; + int secondary70; + int secondary60; + int secondary50; + int secondary40; + int secondary30; + int secondary20; + int secondary10; + int secondary0; + + // The tertiary tonal range from the generated dynamic color palette. + int tertiary100; + int tertiary99; + int tertiary95; + int tertiary90; + int tertiary80; + int tertiary70; + int tertiary60; + int tertiary50; + int tertiary40; + int tertiary30; + int tertiary20; + int tertiary10; + int tertiary0; + + //boolean isDarkTheme = false; + //boolean isSystemTheme = true; + } + + /** @noinspection InnerClassMayBeStatic*/ + class ColorScheme { + + int primary; + int onPrimary; + int primaryContainer; + int onPrimaryContainer; + int inversePrimary; + int secondary; + int onSecondary; + int secondaryContainer; + int onSecondaryContainer; + int tertiary; + int onTertiary; + int tertiaryContainer; + int onTertiaryContainer; + int background; + int onBackground; + int surface; + int onSurface; + int surfaceVariant; + int onSurfaceVariant; + int inverseSurface; + int inverseOnSurface; + int outline; + int outlineVariant; + int scrim; + int surfaceBright; + int surfaceDim; + int surfaceContainer; + int surfaceContainerHigh; + int surfaceContainerHighest; + int surfaceContainerLow; + int surfaceContainerLowest; + int surfaceTint; + } + + /* Dynamic colors in Material. */ + @RequiresApi(api = Build.VERSION_CODES.S) + TonalPalette dynamicTonalPalette(Context context) { + TonalPalette palette = new TonalPalette(); + + // The neutral tonal range from the generated dynamic color palette. + palette.neutral100 = context.getColor(android.R.color.system_neutral1_0); + palette.neutral99 = context.getColor(android.R.color.system_neutral1_10); + palette.neutral95 = context.getColor(android.R.color.system_neutral1_50); + palette.neutral90 = context.getColor(android.R.color.system_neutral1_100); + palette.neutral80 = context.getColor(android.R.color.system_neutral1_200); + palette.neutral70 = context.getColor(android.R.color.system_neutral1_300); + palette.neutral60 = context.getColor(android.R.color.system_neutral1_400); + palette.neutral50 = context.getColor(android.R.color.system_neutral1_500); + palette.neutral40 = context.getColor(android.R.color.system_neutral1_600); + palette.neutral30 = context.getColor(android.R.color.system_neutral1_700); + palette.neutral20 = context.getColor(android.R.color.system_neutral1_800); + palette.neutral10 = context.getColor(android.R.color.system_neutral1_900); + palette.neutral0 = context.getColor(android.R.color.system_neutral1_1000); + + // The neutral variant tonal range, sometimes called "neutral 2", from the + // generated dynamic color palette. + palette.neutralVariant100 = context.getColor(android.R.color.system_neutral2_0); + palette.neutralVariant99 = context.getColor(android.R.color.system_neutral2_10); + + palette.neutralVariant98 = setLuminance( + context.getColor(android.R.color.system_neutral2_600), 98f); + palette.neutralVariant96 = setLuminance( + context.getColor(android.R.color.system_neutral2_600),96f); + palette.neutralVariant95 = context.getColor(android.R.color.system_neutral2_50); + palette.neutralVariant94 = setLuminance( + context.getColor(android.R.color.system_neutral2_600),94f); + palette.neutralVariant92 = setLuminance( + context.getColor(android.R.color.system_neutral2_600), 92f); + palette.neutralVariant90 = context.getColor(android.R.color.system_neutral2_100); + palette.neutralVariant80 = context.getColor(android.R.color.system_neutral2_200); + palette.neutralVariant87 = setLuminance( + context.getColor(android.R.color.system_neutral2_600),87f); + palette.neutralVariant70 = context.getColor(android.R.color.system_neutral2_300); + palette.neutralVariant60 = context.getColor(android.R.color.system_neutral2_400); + palette.neutralVariant50 = context.getColor(android.R.color.system_neutral2_500); + palette.neutralVariant40 = context.getColor(android.R.color.system_neutral2_600); + palette.neutralVariant30 = context.getColor(android.R.color.system_neutral2_700); + palette.neutralVariant24 = setLuminance( + context.getColor(android.R.color.system_neutral2_600),24f); + palette.neutralVariant22 = setLuminance( + context.getColor(android.R.color.system_neutral2_600),22f); + palette.neutralVariant17 = setLuminance( + context.getColor(android.R.color.system_neutral2_600),17f); + palette.neutralVariant12 = setLuminance( + context.getColor(android.R.color.system_neutral2_600),12f); + palette.neutralVariant6 = setLuminance( + context.getColor(android.R.color.system_neutral2_600),6f); + palette.neutralVariant4 = setLuminance( + context.getColor(android.R.color.system_neutral2_600),4f); + palette.neutralVariant20 = context.getColor(android.R.color.system_neutral2_800); + palette.neutralVariant10 = context.getColor(android.R.color.system_neutral2_900); + palette.neutralVariant0 = context.getColor(android.R.color.system_neutral2_1000); + + // The primary tonal range from the generated dynamic color palette. + palette.primary100 = context.getColor(android.R.color.system_accent1_0); + palette.primary99 = context.getColor(android.R.color.system_accent1_10); + palette.primary95 = context.getColor(android.R.color.system_accent1_50); + palette.primary90 = context.getColor(android.R.color.system_accent1_100); + palette.primary80 = context.getColor(android.R.color.system_accent1_200); + palette.primary70 = context.getColor(android.R.color.system_accent1_300); + palette.primary60 = context.getColor(android.R.color.system_accent1_400); + palette.primary50 = context.getColor(android.R.color.system_accent1_500); + palette.primary40 = context.getColor(android.R.color.system_accent1_600); + palette.primary30 = context.getColor(android.R.color.system_accent1_700); + palette.primary20 = context.getColor(android.R.color.system_accent1_800); + palette.primary10 = context.getColor(android.R.color.system_accent1_900); + palette.primary0 = context.getColor(android.R.color.system_accent1_1000); + + // The secondary tonal range from the generated dynamic color palette. + palette.secondary100 = context.getColor(android.R.color.system_accent2_0); + palette.secondary99 = context.getColor(android.R.color.system_accent2_10); + palette.secondary95 = context.getColor(android.R.color.system_accent2_50); + palette.secondary90 = context.getColor(android.R.color.system_accent2_100); + palette.secondary80 = context.getColor(android.R.color.system_accent2_200); + palette.secondary70 = context.getColor(android.R.color.system_accent2_300); + palette.secondary60 = context.getColor(android.R.color.system_accent2_400); + palette.secondary50 = context.getColor(android.R.color.system_accent2_500); + palette.secondary40 = context.getColor(android.R.color.system_accent2_600); + palette.secondary30 = context.getColor(android.R.color.system_accent2_700); + palette.secondary20 = context.getColor(android.R.color.system_accent2_800); + palette.secondary10 = context.getColor(android.R.color.system_accent2_900); + palette.secondary0 = context.getColor(android.R.color.system_accent2_1000); + + // The tertiary tonal range from the generated dynamic color palette. + palette.tertiary100 = context.getColor(android.R.color.system_accent3_0); + palette.tertiary99 = context.getColor(android.R.color.system_accent3_10); + palette.tertiary95 = context.getColor(android.R.color.system_accent3_50); + palette.tertiary90 = context.getColor(android.R.color.system_accent3_100); + palette.tertiary80 = context.getColor(android.R.color.system_accent3_200); + palette.tertiary70 = context.getColor(android.R.color.system_accent3_300); + palette.tertiary60 = context.getColor(android.R.color.system_accent3_400); + palette.tertiary50 = context.getColor(android.R.color.system_accent3_500); + palette.tertiary40 = context.getColor(android.R.color.system_accent3_600); + palette.tertiary30 = context.getColor(android.R.color.system_accent3_700); + palette.tertiary20 = context.getColor(android.R.color.system_accent3_800); + palette.tertiary10 = context.getColor(android.R.color.system_accent3_900); + palette.tertiary0 = context.getColor(android.R.color.system_accent3_1000); + + return palette; + } + + /** + * Creates a light dynamic color scheme. + * + * Use this function to create a color scheme based off the system wallpaper. If the developer + * changes the wallpaper this color scheme will change accordingly. This dynamic scheme is a + * light theme variant. + * + * @param context The context required to get system resource data. + * @noinspection JavadocBlankLines + */ + @RequiresApi(api = Build.VERSION_CODES.S) + ColorScheme dynamicLightColorSchemeSamsung(Context context) { + if (PPApplication.deviceIsSamsung && (!PPApplication.romIsGalaxy611)) { + TonalPalette tonalPalette = dynamicTonalPalette(context); + + ColorScheme colorSchene = new ColorScheme(); + + colorSchene.primary = tonalPalette.primary40; + colorSchene.onPrimary = tonalPalette.primary100; + colorSchene.primaryContainer = tonalPalette.primary90; + colorSchene.onPrimaryContainer = tonalPalette.primary10; + colorSchene.inversePrimary = tonalPalette.primary80; + colorSchene.secondary = tonalPalette.secondary40; + colorSchene.onSecondary = tonalPalette.secondary100; + colorSchene.secondaryContainer = tonalPalette.secondary90; + colorSchene.onSecondaryContainer = tonalPalette.secondary10; + colorSchene.tertiary = tonalPalette.tertiary40; + colorSchene.onTertiary = tonalPalette.tertiary100; + colorSchene.tertiaryContainer = tonalPalette.tertiary90; + colorSchene.onTertiaryContainer = tonalPalette.tertiary10; + colorSchene.background = tonalPalette.neutralVariant98; + colorSchene.onBackground = tonalPalette.neutralVariant10; + colorSchene.surface = tonalPalette.neutralVariant98; + colorSchene.onSurface = tonalPalette.neutralVariant10; + colorSchene.surfaceVariant = tonalPalette.neutralVariant90; + colorSchene.onSurfaceVariant = tonalPalette.neutralVariant30; + colorSchene.inverseSurface = tonalPalette.neutralVariant20; + colorSchene.inverseOnSurface = tonalPalette.neutralVariant95; + colorSchene.outline = tonalPalette.neutralVariant50; + colorSchene.outlineVariant = tonalPalette.neutralVariant80; + colorSchene.scrim = tonalPalette.neutralVariant0; + colorSchene.surfaceBright = tonalPalette.neutralVariant98; + colorSchene.surfaceDim = tonalPalette.neutralVariant87; + colorSchene.surfaceContainer = tonalPalette.neutralVariant94; + colorSchene.surfaceContainerHigh = tonalPalette.neutralVariant92; + colorSchene.surfaceContainerHighest = tonalPalette.neutralVariant90; + colorSchene.surfaceContainerLow = tonalPalette.neutralVariant96; + colorSchene.surfaceContainerLowest = tonalPalette.neutralVariant100; + colorSchene.surfaceTint = tonalPalette.primary40; + + return colorSchene; + } + else + return null; + } + + /** + * Creates a dark dynamic color scheme. + * + * Use this function to create a color scheme based off the system wallpaper. If the developer + * changes the wallpaper this color scheme will change accordingly. This dynamic scheme is a dark + * theme variant. + * + * @param context The context required to get system resource data. + * @noinspection JavadocBlankLines + */ + @RequiresApi(api = Build.VERSION_CODES.S) + ColorScheme dynamicDarkColorSchemeSamsung(Context context) { + if (PPApplication.deviceIsSamsung && (!PPApplication.romIsGalaxy611)) { + TonalPalette tonalPalette = dynamicTonalPalette(context); + + ColorScheme colorSchene = new ColorScheme(); + + colorSchene.primary = tonalPalette.primary80; + colorSchene.onPrimary = tonalPalette.primary20; + colorSchene.primaryContainer = tonalPalette.primary30; + colorSchene.onPrimaryContainer = tonalPalette.primary90; + colorSchene.inversePrimary = tonalPalette.primary40; + colorSchene.secondary = tonalPalette.secondary80; + colorSchene.onSecondary = tonalPalette.secondary20; + colorSchene.secondaryContainer = tonalPalette.secondary30; + colorSchene.onSecondaryContainer = tonalPalette.secondary90; + colorSchene.tertiary = tonalPalette.tertiary80; + colorSchene.onTertiary = tonalPalette.tertiary20; + colorSchene.tertiaryContainer = tonalPalette.tertiary30; + colorSchene.onTertiaryContainer = tonalPalette.tertiary90; + colorSchene.background = tonalPalette.neutralVariant6; + colorSchene.onBackground = tonalPalette.neutralVariant90; + colorSchene.surface = tonalPalette.neutralVariant6; + colorSchene.onSurface = tonalPalette.neutralVariant90; + colorSchene.surfaceVariant = tonalPalette.neutralVariant30; + colorSchene.onSurfaceVariant = tonalPalette.neutralVariant80; + colorSchene.inverseSurface = tonalPalette.neutralVariant90; + colorSchene.inverseOnSurface = tonalPalette.neutralVariant20; + colorSchene.outline = tonalPalette.neutralVariant60; + colorSchene.outlineVariant = tonalPalette.neutralVariant30; + colorSchene.scrim = tonalPalette.neutralVariant0; + colorSchene.surfaceBright = tonalPalette.neutralVariant24; + colorSchene.surfaceDim = tonalPalette.neutralVariant6; + colorSchene.surfaceContainer = tonalPalette.neutralVariant12; + colorSchene.surfaceContainerHigh = tonalPalette.neutralVariant17; + colorSchene.surfaceContainerHighest = tonalPalette.neutralVariant22; + colorSchene.surfaceContainerLow = tonalPalette.neutralVariant10; + colorSchene.surfaceContainerLowest = tonalPalette.neutralVariant4; + colorSchene.surfaceTint = tonalPalette.primary80; + + return colorSchene; + } else + return null; + } + + + int setLuminance(int color, float luminance) { + int red = Color.red(color); + int green = Color.green(color); + int blue = Color.blue(color); + //int alpha = Color.alpha(intColor); + float[] hsl = GlobalGUIRoutines.rgbToHsl(red, green, blue); + hsl[2] = hsl[2] / 100f * luminance; + int[] rgb = GlobalGUIRoutines.hslToRgb(hsl[0], hsl[1], hsl[2]); + Color newColor = Color.valueOf(rgb[0], rgb[1], rgb[2], 1); + return newColor.toArgb(); + } + +} diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorActivity.java index 410f917096..98fd96a108 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorActivity.java @@ -57,6 +57,7 @@ import androidx.core.content.FileProvider; //import androidx.core.splashscreen.SplashScreen; import androidx.core.view.MenuCompat; +import androidx.core.view.WindowCompat; import androidx.documentfile.provider.DocumentFile; import androidx.fragment.app.Fragment; import androidx.localbroadcastmanager.content.LocalBroadcastManager; @@ -234,6 +235,10 @@ public void onReceive( Context context, Intent intent ) { protected void onCreate(Bundle savedInstanceState) { GlobalGUIRoutines.setTheme(this, false, true, false, false, false, false); + //if (Build.VERSION.SDK_INT >= 34) + // EdgeToEdge.enable(this); + WindowCompat.setDecorFitsSystemWindows(this.getWindow(), false); + super.onCreate(savedInstanceState); // Log.e("EditorActivity.onCreate", "xxxx"); @@ -274,6 +279,25 @@ public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { ); */ + /* + ViewCompat.setOnApplyWindowInsetsListener(fab, (v, windowInsets) -> { + Insets insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars()); + // Apply the insets as a margin to the view. This solution sets only the + // bottom, left, and right dimensions, but you can apply whichever insets are + // appropriate to your layout. You can also update the view padding if that's + // more appropriate. + MarginLayoutParams mlp = (MarginLayoutParams) v.getLayoutParams(); + mlp.leftMargin = insets.left; + mlp.bottomMargin = insets.bottom; + mlp.rightMargin = insets.right; + v.setLayoutParams(mlp); + + // Return CONSUMED if you don't want want the window insets to keep passing + // down to descendant views. + return WindowInsetsCompat.CONSUMED; + }); + */ + //overridePendingTransition(R.anim.fade_in, R.anim.fade_out); //String appTheme = ApplicationPreferences.applicationTheme(getApplicationContext(), true); @@ -420,6 +444,7 @@ public void onDrawerOpened(View drawerView) { */ bottomNavigationView = findViewById(R.id.editor_list_bottom_navigation); + //noinspection DataFlowIssue bottomNavigationView.setOnItemSelectedListener( (me.ibrahimsn.lib.OnItemSelectedListener) item -> { bottomNavigationView.playSoundEffect(SoundEffectConstants.CLICK); @@ -443,13 +468,13 @@ public void onDrawerOpened(View drawerView) { /*getString(R.string.editor_drawer_title_profiles) + " - " + */getString(R.string.editor_drawer_list_item_profiles_show_in_activator), /*getString(R.string.editor_drawer_title_profiles) + " - " + */getString(R.string.editor_drawer_list_item_profiles_no_show_in_activator) }; - HighlightedSpinnerAdapter filterSpinnerAdapter = new HighlightedSpinnerAdapter( + PPSpinnerAdapter filterSpinnerAdapter = new PPSpinnerAdapter( this, - R.layout.spinner_highlighted_filter, + R.layout.ppp_spinner_filter, filterItems); - filterSpinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + filterSpinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); filterSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background); - filterSpinner.setSupportBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all_editor)); + //filterSpinner.setSupportBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all_editor)); /* switch (appTheme) { case "dark": filterSpinner.setSupportBackgroundTintList(ContextCompat.getColorStateList(getBaseContext(), R.color.editorFilterTitleColor_dark)); @@ -480,7 +505,7 @@ public void onItemSelected(AdapterView parent, View view, int position, long if (filterSpinner.getAdapter() != null) { //if (filterSpinner.getAdapter().getCount() <= position) // position = 0; - ((HighlightedSpinnerAdapter) filterSpinner.getAdapter()).setSelection(position); + ((PPSpinnerAdapter) filterSpinner.getAdapter()).setSelection(position); } selectFilterItem(editorSelectedView, position, true/*, true*/); @@ -491,6 +516,7 @@ public void onNothingSelected(AdapterView parent) { }); eventsRunStopIndicator = findViewById(R.id.editor_list_run_stop_indicator); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(eventsRunStopIndicator, getString(R.string.editor_activity_targetHelps_trafficLightIcon_title)); eventsRunStopIndicator.setOnClickListener(view -> { if (!isFinishing()) { @@ -1274,42 +1300,73 @@ public boolean onOptionsItemSelected(MenuItem item) { if (!uris.isEmpty()) { String emailAddress = StringConstants.AUTHOR_EMAIL; - Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts( - StringConstants.INTENT_DATA_MAIL_TO, emailAddress, null)); - String packageVersion = ""; - try { - PackageInfo pInfo = getPackageManager().getPackageInfo(PPApplication.PACKAGE_NAME, 0); - packageVersion = " - v" + pInfo.versionName + " (" + PPApplicationStatic.getVersionCode(pInfo) + ")"; - } catch (Exception e) { - PPApplicationStatic.recordException(e); - } - emailIntent.putExtra(Intent.EXTRA_SUBJECT, StringConstants.PHONE_PROFILES_PLUS + packageVersion + " - " + getString(R.string.email_debug_log_files_subject)); - emailIntent.putExtra(Intent.EXTRA_TEXT, getEmailBodyText(this)); - emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - - List resolveInfo = getPackageManager().queryIntentActivities(emailIntent, 0); - List intents = new ArrayList<>(); - for (ResolveInfo info : resolveInfo) { - intent = new Intent(Intent.ACTION_SEND_MULTIPLE); - intent.setComponent(new ComponentName(info.activityInfo.packageName, info.activityInfo.name)); - intent.putExtra(Intent.EXTRA_EMAIL, new String[]{emailAddress}); - intent.putExtra(Intent.EXTRA_SUBJECT, StringConstants.PHONE_PROFILES_PLUS + packageVersion + " - " + getString(R.string.email_debug_log_files_subject)); - intent.putExtra(Intent.EXTRA_TEXT, getEmailBodyText(this)); - intent.setType(StringConstants.MINE_TYPE_ALL); // gmail will only match with type set - intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); //ArrayList of attachment Uri's - intents.add(new LabeledIntent(intent, info.activityInfo.packageName, info.loadLabel(getPackageManager()), info.icon)); - } - if (!intents.isEmpty()) { + if (Build.VERSION.SDK_INT >= 35) { + Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE); + emailIntent.setType("message/rfc822"); // only email apps should handle this + //emailIntent.setData(Uri.parse(StringConstants.INTENT_DATA_MAIL_TO_COLON)); + + emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); + emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{emailAddress}); + + String packageVersion = ""; + try { + PackageInfo pInfo = getPackageManager().getPackageInfo(PPApplication.PACKAGE_NAME, 0); + packageVersion = " - v" + pInfo.versionName + " (" + PPApplicationStatic.getVersionCode(pInfo) + ")"; + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } + emailIntent.putExtra(Intent.EXTRA_SUBJECT, StringConstants.PHONE_PROFILES_PLUS + packageVersion + " - " + getString(R.string.email_debug_log_files_subject)); + emailIntent.putExtra(Intent.EXTRA_TEXT, getEmailBodyText(this)); + emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + try { - Intent chooser = Intent.createChooser(new Intent(Intent.ACTION_CHOOSER), getString(R.string.email_chooser)); - chooser.putExtra(Intent.EXTRA_INTENT, intents.get(0)); - chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new LabeledIntent[0])); + Intent chooser = Intent.createChooser(emailIntent, getString(R.string.email_chooser)); + //chooser.putExtra(Intent.EXTRA_INTENT, intents.get(0)); + //chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new LabeledIntent[0])); startActivity(chooser); + } catch (Exception e) { + //Log.e("EditorActivity.ExportAsyncTask.onPostExecute", Log.getStackTraceString(e)); + PPApplicationStatic.recordException(e); + } + } else { + Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts( + StringConstants.INTENT_DATA_MAIL_TO, emailAddress, null)); + + String packageVersion = ""; + try { + PackageInfo pInfo = getPackageManager().getPackageInfo(PPApplication.PACKAGE_NAME, 0); + packageVersion = " - v" + pInfo.versionName + " (" + PPApplicationStatic.getVersionCode(pInfo) + ")"; } catch (Exception e) { PPApplicationStatic.recordException(e); } + emailIntent.putExtra(Intent.EXTRA_SUBJECT, StringConstants.PHONE_PROFILES_PLUS + packageVersion + " - " + getString(R.string.email_debug_log_files_subject)); + emailIntent.putExtra(Intent.EXTRA_TEXT, getEmailBodyText(this)); + emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + + List resolveInfo = getPackageManager().queryIntentActivities(emailIntent, 0); + List intents = new ArrayList<>(); + for (ResolveInfo info : resolveInfo) { + intent = new Intent(Intent.ACTION_SEND_MULTIPLE); + intent.setComponent(new ComponentName(info.activityInfo.packageName, info.activityInfo.name)); + intent.putExtra(Intent.EXTRA_EMAIL, new String[]{emailAddress}); + intent.putExtra(Intent.EXTRA_SUBJECT, StringConstants.PHONE_PROFILES_PLUS + packageVersion + " - " + getString(R.string.email_debug_log_files_subject)); + intent.putExtra(Intent.EXTRA_TEXT, getEmailBodyText(this)); + intent.setType(StringConstants.MINE_TYPE_ALL); // gmail will only match with type set + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); //ArrayList of attachment Uri's + intents.add(new LabeledIntent(intent, info.activityInfo.packageName, info.loadLabel(getPackageManager()), info.icon)); + } + if (!intents.isEmpty()) { + try { + Intent chooser = Intent.createChooser(new Intent(Intent.ACTION_CHOOSER), getString(R.string.email_chooser)); + chooser.putExtra(Intent.EXTRA_INTENT, intents.get(0)); + chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new LabeledIntent[0])); + startActivity(chooser); + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } + } } } else { // toast notification @@ -1341,6 +1398,7 @@ public boolean onOptionsItemSelected(MenuItem item) { true, true, false, false, true, + false, this ); @@ -1365,6 +1423,7 @@ public boolean onOptionsItemSelected(MenuItem item) { true, true, false, false, false, + false, this ); @@ -1392,6 +1451,8 @@ public boolean onOptionsItemSelected(MenuItem item) { } else if (itemId == R.id.menu_donation) { + + intent = new Intent(getBaseContext(), DonationPayPalActivity.class); startActivity(intent); return true; @@ -1542,11 +1603,11 @@ private boolean selectViewItem(int item) { /*activity.getString(R.string.editor_drawer_title_profiles) + " - " + */activity.getString(R.string.editor_drawer_list_item_profiles_show_in_activator), /*activity.getString(R.string.editor_drawer_title_profiles) + " - " + */activity.getString(R.string.editor_drawer_list_item_profiles_no_show_in_activator), }; - HighlightedSpinnerAdapter filterSpinnerAdapter = new HighlightedSpinnerAdapter( + PPSpinnerAdapter filterSpinnerAdapter = new PPSpinnerAdapter( activity, - R.layout.spinner_highlighted_filter, + R.layout.ppp_spinner_filter, filterItems); - filterSpinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + filterSpinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); activity.filterSpinner.setAdapter(filterSpinnerAdapter); activity.selectFilterItem(0, activity.filterProfilesSelectedItem, false/*, startTargetHelps*/); Fragment fragment = activity.getSupportFragmentManager().findFragmentById(R.id.editor_list_container); @@ -1574,11 +1635,11 @@ private boolean selectViewItem(int item) { /*activity.getString(R.string.editor_drawer_title_events) + " - " + */activity.getString(R.string.editor_drawer_list_item_events_paused), /*activity.getString(R.string.editor_drawer_title_events) + " - " + */activity.getString(R.string.editor_drawer_list_item_events_stopped) }; - HighlightedSpinnerAdapter filterSpinnerAdapter = new HighlightedSpinnerAdapter( + PPSpinnerAdapter filterSpinnerAdapter = new PPSpinnerAdapter( activity, - R.layout.spinner_highlighted_filter, + R.layout.ppp_spinner_filter, filterItems); - filterSpinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + filterSpinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); activity.filterSpinner.setAdapter(filterSpinnerAdapter); activity.selectFilterItem(1, activity.filterEventsSelectedItem, false/*, startTargetHelps*/); Fragment fragment = activity.getSupportFragmentManager().findFragmentById(R.id.editor_list_container); @@ -2098,21 +2159,24 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) if ((resultCode == RESULT_OK) && (data != null)) { boolean ok = false; try { - Intent intent; + Intent intent = null; if (Build.VERSION.SDK_INT >= 29) { StorageManager sm = (StorageManager) getSystemService(Context.STORAGE_SERVICE); - intent = sm.getPrimaryStorageVolume().createOpenDocumentTreeIntent(); + if (sm != null) + intent = sm.getPrimaryStorageVolume().createOpenDocumentTreeIntent(); } else { intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); } - //intent.putExtra("android.content.extra.SHOW_ADVANCED",true); - //intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, PPApplication.backupFolderUri); - //noinspection deprecation - startActivityForResult(intent, REQUEST_CODE_RESTORE_SETTINGS); - ok = true; + if (intent != null) { + //intent.putExtra("android.content.extra.SHOW_ADVANCED",true); + //intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, PPApplication.backupFolderUri); + //noinspection deprecation + startActivityForResult(intent, REQUEST_CODE_RESTORE_SETTINGS); + ok = true; + } } catch (Exception e) { //PPApplicationStatic.recordException(e); } @@ -2131,6 +2195,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) true, true, false, false, true, + false, this ); @@ -2173,6 +2238,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) true, true, false, false, true, + false, this ); @@ -2363,6 +2429,7 @@ protected void onPostExecute(Integer result) { true, true, false, false, true, + false, this ); @@ -2399,7 +2466,7 @@ protected void onPostExecute(Integer result) { // PPApplicationStatic.logE("[PPP_NOTIFICATION] EditorActivity.onActivityResult", "call of PPAppNotification.drawNotification"); ImportantInfoNotification.showInfoNotification(appContext); ProfileListNotification.drawNotification(true, appContext); - DrawOverAppsPermissionNotification.showNotification(appContext, true); + //DrawOverAppsPermissionNotification.showNotification(appContext, true); IgnoreBatteryOptimizationNotification.showNotification(appContext, true); DNDPermissionNotification.showNotification(appContext, true); PPAppNotification.drawNotification(true, appContext); @@ -2482,6 +2549,7 @@ private void importExportErrorDialog(int importExport, int dbResult, int appSett true, true, false, false, false, + false, this ); @@ -2718,6 +2786,7 @@ private void importData(final int titleRes, final boolean share) { true, true, false, false, true, + false, EditorActivity.this ); @@ -2730,23 +2799,26 @@ private void importData(final int titleRes, final boolean share) { if (Permissions.grantImportPermissions(false, getApplicationContext(), EditorActivity.this)) { boolean ok = false; try { - Intent intent; + Intent intent = null; if (Build.VERSION.SDK_INT >= 29) { StorageManager sm = (StorageManager) getSystemService(Context.STORAGE_SERVICE); - intent = sm.getPrimaryStorageVolume().createOpenDocumentTreeIntent(); + if (sm != null) + intent = sm.getPrimaryStorageVolume().createOpenDocumentTreeIntent(); } else { intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); } - // not supported by ACTION_OPEN_DOCUMENT_TREE - //intent.putExtra(Intent.EXTRA_LOCAL_ONLY, false); + if (intent != null) { + // not supported by ACTION_OPEN_DOCUMENT_TREE + //intent.putExtra(Intent.EXTRA_LOCAL_ONLY, false); - //intent.putExtra("android.content.extra.SHOW_ADVANCED",true); - //intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, PPApplication.backupFolderUri); - //noinspection deprecation - startActivityForResult(intent, REQUEST_CODE_RESTORE_SETTINGS); - ok = true; + //intent.putExtra("android.content.extra.SHOW_ADVANCED",true); + //intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, PPApplication.backupFolderUri); + //noinspection deprecation + startActivityForResult(intent, REQUEST_CODE_RESTORE_SETTINGS); + ok = true; + } } catch (Exception e) { //PPApplicationStatic.recordException(e); } @@ -2765,6 +2837,7 @@ private void importData(final int titleRes, final boolean share) { true, true, false, false, true, + false, EditorActivity.this ); @@ -2781,6 +2854,7 @@ private void importData(final int titleRes, final boolean share) { true, true, false, false, true, + false, this ); @@ -2805,6 +2879,8 @@ private boolean exportApplicationPreferences(File dst, boolean runStopEvents/*, editor.putBoolean(Event.PREF_GLOBAL_EVENTS_RUN_STOP, runStopEvents); + // these shared preferences are put during export of data, values are from AudioManager + // for import, these data are values from source of imported data (may be from another device) AudioManager audioManager = (AudioManager)getSystemService(Context.AUDIO_SERVICE); if (audioManager != null) { try { @@ -2836,6 +2912,29 @@ private boolean exportApplicationPreferences(File dst, boolean runStopEvents/*, } catch (Exception ignored) {} } + // these shared preferences are put during export of data, values are from: + // - VibrationIntensityPreference.getMinValue() + // - VibrationIntensityPreference.getMaxValue() + // for import, these data are values from source of imported data (may be from another device) + try { + editor.putInt(DatabaseHandlerImportExport.PREF_MINIMUM_VIBRATION_INTENSITY_RINGING, VibrationIntensityPreference.getMinValue(VibrationIntensityPreference.RINGING_VYBRATION_INTENSITY_TYPE)); + } catch (Exception ignored) {} + try { + editor.putInt(DatabaseHandlerImportExport.PREF_MINIMUM_VIBRATION_INTENSITY_NOTIFICATION, VibrationIntensityPreference.getMinValue(VibrationIntensityPreference.NOTIFICATIONS_VYBRATION_INTENSITY_TYPE)); + } catch (Exception ignored) {} + try { + editor.putInt(DatabaseHandlerImportExport.PREF_MINIMUM_VIBRATION_INTENSITY_TOUCH_INTERACTION, VibrationIntensityPreference.getMinValue(VibrationIntensityPreference.TOUCHINTERACTION_VYBRATION_INTENSITY_TYPE)); + } catch (Exception ignored) {} + try { + editor.putInt(DatabaseHandlerImportExport.PREF_MAXIMUM_VIBRATION_INTENSITY_RINGING, VibrationIntensityPreference.getMaxValue(VibrationIntensityPreference.RINGING_VYBRATION_INTENSITY_TYPE)); + } catch (Exception ignored) {} + try { + editor.putInt(DatabaseHandlerImportExport.PREF_MAXIMUM_VIBRATION_INTENSITY_NOTIFICATION, VibrationIntensityPreference.getMaxValue(VibrationIntensityPreference.NOTIFICATIONS_VYBRATION_INTENSITY_TYPE)); + } catch (Exception ignored) {} + try { + editor.putInt(DatabaseHandlerImportExport.PREF_MAXIMUM_VIBRATION_INTENSITY_TOUCH_INTERACTION, VibrationIntensityPreference.getMaxValue(VibrationIntensityPreference.TOUCHINTERACTION_VYBRATION_INTENSITY_TYPE)); + } catch (Exception ignored) {} + editor.commit(); output.writeObject(pref.getAll()); @@ -2902,6 +3001,7 @@ else if (Permissions.grantExportPermissions(getApplicationContext(), EditorActiv true, true, false, false, false, + false, this ); @@ -2935,26 +3035,41 @@ private void doExportData(final boolean email, final boolean toAuthor, final boo dialogBuilder.setPositiveButton(R.string.alert_button_backup, (dialog, which) -> { CheckBox checkbox = layout.findViewById(R.id.deleteSecureDataInExportDialogGeofences); + //noinspection DataFlowIssue boolean deleteGeofences = checkbox.isChecked(); checkbox = layout.findViewById(R.id.deleteSecureDataInExportDialogWifiSSIDs); + //noinspection DataFlowIssue boolean deleteWifiSSIDs = checkbox.isChecked(); checkbox = layout.findViewById(R.id.deleteSecureDataInExportDialogBluetoothNames); + //noinspection DataFlowIssue boolean deleteBluetoothNames = checkbox.isChecked(); checkbox = layout.findViewById(R.id.deleteSecureDataInExportDialogMobileCells); + //noinspection DataFlowIssue boolean deleteMobileCells = checkbox.isChecked(); checkbox = layout.findViewById(R.id.deleteSecureDataInExportDialogCall); + //noinspection DataFlowIssue boolean deleteCall = checkbox.isChecked(); checkbox = layout.findViewById(R.id.deleteSecureDataInExportDialogSMS); + //noinspection DataFlowIssue boolean deleteSMS = checkbox.isChecked(); checkbox = layout.findViewById(R.id.deleteSecureDataInExportDialogNotification); + //noinspection DataFlowIssue boolean deleteNotification = checkbox.isChecked(); - checkbox = layout.findViewById(R.id.deleteSecureDataInExportDialogPhoneCalls); + checkbox = layout.findViewById(R.id.deleteSecureDataInExportDialogSendSMS); + //noinspection DataFlowIssue boolean deletePhoneCalls = checkbox.isChecked(); + checkbox = layout.findViewById(R.id.deleteSecureDataInExportDialogCallScreening); + //noinspection DataFlowIssue + boolean deleteCallScreening = checkbox.isChecked(); + checkbox = layout.findViewById(R.id.deleteSecureDataInExportDialogClearNotifications); + //noinspection DataFlowIssue + boolean deleteClearNotificaitons = checkbox.isChecked(); exportAsyncTask = new ExportAsyncTask(email, toAuthor, share, deleteGeofences, deleteWifiSSIDs, deleteBluetoothNames, deleteMobileCells, deleteCall, deleteSMS, deleteNotification, deletePhoneCalls, + deleteCallScreening, deleteClearNotificaitons, activity); exportAsyncTask.execute(); }); @@ -3093,7 +3208,7 @@ void redrawProfileListFragment(Profile profile, int newProfileMode /*int predefi } if (changeFilter) { fragment.scrollToProfile = _profile; - ((HighlightedSpinnerAdapter) editorActivity.filterSpinner.getAdapter()) + ((PPSpinnerAdapter) editorActivity.filterSpinner.getAdapter()) .setSelection(ApplicationPreferences.EDITOR_PROFILES_VIEW_SELECTED_ITEM_DEFAULT_VALUE); editorActivity.selectFilterItem(0, ApplicationPreferences.EDITOR_PROFILES_VIEW_SELECTED_ITEM_DEFAULT_VALUE, false/*, true*/); } @@ -3206,6 +3321,7 @@ private void startEventPreferenceActivity(Event event, final int editMode, final true, true, false, false, true, + false, this ); @@ -3276,7 +3392,7 @@ void redrawEventListFragment(Event event, int newEventMode /*int predefinedEvent } if (changeFilter) { fragment.scrollToEvent = _event; - ((HighlightedSpinnerAdapter) editorActivity.filterSpinner.getAdapter()) + ((PPSpinnerAdapter) editorActivity.filterSpinner.getAdapter()) .setSelection(ApplicationPreferences.EDITOR_EVENTS_VIEW_SELECTED_ITEM_DEFAULT_VALUE); editorActivity.selectFilterItem(1, ApplicationPreferences.EDITOR_EVENTS_VIEW_SELECTED_ITEM_DEFAULT_VALUE, false/*, true*/); } @@ -3343,13 +3459,9 @@ private void refreshGUI(/*final boolean refresh,*/ final boolean refreshIcons, f } private void showTargetHelps() { - //startTargetHelps = true; - final Context appContext = getApplicationContext(); boolean startTargetHelps = ApplicationPreferences.prefEditorActivityStartTargetHelps; - //boolean startTargetHelpsProfilesFilterSpinner = ApplicationPreferences.prefEditorActivityStartTargetHelpsProfilesFilterSpinner; - //boolean startTargetHelpsEventsFilterSpinner = ApplicationPreferences.prefEditorActivityStartTargetHelpsEventsFilterSpinner; boolean startTargetHelpsRunStopIndicator = ApplicationPreferences.prefEditorActivityStartTargetHelpsRunStopIndicator; boolean startTargetHelpsBottomNavigation = ApplicationPreferences.prefEditorActivityStartTargetHelpsBottomNavigation; @@ -3373,108 +3485,36 @@ private void showTargetHelps() { Editor editor = ApplicationPreferences.getEditor(appContext); editor.putBoolean(PPApplication.PREF_EDITOR_ACTIVITY_START_TARGET_HELPS, false); - //if (editorSelectedView == 0) - // editor.putBoolean(EditorActivity.PREF_START_TARGET_HELPS_PROFILES_FILTER_SPINNER, false); - //else - // editor.putBoolean(EditorActivity.PREF_START_TARGET_HELPS_EVENTS_FILTER_SPINNER, false); - editor.putBoolean(PPApplication.PREF_EDITOR_ACTIVITY_START_TARGET_HELPS_RUN_STOP_INDICATOR, false); editor.putBoolean(PPApplication.PREF_EDITOR_ACTIVITY_START_TARGET_HELPS_BOTTOM_NAVIGATION, false); editor.apply(); ApplicationPreferences.prefEditorActivityStartTargetHelps = false; - //if (editorSelectedView == 0) - // ApplicationPreferences.prefEditorActivityStartTargetHelpsProfilesFilterSpinner = false; - //else - // ApplicationPreferences.prefEditorActivityStartTargetHelpsEventsFilterSpinner = false; - ApplicationPreferences.prefEditorActivityStartTargetHelpsRunStopIndicator = false; ApplicationPreferences.prefEditorActivityStartTargetHelpsBottomNavigation = false; - //TypedValue tv = new TypedValue(); - //getTheme().resolveAttribute(R.attr.colorAccent, tv, true); - - //final Display display = getWindowManager().getDefaultDisplay(); - - //String appTheme = ApplicationPreferences.applicationTheme(appContext, true); int outerCircleColor = R.color.tabTargetHelpOuterCircleColor; -// if (appTheme.equals("dark")) -// outerCircleColor = R.color.tabTargetHelpOuterCircleColor_dark; int targetCircleColor = R.color.tabTargetHelpTargetCircleColor; -// if (appTheme.equals("dark")) -// targetCircleColor = R.color.tabTargetHelpTargetCircleColor_dark; int titleTextColor = R.color.tabTargetHelpTitleTextColor; int descriptionTextColor = R.color.tabTargetHelpDescriptionTextColor; -// if (appTheme.equals("dark")) -// textColor = R.color.tabTargetHelpTextColor_dark; - - //int[] screenLocation = new int[2]; - //filterSpinner.getLocationOnScreen(screenLocation); - //filterSpinner.getLocationInWindow(screenLocation); - //Rect filterSpinnerTarget = new Rect(0, 0, filterSpinner.getHeight(), filterSpinner.getHeight()); - //filterSpinnerTarget.offset(screenLocation[0] + 100, screenLocation[1]); - - /* - eventsRunStopIndicator.getLocationOnScreen(screenLocation); - //eventsRunStopIndicator.getLocationInWindow(screenLocation); - Rect eventRunStopIndicatorTarget = new Rect(0, 0, eventsRunStopIndicator.getHeight(), eventsRunStopIndicator.getHeight()); - eventRunStopIndicatorTarget.offset(screenLocation[0], screenLocation[1]); - */ final TapTargetSequence sequence = new TapTargetSequence(this); List targets = new ArrayList<>(); if (startTargetHelps) { - // do not add it again - //if (editorSelectedView == 0) - // startTargetHelpsProfilesFilterSpinner = false; - //else - // startTargetHelpsEventsFilterSpinner = false; - startTargetHelpsRunStopIndicator = false; startTargetHelpsBottomNavigation = false; if (EventStatic.getGlobalEventsRunning(this)) { - /*targets.add( - TapTarget.forToolbarNavigationIcon(editorToolbar, getString(R.string.editor_activity_targetHelps_navigationIcon_title), getString(R.string.editor_activity_targetHelps_navigationIcon_description)) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(1) - );*/ - /*if (editorSelectedView == 0) - targets.add( - //TapTarget.forBounds(filterSpinnerTarget, getString(R.string.editor_activity_targetHelps_filterSpinner_title), getString(R.string.editor_activity_targetHelps_filterSpinner_description)) - TapTarget.forView(filterSpinner, getString(R.string.editor_activity_targetHelps_filterSpinner_title), getString(R.string.editor_activity_targetHelps_filterSpinner_description)) - .transparentTarget(true) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(1) - ); - else - targets.add( - //TapTarget.forBounds(filterSpinnerTarget, getString(R.string.editor_activity_targetHelps_filterSpinner_title), getString(R.string.editor_activity_targetHelps_filterSpinner_description)) - TapTarget.forView(filterSpinner, getString(R.string.editor_activity_targetHelps_filterSpinner_title), getString(R.string.editor_activity_targetHelps_filterSpinner_description)) - .transparentTarget(true) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(1) - ); - */ targets.add( TapTarget.forToolbarOverflow(editorToolbar, getString(R.string.editor_activity_targetHelps_applicationMenu_title), getString(R.string.editor_activity_targetHelps_applicationMenu_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -3489,6 +3529,9 @@ private void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -3505,6 +3548,9 @@ private void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -3521,6 +3567,9 @@ private void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -3537,38 +3586,15 @@ private void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(false) .drawShadow(true) .id(id) ); ++id; -/* - targets.add( - TapTarget.forView(bottomNavigationView.findViewById(R.id.menu_profiles_view), getString(R.string.editor_activity_targetHelps_bottomNavigationProfiles_title), - getString(R.string.editor_activity_targetHelps_bottomNavigationProfiles_description) + "\n" + - getString(R.string.editor_activity_targetHelps_bottomNavigation_description_2)) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(id) - ); - ++id; - targets.add( - TapTarget.forView(bottomNavigationView.findViewById(R.id.menu_events_view), getString(R.string.editor_activity_targetHelps_bottomNavigationEvents_title), - getString(R.string.editor_activity_targetHelps_bottomNavigationEvents_description) + "\n" + - getString(R.string.editor_activity_targetHelps_bottomNavigation_description_2)) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(id) - ); - ++id; - */ targets.add( TapTarget.forView(bottomNavigationView, getString(R.string.editor_activity_targetHelps_bottomNavigation_title), getString(R.string.editor_activity_targetHelps_bottomNavigation_description)) @@ -3576,6 +3602,9 @@ private void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(false) .drawShadow(true) @@ -3586,45 +3615,15 @@ private void showTargetHelps() { } else { - /*targets.add( - TapTarget.forToolbarNavigationIcon(editorToolbar, getString(R.string.editor_activity_targetHelps_navigationIcon_title), getString(R.string.editor_activity_targetHelps_navigationIcon_description)) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(1) - );*/ - /*if (editorSelectedView == 0) - targets.add( - //TapTarget.forBounds(filterSpinnerTarget, getString(R.string.editor_activity_targetHelps_filterSpinner_title), getString(R.string.editor_activity_targetHelps_filterSpinner_description)) - TapTarget.forView(filterSpinner, getString(R.string.editor_activity_targetHelps_filterSpinner_title), getString(R.string.editor_activity_targetHelps_filterSpinner_description)) - .transparentTarget(true) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(1) - ); - else - targets.add( - //TapTarget.forBounds(filterSpinnerTarget, getString(R.string.editor_activity_targetHelps_filterSpinner_title), getString(R.string.editor_activity_targetHelps_filterSpinner_description)) - TapTarget.forView(filterSpinner, getString(R.string.editor_activity_targetHelps_filterSpinner_title), getString(R.string.editor_activity_targetHelps_filterSpinner_description)) - .transparentTarget(true) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(1) - );*/ targets.add( TapTarget.forToolbarOverflow(editorToolbar, getString(R.string.editor_activity_targetHelps_applicationMenu_title), getString(R.string.editor_activity_targetHelps_applicationMenu_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -3639,6 +3638,9 @@ private void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -3655,6 +3657,9 @@ private void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -3671,6 +3676,9 @@ private void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -3687,38 +3695,15 @@ private void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(false) .drawShadow(true) .id(id) ); ++id; -/* - targets.add( - TapTarget.forView(bottomNavigationView.findViewById(R.id.menu_profiles_view), getString(R.string.editor_activity_targetHelps_bottomNavigationProfiles_title), - getString(R.string.editor_activity_targetHelps_bottomNavigationProfiles_description) + "\n" + - getString(R.string.editor_activity_targetHelps_bottomNavigation_description_2)) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(id) - ); - ++id; - targets.add( - TapTarget.forView(bottomNavigationView.findViewById(R.id.menu_events_view), getString(R.string.editor_activity_targetHelps_bottomNavigationEvents_title), - getString(R.string.editor_activity_targetHelps_bottomNavigationEvents_description) + "\n" + - getString(R.string.editor_activity_targetHelps_bottomNavigation_description_2)) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(id) - ); - ++id; -*/ targets.add( TapTarget.forView(bottomNavigationView, getString(R.string.editor_activity_targetHelps_bottomNavigation_title), getString(R.string.editor_activity_targetHelps_bottomNavigation_description)) @@ -3726,6 +3711,9 @@ private void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(false) .drawShadow(true) @@ -3736,32 +3724,6 @@ private void showTargetHelps() { } } - /*if (startTargetHelpsProfilesFilterSpinner) { - targets.add( - //TapTarget.forBounds(filterSpinnerTarget, getString(R.string.editor_activity_targetHelps_filterSpinner_title), getString(R.string.editor_activity_targetHelps_filterSpinner_description)) - TapTarget.forView(filterSpinner, getString(R.string.editor_activity_targetHelps_filterSpinner_title), getString(R.string.editor_activity_targetHelps_filterSpinner_description)) - .transparentTarget(true) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(1) - ); - } - if (startTargetHelpsEventsFilterSpinner) { - targets.add( - //TapTarget.forBounds(filterSpinnerTarget, getString(R.string.editor_activity_targetHelps_filterSpinner_title), getString(R.string.editor_activity_targetHelps_filterSpinner_description)) - TapTarget.forView(filterSpinner, getString(R.string.editor_activity_targetHelps_filterSpinner_title), getString(R.string.editor_activity_targetHelps_filterSpinner_description)) - .transparentTarget(true) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(1) - ); - }*/ if (startTargetHelpsRunStopIndicator) { targets.add( TapTarget.forView(eventsRunStopIndicator, getString(R.string.editor_activity_targetHelps_trafficLightIcon_title), getString(R.string.editor_activity_targetHelps_trafficLightIcon_description)) @@ -3769,6 +3731,9 @@ private void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(false) .drawShadow(true) @@ -3776,29 +3741,6 @@ private void showTargetHelps() { ); } if (startTargetHelpsBottomNavigation) { - /*targets.add( - TapTarget.forView(bottomNavigationView.findViewById(R.id.menu_profiles_view), getString(R.string.editor_activity_targetHelps_bottomNavigationProfiles_title), - getString(R.string.editor_activity_targetHelps_bottomNavigationProfiles_description) + "\n" + - getString(R.string.editor_activity_targetHelps_bottomNavigation_description_2)) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(1) - ); - targets.add( - TapTarget.forView(bottomNavigationView.findViewById(R.id.menu_events_view), getString(R.string.editor_activity_targetHelps_bottomNavigationEvents_title), - getString(R.string.editor_activity_targetHelps_bottomNavigationEvents_description) + "\n " + - getString(R.string.editor_activity_targetHelps_bottomNavigation_description_2)) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(2) - ); - */ targets.add( TapTarget.forView(bottomNavigationView, getString(R.string.editor_activity_targetHelps_bottomNavigation_title), getString(R.string.editor_activity_targetHelps_bottomNavigation_description)) @@ -3806,6 +3748,9 @@ private void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(false) .drawShadow(true) @@ -3814,6 +3759,10 @@ private void showTargetHelps() { ); } + for (TapTarget target : targets) { + target.setDrawBehindStatusBar(true); + target.setDrawBehindNavigationBar(true); + } sequence.targets(targets); sequence.listener(new TapTargetSequence.Listener() { @@ -3821,8 +3770,6 @@ private void showTargetHelps() { // to the sequence @Override public void onSequenceFinish() { - //targetHelpsSequenceStarted = false; - SharedPreferences.Editor editor = ApplicationPreferences.getEditor(appContext); editor.putBoolean(PPApplication.PREF_EDITOR_ACTIVITY_START_TARGET_HELPS_FINISHED, true); editor.apply(); @@ -3844,7 +3791,6 @@ public void onSequenceStep(TapTarget lastTarget, boolean targetClicked) { @Override public void onSequenceCanceled(TapTarget lastTarget) { - //targetHelpsSequenceStarted = false; Editor editor = ApplicationPreferences.getEditor(appContext); if (editorSelectedView == 0) { editor.putBoolean(PPApplication.PREF_EDITOR_PROFILE_LIST_FRAGMENT_START_TARGET_HELPS, false); @@ -3855,7 +3801,6 @@ public void onSequenceCanceled(TapTarget lastTarget) { editor.putBoolean(PPApplication.PREF_EDITOR_PROFILE_LIST_ADAPTER_START_TARGET_HELPS_SHOW_IN_ACTIVATOR, false); editor.putBoolean(PPApplication.PREF_EDITOR_PROFILE_LIST_FRAGMENT_START_TARGET_HELPS_FINISHED, true); - //editor.putBoolean(EditorProfileListAdapter.PREF_START_TARGET_HELPS_FINISHED, true); ApplicationPreferences.prefEditorProfilesFragmentStartTargetHelps = false; ApplicationPreferences.prefEditorProfilesAdapterStartTargetHelps = false; @@ -3865,8 +3810,6 @@ public void onSequenceCanceled(TapTarget lastTarget) { ApplicationPreferences.prefEditorProfilesAdapterStartTargetHelpsShowInActivator = false; ApplicationPreferences.prefEditorProfilesFragmentStartTargetHelpsFinished = true; - //ApplicationPreferences.prefEditorProfilesAdapterStartTargetHelpsFinished = true; - } else { editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_FRAGMENT_START_TARGET_HELPS, false); @@ -3876,7 +3819,6 @@ public void onSequenceCanceled(TapTarget lastTarget) { editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_ADAPTER_START_TARGET_HELPS_STATUS, false); editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_FRAGMENT_START_TARGET_HELPS_FINISHED, true); - //editor.putBoolean(EditorEventListAdapter.PREF_START_TARGET_HELPS_FINISHED, true); ApplicationPreferences.prefEditorEventsFragmentStartTargetHelps = false; ApplicationPreferences.prefEditorEventsAdapterStartTargetHelps = false; @@ -3885,14 +3827,12 @@ public void onSequenceCanceled(TapTarget lastTarget) { ApplicationPreferences.prefEditorEventsAdapterStartTargetHelpsStatus = false; ApplicationPreferences.prefEditorEventsFragmentStartTargetHelpsFinished = true; - //ApplicationPreferences.prefEditorEventsAdapterStartTargetHelpsFinished = true; } editor.apply(); } }); sequence.continueOnCancel(true) .considerOuterCircleCanceled(true); - //targetHelpsSequenceStarted = true; editor = ApplicationPreferences.getEditor(appContext); editor.putBoolean(PPApplication.PREF_EDITOR_ACTIVITY_START_TARGET_HELPS_FINISHED, false); @@ -3914,15 +3854,6 @@ public void onSequenceCanceled(TapTarget lastTarget) { // PPApplicationStatic.logE("[LOCAL_BROADCAST_CALL] EditorActivity.showTargetHelps", "xxx"); Intent intent = new Intent(ACTION_SHOW_EDITOR_TARGET_HELPS_BROADCAST_RECEIVER); LocalBroadcastManager.getInstance(activity.getApplicationContext()).sendBroadcast(intent); - /*if (EditorActivity.getInstance() != null) { - Fragment fragment = EditorActivity.getInstance().getFragmentManager().findFragmentById(R.id.editor_list_container); - if (fragment != null) { - if (fragment instanceof EditorProfileListFragment) - ((EditorProfileListFragment) fragment).showTargetHelps(); - else - ((EditorEventListFragment) fragment).showTargetHelps(); - } - }*/ }, 500); } } @@ -4053,6 +3984,7 @@ protected void onPostExecute(Integer result) { true, true, false, false, true, + false, activity ); @@ -4175,39 +4107,41 @@ protected Integer doInBackground(Void... params) { if (pickedFile != null) { if (pickedFile.canRead()) { File applicationDir = activity.getApplicationContext().getExternalFilesDir(null); + if (applicationDir != null) { + // file name in local storage will be PPApplication.SHARED_EXPORT_FILENAME + PPApplication.SHARED_EXPORT_FILEEXTENSION + ok = copySharedFile(pickedFile, applicationDir, activity.getApplicationContext()); - // file name in local storage will be PPApplication.SHARED_EXPORT_FILENAME + PPApplication.SHARED_EXPORT_FILEEXTENSION - ok = copySharedFile(pickedFile, applicationDir, activity.getApplicationContext()); - - if (ok == 1) { - // delete backup files - File importFile = new File(applicationDir, PPApplication.EXPORT_APP_PREF_FILENAME); - if (importFile.exists()) { - // delete old file - if (!importFile.delete()) - ok = -10; - } if (ok == 1) { - importFile = new File(applicationDir, DatabaseHandler.EXPORT_DBFILENAME); + // delete backup files + File importFile = new File(applicationDir, PPApplication.EXPORT_APP_PREF_FILENAME); if (importFile.exists()) { // delete old file if (!importFile.delete()) - ok = -11; + ok = -10; + } + if (ok == 1) { + importFile = new File(applicationDir, DatabaseHandler.EXPORT_DBFILENAME); + if (importFile.exists()) { + // delete old file + if (!importFile.delete()) + ok = -11; + } } - } - if (ok == 1) { - // unzip shared file - ZipManager zipManager = new ZipManager(); - File zipFile = new File(applicationDir, PPApplication.SHARED_EXPORT_FILENAME + PPApplication.SHARED_EXPORT_FILEEXTENSION); - String destinationDir = applicationDir.getAbsolutePath(); - if (!destinationDir.endsWith("/")) - destinationDir = destinationDir + "/"; - if (!zipManager.unzip(zipFile.getAbsolutePath(), destinationDir)) - ok = -12; + if (ok == 1) { + // unzip shared file + ZipManager zipManager = new ZipManager(); + File zipFile = new File(applicationDir, PPApplication.SHARED_EXPORT_FILENAME + PPApplication.SHARED_EXPORT_FILEEXTENSION); + String destinationDir = applicationDir.getAbsolutePath(); + if (!destinationDir.endsWith("/")) + destinationDir = destinationDir + "/"; + if (!zipManager.unzip(zipFile.getAbsolutePath(), destinationDir)) + ok = -12; + } } } - + else + ok = -18; } else { // pickedDir is not writable ok = -13; @@ -4281,6 +4215,7 @@ protected void onPostExecute(Integer result) { true, true, false, false, true, + false, activity ); @@ -4352,15 +4287,18 @@ private int copyFromBackupDirectory(DocumentFile pickedDir, File applicationDir, private int copySharedFile(DocumentFile pickedFile, File applicationDir, Context context) { // delete all zip files in local storage File sd = context.getApplicationContext().getExternalFilesDir(null); - File[] oldZipFiles = sd.listFiles(); - if (oldZipFiles != null) { - for (File f : oldZipFiles) { - if (f.getName().startsWith(PPApplication.SHARED_EXPORT_FILENAME)) { - if (!f.delete()) - return -1; + if (sd != null) { + File[] oldZipFiles = sd.listFiles(); + if (oldZipFiles != null) { + for (File f : oldZipFiles) { + if (f.getName().startsWith(PPApplication.SHARED_EXPORT_FILENAME)) { + if (!f.delete()) + return -1; + } } } - } + } else + return -10; // copy file //DocumentFile inputFile = pickedFile; if (pickedFile != null) { @@ -4586,7 +4524,7 @@ protected void onPostExecute(Integer result) { if (!activity.isFinishing()) GlobalGUIRoutines.reloadActivity(activity, true); - DrawOverAppsPermissionNotification.showNotification(_dataWrapper.context, true); + //DrawOverAppsPermissionNotification.showNotification(_dataWrapper.context, true); IgnoreBatteryOptimizationNotification.showNotification(_dataWrapper.context, true); DNDPermissionNotification.showNotification(_dataWrapper.context, true); @@ -4621,6 +4559,8 @@ private static class ExportAsyncTask extends AsyncTask { final boolean deleteSMS; final boolean deleteNotification; final boolean deletePhoneCalls; + final boolean deleteCallScreening; + final boolean deleteClearNotifications; File zipFile = null; public ExportAsyncTask(final boolean email, final boolean toAuthor, final boolean share, @@ -4628,6 +4568,7 @@ public ExportAsyncTask(final boolean email, final boolean toAuthor, final boolea final boolean deleteBluetoothNames, final boolean deleteMobileCells, final boolean deleteCall, final boolean deleteSMS, final boolean deleteNotification, final boolean deletePhoneCalls, + final boolean deleteCallScreening, final boolean deleteClearNotifications, EditorActivity activity) { this.activityWeakRef = new WeakReference<>(activity); this.email = email; @@ -4641,6 +4582,8 @@ public ExportAsyncTask(final boolean email, final boolean toAuthor, final boolea this.deleteSMS = deleteSMS; this.deleteNotification = deleteNotification; this.deletePhoneCalls = deletePhoneCalls; + this.deleteCallScreening = deleteCallScreening; + this.deleteClearNotifications = deleteClearNotifications; AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(activity); dialogBuilder.setTitle(R.string.export_profiles_alert_title); @@ -4698,7 +4641,8 @@ protected Integer doInBackground(Void... params) { this.deleteGeofences, this.deleteWifiSSIDs, this.deleteBluetoothNames, this.deleteMobileCells, this.deleteCall, this.deleteSMS, this.deleteNotification, - this.deletePhoneCalls + this.deletePhoneCalls, this.deleteCallScreening, + this.deleteClearNotifications ); if (ret == 1) { //File exportFile = new File(sd, PPApplication.EXPORT_PATH + "/" + PPApplication.EXPORT_APP_PREF_FILENAME); @@ -4719,12 +4663,14 @@ protected Integer doInBackground(Void... params) { try { // delete all zip files in local storage sd = activity.getApplicationContext().getExternalFilesDir(null); - File[] oldZipFiles = sd.listFiles(); - if (oldZipFiles != null) { - for (File f : oldZipFiles) { - if (f.getName().startsWith(PPApplication.SHARED_EXPORT_FILENAME)) { - //noinspection ResultOfMethodCallIgnored - f.delete(); + if (sd != null) { + File[] oldZipFiles = sd.listFiles(); + if (oldZipFiles != null) { + for (File f : oldZipFiles) { + if (f.getName().startsWith(PPApplication.SHARED_EXPORT_FILENAME)) { + //noinspection ResultOfMethodCallIgnored + f.delete(); + } } } } @@ -4831,48 +4777,81 @@ protected void onPostExecute(Integer result) { String emailAddress = ""; if (toAuthor) emailAddress = StringConstants.AUTHOR_EMAIL; - Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts( - StringConstants.INTENT_DATA_MAIL_TO, emailAddress, null)); - String packageVersion = ""; - try { - PackageInfo pInfo = context.getPackageManager().getPackageInfo(PPApplication.PACKAGE_NAME, 0); - packageVersion = " - v" + pInfo.versionName + " (" + PPApplicationStatic.getVersionCode(pInfo) + ")"; - } catch (Exception e) { - //Log.e("EditorActivity.ExportAsyncTask.onPostExecute", Log.getStackTraceString(e)); - PPApplicationStatic.recordException(e); - } - emailIntent.putExtra(Intent.EXTRA_SUBJECT, StringConstants.PHONE_PROFILES_PLUS + packageVersion + " - " + activity.getString(R.string.export_data_email_subject)); - emailIntent.putExtra(Intent.EXTRA_TEXT, getEmailBodyText(activity)); - emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - - List resolveInfo = context.getPackageManager().queryIntentActivities(emailIntent, 0); - List intents = new ArrayList<>(); - for (ResolveInfo info : resolveInfo) { - //Log.e("EditorActivity.ExportAsyncTask.onPostExecute", "packageName="+info.activityInfo.packageName); - //Log.e("EditorActivity.ExportAsyncTask.onPostExecute", "name="+info.activityInfo.name); - Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); - intent.setComponent(new ComponentName(info.activityInfo.packageName, info.activityInfo.name)); - if (!emailAddress.isEmpty()) - intent.putExtra(Intent.EXTRA_EMAIL, new String[]{emailAddress}); - intent.putExtra(Intent.EXTRA_SUBJECT, StringConstants.PHONE_PROFILES_PLUS + packageVersion + " - " + activity.getString(R.string.export_data_email_subject)); - intent.putExtra(Intent.EXTRA_TEXT, getEmailBodyText(activity)); - intent.setType(StringConstants.MINE_TYPE_ALL); // gmail will only match with type set - intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); - intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); //ArrayList of attachment Uri's - intents.add(new LabeledIntent(intent, info.activityInfo.packageName, info.loadLabel(context.getPackageManager()), info.icon)); - } - //Log.e("EditorActivity.ExportAsyncTask.onPostExecute", "intents.size()="+intents.size()); - if (!intents.isEmpty()) { + if (Build.VERSION.SDK_INT >= 35) { + Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE); + emailIntent.setType("message/rfc822"); // only email apps should handle this + //emailIntent.setData(Uri.parse(StringConstants.INTENT_DATA_MAIL_TO_COLON)); + + emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); + emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[]{emailAddress}); + + String packageVersion = ""; + try { + PackageInfo pInfo = context.getPackageManager().getPackageInfo(PPApplication.PACKAGE_NAME, 0); + packageVersion = " - v" + pInfo.versionName + " (" + PPApplicationStatic.getVersionCode(pInfo) + ")"; + } catch (Exception e) { + //Log.e("EditorActivity.ExportAsyncTask.onPostExecute", Log.getStackTraceString(e)); + PPApplicationStatic.recordException(e); + } + emailIntent.putExtra(Intent.EXTRA_SUBJECT, StringConstants.PHONE_PROFILES_PLUS + packageVersion + " - " + activity.getString(R.string.export_data_email_subject)); + emailIntent.putExtra(Intent.EXTRA_TEXT, getEmailBodyText(activity)); + emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + try { - Intent chooser = Intent.createChooser(new Intent(Intent.ACTION_CHOOSER), context.getString(R.string.email_chooser)); - chooser.putExtra(Intent.EXTRA_INTENT, intents.get(0)); - chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new LabeledIntent[0])); + Intent chooser = Intent.createChooser(emailIntent, context.getString(R.string.email_chooser)); + //chooser.putExtra(Intent.EXTRA_INTENT, intents.get(0)); + //chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new LabeledIntent[0])); activity.startActivity(chooser); } catch (Exception e) { //Log.e("EditorActivity.ExportAsyncTask.onPostExecute", Log.getStackTraceString(e)); PPApplicationStatic.recordException(e); } + } else { + Intent emailIntent = new Intent(Intent.ACTION_SENDTO, Uri.fromParts( + StringConstants.INTENT_DATA_MAIL_TO, emailAddress, null)); + + String packageVersion = ""; + try { + PackageInfo pInfo = context.getPackageManager().getPackageInfo(PPApplication.PACKAGE_NAME, 0); + packageVersion = " - v" + pInfo.versionName + " (" + PPApplicationStatic.getVersionCode(pInfo) + ")"; + } catch (Exception e) { + //Log.e("EditorActivity.ExportAsyncTask.onPostExecute", Log.getStackTraceString(e)); + PPApplicationStatic.recordException(e); + } + emailIntent.putExtra(Intent.EXTRA_SUBJECT, StringConstants.PHONE_PROFILES_PLUS + packageVersion + " - " + activity.getString(R.string.export_data_email_subject)); + emailIntent.putExtra(Intent.EXTRA_TEXT, getEmailBodyText(activity)); + emailIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + + List resolveInfo = context.getPackageManager().queryIntentActivities(emailIntent, 0); + List intents = new ArrayList<>(); + for (ResolveInfo info : resolveInfo) { +// Log.e("EditorActivity.ExportAsyncTask.onPostExecute", "packageName=" + info.activityInfo.packageName); +// Log.e("EditorActivity.ExportAsyncTask.onPostExecute", "name=" + info.activityInfo.name); + Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE); + intent.setComponent(new ComponentName(info.activityInfo.packageName, info.activityInfo.name)); + if (!emailAddress.isEmpty()) + intent.putExtra(Intent.EXTRA_EMAIL, new String[]{emailAddress}); + intent.putExtra(Intent.EXTRA_SUBJECT, StringConstants.PHONE_PROFILES_PLUS + packageVersion + " - " + activity.getString(R.string.export_data_email_subject)); + intent.putExtra(Intent.EXTRA_TEXT, getEmailBodyText(activity)); + intent.setType(StringConstants.MINE_TYPE_ALL); // gmail will only match with type set + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); //ArrayList of attachment Uri's + intents.add(new LabeledIntent(intent, info.activityInfo.packageName, info.loadLabel(context.getPackageManager()), info.icon)); + } +// Log.e("EditorActivity.ExportAsyncTask.onPostExecute", "intents.size()=" + intents.size()); + if (!intents.isEmpty()) { + try { + Intent chooser = Intent.createChooser(emailIntent, context.getString(R.string.email_chooser)); + chooser.putExtra(Intent.EXTRA_INTENT, intents.get(0)); + //chooser.putExtra(Intent.EXTRA_INITIAL_INTENTS, intents.toArray(new LabeledIntent[0])); + activity.startActivity(chooser); +// Log.e("EditorActivity.ExportAsyncTask.onPostExecute", "email app opened"); + } catch (Exception e) { + //Log.e("EditorActivity.ExportAsyncTask.onPostExecute", Log.getStackTraceString(e)); + PPApplicationStatic.recordException(e); + } + } } } else if (share) { @@ -4903,42 +4882,46 @@ protected void onPostExecute(Integer result) { boolean createPPPSubfolder = ApplicationPreferences.getSharedPreferences(context).getBoolean(PREF_BACKUP_CREATE_PPP_SUBFOLDER, true); final TextView rewriteInfo = layout.findViewById(R.id.backup_settings_alert_dialog_rewrite_files_info); + //noinspection DataFlowIssue rewriteInfo.setEnabled(!createPPPSubfolder); final CheckBox checkBox = layout.findViewById(R.id.backup_settings_alert_dialog_checkBox); + //noinspection DataFlowIssue checkBox.setChecked(createPPPSubfolder); checkBox.setOnCheckedChangeListener((buttonView, isChecked) -> rewriteInfo.setEnabled(!isChecked)); dialogBuilder.setPositiveButton(R.string.alert_button_yes, (dialog, which) -> { boolean ok = false; try { - boolean _createPPPSubfolder = checkBox.isChecked(); Editor editor = ApplicationPreferences.getEditor(context); editor.putBoolean(PREF_BACKUP_CREATE_PPP_SUBFOLDER, _createPPPSubfolder); editor.apply(); - Intent intent; + Intent intent = null; if (Build.VERSION.SDK_INT >= 29) { StorageManager sm = (StorageManager) context.getSystemService(Context.STORAGE_SERVICE); - intent = sm.getPrimaryStorageVolume().createOpenDocumentTreeIntent(); + if (sm != null) + intent = sm.getPrimaryStorageVolume().createOpenDocumentTreeIntent(); } else { intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION); } - // not supported by ACTION_OPEN_DOCUMENT_TREE - //intent.putExtra(Intent.EXTRA_LOCAL_ONLY, false); - - //intent.putExtra("android.content.extra.SHOW_ADVANCED",true); - //intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, PPApplication.backupFolderUri); - if (_createPPPSubfolder) - //noinspection deprecation - activity.startActivityForResult(intent, REQUEST_CODE_BACKUP_SETTINGS_2); - else - //noinspection deprecation - activity.startActivityForResult(intent, REQUEST_CODE_BACKUP_SETTINGS); - ok = true; + if (intent != null) { + // not supported by ACTION_OPEN_DOCUMENT_TREE + //intent.putExtra(Intent.EXTRA_LOCAL_ONLY, false); + + //intent.putExtra("android.content.extra.SHOW_ADVANCED",true); + //intent.putExtra(DocumentsContract.EXTRA_INITIAL_URI, PPApplication.backupFolderUri); + if (_createPPPSubfolder) + //noinspection deprecation + activity.startActivityForResult(intent, REQUEST_CODE_BACKUP_SETTINGS_2); + else + //noinspection deprecation + activity.startActivityForResult(intent, REQUEST_CODE_BACKUP_SETTINGS); + ok = true; + } } catch (Exception e) { //PPApplicationStatic.recordException(e); } @@ -4957,6 +4940,7 @@ protected void onPostExecute(Integer result) { true, true, false, false, true, + false, activity ); @@ -5042,7 +5026,7 @@ public void finishActivityFromListener(Intent intent) { if (action != null) { if (action.equals(PPApplication.ACTION_FINISH_ACTIVITY)) { String what = intent.getStringExtra(PPApplication.EXTRA_WHAT_FINISH); - if (what.equals(StringConstants.EXTRA_EDITOR)) { + if ((what != null) && what.equals(StringConstants.EXTRA_EDITOR)) { try { setResult(Activity.RESULT_CANCELED); finishAffinity(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorEventListAdapter.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorEventListAdapter.java index 542f0a987e..7f6e15a99c 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorEventListAdapter.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorEventListAdapter.java @@ -16,8 +16,10 @@ import com.getkeepsafe.taptargetview.TapTarget; import com.getkeepsafe.taptargetview.TapTargetSequence; +import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; +import java.util.List; class EditorEventListAdapter extends RecyclerView.Adapter implements ItemTouchHelperAdapter @@ -367,10 +369,7 @@ public void clearView() { activityDataWrapper.restartEventsWithDelay(true, true, false, true, PPApplication.ALTYPE_EVENT_PREFERENCES_CHANGED); } - void showTargetHelps(Activity activity, /*EditorEventListFragment fragment,*/ View listItemView) { - //if (fragment.targetHelpsSequenceStarted) - // return; - + void showTargetHelps(Activity activity, View listItemView) { boolean startTargetHelpsFinished = ApplicationPreferences.prefEditorActivityStartTargetHelpsFinished && ApplicationPreferences.prefEditorEventsFragmentStartTargetHelpsFinished; if (!startTargetHelpsFinished) @@ -382,27 +381,19 @@ void showTargetHelps(Activity activity, /*EditorEventListFragment fragment,*/ Vi if (startTargetHelps || startTargetHelpsOrder || startTargetHelpsStatus) { - //String appTheme = ApplicationPreferences.applicationTheme(activity, true); int outerCircleColor = R.color.tabTargetHelpOuterCircleColor; -// if (appTheme.equals("dark")) -// outerCircleColor = R.color.tabTargetHelpOuterCircleColor_dark; int targetCircleColor = R.color.tabTargetHelpTargetCircleColor; -// if (appTheme.equals("dark")) -// targetCircleColor = R.color.tabTargetHelpTargetCircleColor_dark; int titleTextColor = R.color.tabTargetHelpTitleTextColor; int descriptionTextColor = R.color.tabTargetHelpDescriptionTextColor; -// if (appTheme.equals("dark")) -// textColor = R.color.tabTargetHelpTextColor_dark; - //boolean tintTarget = !appTheme.equals("white"); //Log.d("EditorEventListAdapter.showTargetHelps", "PREF_START_TARGET_HELPS=true"); Rect eventItemTarget = new Rect(0, 0, listItemView.getHeight(), listItemView.getHeight()); int[] screenLocation = new int[2]; listItemView.getLocationOnScreen(screenLocation); - //listItemView.getLocationInWindow(screenLocation); final TapTargetSequence sequence = new TapTargetSequence(activity); + List targets = new ArrayList<>(); if (startTargetHelps) { @@ -418,6 +409,7 @@ void showTargetHelps(Activity activity, /*EditorEventListFragment fragment,*/ Vi if (filterType == EditorEventListFragment.FILTER_TYPE_START_ORDER) { View view = listItemView.findViewById(R.id.event_list_drag_handle); + //noinspection DataFlowIssue eventItemTarget.offset(screenLocation[0] + 80 + view.getWidth(), screenLocation[1]); editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_ADAPTER_START_TARGET_HELPS_ORDER, false); @@ -427,49 +419,77 @@ void showTargetHelps(Activity activity, /*EditorEventListFragment fragment,*/ Vi // do not add it again startTargetHelpsOrder = false; - sequence.targets( + targets.add( TapTarget.forBounds(eventItemTarget, activity.getString(R.string.editor_activity_targetHelps_eventPreferences_title), activity.getString(R.string.editor_activity_targetHelps_eventPreferences_description)) .transparentTarget(true) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) - .id(1), + .id(1) + ); + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.event_list_item_edit_menu), activity.getString(R.string.editor_activity_targetHelps_eventMenu_title), activity.getString(R.string.editor_activity_targetHelps_eventMenu_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) - .id(2), + .id(2) + ); + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.event_list_item_ignore_manual_activation), activity.getString(R.string.editor_activity_targetHelps_ignoreManualActivation_title), activity.getString(R.string.editor_activity_targetHelps_ignoreManualActivation_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) - .id(3), + .id(3) + ); + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.event_list_drag_handle), activity.getString(R.string.editor_activity_targetHelps_eventOrderHandler_title), activity.getString(R.string.editor_activity_targetHelps_eventOrderHandler_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) - .id(4), + .id(4) + ); + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.event_list_item_status), activity.getString(R.string.editor_activity_targetHelps_eventStatusIcon_title), activity.getString(R.string.editor_activity_targetHelps_eventStatusIcon_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(false) .drawShadow(true) @@ -478,40 +498,61 @@ void showTargetHelps(Activity activity, /*EditorEventListFragment fragment,*/ Vi } else { eventItemTarget.offset(screenLocation[0] + 80, screenLocation[1]); - sequence.targets( + targets.add( TapTarget.forBounds(eventItemTarget, activity.getString(R.string.editor_activity_targetHelps_eventPreferences_title), activity.getString(R.string.editor_activity_targetHelps_eventPreferences_description)) .transparentTarget(true) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) - .id(1), + .id(1) + ); + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.event_list_item_edit_menu), activity.getString(R.string.editor_activity_targetHelps_eventMenu_title), activity.getString(R.string.editor_activity_targetHelps_eventMenu_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) - .id(2), + .id(2) + ); + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.event_list_item_ignore_manual_activation), activity.getString(R.string.editor_activity_targetHelps_ignoreManualActivation_title), activity.getString(R.string.editor_activity_targetHelps_ignoreManualActivation_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) - .id(3), + .id(3) + ); + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.event_list_item_status), activity.getString(R.string.editor_activity_targetHelps_eventStatusIcon_title), activity.getString(R.string.editor_activity_targetHelps_eventStatusIcon_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(false) .drawShadow(true) @@ -527,12 +568,16 @@ void showTargetHelps(Activity activity, /*EditorEventListFragment fragment,*/ Vi editor.apply(); ApplicationPreferences.prefEditorEventsAdapterStartTargetHelpsOrder = false; - sequence.targets( + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.event_list_drag_handle), activity.getString(R.string.editor_activity_targetHelps_eventOrderHandler_title), activity.getString(R.string.editor_activity_targetHelps_eventOrderHandler_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -547,12 +592,16 @@ void showTargetHelps(Activity activity, /*EditorEventListFragment fragment,*/ Vi editor.apply(); ApplicationPreferences.prefEditorEventsAdapterStartTargetHelpsStatus= false; - sequence.targets( + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.event_list_item_status), activity.getString(R.string.editor_activity_targetHelps_eventStatusIcon_title), activity.getString(R.string.editor_activity_targetHelps_eventStatusIcon_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(false) .drawShadow(true) @@ -565,15 +614,10 @@ void showTargetHelps(Activity activity, /*EditorEventListFragment fragment,*/ Vi // to the sequence @Override public void onSequenceFinish() { - //targetHelpsSequenceStarted = false; - SharedPreferences.Editor editor = ApplicationPreferences.getEditor(activity.getApplicationContext()); editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_FRAGMENT_START_TARGET_HELPS_FINISHED, true); - //editor.putBoolean(EditorEventListAdapter.PREF_START_TARGET_HELPS_FINISHED, true); editor.apply(); ApplicationPreferences.prefEditorEventsFragmentStartTargetHelpsFinished = true; - //ApplicationPreferences.prefEditorEventsAdapterStartTargetHelpsFinished = true; - } @Override @@ -583,14 +627,11 @@ public void onSequenceStep(TapTarget lastTarget, boolean targetClicked) { @Override public void onSequenceCanceled(TapTarget lastTarget) { - //targetHelpsSequenceStarted = false; - SharedPreferences.Editor editor = ApplicationPreferences.getEditor(activity.getApplicationContext()); editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_FRAGMENT_START_TARGET_HELPS, false); editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_ADAPTER_START_TARGET_HELPS, false); editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_FRAGMENT_START_TARGET_HELPS_FINISHED, true); - //editor.putBoolean(EditorEventListAdapter.PREF_START_TARGET_HELPS_FINISHED, true); editor.apply(); @@ -598,18 +639,16 @@ public void onSequenceCanceled(TapTarget lastTarget) { ApplicationPreferences.prefEditorEventsAdapterStartTargetHelps = false; ApplicationPreferences.prefEditorEventsFragmentStartTargetHelpsFinished = true; - //ApplicationPreferences.prefEditorEventsAdapterStartTargetHelpsFinished = true; - } }); sequence.continueOnCancel(true) .considerOuterCircleCanceled(true); - //targetHelpsSequenceStarted = true; - //SharedPreferences.Editor editor = ApplicationPreferences.getEditor(activity.getApplicationContext()); - //editor.putBoolean(EditorEventListAdapter.PREF_START_TARGET_HELPS_FINISHED, false); - //editor.apply(); - //ApplicationPreferences.prefEditorEventsAdapterStartTargetHelpsFinished = false; + for (TapTarget target : targets) { + target.setDrawBehindStatusBar(true); + target.setDrawBehindNavigationBar(true); + } + sequence.targets(targets); sequence.start(); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorEventListFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorEventListFragment.java index de453af1b5..6929ac8801 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorEventListFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorEventListFragment.java @@ -34,7 +34,6 @@ import androidx.appcompat.widget.AppCompatSpinner; import androidx.appcompat.widget.Toolbar; import androidx.core.app.NotificationManagerCompat; -import androidx.core.content.ContextCompat; import androidx.fragment.app.Fragment; import androidx.recyclerview.widget.ItemTouchHelper; import androidx.recyclerview.widget.LinearLayoutManager; @@ -201,6 +200,7 @@ private void doOnViewCreated(View view, boolean fromOnViewCreated) { profilePrefIndicatorImageView = view.findViewById(R.id.editor_events_activated_profile_pref_indicator); if (!ApplicationPreferences.applicationEditorPrefIndicator) + //noinspection DataFlowIssue profilePrefIndicatorImageView.setVisibility(GONE); activeProfileName = view.findViewById(R.id.editor_events_activated_profile_name); @@ -209,6 +209,7 @@ private void doOnViewCreated(View view, boolean fromOnViewCreated) RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity()); listView = view.findViewById(R.id.editor_events_list); //listView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL)); + //noinspection DataFlowIssue listView.setLayoutManager(layoutManager); listView.setHasFixedSize(true); @@ -219,8 +220,9 @@ private void doOnViewCreated(View view, boolean fromOnViewCreated) if (GlobalGUIRoutines.areSystemAnimationsEnabled(getActivity().getApplicationContext())) { if (ApplicationPreferences.applicationEditorHideHeaderOrBottomBar || getResources().getBoolean(R.bool.forceHideHeaderOrBottomBar)) { - final LayoutTransition layoutTransition = ((ViewGroup) view.findViewById(R.id.layout_events_list_fragment)) - .getLayoutTransition(); + ViewGroup eventListFragmnet = view.findViewById(R.id.layout_events_list_fragment); + //noinspection DataFlowIssue + final LayoutTransition layoutTransition = eventListFragmnet.getLayoutTransition(); layoutTransition.enableTransitionType(LayoutTransition.CHANGING); //layoutTransition.setDuration(500); @@ -337,8 +339,10 @@ public void onShow() { LinearLayout bottomBarOrderRoot = view.findViewById(R.id.editor_events_list_bottom_bar_order_root); if (filterType == EditorEventListFragment.FILTER_TYPE_START_ORDER) + //noinspection DataFlowIssue bottomBarOrderRoot.setVisibility(View.INVISIBLE); // MUST BE INVISIBLE, required for showTargetHelps(). else + //noinspection DataFlowIssue bottomBarOrderRoot.setVisibility(VISIBLE); orderSpinner = view.findViewById(R.id.editor_events_list_bottom_bar_order); @@ -349,6 +353,7 @@ public void onShow() { // orderSpinner.setVisibility(VISIBLE); TextView orderLabel = view.findViewById(R.id.editor_events_list_bottom_bar_order_title); + //noinspection DataFlowIssue orderLabel.setText(getString(R.string.editor_drawer_title_events_order) + ":"); String[] orderItems = new String[] { @@ -359,13 +364,13 @@ public void onShow() { getString(R.string.editor_drawer_order_priority) }; - HighlightedSpinnerAdapter orderSpinnerAdapter = new HighlightedSpinnerAdapter( + PPSpinnerAdapter orderSpinnerAdapter = new PPSpinnerAdapter( activity, - R.layout.spinner_highlighted_order, + R.layout.ppp_spinner_order, orderItems); - orderSpinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + orderSpinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); orderSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background); - orderSpinner.setBackgroundTintList(ContextCompat.getColorStateList(activity/*.getBaseContext()*/, R.color.highlighted_spinner_all_editor)); + //orderSpinner.setBackgroundTintList(ContextCompat.getColorStateList(activity/*.getBaseContext()*/, R.color.highlighted_spinner_all_editor)); orderSpinner.setAdapter(orderSpinnerAdapter); orderSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { @@ -373,7 +378,7 @@ public void onItemSelected(AdapterView parent, View view, int position, long if (orderSpinner.getAdapter() != null) { //if (orderSpinner.getAdapter().getCount() <= position) // position = 0; - ((HighlightedSpinnerAdapter) orderSpinner.getAdapter()).setSelection(position); + ((PPSpinnerAdapter) orderSpinner.getAdapter()).setSelection(position); } if (position != orderSelectedItem) changeEventOrder(position, false); @@ -1028,6 +1033,7 @@ private void deleteEventWithAlert(Event event) true, true, false, false, true, + false, getActivity() ); @@ -1095,6 +1101,7 @@ private void deleteAllEvents() true, true, false, false, true, + false, getActivity() ); @@ -1514,9 +1521,6 @@ void showTargetHelps() { if (getActivity() == null) return; - //if (((EditorActivity)getActivity()).targetHelpsSequenceStarted) - // return; - boolean startTargetHelpsFinished = ApplicationPreferences.prefEditorActivityStartTargetHelpsFinished; if (!startTargetHelpsFinished) return; @@ -1548,24 +1552,10 @@ void showTargetHelps() { if (filterType != FILTER_TYPE_START_ORDER) ApplicationPreferences.prefEditorEventsFragmentStartTargetHelpsOrderSpinner = false; - //String appTheme = ApplicationPreferences.applicationTheme(getActivity(), true); int outerCircleColor = R.color.tabTargetHelpOuterCircleColor; -// if (appTheme.equals("dark")) -// outerCircleColor = R.color.tabTargetHelpOuterCircleColor_dark; int targetCircleColor = R.color.tabTargetHelpTargetCircleColor; -// if (appTheme.equals("dark")) -// targetCircleColor = R.color.tabTargetHelpTargetCircleColor_dark; int titleTextColor = R.color.tabTargetHelpTitleTextColor; int descriptionTextColor = R.color.tabTargetHelpDescriptionTextColor; -// if (appTheme.equals("dark")) -// textColor = R.color.tabTargetHelpTextColor_dark; - //boolean tintTarget = !appTheme.equals("white"); - - //int[] screenLocation = new int[2]; - //orderSpinner.getLocationOnScreen(screenLocation); - //orderSpinner.getLocationInWindow(screenLocation); - //Rect orderSpinnerTarget = new Rect(0, 0, orderSpinner.getHeight(), orderSpinner.getHeight()); - //orderSpinnerTarget.offset(screenLocation[0] + 100, screenLocation[1]); final TapTargetSequence sequence = new TapTargetSequence(getActivity()); List targets = new ArrayList<>(); @@ -1579,6 +1569,9 @@ void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -1596,6 +1589,9 @@ void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -1613,6 +1609,9 @@ void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -1629,6 +1628,9 @@ void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -1647,6 +1649,9 @@ void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -1668,6 +1673,9 @@ void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -1680,14 +1688,17 @@ void showTargetHelps() { } } + for (TapTarget target : targets) { + target.setDrawBehindStatusBar(true); + target.setDrawBehindNavigationBar(true); + } + sequence.targets(targets) .listener(new TapTargetSequence.Listener() { // This listener will tell us when interesting(tm) events happen in regards // to the sequence @Override public void onSequenceFinish() { - //targetHelpsSequenceStarted = false; - SharedPreferences.Editor editor = ApplicationPreferences.getEditor(activityDataWrapper.context); editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_FRAGMENT_START_TARGET_HELPS_FINISHED, true); editor.apply(); @@ -1703,7 +1714,6 @@ public void onSequenceStep(TapTarget lastTarget, boolean targetClicked) { @Override public void onSequenceCanceled(TapTarget lastTarget) { - //targetHelpsSequenceStarted = false; SharedPreferences.Editor editor = ApplicationPreferences.getEditor(activityDataWrapper.context); editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_ADAPTER_START_TARGET_HELPS, false); if (filterType == FILTER_TYPE_START_ORDER) @@ -1711,7 +1721,6 @@ public void onSequenceCanceled(TapTarget lastTarget) { editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_ADAPTER_START_TARGET_HELPS_STATUS, false); editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_FRAGMENT_START_TARGET_HELPS_FINISHED, true); - //editor.putBoolean(EditorEventListAdapter.PREF_START_TARGET_HELPS_FINISHED, true); editor.apply(); @@ -1721,12 +1730,10 @@ public void onSequenceCanceled(TapTarget lastTarget) { ApplicationPreferences.prefEditorEventsAdapterStartTargetHelpsStatus = false; ApplicationPreferences.prefEditorEventsFragmentStartTargetHelpsFinished = true; - //ApplicationPreferences.prefEditorEventsAdapterStartTargetHelpsFinished = true; } }); sequence.continueOnCancel(true) .considerOuterCircleCanceled(true); - //targetHelpsSequenceStarted = true; editor = ApplicationPreferences.getEditor(activityDataWrapper.context); editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_FRAGMENT_START_TARGET_HELPS_FINISHED, false); @@ -1767,17 +1774,14 @@ private void showAdapterTargetHelps() { if ((eventListAdapter != null) && (itemView != null)) eventListAdapter.showTargetHelps(getActivity(), /*this,*/ itemView); else { - //targetHelpsSequenceStarted = false; SharedPreferences.Editor editor = ApplicationPreferences.getEditor(getActivity().getApplicationContext()); editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_ADAPTER_START_TARGET_HELPS, false); if (filterType == FILTER_TYPE_START_ORDER) editor.putBoolean(PPApplication.PREF_EDITOR_EVENT_LIST_ADAPTER_START_TARGET_HELPS_ORDER, false); - //editor.putBoolean(EditorEventListAdapter.PREF_START_TARGET_HELPS_FINISHED, true); editor.apply(); ApplicationPreferences.prefEditorEventsAdapterStartTargetHelps = false; if (filterType == FILTER_TYPE_START_ORDER) ApplicationPreferences.prefEditorEventsAdapterStartTargetHelpsOrder = false; - //ApplicationPreferences.prefEditorEventsAdapterStartTargetHelpsFinished = true; } } @@ -2118,6 +2122,7 @@ protected Void doInBackground(Void... params) { DatabaseHandler.getInstance(dataWrapper.context).getDeviceBootStartTime(event); DatabaseHandler.getInstance(dataWrapper.context).getPeriodicStartTime(event); DatabaseHandler.getInstance(dataWrapper.context).getApplicationStartTime(event); + DatabaseHandler.getInstance(dataWrapper.context).getCallScreeningStartTime(event); } } @@ -2201,8 +2206,10 @@ protected void onPostExecute(Void result) //if (activatedProfileHeader.isVisibleToUser()) { TextView redText = fragment.activatedProfileHeader.findViewById(R.id.editor_events_activated_profile_red_text); if (redTextVisible) + //noinspection DataFlowIssue redText.setVisibility(View.VISIBLE); else + //noinspection DataFlowIssue redText.setVisibility(GONE); //} } catch (Exception e) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorEventListViewHolder.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorEventListViewHolder.java index 52baae4bfb..0de2eedb83 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorEventListViewHolder.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorEventListViewHolder.java @@ -72,6 +72,7 @@ class EditorEventListViewHolder extends RecyclerView.ViewHolder // don't delete this - it is workaround for set this LinearLayout non-clickable LinearLayout buttonsLayout = itemView.findViewById(R.id.event_list_item_buttons_root); + //noinspection DataFlowIssue buttonsLayout.setOnClickListener(v -> {}); itemView.setOnClickListener(this); @@ -94,7 +95,7 @@ void bindEvent(Event event) { //dataWrapper.invalidateDataWrapper(); int statusRes = R.drawable.ic_event_status_stop; //GlobalGUIRoutines.getThemeEventStopStatusIndicator(context); - int colorRes = R.color.event_status_stop; + int colorRes = R.color.eventStatusStopColor; /*if (!Event.getGlobalEventsRunning()) { if (_eventStatus != Event.ESTATUS_STOP) statusRes = R.drawable.ic_event_status_pause_manual_activation; @@ -105,25 +106,25 @@ void bindEvent(Event event) { case Event.ESTATUS_RUNNING: if (event._isInDelayEnd) { statusRes = R.drawable.ic_event_status_running_delay; - colorRes = R.color.altype_eventDelayStartEnd; + colorRes = R.color.altypeEventDelayStartEndColor; } else { statusRes = R.drawable.ic_event_status_running; - colorRes = R.color.altype_eventStart; + colorRes = R.color.altypeEventStartColor; } break; case Event.ESTATUS_PAUSE: if (/*!Event.getGlobalEventsRunning() ||*/ (manualProfileActivation && !event._ignoreManualActivation)) { statusRes = R.drawable.ic_event_status_pause_manual_activation; - colorRes = R.color.altype_eventEnd; + colorRes = R.color.altypeEventEndColor; } else if (event._isInDelayStart) { statusRes = R.drawable.ic_event_status_pause_delay; - colorRes = R.color.altype_eventDelayStartEnd; + colorRes = R.color.altypeEventDelayStartEndColor; } else { statusRes = R.drawable.ic_event_status_pause; - colorRes = R.color.altype_eventEnd; + colorRes = R.color.altypeEventEndColor; } break; case Event.ESTATUS_STOP: @@ -131,7 +132,7 @@ else if (event._isInDelayStart) { //noinspection ConstantConditions statusRes = R.drawable.ic_event_status_stop; //noinspection ConstantConditions - colorRes = R.color.event_status_stop; + colorRes = R.color.eventStatusStopColor; //statusRes = GlobalGUIRoutines.getThemeEventStopStatusIndicator(context); //else // statusRes = R.drawable.ic_event_status_stop_not_runnable; @@ -151,7 +152,7 @@ else if (event._isInDelayStart) { //else // eventName.setTypeface(null, Typeface.NORMAL); //eventName.setTextSize(15); - eventName.setTextColor(ContextCompat.getColor(context, R.color.error_color)); + eventName.setTextColor(ContextCompat.getColor(context, R.color.errorColor)); } else if (!EventStatic.getGlobalEventsRunning(context)/* || (manualProfileActivation && !event._ignoreManualActivation)*/) { @@ -487,6 +488,7 @@ else if (event._atEndDo == Event.EATENDDO_RESTART_EVENTS) int x = GlobalGUIRoutines.dpToPx(10); int y = 0; + //noinspection DataFlowIssue popup.showOnAnchor(activityView, RelativePopupWindow.VerticalPosition.CENTER, RelativePopupWindow.HorizontalPosition.ALIGN_LEFT, x, y, true); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorProfileListAdapter.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorProfileListAdapter.java index 63638d0335..36d9318876 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorProfileListAdapter.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorProfileListAdapter.java @@ -16,8 +16,10 @@ import com.getkeepsafe.taptargetview.TapTarget; import com.getkeepsafe.taptargetview.TapTargetSequence; +import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; +import java.util.List; class EditorProfileListAdapter extends RecyclerView.Adapter implements ItemTouchHelperAdapter @@ -380,10 +382,7 @@ public void clearView() { } - void showTargetHelps(final Activity activity, /*final EditorProfileListFragment fragment,*/ final View listItemView) { - //if (fragment.targetHelpsSequenceStarted) - // return; - + void showTargetHelps(final Activity activity, final View listItemView) { boolean startTargetHelpsFinished = ApplicationPreferences.prefEditorActivityStartTargetHelpsFinished && ApplicationPreferences.prefEditorProfilesFragmentStartTargetHelpsFinished; if (!startTargetHelpsFinished) @@ -397,20 +396,13 @@ void showTargetHelps(final Activity activity, /*final EditorProfileListFragment if (startTargetHelps || startTargetHelpsOrder || startTargetHelpsShowInActivator) { //Log.d("EditorProfileListAdapter.showTargetHelps", "PREF_START_TARGET_HELPS_ORDER=true"); - //String appTheme = ApplicationPreferences.applicationTheme(activity, true); int outerCircleColor = R.color.tabTargetHelpOuterCircleColor; -// if (appTheme.equals("dark")) -// outerCircleColor = R.color.tabTargetHelpOuterCircleColor_dark; int targetCircleColor = R.color.tabTargetHelpTargetCircleColor; -// if (appTheme.equals("dark")) -// targetCircleColor = R.color.tabTargetHelpTargetCircleColor_dark; int titleTextColor = R.color.tabTargetHelpTitleTextColor; int descriptionTextColor = R.color.tabTargetHelpDescriptionTextColor; -// if (appTheme.equals("dark")) -// textColor = R.color.tabTargetHelpTextColor_dark; - //boolean tintTarget = !appTheme.equals("white"); final TapTargetSequence sequence = new TapTargetSequence(activity); + List targets = new ArrayList<>(); if (startTargetHelps) { SharedPreferences.Editor editor = ApplicationPreferences.getEditor(activityDataWrapper.context); @@ -425,10 +417,10 @@ void showTargetHelps(final Activity activity, /*final EditorProfileListFragment Rect profileItemTarget = new Rect(0, 0, listItemView.getHeight(), listItemView.getHeight()); int[] screenLocation = new int[2]; listItemView.getLocationOnScreen(screenLocation); - //listItemView.getLocationInWindow(screenLocation); if (filterType == EditorProfileListFragment.FILTER_TYPE_SHOW_IN_ACTIVATOR) { View dragHandle = listItemView.findViewById(R.id.profile_list_drag_handle); + //noinspection DataFlowIssue profileItemTarget.offset(screenLocation[0] + 100 + dragHandle.getWidth(), screenLocation[1]); editor.putBoolean(PPApplication.PREF_EDITOR_PROFILE_LIST_ADAPTER_START_TARGET_HELPS_ORDER, false); @@ -438,40 +430,61 @@ void showTargetHelps(final Activity activity, /*final EditorProfileListFragment // do not add it again startTargetHelpsOrder = false; - sequence.targets( + targets.add( TapTarget.forBounds(profileItemTarget, activity.getString(R.string.editor_activity_targetHelps_profilePreferences_title), activity.getString(R.string.editor_activity_targetHelps_profilePreferences_description)) .transparentTarget(true) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) - .id(1), + .id(1) + ); + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.profile_list_item_show_in_activator), activity.getString(R.string.editor_activity_targetHelps_showInActivator_title), activity.getString(R.string.editor_activity_targetHelps_showInActivator_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) - .id(2), + .id(2) + ); + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.profile_list_item_edit_menu), activity.getString(R.string.editor_activity_targetHelps_profileMenu_title), activity.getString(R.string.editor_activity_targetHelps_profileMenu_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) - .id(3), + .id(3) + ); + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.profile_list_drag_handle), activity.getString(R.string.editor_activity_targetHelps_profileOrderHandler_title), activity.getString(R.string.editor_activity_targetHelps_profileOrderHandler_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -480,31 +493,46 @@ void showTargetHelps(final Activity activity, /*final EditorProfileListFragment } else if (filterType == EditorProfileListFragment.FILTER_TYPE_ALL) { profileItemTarget.offset(screenLocation[0] + 100, screenLocation[1]); - sequence.targets( + targets.add( TapTarget.forBounds(profileItemTarget, activity.getString(R.string.editor_activity_targetHelps_profilePreferences_title), activity.getString(R.string.editor_activity_targetHelps_profilePreferences_description)) .transparentTarget(true) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) - .id(1), + .id(1) + ); + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.profile_list_item_show_in_activator), activity.getString(R.string.editor_activity_targetHelps_showInActivator_title), activity.getString(R.string.editor_activity_targetHelps_showInActivator_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) - .id(2), + .id(2) + ); + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.profile_list_item_edit_menu), activity.getString(R.string.editor_activity_targetHelps_profileMenu_title), activity.getString(R.string.editor_activity_targetHelps_profileMenu_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -513,31 +541,46 @@ void showTargetHelps(final Activity activity, /*final EditorProfileListFragment } else { profileItemTarget.offset(screenLocation[0] + 100, screenLocation[1]); - sequence.targets( + targets.add( TapTarget.forBounds(profileItemTarget, activity.getString(R.string.editor_activity_targetHelps_profilePreferences_title), activity.getString(R.string.editor_activity_targetHelps_profilePreferences_description)) .transparentTarget(true) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) - .id(1), + .id(1) + ); + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.profile_list_item_show_in_activator), activity.getString(R.string.editor_activity_targetHelps_showInActivator_title), activity.getString(R.string.editor_activity_targetHelps_showInActivator_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) - .id(2), + .id(2) + ); + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.profile_list_item_edit_menu), activity.getString(R.string.editor_activity_targetHelps_profileMenu_title), activity.getString(R.string.editor_activity_targetHelps_profileMenu_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -554,12 +597,16 @@ void showTargetHelps(final Activity activity, /*final EditorProfileListFragment editor.apply(); ApplicationPreferences.prefEditorProfilesAdapterStartTargetHelpsOrder = false; - sequence.targets( + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.profile_list_drag_handle), activity.getString(R.string.editor_activity_targetHelps_profileOrderHandler_title), activity.getString(R.string.editor_activity_targetHelps_profileOrderHandler_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -574,12 +621,16 @@ void showTargetHelps(final Activity activity, /*final EditorProfileListFragment editor.apply(); ApplicationPreferences.prefEditorProfilesAdapterStartTargetHelpsShowInActivator = false; - sequence.targets( + //noinspection DataFlowIssue + targets.add( TapTarget.forView(listItemView.findViewById(R.id.profile_list_item_show_in_activator), activity.getString(R.string.editor_activity_targetHelps_showInActivator_title), activity.getString(R.string.editor_activity_targetHelps_showInActivator_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -596,11 +647,8 @@ public void onSequenceFinish() { SharedPreferences.Editor editor = ApplicationPreferences.getEditor(activity.getApplicationContext()); editor.putBoolean(PPApplication.PREF_EDITOR_PROFILE_LIST_FRAGMENT_START_TARGET_HELPS_FINISHED, true); - //editor.putBoolean(EditorProfileListAdapter.PREF_START_TARGET_HELPS_FINISHED, true); editor.apply(); ApplicationPreferences.prefEditorProfilesFragmentStartTargetHelpsFinished = true; - //ApplicationPreferences.prefEditorProfilesAdapterStartTargetHelpsFinished = true; - } @Override @@ -610,8 +658,6 @@ public void onSequenceStep(TapTarget lastTarget, boolean targetClicked) { @Override public void onSequenceCanceled(TapTarget lastTarget) { - //targetHelpsSequenceStarted = false; - SharedPreferences.Editor editor = ApplicationPreferences.getEditor(activity.getApplicationContext()); editor.putBoolean(PPApplication.PREF_EDITOR_PROFILE_LIST_FRAGMENT_START_TARGET_HELPS, false); editor.putBoolean(PPApplication.PREF_EDITOR_PROFILE_LIST_ADAPTER_START_TARGET_HELPS, false); @@ -624,18 +670,16 @@ public void onSequenceCanceled(TapTarget lastTarget) { ApplicationPreferences.prefEditorProfilesAdapterStartTargetHelps = false; ApplicationPreferences.prefEditorProfilesFragmentStartTargetHelpsFinished = true; - //ApplicationPreferences.prefEditorProfilesAdapterStartTargetHelpsFinished = true; - } }); sequence.continueOnCancel(true) .considerOuterCircleCanceled(true); - //targetHelpsSequenceStarted = true; - //SharedPreferences.Editor editor = ApplicationPreferences.getEditor(activity.getApplicationContext()); - //editor.putBoolean(EditorProfileListAdapter.PREF_START_TARGET_HELPS_FINISHED, false); - //editor.apply(); - //ApplicationPreferences.prefEditorProfilesAdapterStartTargetHelpsFinished = false; + for (TapTarget target : targets) { + target.setDrawBehindStatusBar(true); + target.setDrawBehindNavigationBar(true); + } + sequence.targets(targets); sequence.start(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorProfileListFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorProfileListFragment.java index ad862896ae..ac877ed826 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorProfileListFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorProfileListFragment.java @@ -168,6 +168,7 @@ private void doOnViewCreated(View view, boolean fromOnViewCreated) { profilePrefIndicatorImageView = view.findViewById(R.id.editor_profiles_activated_profile_pref_indicator); if (!ApplicationPreferences.applicationEditorPrefIndicator) + //noinspection DataFlowIssue profilePrefIndicatorImageView.setVisibility(GONE); activeProfileName = view.findViewById(R.id.editor_profiles_activated_profile_name); @@ -176,6 +177,7 @@ private void doOnViewCreated(View view, boolean fromOnViewCreated) RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getActivity()); listView = view.findViewById(R.id.editor_profiles_list); //listView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL)); + //noinspection DataFlowIssue listView.setLayoutManager(layoutManager); listView.setHasFixedSize(true); @@ -186,8 +188,9 @@ private void doOnViewCreated(View view, boolean fromOnViewCreated) if (GlobalGUIRoutines.areSystemAnimationsEnabled(getActivity().getApplicationContext())) { if (ApplicationPreferences.applicationEditorHideHeaderOrBottomBar || getResources().getBoolean(R.bool.forceHideHeaderOrBottomBar)) { - final LayoutTransition layoutTransition = ((ViewGroup) view.findViewById(R.id.layout_profiles_list_fragment)) - .getLayoutTransition(); + ViewGroup profilesListFragment = view.findViewById(R.id.layout_profiles_list_fragment); + //noinspection DataFlowIssue + final LayoutTransition layoutTransition = profilesListFragment.getLayoutTransition(); layoutTransition.enableTransitionType(LayoutTransition.CHANGING); listView.addOnScrollListener(new HidingRecyclerViewScrollListener(1) { @@ -819,6 +822,7 @@ private void deleteProfileWithAlert(Profile profile) true, true, false, false, true, + false, getActivity() ); @@ -890,6 +894,7 @@ private void deleteAllProfiles() true, true, false, false, true, + false, getActivity() ); @@ -1322,9 +1327,6 @@ void showTargetHelps() { if (getActivity() == null) return; - //if (((EditorActivity)getActivity()).targetHelpsSequenceStarted) - // return; - boolean startTargetHelpsFinished = ApplicationPreferences.prefEditorActivityStartTargetHelpsFinished; if (!startTargetHelpsFinished) return; @@ -1353,18 +1355,10 @@ void showTargetHelps() { ApplicationPreferences.prefEditorProfilesFragmentStartTargetHelpsFilterSpinner = false; ApplicationPreferences.prefEditorFragmentStartTargetHelpsDefaultProfile = false; - //String appTheme = ApplicationPreferences.applicationTheme(getActivity(), true); int outerCircleColor = R.color.tabTargetHelpOuterCircleColor; -// if (appTheme.equals("dark")) -// outerCircleColor = R.color.tabTargetHelpOuterCircleColor_dark; int targetCircleColor = R.color.tabTargetHelpTargetCircleColor; -// if (appTheme.equals("dark")) -// targetCircleColor = R.color.tabTargetHelpTargetCircleColor_dark; int titleTextColor = R.color.tabTargetHelpTitleTextColor; int descriptionTextColor = R.color.tabTargetHelpDescriptionTextColor; -// if (appTheme.equals("dark")) -// textColor = R.color.tabTargetHelpTextColor_dark; - //boolean tintTarget = !appTheme.equals("white"); final TapTargetSequence sequence = new TapTargetSequence(getActivity()); List targets = new ArrayList<>(); @@ -1378,6 +1372,9 @@ void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -1395,6 +1392,9 @@ void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -1412,6 +1412,9 @@ void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -1428,6 +1431,9 @@ void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -1446,6 +1452,9 @@ void showTargetHelps() { .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -1457,14 +1466,17 @@ void showTargetHelps() { } } + for (TapTarget target : targets) { + target.setDrawBehindStatusBar(true); + target.setDrawBehindNavigationBar(true); + } + sequence.targets(targets) .listener(new TapTargetSequence.Listener() { // This listener will tell us when interesting(tm) events happen in regards // to the sequence @Override public void onSequenceFinish() { - //targetHelpsSequenceStarted = false; - SharedPreferences.Editor editor = ApplicationPreferences.getEditor(activityDataWrapper.context); editor.putBoolean(PPApplication.PREF_EDITOR_PROFILE_LIST_FRAGMENT_START_TARGET_HELPS_FINISHED, true); editor.apply(); @@ -1480,7 +1492,6 @@ public void onSequenceStep(TapTarget lastTarget, boolean targetClicked) { @Override public void onSequenceCanceled(TapTarget lastTarget) { - //targetHelpsSequenceStarted = false; SharedPreferences.Editor editor = ApplicationPreferences.getEditor(activityDataWrapper.context); editor.putBoolean(PPApplication.PREF_EDITOR_PROFILE_LIST_FRAGMENT_START_TARGET_HELPS, false); @@ -1491,7 +1502,6 @@ public void onSequenceCanceled(TapTarget lastTarget) { editor.putBoolean(PPApplication.PREF_EDITOR_PROFILE_LIST_ADAPTER_START_TARGET_HELPS_SHOW_IN_ACTIVATOR, false); editor.putBoolean(PPApplication.PREF_EDITOR_PROFILE_LIST_FRAGMENT_START_TARGET_HELPS_FINISHED, true); - //editor.putBoolean(EditorProfileListAdapter.PREF_START_TARGET_HELPS_FINISHED, true); editor.apply(); @@ -1503,12 +1513,10 @@ public void onSequenceCanceled(TapTarget lastTarget) { ApplicationPreferences.prefEditorProfilesAdapterStartTargetHelpsShowInActivator = false; ApplicationPreferences.prefEditorProfilesFragmentStartTargetHelpsFinished = true; - //ApplicationPreferences.prefEditorProfilesAdapterStartTargetHelpsFinished = true; } }); sequence.continueOnCancel(true) .considerOuterCircleCanceled(true); - //targetHelpsSequenceStarted = true; editor = ApplicationPreferences.getEditor(activityDataWrapper.context); editor.putBoolean(PPApplication.PREF_EDITOR_PROFILE_LIST_FRAGMENT_START_TARGET_HELPS_FINISHED, false); @@ -1551,13 +1559,10 @@ private void showAdapterTargetHelps() { if ((profileListAdapter != null) && (itemView != null)) profileListAdapter.showTargetHelps(getActivity(), /*this,*/ itemView); else { - //targetHelpsSequenceStarted = false; SharedPreferences.Editor editor = ApplicationPreferences.getEditor(activityDataWrapper.context); editor.putBoolean(PPApplication.PREF_EDITOR_PROFILE_LIST_ADAPTER_START_TARGET_HELPS, false); - //editor.putBoolean(EditorProfileListAdapter.PREF_START_TARGET_HELPS_FINISHED, true); editor.apply(); ApplicationPreferences.prefEditorProfilesAdapterStartTargetHelps = false; - //ApplicationPreferences.prefEditorProfilesAdapterStartTargetHelpsFinished = true; } } @@ -1721,8 +1726,10 @@ protected void onPostExecute(Void result) //if (activatedProfileHeader.isVisibleToUser()) { TextView redText = fragment.activatedProfileHeader.findViewById(R.id.editor_profiles_activated_profile_red_text); if (redTextVisible) + //noinspection DataFlowIssue redText.setVisibility(View.VISIBLE); else + //noinspection DataFlowIssue redText.setVisibility(GONE); //} } catch (Exception e) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorProfileListViewHolder.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorProfileListViewHolder.java index 6fad8d0f0c..2ac6b705e5 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorProfileListViewHolder.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorProfileListViewHolder.java @@ -55,6 +55,7 @@ class EditorProfileListViewHolder extends RecyclerView.ViewHolder // don't delete this - it is workaround for set this LinearLayout non-clickable LinearLayout buttonsLayout = itemView.findViewById(R.id.profile_list_item_buttons_root); + //noinspection DataFlowIssue buttonsLayout.setOnClickListener(v -> {}); itemView.setOnClickListener(this); @@ -85,7 +86,7 @@ void bindProfile(Profile profile) { if (ProfileStatic.isRedTextNotificationRequired(profile, false, context)){ profileName.setTypeface(null, Typeface.BOLD); //profileName.setTextSize(15); - profileName.setTextColor(ContextCompat.getColor(context, R.color.error_color)); + profileName.setTextColor(ContextCompat.getColor(context, R.color.errorColor)); } else { profileName.setTypeface(null, Typeface.BOLD); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Event.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Event.java index a9c6e814df..4001bf6f73 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Event.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Event.java @@ -89,6 +89,7 @@ class Event { EventPreferencesRoaming _eventPreferencesRoaming; EventPreferencesVPN _eventPreferencesVPN; EventPreferencesMusic _eventPreferencesMusic; + EventPreferencesCallScreening _eventPreferencesCallScreening; Spanned _peferencesDecription; @@ -341,7 +342,7 @@ private void createEventPreferencesBattery() private void createEventPreferencesCall() { - this._eventPreferencesCall = new EventPreferencesCall(this, false, 0, "", "", 0, false, 5, 0); + this._eventPreferencesCall = new EventPreferencesCall(this, false, 0, "", "", 0, false, 5, 0, false, ""); } private void createEventPreferencesAccessories() @@ -475,6 +476,11 @@ private void createEventPreferencesMusic() this._eventPreferencesMusic = new EventPreferencesMusic(this, false, 0, ""); } + private void createEventPreferencesCallScreening() + { + this._eventPreferencesCallScreening = new EventPreferencesCallScreening(this, false, 0, "", "", /*0,*/false, false, false, "", false, 5); + } + void createEventPreferences() { createEventPreferencesTime(); @@ -503,6 +509,7 @@ void createEventPreferences() createEventPreferencesRoaming(); createEventPreferencesVPN(); createEventPreferencesMusic(); + createEventPreferencesCallScreening(); } void copyEventPreferences(Event fromEvent) @@ -559,6 +566,8 @@ void copyEventPreferences(Event fromEvent) createEventPreferencesVPN(); if (this._eventPreferencesMusic == null) createEventPreferencesMusic(); + if (this._eventPreferencesCallScreening == null) + createEventPreferencesCallScreening(); this._eventPreferencesTime.copyPreferences(fromEvent); this._eventPreferencesBattery.copyPreferences(fromEvent); this._eventPreferencesCall.copyPreferences(fromEvent); @@ -585,78 +594,82 @@ void copyEventPreferences(Event fromEvent) this._eventPreferencesRoaming.copyPreferences(fromEvent); this._eventPreferencesVPN.copyPreferences(fromEvent); this._eventPreferencesMusic.copyPreferences(fromEvent); + this._eventPreferencesCallScreening.copyPreferences(fromEvent); } boolean isEnabledSomeSensor(Context context) { Context appContext = context.getApplicationContext(); return (this._eventPreferencesTime._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesTime.PREF_EVENT_TIME_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesTime.PREF_EVENT_TIME_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesBattery._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesBattery.PREF_EVENT_BATTERY_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesBattery.PREF_EVENT_BATTERY_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesCall._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesCall.PREF_EVENT_CALL_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesCall.PREF_EVENT_CALL_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesAccessories._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesAccessories.PREF_EVENT_ACCESSORIES_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesAccessories.PREF_EVENT_ACCESSORIES_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesCalendar._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesCalendar.PREF_EVENT_CALENDAR_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesCalendar.PREF_EVENT_CALENDAR_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesWifi._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesScreen._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesScreen.PREF_EVENT_SCREEN_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesScreen.PREF_EVENT_SCREEN_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesBrightness._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesBrightness.PREF_EVENT_BRIGHTNESS_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesBrightness.PREF_EVENT_BRIGHTNESS_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesBluetooth._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesSMS._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesSMS.PREF_EVENT_SMS_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesSMS.PREF_EVENT_SMS_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesNotification._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesNotification.PREF_EVENT_NOTIFICATION_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesNotification.PREF_EVENT_NOTIFICATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesApplication._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesApplication.PREF_EVENT_APPLICATION_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesApplication.PREF_EVENT_APPLICATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesLocation._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesLocation.PREF_EVENT_LOCATION_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesLocation.PREF_EVENT_LOCATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesOrientation._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesOrientation.PREF_EVENT_ORIENTATION_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesOrientation.PREF_EVENT_ORIENTATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesMobileCells._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesNFC._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesNFC.PREF_EVENT_NFC_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesNFC.PREF_EVENT_NFC_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesRadioSwitch._enabled && (this._eventPreferencesRadioSwitch._wifi != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_WIFI, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_WIFI, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesRadioSwitch._enabled && (this._eventPreferencesRadioSwitch._bluetooth != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_BLUETOOTH, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_BLUETOOTH, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesRadioSwitch._enabled && (this._eventPreferencesRadioSwitch._simOnOff != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_SIM_ON_OFF, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_SIM_ON_OFF, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesRadioSwitch._enabled && (this._eventPreferencesRadioSwitch._defaultSIMForCalls != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesRadioSwitch._enabled && (this._eventPreferencesRadioSwitch._defaultSIMForSMS != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesRadioSwitch._enabled && (this._eventPreferencesRadioSwitch._mobileData != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_MOBILE_DATA, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_MOBILE_DATA, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesRadioSwitch._enabled && (this._eventPreferencesRadioSwitch._gps != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_GPS, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_GPS, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesRadioSwitch._enabled && (this._eventPreferencesRadioSwitch._nfc != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_NFC, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_NFC, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesRadioSwitch._enabled && (this._eventPreferencesRadioSwitch._airplaneMode != 0) && - (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_AIRPLANE_MODE, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_AIRPLANE_MODE, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesAlarmClock._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesAlarmClock.PREF_EVENT_ALARM_CLOCK_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesAlarmClock.PREF_EVENT_ALARM_CLOCK_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesDeviceBoot._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesDeviceBoot.PREF_EVENT_DEVICE_BOOT_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesDeviceBoot.PREF_EVENT_DEVICE_BOOT_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesSoundProfile._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesSoundProfile.PREF_EVENT_SOUND_PROFILE_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesSoundProfile.PREF_EVENT_SOUND_PROFILE_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesPeriodic._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesPeriodic.PREF_EVENT_PERIODIC_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesPeriodic.PREF_EVENT_PERIODIC_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesVolumes._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesVolumes.PREF_EVENT_VOLUMES_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesVolumes.PREF_EVENT_VOLUMES_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesActivatedProfile._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesActivatedProfile.PREF_EVENT_ACTIVATED_PROFILE_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesActivatedProfile.PREF_EVENT_ACTIVATED_PROFILE_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesRoaming._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesRoaming.PREF_EVENT_ROAMING_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesRoaming.PREF_EVENT_ROAMING_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesVPN._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesVPN.PREF_EVENT_VPN_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (EventStatic.isEventPreferenceAllowed(EventPreferencesVPN.PREF_EVENT_VPN_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || (this._eventPreferencesMusic._enabled && - (EventStatic.isEventPreferenceAllowed(EventPreferencesMusic.PREF_EVENT_MUSIC_ENABLED, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)); + (EventStatic.isEventPreferenceAllowed(EventPreferencesMusic.PREF_EVENT_MUSIC_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) || + (this._eventPreferencesCallScreening._enabled && + (EventStatic.isEventPreferenceAllowed(EventPreferencesCallScreening.PREF_EVENT_CALL_SCREENING_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) + ; } boolean isRunnable(Context context, boolean checkSomeSensorEnabled) { @@ -720,6 +733,8 @@ boolean isRunnable(Context context, boolean checkSomeSensorEnabled) { runnable = runnable && this._eventPreferencesVPN.isRunnable(appContext); if (this._eventPreferencesMusic._enabled) runnable = runnable && this._eventPreferencesMusic.isRunnable(appContext); + if (this._eventPreferencesCallScreening._enabled) + runnable = runnable && this._eventPreferencesCallScreening.isRunnable(appContext); return runnable; } @@ -785,6 +800,8 @@ boolean isAllConfigured(Context context, boolean checkSomeSensorEnabled) { isAllConfigured = isAllConfigured && this._eventPreferencesVPN.isAllConfigured(appContext); if (this._eventPreferencesMusic._enabled) isAllConfigured = isAllConfigured && this._eventPreferencesMusic.isAllConfigured(appContext); + if (this._eventPreferencesCallScreening._enabled) + isAllConfigured = isAllConfigured && this._eventPreferencesCallScreening.isAllConfigured(appContext); return isAllConfigured; } @@ -819,7 +836,8 @@ int isAccessibilityServiceEnabled(Context context, boolean checkSomeSensorEnable this._eventPreferencesActivatedProfile._enabled || this._eventPreferencesRoaming._enabled || this._eventPreferencesVPN._enabled || - this._eventPreferencesMusic._enabled; + this._eventPreferencesMusic._enabled || + this._eventPreferencesCallScreening._enabled; } if (someEnabled) { if (this._eventPreferencesTime._enabled) @@ -874,6 +892,8 @@ int isAccessibilityServiceEnabled(Context context, boolean checkSomeSensorEnable accessibilityEnabled = this._eventPreferencesVPN.isAccessibilityServiceEnabled(context, againCheckInDelay); if (this._eventPreferencesMusic._enabled) accessibilityEnabled = this._eventPreferencesMusic.isAccessibilityServiceEnabled(context, againCheckInDelay); + if (this._eventPreferencesCallScreening._enabled) + accessibilityEnabled = this._eventPreferencesCallScreening.isAccessibilityServiceEnabled(context, againCheckInDelay); } return accessibilityEnabled; @@ -938,6 +958,7 @@ void loadSharedPreferences(SharedPreferences preferences) this._eventPreferencesRoaming.loadSharedPreferences(preferences); this._eventPreferencesVPN.loadSharedPreferences(preferences); this._eventPreferencesMusic.loadSharedPreferences(preferences); + this._eventPreferencesCallScreening.loadSharedPreferences(preferences); editor.apply(); } @@ -1004,6 +1025,7 @@ void saveSharedPreferences(SharedPreferences preferences, Context context) this._eventPreferencesRoaming.saveSharedPreferences(preferences); this._eventPreferencesVPN.saveSharedPreferences(preferences); this._eventPreferencesMusic.saveSharedPreferences(preferences); + this._eventPreferencesCallScreening.saveSharedPreferences(preferences); if (!(this.isRunnable(context, true) && this.isAllConfigured(context, true))) this._status = ESTATUS_STOP; @@ -1278,13 +1300,13 @@ private void setCategorySummary(PreferenceManager prefMng, String key, SharedPre String profileName = dataWrapper.getProfileName(Long.parseLong(startWhenActivatedProfile)); if (profileName != null) { _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(profileName, !preference.isEnabled(), context)) + .append(EventPreferences.getColorForChangedPreferenceValue(profileName, !preference.isEnabled(), false, context)) .append(StringConstants.TAG_BOLD_END_HTML); } } else { _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(context.getString(R.string.profile_multiselect_summary_text_selected) + " " + splits.length, !preference.isEnabled(), context)) + .append(EventPreferences.getColorForChangedPreferenceValue(context.getString(R.string.profile_multiselect_summary_text_selected) + " " + splits.length, !preference.isEnabled(), false, context)) .append(StringConstants.TAG_BOLD_END_HTML); } dataWrapper.invalidateDataWrapper(); @@ -1293,7 +1315,7 @@ private void setCategorySummary(PreferenceManager prefMng, String key, SharedPre if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_delayStart)).append(StringConstants.STR_COLON_WITH_SPACE); _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(delayStart), !preference.isEnabled(), context)) + .append(EventPreferences.getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(delayStart), !preference.isEnabled(), false, context)) .append(StringConstants.TAG_BOLD_END_HTML); } if (notificationSoundStartChanged) { @@ -1308,7 +1330,7 @@ private void setCategorySummary(PreferenceManager prefMng, String key, SharedPre if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_notificationRepeat)).append(StringConstants.STR_COLON_WITH_SPACE); _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(repeatInterval), !preference.isEnabled(), context)) + .append(EventPreferences.getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(repeatInterval), !preference.isEnabled(), false, context)) .append(StringConstants.TAG_BOLD_END_HTML); } @@ -1335,7 +1357,7 @@ private void setCategorySummary(PreferenceManager prefMng, String key, SharedPre /*if (_value.length() > 0)*/ _value.append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_delayStart)).append(StringConstants.STR_COLON_WITH_SPACE); _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(delayEnd), !preference.isEnabled(), context)) + .append(EventPreferences.getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(delayEnd), !preference.isEnabled(), false, context)) .append(StringConstants.TAG_BOLD_END_HTML); } if (notificationSoundEndChanged) { @@ -1484,6 +1506,8 @@ void setSummary(PreferenceManager prefMng, _eventPreferencesVPN.setCategorySummary(prefMng, preferences, context); _eventPreferencesMusic.setSummary(prefMng, key, preferences, context); _eventPreferencesMusic.setCategorySummary(prefMng, preferences, context); + _eventPreferencesCallScreening.setSummary(prefMng, key, preferences, context); + _eventPreferencesCallScreening.setCategorySummary(prefMng, preferences, context); } } @@ -1573,6 +1597,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con _eventPreferencesVPN.setCategorySummary(prefMng, preferences, context); _eventPreferencesMusic.setAllSummary(prefMng, preferences, context); _eventPreferencesMusic.setCategorySummary(prefMng, preferences, context); + _eventPreferencesCallScreening.setAllSummary(prefMng, preferences, context); + _eventPreferencesCallScreening.setCategorySummary(prefMng, preferences, context); } String getPreferencesDescription(Context context, DataWrapper _dataWrapper, boolean addPassStatus) @@ -1659,6 +1685,12 @@ String getPreferencesDescription(Context context, DataWrapper _dataWrapper, bool _value.append(StringConstants.TAG_LIST_START_FIRST_ITEM_HTML).append(desc).append(StringConstants.TAG_LIST_END_LAST_ITEM_HTML); } + if (_eventPreferencesCallScreening._enabled) { + String desc = _eventPreferencesCallScreening.getPreferencesDescription(true, addPassStatus, false, context); + if (desc != null) + _value.append(StringConstants.TAG_LIST_START_FIRST_ITEM_HTML).append(desc).append(StringConstants.TAG_LIST_END_LAST_ITEM_HTML); + } + if (_eventPreferencesSMS._enabled) { String desc = _eventPreferencesSMS.getPreferencesDescription(true, addPassStatus, false, context); if (desc != null) @@ -1819,6 +1851,7 @@ void checkSensorsPreferences(PreferenceManager prefMng, boolean onlyCategory, Co _eventPreferencesRoaming.checkPreferences(prefMng, onlyCategory, context); _eventPreferencesVPN.checkPreferences(prefMng, onlyCategory, context); _eventPreferencesMusic.checkPreferences(prefMng, onlyCategory, context); + _eventPreferencesCallScreening.checkPreferences(prefMng, onlyCategory, context); } /* @@ -1881,6 +1914,7 @@ private void addEventTimeline(DataWrapper dataWrapper, eventTimelineList.add(eventTimeline); } + // !!! WARNING: call it olny from EventsHandler.doHandleEvent() !!! void startEvent(DataWrapper dataWrapper, //boolean ignoreGlobalPref, //boolean interactive, @@ -1889,20 +1923,30 @@ void startEvent(DataWrapper dataWrapper, //boolean log, Profile mergedProfile) { - // remove delay alarm - removeDelayStartAlarm(dataWrapper); // for start delay - removeDelayEndAlarm(dataWrapper); // for end delay - removeStartEventNotificationAlarm(dataWrapper); // for start repeating notification - if ((!EventStatic.getGlobalEventsRunning(dataWrapper.context))/* && (!ignoreGlobalPref)*/) // events are globally stopped return; if (!(this.isRunnable(dataWrapper.context, true) && this.isAllConfigured(dataWrapper.context, true))) { - // event is not runnable, no start it + // event is not runnable, no start it, but pause it + + // parameters as from EventsHandler.doHandleEvent() + //pauseEvent(dataWrapper, true, false, false, + // true, mergedProfile, !forRestartEvents, forRestartEvents, manualRestart, true); + + // parameters as from DataWrapper._activateProfile() but: + // do not allow restart events, do not activate return profile, do not call system event, + // do npt merge to mergedProfile + pauseEvent(dataWrapper, false, true, true, + true, null, false, forRestartEvents, manualRestart, true); return; } + // remove delay alarm + removeDelayStartAlarm(dataWrapper); // for start delay + removeDelayEndAlarm(dataWrapper); // for end delay + removeStartEventNotificationAlarm(dataWrapper); // for start repeating notification + //if (ApplicationPreferences.prefEventsBlocked) if (EventStatic.getEventsBlocked(dataWrapper.context)) { @@ -2327,9 +2371,10 @@ void pauseEvent(DataWrapper dataWrapper, // events are globally stopped return; - if (!(this.isRunnable(dataWrapper.context, true) && this.isAllConfigured(dataWrapper.context, true))) + // !!! Pause event even if is when not good configured !!! + //if (!(this.isRunnable(dataWrapper.context, true) && this.isAllConfigured(dataWrapper.context, true))) // event is not runnable, no pause it - return; + // return; /* if (PPApplication.getEventsBlocked(dataWrapper.context)) { @@ -2532,6 +2577,7 @@ void setSensorsWaiting() { _eventPreferencesRoaming.setSensorPassed(_eventPreferencesRoaming.getSensorPassed() | EventPreferences.SENSOR_PASSED_WAITING); _eventPreferencesVPN.setSensorPassed(_eventPreferencesVPN.getSensorPassed() | EventPreferences.SENSOR_PASSED_WAITING); _eventPreferencesMusic.setSensorPassed(_eventPreferencesMusic.getSensorPassed() | EventPreferences.SENSOR_PASSED_WAITING); + _eventPreferencesCallScreening.setSensorPassed(_eventPreferencesCallScreening.getSensorPassed() | EventPreferences.SENSOR_PASSED_WAITING); } private void setSystemEvent(Context context, int forStatus) @@ -2566,6 +2612,7 @@ private void setSystemEvent(Context context, int forStatus) _eventPreferencesRoaming.setSystemEventForStart(context); _eventPreferencesVPN.setSystemEventForStart(context); _eventPreferencesMusic.setSystemEventForStart(context); + _eventPreferencesCallScreening.setSystemEventForStart(context); } else if (forStatus == ESTATUS_RUNNING) @@ -2598,6 +2645,7 @@ private void setSystemEvent(Context context, int forStatus) _eventPreferencesRoaming.setSystemEventForPause(context); _eventPreferencesVPN.setSystemEventForPause(context); _eventPreferencesMusic.setSystemEventForPause(context); + _eventPreferencesCallScreening.setSystemEventForPause(context); } else if (forStatus == ESTATUS_STOP) @@ -2630,6 +2678,7 @@ private void setSystemEvent(Context context, int forStatus) _eventPreferencesRoaming.removeSystemEvent(context); _eventPreferencesVPN.removeSystemEvent(context); _eventPreferencesMusic.removeSystemEvent(context); + _eventPreferencesCallScreening.removeSystemEvent(context); } } @@ -3134,7 +3183,7 @@ void notifyEventStart(Context context, /*boolean playSound,*/ nText = nText + ". " + context.getString(R.string.start_event_notification_text2); PPApplicationStatic.createNotifyEventStartNotificationChannel(context.getApplicationContext(), false); mBuilder = new NotificationCompat.Builder(context.getApplicationContext(), PPApplication.NOTIFY_EVENT_START_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.information_color)) + .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.informationColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_information_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(context.getApplicationContext().getResources(), R.drawable.ic_information_notification)) .setContentTitle(nTitle) // title for notification @@ -3207,14 +3256,5 @@ void notifyEventEnd(Context context, /*boolean playSound,*/ //return false; } - String getColorForChangedPreferenceValue(String preferenceValue, boolean disabled, Context context) { - if (!disabled) { - int labelColor = ContextCompat.getColor(context, R.color.activityNormalTextColor); - String colorString = String.format(StringConstants.STR_FORMAT_INT, labelColor).substring(2); // !!strip alpha value!! - return String.format(StringConstants.TAG_FONT_COLOR_HTML/*+":"*/, colorString, preferenceValue); - } else - return preferenceValue; - } - } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventDelayEndBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventDelayEndBroadcastReceiver.java index 5139c88dc3..7fd08beeb8 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventDelayEndBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventDelayEndBroadcastReceiver.java @@ -29,7 +29,7 @@ static void doWork(boolean useHandler, Context context) { new int[]{EventsHandler.SENSOR_TYPE_EVENT_DELAY_END}, PPExecutors.SENSOR_NAME_SENSOR_TYPE_EVENT_DELAY_END, 0); } else { - // PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] EventDelayEndBroadcastReceiver.doWork", "sensorType=SENSOR_TYPE_EVENT_DELAY_END (2)"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] EventDelayEndBroadcastReceiver.doWork", "SENSOR_TYPE_EVENT_DELAY_END"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_EVENT_DELAY_END}); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventDelayStartBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventDelayStartBroadcastReceiver.java index 5890ce3c85..abea7ba61c 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventDelayStartBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventDelayStartBroadcastReceiver.java @@ -29,7 +29,7 @@ static void doWork(boolean useHandler, Context context) { new int[]{EventsHandler.SENSOR_TYPE_EVENT_DELAY_START}, PPExecutors.SENSOR_NAME_SENSOR_TYPE_EVENT_DELAY_START, 0); } else { -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] EventDelayStartBroadcastReceiver.doWork", "sensorType=SENSOR_TYPE_EVENT_DELAY_START (2)"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] EventDelayStartBroadcastReceiver.doWork", "SENSOR_TYPE_EVENT_DELAY_START"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_EVENT_DELAY_START}); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferences.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferences.java index 9e6d0cd134..fcd20c8321 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferences.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferences.java @@ -106,9 +106,13 @@ static String _getPassStatusString(int sensorPassed, String sensorTitle, Context } } - String getColorForChangedPreferenceValue(String preferenceValue, boolean disabled, Context context) { + static String getColorForChangedPreferenceValue(String preferenceValue, boolean disabled, boolean inEventList, Context context) { if (!disabled) { - int labelColor = ContextCompat.getColor(context, R.color.activityNormalTextColor); + int labelColor; + if (inEventList) + labelColor = ContextCompat.getColor(context, R.color.activityNormalTextColor); + else + labelColor = ContextCompat.getColor(context, R.color.preferenceSummaryValueColor); String colorString = String.format(StringConstants.STR_FORMAT_INT, labelColor).substring(2); // !!strip alpha value!! return String.format(StringConstants.TAG_FONT_COLOR_HTML/*+":"*/, colorString, preferenceValue); } else diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesAccessories.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesAccessories.java index c3cb00a7d9..90cf9f0aea 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesAccessories.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesAccessories.java @@ -88,7 +88,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_accessories_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_ACCESSORIES_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_ACCESSORIES_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_peripheral), addPassStatus, DatabaseHandler.ETYPE_ACCESSORY, context)); @@ -117,7 +117,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole selectedAccessory = value.toString(); } _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(selectedAccessory, disabled, context)) + .append(getColorForChangedPreferenceValue(selectedAccessory, disabled, addBullet, context)) .append(StringConstants.TAG_BOLD_END_HTML); } } @@ -211,8 +211,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_ACCESSORIES_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_ACCESSORIES_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesAccessories tmp = new EventPreferencesAccessories(this._event, this._enabled, this._accessoryType); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -283,7 +283,7 @@ void removeSystemEvent(Context context) void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesAccessories.PREF_EVENT_ACCESSORIES_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesAccessories.PREF_EVENT_ACCESSORIES_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (!this._accessoryType.isEmpty()) { String[] splits = this._accessoryType.split(StringConstants.STR_SPLIT_REGEX); for (String split : splits) { @@ -336,8 +336,9 @@ void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (bluetooth != null) { boolean isBluetoothEnabled = bluetooth.isEnabled(); boolean isHeadsetConnected = false; + List connectedDevices = BluetoothConnectionBroadcastReceiver.getConnectedDevices(eventsHandler.context); if (isBluetoothEnabled) { - boolean isBluetoothConnected = BluetoothConnectionBroadcastReceiver.isBluetoothConnected(null, ""); + boolean isBluetoothConnected = BluetoothConnectionBroadcastReceiver.isBluetoothConnected(connectedDevices, null, ""); if (isBluetoothConnected) isHeadsetConnected = BluetoothAdapter.STATE_CONNECTED == bluetooth.getProfileConnectionState(BluetoothProfile.HEADSET); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesActivatedProfile.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesActivatedProfile.java index d184365d67..b6b070bdbe 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesActivatedProfile.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesActivatedProfile.java @@ -74,7 +74,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_activated_profile_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_ACTIVATED_PROFILE_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_ACTIVATED_PROFILE_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_activated_profile), addPassStatus, DatabaseHandler.ETYPE_ACTIVATED_PROFILE, context)); @@ -84,18 +84,20 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(context.getString(R.string.event_preferences_activated_profile_startProfile)).append(StringConstants.STR_COLON_WITH_SPACE); DataWrapper dataWrapper = new DataWrapper(context, false, 0, false, 0, 0, 0f); String profileName = dataWrapper.getProfileName(this._startProfile); + //noinspection ReplaceNullCheck if (profileName != null) { - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(profileName, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(profileName, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } else { - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.profile_preference_profile_not_set), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.profile_preference_profile_not_set), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_activated_profile_endProfile)).append(StringConstants.STR_COLON_WITH_SPACE); profileName = dataWrapper.getProfileName(this._endProfile); + //noinspection ReplaceNullCheck if (profileName != null) { - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(profileName, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(profileName, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } else { - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.profile_preference_profile_not_set), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.profile_preference_profile_not_set), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } dataWrapper.invalidateDataWrapper(); } @@ -178,8 +180,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_ACTIVATED_PROFILE_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_ACTIVATED_PROFILE_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesActivatedProfile tmp = new EventPreferencesActivatedProfile(this._event, this._enabled, this._startProfile, this._endProfile); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -251,7 +253,7 @@ void removeSystemEvent(Context context) void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesActivatedProfile.PREF_EVENT_ACTIVATED_PROFILE_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesActivatedProfile.PREF_EVENT_ACTIVATED_PROFILE_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((this._startProfile != 0) && (this._endProfile != 0)) { eventsHandler.activatedProfilePassed = this._running == RUNNING_RUNNING; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesAlarmClock.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesAlarmClock.java index 04d842c2b8..ee3640692d 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesAlarmClock.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesAlarmClock.java @@ -87,7 +87,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_alarm_clock_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_ALARM_CLOCK_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_ALARM_CLOCK_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_alarm_clock), addPassStatus, DatabaseHandler.ETYPE_ALARM_CLOCK, context)); @@ -95,9 +95,9 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } if (this._permanentRun) - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_permanentRun), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_permanentRun), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); else - _value.append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._duration), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._duration), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); String selectedApplications = context.getString(R.string.applications_multiselect_summary_text_not_selected); if (!this._applications.isEmpty() && !this._applications.equals("-")) { @@ -110,7 +110,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole ApplicationInfo app; try { app = packageManager.getApplicationInfo(packageName, PackageManager.MATCH_ALL); - if (app != null) + //if (app != null) selectedApplications = packageManager.getApplicationLabel(app).toString(); } catch (Exception e) { selectedApplications = context.getString(R.string.applications_multiselect_summary_text_selected) + StringConstants.STR_COLON_WITH_SPACE + splits.length; @@ -127,7 +127,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } _value.append(StringConstants.STR_BULLET); - _value.append(context.getString(R.string.event_preferences_alarm_clock_applications)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedApplications, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.event_preferences_alarm_clock_applications)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedApplications, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } @@ -233,8 +233,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_ALARM_CLOCK_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_ALARM_CLOCK_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesAlarmClock tmp = new EventPreferencesAlarmClock(this._event, this._enabled, this._permanentRun, this._duration, this._applications); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -425,7 +425,7 @@ private boolean isPackageSupported(Context context) { void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesAlarmClock.PREF_EVENT_ALARM_CLOCK_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesAlarmClock.PREF_EVENT_ALARM_CLOCK_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { // compute start time if (_startTime > 0) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesApplication.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesApplication.java index 2d11169bb9..508c86ab51 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesApplication.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesApplication.java @@ -90,7 +90,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_application_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_APPLICATION_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_APPLICATION_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_applications), addPassStatus, DatabaseHandler.ETYPE_APPLICATION, context)); @@ -124,7 +124,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole ApplicationInfo app; try { app = packageManager.getApplicationInfo(packageName, PackageManager.MATCH_ALL); - if (app != null) + //if (app != null) selectedApplications = packageManager.getApplicationLabel(app).toString(); } catch (Exception e) { selectedApplications = context.getString(R.string.applications_multiselect_summary_text_selected) + StringConstants.STR_COLON_WITH_SPACE + splits.length; @@ -139,18 +139,18 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } else selectedApplications = context.getString(R.string.applications_multiselect_summary_text_selected) + StringConstants.STR_COLON_WITH_SPACE + splits.length; } - _value.append(context.getString(R.string.event_preferences_applications_applications)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedApplications, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.event_preferences_applications_applications)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedApplications, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_applications_duration)).append(StringConstants.STR_COLON_WITH_SPACE); if (this._duration == 0) - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_applications_duration_unlimited), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_applications_duration_unlimited), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); else { Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.HOUR_OF_DAY, this._duration / 60); calendar.set(Calendar.MINUTE, this._duration % 60); _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue( DateFormat.getTimeFormat(context).format(new Date(calendar.getTimeInMillis())), - disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } //descr = descr + context.getString(R.string.pref_event_duration) + ": " +tmp._duration; @@ -279,8 +279,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_APPLICATION_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_APPLICATION_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesApplication tmp = new EventPreferencesApplication(this._event, this._enabled, this._applications, this._duration); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -508,7 +508,7 @@ void saveStartTime(DataWrapper dataWrapper, String _packageName, long startTime) void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesApplication.PREF_EVENT_APPLICATION_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesApplication.PREF_EVENT_APPLICATION_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { eventsHandler.applicationPassed = false; if (PPExtenderBroadcastReceiver.isEnabled(eventsHandler.context.getApplicationContext(), PPApplication.VERSION_CODE_EXTENDER_REQUIRED, true, true diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBattery.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBattery.java index 0dff08c227..8877547e0a 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBattery.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBattery.java @@ -127,7 +127,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_battery_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_BATTERY_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_BATTERY_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_battery), addPassStatus, DatabaseHandler.ETYPE_BATTERY, context)); @@ -135,14 +135,14 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } _value.append(context.getString(R.string.pref_event_battery_level)); - _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(this._levelLow + "% - " + this._levelHight + "%", disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(this._levelLow + "% - " + this._levelHight + "%", disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); if (this._powerSaveMode) - _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_battery_power_save_mode), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_battery_power_save_mode), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); else { _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.pref_event_battery_charging)); String[] charging = context.getResources().getStringArray(R.array.eventBatteryChargingArray); - _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(charging[this._charging], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(charging[this._charging], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); String selectedPlugged = context.getString(R.string.applications_multiselect_summary_text_not_selected); if ((this._plugged != null) && !this._plugged.isEmpty() && !this._plugged.equals("-")) { @@ -164,7 +164,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } selectedPlugged = value.toString(); } - _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_battery_plugged)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedPlugged, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_battery_plugged)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedPlugged, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } } @@ -289,8 +289,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_BATTERY_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_BATTERY_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesBattery tmp = new EventPreferencesBattery(this._event, this._enabled, this._levelLow, this._levelHight, this._charging, this._powerSaveMode, this._plugged); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -444,7 +444,7 @@ void removeSystemEvent(Context context) void doHandleEvent(EventsHandler eventsHandler/*, String sensorType, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesBattery.PREF_EVENT_BATTERY_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesBattery.PREF_EVENT_BATTERY_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { boolean isPowerSaveMode = GlobalUtils.isPowerSaveMode(eventsHandler.context); boolean isCharging = false; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java index 31fa485168..96ab934599 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java @@ -92,7 +92,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_bluetooth_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_BLUETOOTH_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_BLUETOOTH_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_bluetooth), addPassStatus, DatabaseHandler.ETYPE_BLUETOOTH, context)); @@ -130,7 +130,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (index != -1) { _value.append(context.getString(R.string.event_preferences_bluetooth_connection_type)); String[] connectionListTypeNames = context.getResources().getStringArray(R.array.eventBluetoothConnectionTypeArray); - _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(connectionListTypeNames[index], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(connectionListTypeNames[index], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); } /* @@ -185,7 +185,7 @@ else if (this._devicesType == DTYPE_LE) } } selectedBluetoothNames = value.toString(); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedBluetoothNames, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedBluetoothNames, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } @@ -217,7 +217,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con if ((connectionType == 1) || (connectionType == 3)) { summary = "* " + context.getString(R.string.array_pref_applicationDisableScanning_disabled) + "! *"+StringConstants.STR_DOUBLE_NEWLINE + context.getString(R.string.phone_profiles_pref_eventBluetoothAppSettings_summary); - titleColor = ContextCompat.getColor(context, R.color.error_color); + titleColor = ContextCompat.getColor(context, R.color.errorColor); } else { summary = context.getString(R.string.array_pref_applicationDisableScanning_disabled) + StringConstants.STR_DOUBLE_NEWLINE + context.getString(R.string.phone_profiles_pref_eventBluetoothAppSettings_summary); @@ -273,7 +273,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con if ((connectionType == 1) || (connectionType == 3)) { summary = "* " + context.getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary) + "! *" + StringConstants.STR_DOUBLE_NEWLINE + summary; - titleColor = ContextCompat.getColor(context, R.color.error_color); + titleColor = ContextCompat.getColor(context, R.color.errorColor); } else { summary = context.getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary) + StringConstants.STR_DOUBLE_NEWLINE + @@ -417,7 +417,7 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con setSummary(prefMng, PREF_EVENT_BLUETOOTH_APP_SETTINGS, preferences, context); setSummary(prefMng, PREF_EVENT_BLUETOOTH_LOCATION_SYSTEM_SETTINGS, preferences, context); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, context).allowed + if (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, false, context).preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { Preference preference; @@ -434,8 +434,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_BLUETOOTH_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_BLUETOOTH_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesBluetooth tmp = new EventPreferencesBluetooth(this._event, this._enabled, this._adapterName, this._connectionType/*, this._devicesType*/); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -522,7 +522,7 @@ void removeSystemEvent(Context context) void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) // permissions are checked in EditorActivity.displayRedTextToPreferencesNotification() /*&& Permissions.checkEventLocation(context, event, null) && Permissions.checkEventBluetoothForEMUI(context, event, null)*/) { @@ -537,9 +537,9 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { boolean isBluetoothEnabled = bluetooth.isEnabled(); if (isBluetoothEnabled) { - BluetoothConnectionBroadcastReceiver.getConnectedDevices(eventsHandler.context); + List connectedDevices = BluetoothConnectionBroadcastReceiver.getConnectedDevices(eventsHandler.context); - if (BluetoothConnectionBroadcastReceiver.isBluetoothConnected(null, "")) { + if (BluetoothConnectionBroadcastReceiver.isBluetoothConnected(connectedDevices, null, "")) { // PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "bluetooth is connected event="+_event._name); String[] splits = _adapterName.split(StringConstants.STR_SPLIT_REGEX); @@ -554,13 +554,20 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { break; case EventPreferencesBluetooth.CONFIGURED_BLUETOOTH_NAMES_VALUE: for (BluetoothDeviceData data : boundedDevicesList) { - connected[i] = BluetoothConnectionBroadcastReceiver.isBluetoothConnected(data, ""); + connected[i] = BluetoothConnectionBroadcastReceiver.isBluetoothConnected(connectedDevices, data, ""); if (connected[i]) break; } break; default: - connected[i] = BluetoothConnectionBroadcastReceiver.isBluetoothConnected(null, _bluetoothName); + // check in system configured devices + for (BluetoothDeviceData data : boundedDevicesList) { + connected[i] = BluetoothConnectionBroadcastReceiver.isBluetoothConnected(connectedDevices, data, _bluetoothName); + if (connected[i]) + break; + } + // check by name + connected[i] = BluetoothConnectionBroadcastReceiver.isBluetoothConnected(connectedDevices, null, _bluetoothName); break; } i++; @@ -593,7 +600,7 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { done = true; } } else { -// PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "bluetooth is NOT connected event="+_event._name); +// PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "*** bluetooth is NOT connected event="+_event._name + " ****"); if ((_connectionType == EventPreferencesBluetooth.CTYPE_CONNECTED) || (_connectionType == EventPreferencesBluetooth.CTYPE_NOT_CONNECTED)) { // not use scanner data @@ -603,6 +610,7 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { } // PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "eventsHandler.bluetoothPassed="+eventsHandler.bluetoothPassed); } else { +// PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "*** bluetooth not enabled ***"); if ((_connectionType == EventPreferencesBluetooth.CTYPE_CONNECTED) || (_connectionType == EventPreferencesBluetooth.CTYPE_NOT_CONNECTED)) { // not use scanner data @@ -644,10 +652,11 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { List scanResults = BluetoothScanWorker.getScanResults(eventsHandler.context); if (scanResults != null) { - for (BluetoothDeviceData device : scanResults) { + for (BluetoothDeviceData deviceFromScan : scanResults) { String[] splits = _adapterName.split(StringConstants.STR_SPLIT_REGEX); boolean[] nearby = new boolean[splits.length]; int i = 0; + String _deviceFromScanAddress; for (String _bluetoothName : splits) { nearby[i] = false; switch (_bluetoothName) { @@ -655,45 +664,83 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { nearby[i] = true; break; case EventPreferencesBluetooth.CONFIGURED_BLUETOOTH_NAMES_VALUE: - for (BluetoothDeviceData data : boundedDevicesList) { - String _device = device.getName().toUpperCase(); - String _adapterName = data.getName().toUpperCase(); - if ((!_device.isEmpty()) && - (!_adapterName.isEmpty()) && - Wildcard.match(_device, _adapterName, '_', '%', true)) { - nearby[i] = true; - break; + _deviceFromScanAddress = deviceFromScan.getAddress(); + if (!_deviceFromScanAddress.isEmpty()) { + for (BluetoothDeviceData boundedDevice : boundedDevicesList) { + String _boundedDeviceAddress = boundedDevice.getAddress(); + if ((!_boundedDeviceAddress.isEmpty()) && + _deviceFromScanAddress.equals(_boundedDeviceAddress)) { + // found address + nearby[i] = true; + break; + } + // address not found, search by name + String _boundedDeviceName = boundedDevice.getName().toUpperCase(); + String _sensorName = _bluetoothName.toUpperCase(); + if ((!_sensorName.isEmpty()) && + (!_boundedDeviceName.isEmpty()) && + Wildcard.match(_boundedDeviceName, _sensorName, '_', '%', true)) { + // found name + nearby[i] = true; + break; + } } } break; default: - /* Removed, hidden BT are not supported - if ((device.getName() == null) || device.getName().isEmpty()) { - // scanned device has not name (hidden BT?) - String deviceAddress = device.getAddress(); - if ((deviceAddress != null) && (!deviceAddress.isEmpty())) { - // device has address - for (BluetoothDeviceData data : boundedDevicesList) { - String dataAddress = data.getAddress(); - if ((dataAddress != null) && - (!dataAddress.isEmpty()) && - dataAddress.equals(deviceAddress)) { - nearby[i] = true; + /* Removed, hidden BT are not supported + if ((device.getName() == null) || device.getName().isEmpty()) { + // scanned device has not name (hidden BT?) + String deviceAddress = device.getAddress(); + if ((deviceAddress != null) && (!deviceAddress.isEmpty())) { + // device has address + for (BluetoothDeviceData data : boundedDevicesList) { + String dataAddress = data.getAddress(); + if ((dataAddress != null) && + (!dataAddress.isEmpty()) && + dataAddress.equals(deviceAddress)) { + nearby[i] = true; + break; + } + } + } + } else + {*/ + BluetoothDeviceData configuredDevice = null; + _deviceFromScanAddress = deviceFromScan.getAddress(); + if (!_deviceFromScanAddress.isEmpty()) { + for (BluetoothDeviceData boundedDevice : boundedDevicesList) { + String _boundedDeviceAddress = boundedDevice.getAddress(); + if ((!_boundedDeviceAddress.isEmpty()) && + _deviceFromScanAddress.equals(_boundedDeviceAddress)) { + // found configured device in system by its address + configuredDevice = boundedDevice; break; } } } - } else*/ - { - String _deviceName = device.getName().toUpperCase(); - String _adapterName = _bluetoothName.toUpperCase(); - if ((!_adapterName.isEmpty()) && - (!_deviceName.isEmpty()) && - Wildcard.match(_deviceName, _adapterName, '_', '%', true)) { - nearby[i] = true; + + //noinspection IfStatementWithIdenticalBranches + if (configuredDevice != null) { + String _deviceName = configuredDevice.getName().toUpperCase(); + String _sensorName = _bluetoothName.toUpperCase(); + if ((!_sensorName.isEmpty()) && + (!_deviceName.isEmpty()) && + Wildcard.match(_deviceName, _sensorName, '_', '%', true)) { + // found nearby sensot BT name + nearby[i] = true; + } + } else { + String _deviceName = deviceFromScan.getName().toUpperCase(); + String _sensorName = _bluetoothName.toUpperCase(); + if ((!_sensorName.isEmpty()) && + (!_deviceName.isEmpty()) && + Wildcard.match(_deviceName, _sensorName, '_', '%', true)) { + nearby[i] = true; + } } - } - break; + //} + break; } i++; } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBrightness.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBrightness.java index d1ca60fba9..272d96848a 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBrightness.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBrightness.java @@ -78,7 +78,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_brightness_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_BRIGHTNESS_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_BRIGHTNESS_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_brightness), addPassStatus, DatabaseHandler.ETYPE_BRIGHTNESS, context)); @@ -92,10 +92,10 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (index != -1) { //_value.append(context.getString(R.string.event_preferences_brightness_operator_from)).append(StringConstants.STR_COLON_WITH_SPACE); String[] operatorNames = context.getResources().getStringArray(R.array.brightnessSensorOperatorArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(operatorNames[index], disabled, context)); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(operatorNames[index], disabled, addBullet, context)); String value = this._brightnessLevelFrom; int iValue = ProfileStatic.getDeviceBrightnessValue(value); - _value.append(" ").append(getColorForChangedPreferenceValue(iValue + "/100", disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(" ").append(getColorForChangedPreferenceValue(iValue + "/100", disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_brightness_level_to)).append(StringConstants.STR_COLON_WITH_SPACE); @@ -103,10 +103,10 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (index != -1) { //_value.append(context.getString(R.string.event_preferences_brightness_operator_from)).append(StringConstants.STR_COLON_WITH_SPACE); String[] operatorNames = context.getResources().getStringArray(R.array.brightnessSensorOperatorArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(operatorNames[index], disabled, context)); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(operatorNames[index], disabled, addBullet, context)); String value = this._brightnessLevelTo; int iValue = ProfileStatic.getDeviceBrightnessValue(value); - _value.append(" ").append(getColorForChangedPreferenceValue(iValue + "/100", disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(" ").append(getColorForChangedPreferenceValue(iValue + "/100", disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } } @@ -182,8 +182,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences/*, } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_BRIGHTNESS_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_BRIGHTNESS_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesBrightness tmp = new EventPreferencesBrightness(this._event, this._enabled, this._operatorFrom, this._brightnessLevelFrom, this._operatorTo, this._brightnessLevelTo); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -278,7 +278,7 @@ void removeSystemEvent(Context context) void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesBrightness.PREF_EVENT_BRIGHTNESS_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesBrightness.PREF_EVENT_BRIGHTNESS_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { if (PPApplication.isScreenOn && (!PPApplication.brightnessInternalChange)) { // allowed only when screen is on, because of Huawei devices // check ScreenOnOffBroadcastReceiver for this diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCalendar.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCalendar.java index 1eca16f6bf..efe11d7afe 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCalendar.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCalendar.java @@ -173,7 +173,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_calendar_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_CALENDAR_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_CALENDAR_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_calendar), addPassStatus, DatabaseHandler.ETYPE_CALENDAR, context)); @@ -181,39 +181,39 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } _value.append(context.getString(R.string.event_preferences_calendar_calendars)).append(StringConstants.STR_COLON_WITH_SPACE); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(CalendarsMultiSelectDialogPreference.getSummary(_calendars, context), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(CalendarsMultiSelectDialogPreference.getSummary(_calendars, context), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); if (this._dayContainsEvent > 0) { _value.append(context.getString(R.string.event_preferences_calendar_day_contains_event)).append(StringConstants.STR_COLON_WITH_SPACE); String[] dayContainsEventArray = context.getResources().getStringArray(R.array.eventCalendarDayContainsEventArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(dayContainsEventArray[this._dayContainsEvent], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(dayContainsEventArray[this._dayContainsEvent], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); } if (this._allEvents) { - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_calendar_all_events), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_calendar_all_events), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); } else { _value.append(context.getString(R.string.event_preferences_calendar_search_field)).append(StringConstants.STR_COLON_WITH_SPACE); String[] searchFields = context.getResources().getStringArray(R.array.eventCalendarSearchFieldArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(searchFields[this._searchField], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(searchFields[this._searchField], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_calendar_search_string)).append(StringConstants.STR_COLON_WITH_SPACE); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue("\"" + this._searchString + "\"", disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue("\"" + this._searchString + "\"", disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); } //if (this._ignoreAllDayEvents) - // descr = descr + "" + getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_calendar_ignore_all_day_events, disabled, context)) + " • "; + // descr = descr + "" + getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_calendar_ignore_all_day_events, disabled, addBullet, context)) + " • "; _value.append(context.getString(R.string.event_preferences_calendar_all_day_events)).append(StringConstants.STR_COLON_WITH_SPACE); String[] dayContainsEventArray = context.getResources().getStringArray(R.array.eventCalendarAllDayEventsArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(dayContainsEventArray[this._allDayEvents], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(dayContainsEventArray[this._allDayEvents], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); String[] availabilities = context.getResources().getStringArray(R.array.eventCalendarAvailabilityArray); - _value.append(context.getString(R.string.event_preference_calendar_availability)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(availabilities[this._availability], disabled, context)).append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.event_preference_calendar_availability)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(availabilities[this._availability], disabled, addBullet, context)).append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_END_HTML); String[] statuses = context.getResources().getStringArray(R.array.eventCalendarStatusArray); - _value.append(context.getString(R.string.event_preference_calendar_status)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(statuses[this._status], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.event_preference_calendar_status)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(statuses[this._status], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); if (this._startBeforeEvent > 0) - _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_calendar_start_before_event)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._startBeforeEvent), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_calendar_start_before_event)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._startBeforeEvent), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); if (addBullet) { if (EventStatic.getGlobalEventsRunning(context)) { @@ -462,8 +462,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_CALENDAR_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_CALENDAR_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesCalendar tmp = new EventPreferencesCalendar(this._event, this._enabled, this._calendars, this._allEvents, this._searchField, this._searchString, this._availability, this._status, /*this._ignoreAllDayEvents,*/ this._startBeforeEvent, this._dayContainsEvent, this._allDayEvents); @@ -1164,7 +1164,7 @@ void saveCalendarEventExists(DataWrapper dataWrapper) { void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesCalendar.PREF_EVENT_CALENDAR_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesCalendar.PREF_EVENT_CALENDAR_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) // permissions are checked in EditorActivity.displayRedTextToPreferencesNotification() /*&& (Permissions.checkEventCalendar(context, event, null))*/) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCall.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCall.java index 405feb0137..8f72682381 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCall.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCall.java @@ -29,6 +29,8 @@ class EventPreferencesCall extends EventPreferences { boolean _runAfterCallEndPermanentRun; int _runAfterCallEndDuration; int _forSIMCard; + boolean _sendSMS; + String _smsText; long _runAfterCallEndTime; int _runAfterCallEndFromSIMSlot; @@ -45,6 +47,9 @@ class EventPreferencesCall extends EventPreferences { //static final String PREF_EVENT_CALL_ACCESSIBILITY_SETTINGS = "eventCallAccessibilitySettings"; //static final String PREF_EVENT_CALL_LAUNCH_EXTENDER = "eventCallLaunchExtender"; private static final String PREF_EVENT_CALL_FOR_SIM_CARD = "eventCallForSimCard"; + static final String PREF_EVENT_CALL_SEND_SMS = "eventCallSendSMS"; + static final String PREF_EVENT_CALL_SMS_TEXT = "eventCallSMSText"; + static final String PREF_EVENT_CALL_SEND_SMS_INFO = "eventCallSendSMSInfo"; static final String PREF_EVENT_CALL_ENABLED_NO_CHECK_SIM = "eventCallEnabledEnabledNoCheckSim"; @@ -68,7 +73,7 @@ class EventPreferencesCall extends EventPreferences { private static final int PHONE_CALL_EVENT_OUTGOING_CALL_ANSWERED = 4; private static final int PHONE_CALL_EVENT_INCOMING_CALL_ENDED = 5; private static final int PHONE_CALL_EVENT_OUTGOING_CALL_ENDED = 6; - private static final int PHONE_CALL_EVENT_MISSED_CALL = 7; + static final int PHONE_CALL_EVENT_MISSED_CALL = 7; private static final int PHONE_CALL_EVENT_SERVICE_UNBIND = 8; private static final String PREF_EVENT_CALL_EVENT_TYPE = "eventCallEventType"; @@ -84,7 +89,9 @@ class EventPreferencesCall extends EventPreferences { int contactListType, boolean runAfterCallEndPermanentRun, int runAfterCallEndDuration, - int forSIMCard) { + int forSIMCard, + boolean sendSMS, + String smsText) { super(event, enabled); this._callEvent = callEvent; @@ -94,6 +101,8 @@ class EventPreferencesCall extends EventPreferences { this._runAfterCallEndPermanentRun = runAfterCallEndPermanentRun; this._runAfterCallEndDuration = runAfterCallEndDuration; this._forSIMCard = forSIMCard; + this._sendSMS = sendSMS; + this._smsText = smsText; this._runAfterCallEndTime = 0; this._runAfterCallEndFromSIMSlot = 0; @@ -108,6 +117,8 @@ void copyPreferences(Event fromEvent) { this._runAfterCallEndPermanentRun = fromEvent._eventPreferencesCall._runAfterCallEndPermanentRun; this._runAfterCallEndDuration = fromEvent._eventPreferencesCall._runAfterCallEndDuration; this._forSIMCard = fromEvent._eventPreferencesCall._forSIMCard; + this._sendSMS = fromEvent._eventPreferencesCall._sendSMS; + this._smsText = fromEvent._eventPreferencesCall._smsText; this.setSensorPassed(fromEvent._eventPreferencesCall.getSensorPassed()); this._runAfterCallEndTime = 0; @@ -124,6 +135,8 @@ void loadSharedPreferences(SharedPreferences preferences) { editor.putBoolean(PREF_EVENT_CALL_RUN_AFTER_CALL_END_PERMANENT_RUN, this._runAfterCallEndPermanentRun); editor.putString(PREF_EVENT_CALL_RUN_AFTER_CALL_END_DURATION, String.valueOf(this._runAfterCallEndDuration)); editor.putString(PREF_EVENT_CALL_FOR_SIM_CARD, String.valueOf(this._forSIMCard)); + editor.putBoolean(PREF_EVENT_CALL_SEND_SMS, this._sendSMS); + editor.putString(PREF_EVENT_CALL_SMS_TEXT, this._smsText); editor.apply(); } @@ -136,6 +149,8 @@ void saveSharedPreferences(SharedPreferences preferences) { this._runAfterCallEndPermanentRun = preferences.getBoolean(PREF_EVENT_CALL_RUN_AFTER_CALL_END_PERMANENT_RUN, false); this._runAfterCallEndDuration = Integer.parseInt(preferences.getString(PREF_EVENT_CALL_RUN_AFTER_CALL_END_DURATION, "5")); this._forSIMCard = Integer.parseInt(preferences.getString(PREF_EVENT_CALL_FOR_SIM_CARD, "0")); + this._sendSMS = preferences.getBoolean(PREF_EVENT_CALL_SEND_SMS, false); + this._smsText = preferences.getString(PREF_EVENT_CALL_SMS_TEXT, ""); } String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boolean disabled, Context context) { @@ -151,8 +166,8 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(StringConstants.TAG_BOLD_END_WITH_SPACE_HTML); } - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_CALL_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_CALL_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { int extenderVersion = PPExtenderBroadcastReceiver.isExtenderInstalled(context.getApplicationContext()); if (extenderVersion == 0) { _value.append(context.getString(R.string.profile_preferences_device_not_allowed)) @@ -170,17 +185,17 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } else { _value.append(context.getString(R.string.pref_event_call_event)); String[] callEvents = context.getResources().getStringArray(R.array.eventCallEventsArray); - _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(callEvents[this._callEvent], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(callEvents[this._callEvent], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_call_contact_groups)).append(StringConstants.STR_COLON_WITH_SPACE); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(ContactGroupsMultiSelectDialogPreference.getSummary(_contactGroups, context), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(ContactGroupsMultiSelectDialogPreference.getSummary(_contactGroups, context), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_call_contacts)).append(StringConstants.STR_COLON_WITH_SPACE); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(ContactsMultiSelectDialogPreference.getSummary(_contacts, false, context), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(ContactsMultiSelectDialogPreference.getSummary(_contacts, false, context), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_contactListType)); String[] contactListTypes = context.getResources().getStringArray(R.array.eventCallContactListTypeArray); - _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(contactListTypes[this._contactListType], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(contactListTypes[this._contactListType], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); boolean hasSIMCard = false; final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); @@ -190,27 +205,25 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole // Log.e("EventPreferencesCall.getPreferencesDescription", "called hasSIMCard"); HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); hasSIMCard = hasSIMCardData.simCount > 0; - //boolean sim1Exists = hasSIMCardData.hasSIM1; - //boolean sim2Exists = hasSIMCardData.hasSIM2; - - //simExists = sim1Exists; - //simExists = simExists && sim2Exists; - //hasSIMCard = simExists; } } if (hasSIMCard) { _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_call_forSimCard)); String[] forSimCard = context.getResources().getStringArray(R.array.eventCallForSimCardArray); - _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(forSimCard[this._forSIMCard], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(forSimCard[this._forSIMCard], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } if ((this._callEvent == CALL_EVENT_MISSED_CALL) || (this._callEvent == CALL_EVENT_INCOMING_CALL_ENDED) || (this._callEvent == CALL_EVENT_OUTGOING_CALL_ENDED)) { if (this._runAfterCallEndPermanentRun) - _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_permanentRun), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_permanentRun), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); else - _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._runAfterCallEndDuration), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._runAfterCallEndDuration), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); + + if ((this._callEvent == CALL_EVENT_MISSED_CALL)) { + _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preference_callSendSMS)); + } } } @@ -292,6 +305,12 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con } GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, delay > 5, false, false, false, false); } + if (key.equals(PREF_EVENT_CALL_SMS_TEXT)) { + Preference preference = prefMng.findPreference(key); + if (preference != null) { + preference.setSummary(value); + } + } boolean hasFeature = false; boolean hasSIMCard = false; @@ -301,16 +320,8 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con int phoneCount = telephonyManager.getPhoneCount(); if (phoneCount > 1) { hasFeature = true; - //boolean simExists; -// Log.e("EventPreferencesCall.setSummary", "called hasSIMCard"); HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); hasSIMCard = hasSIMCardData.simCount > 1; - //boolean sim1Exists = hasSIMCardData.hasSIM1; - //boolean sim2Exists = hasSIMCardData.hasSIM2; - - //simExists = sim1Exists; - //simExists = simExists && sim2Exists; - //hasSIMCard = simExists; PPListPreference listPreference = prefMng.findPreference(key); if (listPreference != null) { int index = listPreference.findIndexOfValue(value); @@ -323,7 +334,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con Preference preference = prefMng.findPreference(PREF_EVENT_CALL_FOR_SIM_CARD); if (preference != null) { PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); @@ -333,7 +344,7 @@ else if (!hasSIMCard) { Preference preference = prefMng.findPreference(PREF_EVENT_CALL_FOR_SIM_CARD); if (preference != null) { PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_TWO_SIM_CARDS; preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); @@ -341,30 +352,6 @@ else if (!hasSIMCard) { } } - /* - if (key.equals(PREF_EVENT_CALL_INSTALL_EXTENDER)) { - Preference preference = prefMng.findPreference(key); - if (preference != null) { - int extenderVersion = PPExtenderBroadcastReceiver.isExtenderInstalled(context); - if (extenderVersion == 0) { - String summary = context.getString(R.string.profile_preferences_PPPExtender_not_installed_summary);// + - //"\n\n" + context.getString(R.string.event_preferences_call_PPPExtender_install_summary); - preference.setSummary(summary); - } - else { - String extenderVersionName = PPExtenderBroadcastReceiver.getExtenderVersionName(context); - String summary = context.getString(R.string.profile_preferences_PPPExtender_installed_summary) + - " " + extenderVersionName + " (" + extenderVersion + ")\n\n"; - if (extenderVersion < PPApplication.VERSION_CODE_EXTENDER_LATEST) - summary = summary + context.getString(R.string.event_preferences_applications_PPPExtender_new_version_summary); - else - summary = summary + context.getString(R.string.pppextender_pref_dialog_PPPExtender_upgrade_summary); - preference.setSummary(summary); - } - } - } - */ - Event event = new Event(); event.createEventPreferences(); event._eventPreferencesCall.saveSharedPreferences(prefMng.getSharedPreferences()); @@ -387,6 +374,16 @@ else if (!hasSIMCard) { preference = prefMng.findPreference(PREF_EVENT_CALL_FOR_SIM_CARD); if (preference != null) GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabled, false, false, false, !isRunnable, false); + preference = prefMng.findPreference(PREF_EVENT_CALL_SEND_SMS); + if (preference != null) { + boolean bold = prefMng.getSharedPreferences().getBoolean(PREF_EVENT_CALL_SEND_SMS, false); + GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabled, bold, false, false, false, false); + } + preference = prefMng.findPreference(PREF_EVENT_CALL_SMS_TEXT); + if (preference != null) { + boolean bold = !prefMng.getSharedPreferences().getString(PREF_EVENT_CALL_SMS_TEXT, "").isEmpty(); + GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabled, bold, false, false, false, false); + } int _isAccessibilityEnabled = event._eventPreferencesCall.isAccessibilityServiceEnabled(context, false); boolean isAccessibilityEnabled = _isAccessibilityEnabled == 1; @@ -397,29 +394,6 @@ else if (!hasSIMCard) { GlobalGUIRoutines.setPreferenceTitleStyleX(extenderPreference, enabled, false, false, true, !(isAccessibilityEnabled && (PPApplication.accessibilityServiceForPPPExtenderConnected == 1)), true); } - /* - preference = prefMng.findPreference(PREF_EVENT_CALL_ACCESSIBILITY_SETTINGS); - if (preference != null) { - - String summary; - if (isAccessibilityEnabled && (PPApplication.accessibilityServiceForPPPExtenderConnected == 1)) - summary = context.getString(R.string.accessibility_service_enabled); - else { - if (_isAccessibilityEnabled == -1) { - summary = context.getString(R.string.accessibility_service_not_used); - summary = summary + "\n\n" + context.getString(R.string.preference_not_used_extender_reason) + " " + - context.getString(R.string.preference_not_allowed_reason_extender_not_upgraded); - } else { - summary = context.getString(R.string.accessibility_service_disabled); - summary = summary + "\n\n" + context.getString(R.string.event_preferences_call_AccessibilitySettingsForExtender_summary); - } - } - preference.setSummary(summary); - - GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabled, false, false, true, - !(isAccessibilityEnabled && (PPApplication.accessibilityServiceForPPPExtenderConnected == 1)), true); - } - */ } void setSummary(PreferenceManager prefMng, String key, SharedPreferences preferences, Context context) { @@ -442,9 +416,14 @@ void setSummary(PreferenceManager prefMng, String key, SharedPreferences prefere key.equals(PREF_EVENT_CALL_RUN_AFTER_CALL_END_DURATION) || key.equals(PREF_EVENT_CALL_EXTENDER) || //key.equals(PREF_EVENT_CALL_INSTALL_EXTENDER) || - key.equals(PREF_EVENT_CALL_FOR_SIM_CARD)) { + key.equals(PREF_EVENT_CALL_FOR_SIM_CARD) || + key.equals(PREF_EVENT_CALL_SMS_TEXT)) { setSummary(prefMng, key, preferences.getString(key, ""), context); } + if (key.equals(PREF_EVENT_CALL_SEND_SMS)) { + boolean value = preferences.getBoolean(key, false); + setSummary(prefMng, key, value ? StringConstants.TRUE_STRING : StringConstants.FALSE_STRING, context); + } } void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Context context) { @@ -458,13 +437,16 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con setSummary(prefMng, PREF_EVENT_CALL_EXTENDER, preferences, context); //setSummary(prefMng, PREF_EVENT_CALL_INSTALL_EXTENDER, preferences, context); setSummary(prefMng, PREF_EVENT_CALL_FOR_SIM_CARD, preferences, context); + setSummary(prefMng, PREF_EVENT_CALL_SEND_SMS, preferences, context); + setSummary(prefMng, PREF_EVENT_CALL_SMS_TEXT, preferences, context); } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_CALL_ENABLED_NO_CHECK_SIM, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_CALL_ENABLED_NO_CHECK_SIM, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesCall tmp = new EventPreferencesCall(this._event, this._enabled, this._callEvent, this._contacts, this._contactGroups, - this._contactListType, this._runAfterCallEndPermanentRun, this._runAfterCallEndDuration, this._forSIMCard); + this._contactListType, this._runAfterCallEndPermanentRun, this._runAfterCallEndDuration, this._forSIMCard, + this._sendSMS, this._smsText); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -538,10 +520,6 @@ void checkPreferences(PreferenceManager prefMng, boolean onlyCategory, Context c if (preference != null) GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabled, false, false, true, !accessibilityEnabled, true); -// preference = prefMng.findPreference(PREF_EVENT_CALL_ACCESSIBILITY_SETTINGS); -// if (preference != null) -// GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabled, false, false, true, !accessibilityEnabled, true); - boolean showPreferences = false; final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null) { @@ -576,6 +554,21 @@ void checkPreferences(PreferenceManager prefMng, boolean onlyCategory, Context c if (preference != null) preference.setVisible(false); } + if (preferences != null) { + String callEvent = preferences.getString(PREF_EVENT_CALL_EVENT, "-1"); + int contactListType = Integer.parseInt(preferences.getString(PREF_EVENT_CALL_CONTACT_LIST_TYPE, "0")); + preference = prefMng.findPreference(PREF_EVENT_CALL_SEND_SMS); + if (preference != null) + preference.setEnabled(callEvent.equals(String.valueOf(CALL_EVENT_MISSED_CALL))); + preference = prefMng.findPreference(PREF_EVENT_CALL_SEND_SMS_INFO); + if (preference != null) + preference.setEnabled(callEvent.equals(String.valueOf(CALL_EVENT_MISSED_CALL))); + + boolean sendSMS = preferences.getBoolean(PREF_EVENT_CALL_SEND_SMS, false); + preference = prefMng.findPreference(PREF_EVENT_CALL_SMS_TEXT); + if (preference != null) + preference.setEnabled(sendSMS && contactListType == CONTACT_LIST_TYPE_WHITE_LIST); + } setSummary(prefMng, PREF_EVENT_CALL_ENABLED, preferences, context); } @@ -589,8 +582,6 @@ private long computeRunAfterCallEndAlarm() { int gmtOffset = 0; //TimeZone.getDefault().getRawOffset(); callEndTime.setTimeInMillis((_runAfterCallEndTime - gmtOffset) + (_runAfterCallEndDuration * 1000L)); - //calEndTime.set(Calendar.SECOND, 0); - //calEndTime.set(Calendar.MILLISECOND, 0); long alarmTime; alarmTime = callEndTime.getTimeInMillis(); @@ -635,10 +626,8 @@ void removeRunAfterCallEndAlarm(Context context) { try { AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); if (alarmManager != null) { - //Intent intent = new Intent(context, MissedCallEventEndBroadcastReceiver.class); Intent intent = new Intent(); intent.setAction(PhoneProfilesService.ACTION_MISSED_CALL_EVENT_END_BROADCAST_RECEIVER); - //intent.setClass(context, MissedCallEventEndBroadcastReceiver.class); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, (int) _event._id, intent, PendingIntent.FLAG_NO_CREATE); if (pendingIntent != null) { @@ -655,12 +644,8 @@ void removeRunAfterCallEndAlarm(Context context) { private void setRunAfterCallEndAlarm(long alarmTime, Context context) { if (!_runAfterCallEndPermanentRun) { if (_runAfterCallEndTime > 0) { - //Intent intent = new Intent(context, MissedCallEventEndBroadcastReceiver.class); Intent intent = new Intent(); intent.setAction(PhoneProfilesService.ACTION_MISSED_CALL_EVENT_END_BROADCAST_RECEIVER); - //intent.setClass(context, MissedCallEventEndBroadcastReceiver.class); - - //intent.putExtra(PPApplication.EXTRA_EVENT_ID, _event._id); PendingIntent pendingIntent = PendingIntent.getBroadcast(context, (int) _event._id, intent, PendingIntent.FLAG_UPDATE_CURRENT); @@ -685,18 +670,10 @@ boolean isPhoneNumberConfigured(List contactList, String phoneNumber/*, boolean phoneNumberFound = false; if (this._contactListType != EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) { - /*ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); - if (contactsCache == null) - return false; - List contactList; -// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCall.isPhoneNumberConfigured", "(1) PPApplication.contactsCacheMutex"); - synchronized (PPApplication.contactsCacheMutex) { - contactList = contactsCache.getList(); //false - }*/ - // find phone number in groups String[] splits = this._contactGroups.split(StringConstants.STR_SPLIT_REGEX); for (String split : splits) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.isPhoneNumberConfigured", "in senzor configured group="+split); if (!split.isEmpty()) { // PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCall.isPhoneNumberConfigured", "(2) PPApplication.contactsCacheMutex"); synchronized (PPApplication.contactsCacheMutex) { @@ -708,6 +685,7 @@ boolean isPhoneNumberConfigured(List contactList, String phoneNumber/*, // group found in contact if (contact.phoneId != 0) { String _phoneNumber = contact.phoneNumber; +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.isPhoneNumberConfigured", "found in group _phoneNumber="+_phoneNumber); if (PhoneNumberUtils.compare(_phoneNumber, phoneNumber)) { phoneNumberFound = true; break; @@ -724,12 +702,19 @@ boolean isPhoneNumberConfigured(List contactList, String phoneNumber/*, break; } +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.isPhoneNumberConfigured", "(1) phoneNumberFound="+phoneNumberFound); + if (!phoneNumberFound) { // find phone number in contacts // contactId#phoneId|... splits = this._contacts.split(StringConstants.STR_SPLIT_REGEX); for (String split : splits) { String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX); +// if (!split.isEmpty()) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.isPhoneNumberConfigured", "in senzor configured phone numbe[0]r="+splits2[0]); +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.isPhoneNumberConfigured", "in senzor configured phone number[1]="+splits2[1]); +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.isPhoneNumberConfigured", "in senzor configured phone number[2]="+splits2[2]); +// } if ((!split.isEmpty()) && (splits2.length == 3) && @@ -746,6 +731,8 @@ boolean isPhoneNumberConfigured(List contactList, String phoneNumber/*, } } +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.isPhoneNumberConfigured", "(2) phoneNumberFound="+phoneNumberFound); + if (this._contactListType == EventPreferencesCall.CONTACT_LIST_TYPE_BLACK_LIST) phoneNumberFound = !phoneNumberFound; } else @@ -781,13 +768,9 @@ void saveRunAfterCallEndTime(List contactList, DataWrapper dataWrapper) DatabaseHandler.getInstance(dataWrapper.context).updateCallRunAfterCallEndTime(_event); if (phoneNumberFound) { - //if (_event.getStatus() == Event.ESTATUS_RUNNING) - setSystemEventForPause(dataWrapper.context); + setSystemEventForPause(dataWrapper.context); } - }// else { - // _startTime = 0; - // DatabaseHandler.getInstance(dataWrapper.context).updateCallStartTime(_event); - //} + } } else { _runAfterCallEndTime = 0; DatabaseHandler.getInstance(dataWrapper.context).updateCallRunAfterCallEndTime(_event); @@ -800,7 +783,6 @@ static void getEventCallEventType(Context context) { synchronized (PPApplication.eventCallSensorMutex) { ApplicationPreferences.prefEventCallEventType = ApplicationPreferences. getSharedPreferences(context).getInt(EventPreferencesCall.PREF_EVENT_CALL_EVENT_TYPE, EventPreferencesCall.PHONE_CALL_EVENT_UNDEFINED); - //return ApplicationPreferences.prefEventCallEventType; } } static void setEventCallEventType(Context context, int eventType) { @@ -823,8 +805,6 @@ static void getEventCallEventTime(Context context, int eventType) { (eventType == PHONE_CALL_EVENT_UNDEFINED)) ApplicationPreferences.prefEventCallRunAfterCallEndTime = ApplicationPreferences. getSharedPreferences(context).getLong(EventPreferencesCall.PREF_EVENT_CALL_RUN_AFTER_CALL_END_TIME, 0); - - //return ApplicationPreferences.prefEventCallEventTime; } } static void setEventCallEventTime(Context context, long time, int eventType) { @@ -847,7 +827,6 @@ static void getEventCallPhoneNumber(Context context) { synchronized (PPApplication.eventCallSensorMutex) { ApplicationPreferences.prefEventCallPhoneNumber = ApplicationPreferences. getSharedPreferences(context).getString(EventPreferencesCall.PREF_EVENT_CALL_PHONE_NUMBER, ""); - //return ApplicationPreferences.prefEventCallPhoneNumber; } } static void setEventCallPhoneNumber(Context context, String phoneNumber) { @@ -869,8 +848,6 @@ static void getEventCallFromSIMSlot(Context context, int eventType) { (eventType == PHONE_CALL_EVENT_UNDEFINED)) ApplicationPreferences.prefEventCallRunAfterCallEndFromSIMSlot = ApplicationPreferences. getSharedPreferences(context).getInt(EventPreferencesCall.PREF_EVENT_CALL_RUN_AFTER_CALL_END_FROM_SIM_SLOT, 0); - - //return ApplicationPreferences.prefEventCallPhoneNumber; } } static void setEventCallFromSIMSlot(Context context, int simSlot, int eventType) { @@ -892,7 +869,7 @@ static void setEventCallFromSIMSlot(Context context, int simSlot, int eventType) void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesCall.PREF_EVENT_CALL_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesCall.PREF_EVENT_CALL_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) // permissions are checked in EditorActivity.displayRedTextToPreferencesNotification() /*&& Permissions.checkEventCallContacts(context, event, null)*//* && this is not required, is only for simulating ringing -> Permissions.checkEventPhoneBroadcast(context, event, null)*/) { @@ -902,6 +879,9 @@ void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { //Log.e("EventPreferencesCall.doHandleEvent", "callEventType="+callEventType); //Log.e("EventPreferencesCall.doHandleEvent", "phoneNumber="+phoneNumber); //Log.e("EventPreferencesCall.doHandleEvent", "simSlot="+simSlot); +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.doHandleEvent", "callEventType="+callEventType); +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.doHandleEvent", "phoneNumber="+phoneNumber); +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.doHandleEvent", "runAfterCallEndSIMSlot="+runAfterCallEndSIMSlot); boolean phoneNumberFound = false; @@ -909,14 +889,15 @@ void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (callEventType == EventPreferencesCall.PHONE_CALL_EVENT_SERVICE_UNBIND) eventsHandler.callPassed = false; else { +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.doHandleEvent", "PPApplicationStatic.getContactsCache()"); ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); if (contactsCache != null) { List contactList; // PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCall.doHandleEvent", "PPApplication.contactsCacheMutex"); - synchronized (PPApplication.contactsCacheMutex) { - contactList = contactsCache.getList(/*false*/); - } +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.doHandleEvent", "contactsCache.getList()"); + contactList = contactsCache.getList(/*false*/); phoneNumberFound = isPhoneNumberConfigured(contactList, phoneNumber/*, this*/); +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.doHandleEvent", "phoneNumberFound="+phoneNumberFound); if (contactList != null) contactList.clear(); } @@ -992,13 +973,6 @@ void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { } else eventsHandler.callPassed = false; - - //if ((callEventType == PhoneCallsListener.CALL_EVENT_INCOMING_CALL_ENDED) || - // (callEventType == PhoneCallsListener.CALL_EVENT_OUTGOING_CALL_ENDED)) { - // //callPassed = true; - // //eventStart = eventStart && false; - // callPassed = false; - //} } else eventsHandler.callPassed = false; @@ -1043,6 +1017,9 @@ void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { eventsHandler.notAllowedCall = true; } +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.doHandleEvent", "eventsHandler.notAllowedCall="+eventsHandler.notAllowedCall); +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCall.doHandleEvent", "eventsHandler.callPassed="+eventsHandler.callPassed); + if (!eventsHandler.notAllowedCall) { if (eventsHandler.callPassed) setSensorPassed(EventPreferences.SENSOR_PASSED_PASSED); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCallScreening.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCallScreening.java new file mode 100644 index 0000000000..b96de0ee78 --- /dev/null +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCallScreening.java @@ -0,0 +1,899 @@ +package sk.henrichg.phoneprofilesplus; + +import static android.app.role.RoleManager.ROLE_CALL_SCREENING; +import static android.content.Context.ROLE_SERVICE; + +import android.app.AlarmManager; +import android.app.PendingIntent; +import android.app.role.RoleManager; +import android.content.Context; +import android.content.Intent; +import android.content.SharedPreferences; +import android.content.SharedPreferences.Editor; +import android.os.Build; +import android.telephony.PhoneNumberUtils; + +import androidx.preference.Preference; +import androidx.preference.PreferenceManager; +import androidx.preference.SwitchPreferenceCompat; + +import java.util.Arrays; +import java.util.Calendar; +import java.util.List; + +/** @noinspection ExtractMethodRecommender*/ +class EventPreferencesCallScreening extends EventPreferences { + + int _callDirection; + String _contacts; // contactId#phoneId|... + String _contactGroups; // groupId|... + //int _contactListType; // !!! enabled are ony configured contacts + boolean _notInContacts; + boolean _blockCalls; + boolean _sendSMS; + String _smsText; + boolean _permanentRun; + int _duration; + + long _startTime; + + static final String PREF_EVENT_CALL_SCREENING_ENABLED = "eventCallScreeningEnabled"; + private static final String PREF_EVENT_CALL_SCREENING_CALL_DIRECTION = "eventCallScreeningCallDireciton"; + static final String PREF_EVENT_CALL_SCREENING_CONTACTS = "eventCallScreeningContacts"; + static final String PREF_EVENT_CALL_SCREENING_CONTACT_GROUPS = "eventCallScreeningContactGroups"; + //private static final String PREF_EVENT_CALL_SCREENING_CONTACT_LIST_TYPE = "eventCallScreeningContactListType"; + static final String PREF_EVENT_CALL_SCREENING_BLOCK_CALLS_INFO = "eventCallScreeningBlockCallsInfo"; + static final String PREF_EVENT_CALL_SCREENING_BLOCK_CALLS = "eventCallScreeningBlockCalls"; + static final String PREF_EVENT_CALL_SCREENING_SEND_SMS = "eventCallScreeningSendSMS"; + static final String PREF_EVENT_CALL_SCREENING_SMS_TEXT = "eventCallScreeningSMSText"; + static final String PREF_EVENT_CALL_SCREENING_PERMANENT_RUN = "eventCallScreeningPermanentRun"; + private static final String PREF_EVENT_CALL_SCREENING_DURATION = "eventCallScreeningDuration"; + static final String PREF_EVENT_CALL_SCREENING_NOT_IN_CONTACTS = "eventCallScreeningNotInContacts"; + + static final String PREF_EVENT_CALL_SCREENING_SET_CALL_SCREENING_ROLE = "eventCallScreeningSetCallScreeningRole"; + + static final String PREF_EVENT_CALL_SCREENING_CATEGORY = "eventCallScreeningCategoryRoot"; + + //private static final String PREF_EVENT_CALL_SCREENING_ACTIVE = "eventCallScreeningActive"; + private static final String PREF_EVENT_CALL_SCREENING_TIME = "eventCallScreeningTime"; + private static final String PREF_EVENT_CALL_SCREENING_PHONE_NUMBER = "eventCallScreeningPhoneNumber"; + //private static final String PREF_EVENT_CALL_SCREENING_CALL_DIRECTION = "eventCallScreeningCallDirection"; + + //static final int CONTACT_LIST_TYPE_WHITE_LIST = 0; + //static final int CONTACT_LIST_TYPE_BLACK_LIST = 1; + //static final int CONTACT_LIST_TYPE_NOT_USE = 2; + + static final int CALL_DIRECTION_INCOMING = 0; + static final int CALL_DIRECTION_OUTGOING = 1; + static final int CALL_DIRECTION_ALL = 2; + + EventPreferencesCallScreening(Event event, + boolean enabled, + int callDirection, + String contacts, + String contactGroups, + //int contactListType, + boolean notInContacts, + boolean blockCalls, + boolean sendSMS, + String smsText, + boolean permanetRun, + int duration) { + super(event, enabled); + + this._callDirection = callDirection; + this._contacts = contacts; + this._contactGroups = contactGroups; + //this._contactListType = contactListType; + this._notInContacts = notInContacts; + this._blockCalls = blockCalls; + this._sendSMS = sendSMS; + this._smsText = smsText; + this._permanentRun = permanetRun; + this._duration = duration; + + this._startTime = 0; + } + + void copyPreferences(Event fromEvent) { + this._enabled = fromEvent._eventPreferencesCallScreening._enabled; + this._callDirection = fromEvent._eventPreferencesCallScreening._callDirection; + this._contacts = fromEvent._eventPreferencesCallScreening._contacts; + this._contactGroups = fromEvent._eventPreferencesCallScreening._contactGroups; + //this._contactListType = fromEvent._eventPreferencesCallScreening._contactListType; + this._notInContacts = fromEvent._eventPreferencesCallScreening._notInContacts; + this._blockCalls = fromEvent._eventPreferencesCallScreening._blockCalls; + this._sendSMS = fromEvent._eventPreferencesCallScreening._sendSMS; + this._smsText = fromEvent._eventPreferencesCallScreening._smsText; + this._permanentRun = fromEvent._eventPreferencesCallScreening._permanentRun; + this._duration = fromEvent._eventPreferencesCallScreening._duration; + this.setSensorPassed(fromEvent._eventPreferencesCallScreening.getSensorPassed()); + + this._startTime = 0; + } + + void loadSharedPreferences(SharedPreferences preferences) { + Editor editor = preferences.edit(); + editor.putBoolean(PREF_EVENT_CALL_SCREENING_ENABLED, _enabled); + editor.putString(PREF_EVENT_CALL_SCREENING_CALL_DIRECTION, String.valueOf(this._callDirection)); + editor.putString(PREF_EVENT_CALL_SCREENING_CONTACTS, this._contacts); + editor.putString(PREF_EVENT_CALL_SCREENING_CONTACT_GROUPS, this._contactGroups); + //editor.putString(PREF_EVENT_CALL_SCREENING_CONTACT_LIST_TYPE, String.valueOf(this._contactListType)); + editor.putBoolean(PREF_EVENT_CALL_SCREENING_NOT_IN_CONTACTS, this._notInContacts); + editor.putBoolean(PREF_EVENT_CALL_SCREENING_BLOCK_CALLS, this._blockCalls); + editor.putBoolean(PREF_EVENT_CALL_SCREENING_SEND_SMS, this._sendSMS); + editor.putString(PREF_EVENT_CALL_SCREENING_SMS_TEXT, this._smsText); + editor.putBoolean(PREF_EVENT_CALL_SCREENING_PERMANENT_RUN, this._permanentRun); + editor.putString(PREF_EVENT_CALL_SCREENING_DURATION, String.valueOf(this._duration)); + editor.apply(); + } + + void saveSharedPreferences(SharedPreferences preferences) { + this._enabled = preferences.getBoolean(PREF_EVENT_CALL_SCREENING_ENABLED, false); + this._callDirection = Integer.parseInt(preferences.getString(PREF_EVENT_CALL_SCREENING_CALL_DIRECTION, String.valueOf(CALL_DIRECTION_INCOMING))); + this._contacts = preferences.getString(PREF_EVENT_CALL_SCREENING_CONTACTS, ""); + this._contactGroups = preferences.getString(PREF_EVENT_CALL_SCREENING_CONTACT_GROUPS, ""); + //this._contactListType = Integer.parseInt(preferences.getString(PREF_EVENT_CALL_SCREENING_CONTACT_LIST_TYPE, "0")); + this._notInContacts = preferences.getBoolean(PREF_EVENT_CALL_SCREENING_NOT_IN_CONTACTS, false); + this._blockCalls = preferences.getBoolean(PREF_EVENT_CALL_SCREENING_BLOCK_CALLS, false); + this._sendSMS = preferences.getBoolean(PREF_EVENT_CALL_SCREENING_SEND_SMS, false); + this._smsText = preferences.getString(PREF_EVENT_CALL_SCREENING_SMS_TEXT, ""); + this._permanentRun = preferences.getBoolean(PREF_EVENT_CALL_SCREENING_PERMANENT_RUN, false); + this._duration = Integer.parseInt(preferences.getString(PREF_EVENT_CALL_SCREENING_DURATION, "5")); + } + + String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boolean disabled, Context context) { + StringBuilder _value = new StringBuilder(); + + if (!this._enabled) { + if (!addBullet) + _value.append(context.getString(R.string.event_preference_sensor_call_screening_summary)); + } else { + if (addBullet) { + _value.append(StringConstants.TAG_BOLD_START_HTML); + _value.append(getPassStatusString(context.getString(R.string.event_type_call_screening), addPassStatus, DatabaseHandler.ETYPE_CALL_SCREENING, context)); + _value.append(StringConstants.TAG_BOLD_END_WITH_SPACE_HTML); + } + + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_CALL_SCREENING_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + boolean isHeld = isIsCallScreeningHeld(context); + if (!isHeld) { + _value.append(context.getString(R.string.profile_preferences_device_not_allowed)) + .append(StringConstants.STR_COLON_WITH_SPACE).append(context.getString(R.string.event_preference_callScreening_not_held_call_screening_role)); + } else { + _value.append(context.getString(R.string.event_preferences_call_screening_call_direction)); + String[] callEvents = context.getResources().getStringArray(R.array.eventCallScreeningCallDirecitonArray); + _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(callEvents[this._callDirection], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + + if (!_notInContacts) { + _value.append(context.getString(R.string.event_preferences_call_contact_groups)).append(StringConstants.STR_COLON_WITH_SPACE); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(ContactGroupsMultiSelectDialogPreference.getSummary(_contactGroups, context), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + + _value.append(context.getString(R.string.event_preferences_call_contacts)).append(StringConstants.STR_COLON_WITH_SPACE); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(ContactsMultiSelectDialogPreference.getSummary(_contacts, false, context), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); + + //_value.append(context.getString(R.string.event_preferences_contactListType)); + //String[] contactListTypes = context.getResources().getStringArray(R.array.eventCallContactListTypeArray); + //_value.append(StringConstants.STR_BULLET).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(contactListTypes[this._contactListType], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + } else { + _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preference_callScreeningNotInContacts)); + } + + if (_blockCalls) { + _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preference_callScreeningBlockCalls)); + if (_sendSMS) { + _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preference_callScreeningSendSMS)); + } + } + + if (this._permanentRun) + _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_permanentRun), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); + else + _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._duration), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); + } + } + else { + _value.append(context.getString(R.string.profile_preferences_device_not_allowed)) + .append(StringConstants.STR_COLON_WITH_SPACE).append(preferenceAllowed.getNotAllowedPreferenceReasonString(context)); + } + } + + return _value.toString(); + } + + private void setSummary(PreferenceManager prefMng, String key, String value, Context context) { + SharedPreferences preferences = prefMng.getSharedPreferences(); + if (preferences == null) + return; + + if (key.equals(PREF_EVENT_CALL_SCREENING_ENABLED)) { + SwitchPreferenceCompat preference = prefMng.findPreference(key); + if (preference != null) { + GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, preferences.getBoolean(key, false), false, false, false, false); + } + } + + if (key.equals((PREF_EVENT_CALL_SCREENING_CALL_DIRECTION)) /*|| + key.equals(PREF_EVENT_CALL_SCREENING_CONTACT_LIST_TYPE)*/) { + PPListPreference listPreference = prefMng.findPreference(key); + if (listPreference != null) { + int index = listPreference.findIndexOfValue(value); + CharSequence summary = (index >= 0) ? listPreference.getEntries()[index] : null; + listPreference.setSummary(summary); + } + } + + if (key.equals(PREF_EVENT_CALL_SCREENING_SMS_TEXT)) { + Preference preference = prefMng.findPreference(key); + if (preference != null) { + preference.setSummary(value); + } + } + + if (key.equals(PREF_EVENT_CALL_SCREENING_DURATION)) { + Preference preference = prefMng.findPreference(key); + int delay; + try { + delay = Integer.parseInt(value); + } catch (Exception e) { + delay = 5; + } + GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, delay > 5, false, false, false, false); + } + + Event event = new Event(); + event.createEventPreferences(); + event._eventPreferencesCallScreening.saveSharedPreferences(prefMng.getSharedPreferences()); + boolean isRunnable = event._eventPreferencesCallScreening.isRunnable(context); + //boolean isAllConfigured = event._eventPreferencesCall.isAllConfigured(context); + //boolean isAllConfigured = (/*(_contactListType == CONTACT_LIST_TYPE_NOT_USE) ||*/ + // (_notInContacts) || + // (!(_contacts.isEmpty() && _contactGroups.isEmpty()))); + boolean roleHeld = isIsCallScreeningHeld(context); + boolean enabledAndHeld = preferences.getBoolean(PREF_EVENT_CALL_SCREENING_ENABLED, false) && + roleHeld; + Preference preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_SET_CALL_SCREENING_ROLE); + if (preference != null) { + boolean enabled = preferences.getBoolean(PREF_EVENT_CALL_SCREENING_ENABLED, false); + GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabled, roleHeld, false, true, !roleHeld, true); + } + preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_CONTACT_GROUPS); + if (preference != null) { + boolean bold = !prefMng.getSharedPreferences().getString(PREF_EVENT_CALL_SCREENING_CONTACT_GROUPS, "").isEmpty(); + GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabledAndHeld, bold, false, true, !isRunnable, false); + } + preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_CONTACTS); + if (preference != null) { + boolean bold = !prefMng.getSharedPreferences().getString(PREF_EVENT_CALL_SCREENING_CONTACTS, "").isEmpty(); + GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabledAndHeld, bold, false, true, !isRunnable, false); + } + //preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_CONTACT_LIST_TYPE); + //if (preference != null) + // GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabled, false, false, true, !isRunnable, false); + preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_NOT_IN_CONTACTS); + if (preference != null) { + boolean bold = prefMng.getSharedPreferences().getBoolean(PREF_EVENT_CALL_SCREENING_NOT_IN_CONTACTS, false); + GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabledAndHeld, bold, false, true, !isRunnable, false); + } + + preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_BLOCK_CALLS); + if (preference != null) { + boolean bold = prefMng.getSharedPreferences().getBoolean(PREF_EVENT_CALL_SCREENING_BLOCK_CALLS, false); + GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabledAndHeld, bold, false, false, false, false); + } + preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_SEND_SMS); + if (preference != null) { + boolean bold = prefMng.getSharedPreferences().getBoolean(PREF_EVENT_CALL_SCREENING_SEND_SMS, false); + GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabledAndHeld, bold, false, false, false, false); + } + preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_SMS_TEXT); + if (preference != null) { + boolean bold = !prefMng.getSharedPreferences().getString(PREF_EVENT_CALL_SCREENING_SMS_TEXT, "").isEmpty(); + GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabledAndHeld, bold, false, false, false, false); + } + preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_PERMANENT_RUN); + if (preference != null) { + boolean bold = prefMng.getSharedPreferences().getBoolean(PREF_EVENT_CALL_SCREENING_PERMANENT_RUN, false); + GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabledAndHeld, bold, false, false, false, false); + } + } + + void setSummary(PreferenceManager prefMng, String key, SharedPreferences preferences, Context context) { + if (preferences == null) + return; + + Preference preference = prefMng.findPreference(key); + if (preference == null) + return; + + if (key.equals(PREF_EVENT_CALL_SCREENING_ENABLED)) { + boolean value = preferences.getBoolean(key, false); + setSummary(prefMng, key, value ? StringConstants.TRUE_STRING : StringConstants.FALSE_STRING, context); + } + if (/*key.equals(PREF_EVENT_CALL_SCREENING_CONTACT_LIST_TYPE) || + key.equals(PREF_EVENT_CALL_SCREENING_CONTACTS) || + key.equals(PREF_EVENT_CALL_SCREENING_CONTACT_GROUPS) ||*/ + key.equals(PREF_EVENT_CALL_SCREENING_CALL_DIRECTION) || + key.equals(PREF_EVENT_CALL_SCREENING_SMS_TEXT)) { + setSummary(prefMng, key, preferences.getString(key, ""), context); + } + if (key.equals(PREF_EVENT_CALL_SCREENING_NOT_IN_CONTACTS) || + key.equals(PREF_EVENT_CALL_SCREENING_BLOCK_CALLS) || + key.equals(PREF_EVENT_CALL_SCREENING_SEND_SMS)) { + boolean value = preferences.getBoolean(key, false); + setSummary(prefMng, key, value ? StringConstants.TRUE_STRING : StringConstants.FALSE_STRING, context); + } + + if (key.equals(PREF_EVENT_CALL_SCREENING_SET_CALL_SCREENING_ROLE)) { + if (Build.VERSION.SDK_INT >= 29) { + String summary = context.getString(R.string.phone_profiles_pref_call_screening_setCallScreeningRole_summary); + if (isIsCallScreeningHeld(context)) { + summary = context.getString(R.string.phone_profiles_pref_call_screening_setCallScreeningRole_summary_ststus_1) + + StringConstants.STR_DOUBLE_NEWLINE + summary; + } else { + summary = context.getString(R.string.phone_profiles_pref_call_screening_setCallScreeningRole_summary_ststus_0) + + StringConstants.STR_DOUBLE_NEWLINE + summary; + } + preference.setSummary(summary); + } + } + } + + void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Context context) { + setSummary(prefMng, PREF_EVENT_CALL_SCREENING_ENABLED, preferences, context); + setSummary(prefMng, PREF_EVENT_CALL_SCREENING_CALL_DIRECTION, preferences, context); + //setSummary(prefMng, PREF_EVENT_CALL_SCREENING_CONTACT_LIST_TYPE, preferences, context); + setSummary(prefMng, PREF_EVENT_CALL_SCREENING_CONTACTS, preferences, context); + setSummary(prefMng, PREF_EVENT_CALL_SCREENING_CONTACT_GROUPS, preferences, context); + setSummary(prefMng, PREF_EVENT_CALL_SCREENING_NOT_IN_CONTACTS, preferences, context); + setSummary(prefMng, PREF_EVENT_CALL_SCREENING_SET_CALL_SCREENING_ROLE, preferences, context); + setSummary(prefMng, PREF_EVENT_CALL_SCREENING_BLOCK_CALLS, preferences, context); + setSummary(prefMng, PREF_EVENT_CALL_SCREENING_SEND_SMS, preferences, context); + setSummary(prefMng, PREF_EVENT_CALL_SCREENING_SMS_TEXT, preferences, context); + } + + void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_CALL_SCREENING_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + EventPreferencesCallScreening tmp = new EventPreferencesCallScreening(this._event, this._enabled, this._callDirection, this._contacts, + this._contactGroups,/*this._contactListType,*/ this._notInContacts, this._blockCalls, this._sendSMS, this._smsText, this._permanentRun, this._duration); + if (preferences != null) + tmp.saveSharedPreferences(preferences); + + Preference preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_CATEGORY); + if (preference != null) { + boolean enabled = tmp._enabled; //(preferences != null) && preferences.getBoolean(PREF_EVENT_CALL_ENABLED, false); + boolean runnable = tmp.isRunnable(context) && tmp.isAllConfigured(context) && + tmp.isIsCallScreeningHeld(context); + boolean permissionGranted = true; + if (enabled) + permissionGranted = Permissions.checkEventPermissions(context, null, preferences, EventsHandler.SENSOR_TYPE_CALL_SCREENING).isEmpty(); + GlobalGUIRoutines.setPreferenceTitleStyleX(preference, enabled, tmp._enabled, false, false, !(runnable && permissionGranted), true); + if (enabled) + preference.setSummary(StringFormatUtils.fromHtml(tmp.getPreferencesDescription(false, false, !preference.isEnabled(), context), false, false, 0, 0, true)); + else + preference.setSummary(tmp.getPreferencesDescription(false, false, !preference.isEnabled(), context)); + } + } else { + Preference preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_CATEGORY); + if (preference != null) { + preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed)+ + StringConstants.STR_COLON_WITH_SPACE+ preferenceAllowed.getNotAllowedPreferenceReasonString(context)); + preference.setEnabled(false); + } + } + } + + @Override + boolean isRunnable(Context context) { + + boolean runnable = super.isRunnable(context); + + runnable = runnable && isIsCallScreeningHeld(context) && + (/*(_contactListType == CONTACT_LIST_TYPE_NOT_USE) ||*/ + (_notInContacts || + (!(_contacts.isEmpty() && _contactGroups.isEmpty())))); + + return runnable; + } + + boolean isIsCallScreeningHeld(Context context) + { + boolean isHeld = false; + if (Build.VERSION.SDK_INT >= 29) { + RoleManager roleManager = (RoleManager) context.getSystemService(ROLE_SERVICE); + isHeld = (roleManager != null) && roleManager.isRoleHeld(ROLE_CALL_SCREENING); + } + return isHeld; + } + + @Override + void checkPreferences(PreferenceManager prefMng, boolean onlyCategory, Context context) { + super.checkPreferences(prefMng, onlyCategory, context); + SharedPreferences preferences = prefMng.getSharedPreferences(); + if (!onlyCategory) { + if (prefMng.findPreference(PREF_EVENT_CALL_SCREENING_ENABLED) != null) + { + boolean isRoleHeld = isIsCallScreeningHeld(context); + if (preferences != null) { + boolean enabled = preferences.getBoolean(PREF_EVENT_CALL_SCREENING_ENABLED, false); + int direction = Integer.parseInt(preferences.getString(PREF_EVENT_CALL_SCREENING_CALL_DIRECTION, "0")); + boolean notInContacts = preferences.getBoolean(PREF_EVENT_CALL_SCREENING_NOT_IN_CONTACTS, false); + + if (enabled) { + Preference preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_CONTACTS); + if (preference != null) + preference.setEnabled(isRoleHeld && (!notInContacts)); + preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_CONTACT_GROUPS); + if (preference != null) + preference.setEnabled(isRoleHeld && (!notInContacts)); + //preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_CONTACT_LIST_TYPE); + //if (preference != null) + // preference.setEnabled(isRoleHeld); + preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_NOT_IN_CONTACTS); + if (preference != null) + preference.setEnabled(isRoleHeld); + preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_BLOCK_CALLS_INFO); + if (preference != null) + preference.setEnabled(isRoleHeld && (direction != CALL_DIRECTION_OUTGOING)); + preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_BLOCK_CALLS); + if (preference != null) + preference.setEnabled(isRoleHeld && (direction != CALL_DIRECTION_OUTGOING)); + preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_SEND_SMS); + if (preference != null) + preference.setEnabled(isRoleHeld && (direction != CALL_DIRECTION_OUTGOING)); + + boolean sendSMS = preferences.getBoolean(PREF_EVENT_CALL_SCREENING_SEND_SMS, false); + preference = prefMng.findPreference(PREF_EVENT_CALL_SCREENING_SMS_TEXT); + if (preference != null) + preference.setEnabled(isRoleHeld && sendSMS && (direction != CALL_DIRECTION_OUTGOING)); + } + } + + setSummary(prefMng, PREF_EVENT_CALL_SCREENING_ENABLED, preferences, context); + } + } + setCategorySummary(prefMng, preferences, context); + } + + private long computeAlarm() + { + Calendar calEndTime = Calendar.getInstance(); + + int gmtOffset = 0; //TimeZone.getDefault().getRawOffset(); + + calEndTime.setTimeInMillis((_startTime - gmtOffset) + (_duration * 1000L)); + //calEndTime.set(Calendar.SECOND, 0); + //calEndTime.set(Calendar.MILLISECOND, 0); + + long alarmTime; + alarmTime = calEndTime.getTimeInMillis(); + + return alarmTime; + } + + @Override + void setSystemEventForStart(Context context) { + // set alarm for state PAUSE + + // this alarm generates broadcast, that will change state into RUNNING; + // from broadcast will by called EventsHandler + + removeAlarm(context); + } + + @Override + void setSystemEventForPause(Context context) { + // set alarm for state RUNNING + + // this alarm generates broadcast, that will change state into PAUSE; + // from broadcast will by called EventsHandler + + removeAlarm(context); + + //Log.e("EventPreferencesCallScreening.setSystemEventForPause", "xxxxxxxxx (1)"); + + if (!(isRunnable(context) && isAllConfigured(context) && _enabled)) + return; + + //Log.e("EventPreferencesCallScreening.setSystemEventForPause", "xxxxxxxxx (2)"); + + setAlarm(computeAlarm(), context); + } + + @Override + void removeSystemEvent(Context context) { + removeAlarm(context); + } + + boolean isPhoneNumberConfigured(List contactList, String phoneNumber/*, DataWrapper dataWrapper*/) { + boolean phoneNumberFound = false; + + //if (this._contactListType != CONTACT_LIST_TYPE_NOT_USE) { + /*ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); + if (contactsCache == null) + return false; + List contactList; +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCall.isPhoneNumberConfigured", "(1) PPApplication.contactsCacheMutex"); + synchronized (PPApplication.contactsCacheMutex) { + contactList = contactsCache.getList(); //false + }*/ + + // find phone number in groups + String[] splits = this._contactGroups.split(StringConstants.STR_SPLIT_REGEX); + for (String split : splits) { + if (!split.isEmpty()) { +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCall.isPhoneNumberConfigured", "(2) PPApplication.contactsCacheMutex"); + synchronized (PPApplication.contactsCacheMutex) { + if (contactList != null) { + for (Contact contact : contactList) { + if (contact.groups != null) { + long groupId = contact.groups.indexOf(Long.valueOf(split)); + if (groupId != -1) { + // group found in contact + if (contact.phoneId != 0) { + String _phoneNumber = contact.phoneNumber; + if (PhoneNumberUtils.compare(_phoneNumber, phoneNumber)) { + phoneNumberFound = true; + break; + } + } + } + } + } + } + } + } + + if (phoneNumberFound) + break; + } + + if (!phoneNumberFound) { + // find phone number in contacts + // contactId#phoneId|... + splits = this._contacts.split(StringConstants.STR_SPLIT_REGEX); + for (String split : splits) { + String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX); + + if ((!split.isEmpty()) && + (splits2.length == 3) && + (!splits2[0].isEmpty()) && + (!splits2[1].isEmpty()) && + (!splits2[2].isEmpty())) { + String contactPhoneNumber = splits2[1]; + if (PhoneNumberUtils.compare(contactPhoneNumber, phoneNumber)) { + // phone number is in sensor configured + phoneNumberFound = true; + break; + } + } + } + } + + //if (this._contactListType == CONTACT_LIST_TYPE_BLACK_LIST) + // phoneNumberFound = !phoneNumberFound; + //} else + // phoneNumberFound = true; + + if (this._notInContacts && (!phoneNumberFound)) + return true; + else + return phoneNumberFound; + } + + /* + static void getEventCallScreeningActive(Context context) { +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCallScreening.getEventCallScreeningActive", "PPApplication.eventCallSensorMutex"); + synchronized (PPApplication.eventCallSensorMutex) { + ApplicationPreferences.prefEventCallScreeningActive = ApplicationPreferences. + getSharedPreferences(context).getBoolean(EventPreferencesCallScreening.PREF_EVENT_CALL_SCREENING_ACTIVE, false); + } + } + static void setEventCallScreeningActive(Context context, boolean active) { +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCallScreening.setEventCallScreeningActive", "PPApplication.eventCallSensorMutex"); + synchronized (PPApplication.eventCallSensorMutex) { + SharedPreferences.Editor editor = ApplicationPreferences.getEditor(context); + editor.putBoolean(EventPreferencesCallScreening.PREF_EVENT_CALL_SCREENING_ACTIVE, active); + editor.apply(); + ApplicationPreferences.prefEventCallScreeningActive = active; + } + } + */ + static void getEventCallScreeningTime(Context context) { +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCall.getEventCallEventTime", "PPApplication.eventCallSensorMutex"); + synchronized (PPApplication.eventCallSensorMutex) { + ApplicationPreferences.prefEventCallScreeningTime = ApplicationPreferences. + getSharedPreferences(context).getLong(PREF_EVENT_CALL_SCREENING_TIME, 0); + } + } + static void setEventCallScreeningTime(Context context, long time) { +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCall.setEventCallEventTime", "PPApplication.eventCallSensorMutex"); + synchronized (PPApplication.eventCallSensorMutex) { + SharedPreferences.Editor editor = ApplicationPreferences.getEditor(context); + editor.putLong(PREF_EVENT_CALL_SCREENING_TIME, time); + ApplicationPreferences.prefEventCallScreeningTime = time; + editor.apply(); + } + } + static void getEventCallScreeningPhoneNumber(Context context) { +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCallScreening.getEventCallScreeningPhoneNumber", "PPApplication.eventCallSensorMutex"); + synchronized (PPApplication.eventCallSensorMutex) { + ApplicationPreferences.prefEventCallScreeningPhoneNumber = ApplicationPreferences. + getSharedPreferences(context).getString(PREF_EVENT_CALL_SCREENING_PHONE_NUMBER, ""); + } + } + static void setEventCallScreeningPhoneNumber(Context context, String phoneNumber) { +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCallScreening.setEventCallScreeningPhoneNumber", "PPApplication.eventCallSensorMutex"); + synchronized (PPApplication.eventCallSensorMutex) { + SharedPreferences.Editor editor = ApplicationPreferences.getEditor(context); + editor.putString(PREF_EVENT_CALL_SCREENING_PHONE_NUMBER, phoneNumber); + editor.apply(); + ApplicationPreferences.prefEventCallScreeningPhoneNumber = phoneNumber; + } + } + static void getEventCallScreeningCallDirection(Context context) { +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCall.getEventCallEventTime", "PPApplication.eventCallSensorMutex"); + synchronized (PPApplication.eventCallSensorMutex) { + ApplicationPreferences.prefEventCallScreeningCallDirection = ApplicationPreferences. + getSharedPreferences(context).getInt(PREF_EVENT_CALL_SCREENING_CALL_DIRECTION, CALL_DIRECTION_INCOMING); + } + } + static void setEventCallScreeningCallDirection(Context context, int direction) { +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCall.setEventCallEventTime", "PPApplication.eventCallSensorMutex"); + synchronized (PPApplication.eventCallSensorMutex) { + SharedPreferences.Editor editor = ApplicationPreferences.getEditor(context); + editor.putInt(PREF_EVENT_CALL_SCREENING_CALL_DIRECTION, direction); + ApplicationPreferences.prefEventCallScreeningCallDirection = direction; + editor.apply(); + } + } + + + void removeAlarm(Context context) + { + try { + AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); + if (alarmManager != null) { + //Intent intent = new Intent(context, SMSEventEndBroadcastReceiver.class); + Intent intent = new Intent(); + intent.setAction(PhoneProfilesService.ACTION_CALL_SCREENING_EVENT_END_BROADCAST_RECEIVER); + //intent.setClass(context, SMSEventEndBroadcastReceiver.class); + + PendingIntent pendingIntent = PendingIntent.getBroadcast(context, (int) _event._id, intent, PendingIntent.FLAG_NO_CREATE); + if (pendingIntent != null) { + alarmManager.cancel(pendingIntent); + pendingIntent.cancel(); + } + } + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } + //PPApplication.cancelWork(WorkerWithoutData.ELAPSED_ALARMS_SMS_EVENT_SENSOR_TAG_WORK+"_" + (int) _event._id); + } + + private void setAlarm(long alarmTime, Context context) + { + if (!_permanentRun) { + if (_startTime > 0) { + //Intent intent = new Intent(context, SMSEventEndBroadcastReceiver.class); + Intent intent = new Intent(); + intent.setAction(PhoneProfilesService.ACTION_CALL_SCREENING_EVENT_END_BROADCAST_RECEIVER); + //intent.setClass(context, SMSEventEndBroadcastReceiver.class); + + //intent.putExtra(PPApplication.EXTRA_EVENT_ID, _event._id); + + PendingIntent pendingIntent = PendingIntent.getBroadcast(context, (int) _event._id, intent, PendingIntent.FLAG_UPDATE_CURRENT); + + AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE); + if (alarmManager != null) { + if (ApplicationPreferences.applicationUseAlarmClock) { + Intent editorIntent = new Intent(context, EditorActivity.class); + editorIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); + PendingIntent infoPendingIntent = PendingIntent.getActivity(context, 1000, editorIntent, PendingIntent.FLAG_UPDATE_CURRENT); + AlarmManager.AlarmClockInfo clockInfo = new AlarmManager.AlarmClockInfo(alarmTime + Event.EVENT_ALARM_TIME_SOFT_OFFSET, infoPendingIntent); + alarmManager.setAlarmClock(clockInfo, pendingIntent); + } + else { + alarmManager.setExactAndAllowWhileIdle(AlarmManager.RTC_WAKEUP, alarmTime + Event.EVENT_ALARM_TIME_OFFSET, pendingIntent); + } + } + } + } + } + + void saveStartTime(List contactList, DataWrapper dataWrapper, String phoneNumber, long startTime) { + if (this._startTime == 0) { + // alarm for end is not set + + if (Permissions.checkContacts(dataWrapper.context)) { + boolean phoneNumberFound = false; + + //if (this._contactListType != EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) { + // find phone number in groups + String[] splits = this._contactGroups.split(StringConstants.STR_SPLIT_REGEX); + for (String split : splits) { + if (!split.isEmpty()) { +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCallScreening.saveStartTime", "(2) PPApplication.contactsCacheMutex"); + synchronized (PPApplication.contactsCacheMutex) { + if (contactList != null) { + for (Contact contact : contactList) { + if (contact.groups != null) { + long groupId = contact.groups.indexOf(Long.valueOf(split)); + if (groupId != -1) { + // group found in contact + if (contact.phoneId != 0) { + String _phoneNumber = contact.phoneNumber; + if (PhoneNumberUtils.compare(_phoneNumber, phoneNumber)) { + phoneNumberFound = true; + break; + } + } + } + } + } + } + } + } + + if (phoneNumberFound) + break; + } + + if (!phoneNumberFound) { + // find phone number in contacts + // contactId#phoneId|... + splits = this._contacts.split(StringConstants.STR_SPLIT_REGEX); + for (String split : splits) { + String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX); + + if ((!split.isEmpty()) && + (splits2.length == 3) && + (!splits2[0].isEmpty()) && + (!splits2[1].isEmpty()) && + (!splits2[2].isEmpty())) { + String contactPhoneNumber = splits2[1]; + if (PhoneNumberUtils.compare(contactPhoneNumber, phoneNumber)) { + // phone number is in sensor configured + phoneNumberFound = true; + break; + } + } + } + } + + //if (this._contactListType == EventPreferencesCall.CONTACT_LIST_TYPE_BLACK_LIST) + // phoneNumberFound = !phoneNumberFound; + + //} else + // phoneNumberFound = true; + + boolean callSystemEvent = false; + if (this._notInContacts) { + if (!phoneNumberFound) { + this._startTime = startTime;// + (10 * 1000); + callSystemEvent = true; + } + else { + this._startTime = 0; + } + } + else { + if (phoneNumberFound) { + this._startTime = startTime;// + (10 * 1000); + callSystemEvent = true; + } else { + //Log.e("EventPreferencesCallScreening.saveStartTime", "*** (1) _startTime = 0"); + this._startTime = 0; + } + } + + DatabaseHandler.getInstance(dataWrapper.context).updateCallScreeningStartTime(_event); + + if (callSystemEvent) { + //if (_event.getStatus() == Event.ESTATUS_RUNNING) + setSystemEventForPause(dataWrapper.context); + } + } else { + //Log.e("EventPreferencesCallScreening.saveStartTime", "*** (2) _startTime = 0"); + this._startTime = 0; + DatabaseHandler.getInstance(dataWrapper.context).updateCallScreeningStartTime(_event); + } + } + } + + void doHandleEvent(EventsHandler eventsHandler) { + if (_enabled) { + int oldSensorPassed = getSensorPassed(); + if ((EventStatic.isEventPreferenceAllowed(PREF_EVENT_CALL_SCREENING_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + + if (isIsCallScreeningHeld(eventsHandler.context)) { + + //Log.e("EventPreferencesCallScreening.doHandleEvent", "_startTime="+_startTime); + if (_startTime > 0) { + + int gmtOffset = 0; //TimeZone.getDefault().getRawOffset(); + long startTime = _startTime - gmtOffset; + + // compute end datetime + long endAlarmTime = computeAlarm(); + + Calendar now = Calendar.getInstance(); + long nowAlarmTime = now.getTimeInMillis(); + + boolean continueHandler; + if (Arrays.stream(eventsHandler.sensorType).anyMatch(i -> i == EventsHandler.SENSOR_TYPE_CALL_SCREENING)) + continueHandler = true; + else if (!_permanentRun) { + if (Arrays.stream(eventsHandler.sensorType).anyMatch(i -> i == EventsHandler.SENSOR_TYPE_CALL_SCREENING_EVENT_END)) + continueHandler = false; + else + continueHandler = ((nowAlarmTime >= startTime) && (nowAlarmTime < endAlarmTime)); + } else { + continueHandler = nowAlarmTime >= startTime; + } + + //Log.e("EventPreferencesCallScreening.doHandleEvent", "continueHandler="+continueHandler); + + if (continueHandler) { + // permissions are checked in EditorActivity.displayRedTextToPreferencesNotification() + int callDirection = ApplicationPreferences.prefEventCallScreeningCallDirection; + String phoneNumber = ApplicationPreferences.prefEventCallScreeningPhoneNumber; + //Log.e("EventPreferencesCallScreening.doHandleEvent", "screeningActive="+screeningActive); + //Log.e("EventPreferencesCallScreening.doHandleEvent", "phoneNumber="+phoneNumber); + + boolean phoneNumberFound = false; + + if ((_callDirection == CALL_DIRECTION_ALL) || (_callDirection == callDirection)) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCallScreening.doHandleEvent", "PPApplicationStatic.getContactsCache()"); + ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); + if (contactsCache != null) { + List contactList; +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCall.doHandleEvent", "PPApplication.contactsCacheMutex"); +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesCallScreening.doHandleEvent", "contactsCache.getList()"); + contactList = contactsCache.getList(); + phoneNumberFound = isPhoneNumberConfigured(contactList, phoneNumber); + if (contactList != null) + contactList.clear(); + } + + //Log.e("EventPreferencesCallScreening.doHandleEvent", "phoneNumberFound="+phoneNumberFound); + + if (!phoneNumberFound) + eventsHandler.callScreeningPassed = false; + + } else + eventsHandler.callScreeningPassed = false; + } else + eventsHandler.callScreeningPassed = false; + } else + eventsHandler.callScreeningPassed = false; + } else + eventsHandler.notAllowedCallScreening = false; + + if (!eventsHandler.callScreeningPassed) { + //Log.e("EventPreferencesCallScreening.doHandleEvent", "*** _startTime = 0"); + _startTime = 0; + DatabaseHandler.getInstance(eventsHandler.context).updateCallScreeningStartTime(_event); + } + + if (!eventsHandler.notAllowedCallScreening) { + if (eventsHandler.callScreeningPassed) + setSensorPassed(EventPreferences.SENSOR_PASSED_PASSED); + else + setSensorPassed(EventPreferences.SENSOR_PASSED_NOT_PASSED); + } + } + else + eventsHandler.notAllowedCallScreening = true; + + int newSensorPassed = getSensorPassed() & (~EventPreferences.SENSOR_PASSED_WAITING); + if (oldSensorPassed != newSensorPassed) { + setSensorPassed(newSensorPassed); + DatabaseHandler.getInstance(eventsHandler.context).updateEventSensorPassed(_event, DatabaseHandler.ETYPE_CALL_SCREENING); + } + } + } + +} diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesDeviceBoot.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesDeviceBoot.java index 6a264f7ef1..7e43209b2d 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesDeviceBoot.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesDeviceBoot.java @@ -72,7 +72,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_device_boot_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_DEVICE_BOOT_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_DEVICE_BOOT_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_device_boot), addPassStatus, DatabaseHandler.ETYPE_DEVICE_BOOT, context)); @@ -80,9 +80,9 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } if (this._permanentRun) - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_permanentRun), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_permanentRun), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); else - _value.append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._duration), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._duration), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } @@ -152,8 +152,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences/*, C } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_DEVICE_BOOT_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_DEVICE_BOOT_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesDeviceBoot tmp = new EventPreferencesDeviceBoot(this._event, this._enabled, this._permanentRun, this._duration); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -311,7 +311,7 @@ void saveStartTime(DataWrapper dataWrapper, long startTime) { void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesDeviceBoot.PREF_EVENT_DEVICE_BOOT_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesDeviceBoot.PREF_EVENT_DEVICE_BOOT_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { // compute start time if (_startTime > 0) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesLocation.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesLocation.java index 247c9d8f50..c5d1b0c571 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesLocation.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesLocation.java @@ -72,7 +72,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_location_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_LOCATION_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_LOCATION_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_locations), addPassStatus, DatabaseHandler.ETYPE_LOCATION, context)); @@ -125,9 +125,9 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } } selectedLocations = value.toString(); - _value.append(context.getString(R.string.event_preferences_locations_location)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedLocations, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.event_preferences_locations_location)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedLocations, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); if (this._whenOutside) - _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_location_when_outside_description), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_location_when_outside_description), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } @@ -157,7 +157,7 @@ private void setSummary(PreferenceManager prefMng, String key/*, String value*/, if (!ApplicationPreferences.applicationEventLocationDisabledScannigByProfile) { summary = "* " + context.getString(R.string.array_pref_applicationDisableScanning_disabled) + "! *"+StringConstants.STR_DOUBLE_NEWLINE + context.getString(R.string.phone_profiles_pref_eventLocationAppSettings_summary); - titleColor = ContextCompat.getColor(context, R.color.error_color); + titleColor = ContextCompat.getColor(context, R.color.errorColor); } else { summary = context.getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile) + StringConstants.STR_DOUBLE_NEWLINE + @@ -205,7 +205,7 @@ private void setSummary(PreferenceManager prefMng, String key/*, String value*/, if (!GlobalUtils.isLocationEnabled(context.getApplicationContext())) { summary = "* " + context.getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary) + "! *"+StringConstants.STR_DOUBLE_NEWLINE + summary; - titleColor = ContextCompat.getColor(context, R.color.error_color); + titleColor = ContextCompat.getColor(context, R.color.errorColor); } else { summary = context.getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsEnabled_summary) + StringConstants.STR_DOUBLE_NEWLINE_WITH_DOT+ @@ -282,8 +282,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_LOCATION_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_LOCATION_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesLocation tmp = new EventPreferencesLocation(this._event, this._enabled, this._geofences, this._whenOutside); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -383,7 +383,7 @@ static String getGeofenceName(long geofenceId, Context context) { void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesLocation.PREF_EVENT_LOCATION_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesLocation.PREF_EVENT_LOCATION_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) // permissions are checked in EditorActivity.displayRedTextToPreferencesNotification() /*&& Permissions.checkEventLocation(context, event, null)*/) { if (!ApplicationPreferences.applicationEventLocationEnableScanning) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesMobileCells.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesMobileCells.java index 64797b3c63..77a87b8703 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesMobileCells.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesMobileCells.java @@ -91,8 +91,8 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(StringConstants.TAG_BOLD_END_WITH_SPACE_HTML); } - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_MOBILE_CELLS_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_MOBILE_CELLS_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { boolean locationErrorDisplayed = false; if (!ApplicationPreferences.applicationEventMobileCellEnableScanning) { @@ -124,9 +124,9 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } } - _value.append(context.getString(R.string.event_preferences_mobile_cells_cellNames)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(MobileCellNamesPreference.getSummary(this._cellsNames, context), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.event_preferences_mobile_cells_cellNames)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(MobileCellNamesPreference.getSummary(this._cellsNames, context), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); if (this._whenOutside) - _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_mobile_cells_when_outside_description), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_mobile_cells_when_outside_description), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); boolean hasSIMCard = false; final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); @@ -148,7 +148,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (hasSIMCard) { _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_mobile_cells_forSimCard)); String[] forSimCard = context.getResources().getStringArray(R.array.eventMobileCellsForSimCardArray); - _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(forSimCard[this._forSIMCard], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(forSimCard[this._forSIMCard], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } else { @@ -183,7 +183,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con if (!ApplicationPreferences.applicationEventMobileCellDisabledScannigByProfile) { summary = "* " + context.getString(R.string.array_pref_applicationDisableScanning_disabled) + "! *"+StringConstants.STR_DOUBLE_NEWLINE + context.getString(R.string.phone_profiles_pref_eventMobileCellsAppSettings_summary); - titleColor = ContextCompat.getColor(context, R.color.error_color); + titleColor = ContextCompat.getColor(context, R.color.errorColor); } else { summary = context.getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile) + StringConstants.STR_DOUBLE_NEWLINE + @@ -240,7 +240,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con } else { summary = "* " + context.getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary) + "! *" + StringConstants.STR_DOUBLE_NEWLINE + summary; - titleColor = ContextCompat.getColor(context, R.color.error_color); + titleColor = ContextCompat.getColor(context, R.color.errorColor); } } else { @@ -308,7 +308,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con Preference preference = prefMng.findPreference(PREF_EVENT_MOBILE_CELLS_FOR_SIM_CARD); if (preference != null) { PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); @@ -318,7 +318,7 @@ else if (!hasSIMCard) { Preference preference = prefMng.findPreference(PREF_EVENT_MOBILE_CELLS_FOR_SIM_CARD); if (preference != null) { PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_TWO_SIM_CARDS; preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); @@ -373,8 +373,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_MOBILE_CELLS_ENABLED_NO_CHECK_SIM, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_MOBILE_CELLS_ENABLED_NO_CHECK_SIM, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesMobileCells tmp = new EventPreferencesMobileCells(this._event, this._enabled, this._cellsNames, this._whenOutside, this._forSIMCard); if (preferences != null) @@ -525,7 +525,7 @@ void removeSystemEvent(Context context) void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) // permissions are checked in EditorActivity.displayRedTextToPreferencesNotification() /*&& Permissions.checkEventLocation(context, event, null)*/) { if (!ApplicationPreferences.applicationEventMobileCellEnableScanning) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesMusic.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesMusic.java index d7834120b0..dd53df9f5e 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesMusic.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesMusic.java @@ -73,7 +73,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_music_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_MUSIC_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_MUSIC_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_music), addPassStatus, DatabaseHandler.ETYPE_MUSIC, context)); @@ -82,7 +82,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(context.getString(R.string.event_preferences_music_state)); String[] musicSate = context.getResources().getStringArray(R.array.eventMusicStatesArray); - _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(musicSate[this._musicState], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(musicSate[this._musicState], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); String selectedApplications = context.getString(R.string.applications_multiselect_summary_text_not_selected); if (!this._applications.isEmpty() && !this._applications.equals("-")) { @@ -95,7 +95,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole ApplicationInfo app; try { app = packageManager.getApplicationInfo(packageName, PackageManager.MATCH_ALL); - if (app != null) + //if (app != null) selectedApplications = packageManager.getApplicationLabel(app).toString(); } catch (Exception e) { selectedApplications = context.getString(R.string.applications_multiselect_summary_text_selected) + StringConstants.STR_COLON_WITH_SPACE + splits.length; @@ -110,7 +110,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } else selectedApplications = context.getString(R.string.applications_multiselect_summary_text_selected) + StringConstants.STR_COLON_WITH_SPACE + splits.length; } - _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_applications_applications)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedApplications, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_applications_applications)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedApplications, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } @@ -197,8 +197,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_MUSIC_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_MUSIC_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesMusic tmp = new EventPreferencesMusic(this._event, this._enabled, this._musicState, this._applications); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -272,7 +272,7 @@ void removeSystemEvent(Context context) void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesMusic.PREF_EVENT_MUSIC_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesMusic.PREF_EVENT_MUSIC_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { boolean isNotAllowedSession = false; // play media from PPP is ignored @@ -295,7 +295,8 @@ void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { for (MediaController controller : activeSessions) { String applicationFromController = controller.getPackageName(); // Log.e("EventPreferencesMusic.doHandleEvent", "controller=" + applicationFromController); - if (applicationFromController.equals(PPApplication.PACKAGE_NAME) || + if (applicationFromController.equals(PPApplication.PACKAGE_NAME_PP) || + applicationFromController.equals(PPApplication.PACKAGE_NAME) || applicationFromController.equals(PPApplication.PACKAGE_NAME_EXTENDER) || applicationFromController.equals(PPApplication.PACKAGE_NAME_PPPPS)) { isNotAllowedSession = true; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesNFC.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesNFC.java index cb8bbd497d..4d113c7b79 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesNFC.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesNFC.java @@ -82,7 +82,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_nfc_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_NFC_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_NFC_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_nfc), addPassStatus, DatabaseHandler.ETYPE_NFC, context)); @@ -109,11 +109,11 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } } selectedNfcTags = value.toString(); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedNfcTags, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedNfcTags, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); if (this._permanentRun) - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_permanentRun), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_permanentRun), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); else - _value.append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._duration), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._duration), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } @@ -195,7 +195,7 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con setSummary(prefMng, PREF_EVENT_NFC_PERMANENT_RUN, preferences, context); setSummary(prefMng, PREF_EVENT_NFC_DURATION, preferences, context); - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_NFC_ENABLED, context).allowed + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_NFC_ENABLED, false, context).preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { Preference preference = prefMng.findPreference(PREF_EVENT_NFC_ENABLED); @@ -208,8 +208,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_NFC_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_NFC_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesNFC tmp = new EventPreferencesNFC(this._event, this._enabled, this._nfcTags, this._permanentRun, this._duration); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -255,7 +255,7 @@ void checkPreferences(PreferenceManager prefMng, boolean onlyCategory, Context c SharedPreferences preferences = prefMng.getSharedPreferences(); if (!onlyCategory) { if (prefMng.findPreference(PREF_EVENT_NFC_ENABLED) != null) { - boolean enabled = EventStatic.isEventPreferenceAllowed(PREF_EVENT_NFC_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED; + boolean enabled = EventStatic.isEventPreferenceAllowed(PREF_EVENT_NFC_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; Preference nfcTagsPreference = prefMng.findPreference(PREF_EVENT_NFC_NFC_TAGS); Preference permanentRunPreference = prefMng.findPreference(PREF_EVENT_NFC_PERMANENT_RUN); Preference durationPreference = prefMng.findPreference(PREF_EVENT_NFC_DURATION); @@ -409,7 +409,7 @@ void saveStartTime(DataWrapper dataWrapper, String tagName, long startTime) { void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesNFC.PREF_EVENT_NFC_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesNFC.PREF_EVENT_NFC_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { // compute start time if (_startTime > 0) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesNotification.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesNotification.java index 8782c494a8..c19d17e88e 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesNotification.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesNotification.java @@ -141,7 +141,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_notification_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_NOTIFICATION_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_NOTIFICATION_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_notifications), addPassStatus, DatabaseHandler.ETYPE_NOTIFICATION, context)); @@ -167,12 +167,12 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole //descr = descr + context.getString(R.string.event_preferences_notificationsAccessSettings_enabled_summary) + "
"; if (this._inCall) { - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_notifications_inCall), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_notifications_inCall), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } if (this._missedCall) { if (this._inCall) _value.append(StringConstants.STR_BULLET); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_notifications_missedCall), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_notifications_missedCall), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } String selectedApplications = context.getString(R.string.applications_multiselect_summary_text_not_selected); if (!this._applications.isEmpty() && !this._applications.equals("-")) { @@ -185,7 +185,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole ApplicationInfo app; try { app = packageManager.getApplicationInfo(packageName, PackageManager.MATCH_ALL); - if (app != null) + //if (app != null) selectedApplications = packageManager.getApplicationLabel(app).toString(); } catch (Exception e) { selectedApplications = context.getString(R.string.applications_multiselect_summary_text_selected) + StringConstants.STR_COLON_WITH_SPACE + splits.length; @@ -202,31 +202,31 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } if (this._inCall || this._missedCall) _value.append(StringConstants.STR_BULLET); - _value.append(context.getString(R.string.event_preferences_notifications_applications)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedApplications, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.event_preferences_notifications_applications)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedApplications, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); if (this._checkContacts) { _value.append(StringConstants.STR_BULLET); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_notifications_checkContacts), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_COLON_WITH_SPACE); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_notifications_checkContacts), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_COLON_WITH_SPACE); _value.append(context.getString(R.string.event_preferences_notifications_contact_groups)).append(StringConstants.STR_COLON_WITH_SPACE); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(ContactGroupsMultiSelectDialogPreference.getSummary(_contactGroups, context), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(ContactGroupsMultiSelectDialogPreference.getSummary(_contactGroups, context), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_notifications_contacts)).append(StringConstants.STR_COLON_WITH_SPACE); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(ContactsMultiSelectDialogPreference.getSummary(_contacts, true, context), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(ContactsMultiSelectDialogPreference.getSummary(_contacts, true, context), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_contactListType)).append(StringConstants.STR_COLON_WITH_SPACE); String[] contactListTypes = context.getResources().getStringArray(R.array.eventNotificationContactListTypeArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(contactListTypes[this._contactListType], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(contactListTypes[this._contactListType], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } if (this._checkText) { _value.append(StringConstants.STR_BULLET); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_notifications_checkText), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_COLON_WITH_SPACE); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_notifications_checkText), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_COLON_WITH_SPACE); _value.append(context.getString(R.string.event_preferences_notifications_text)).append(StringConstants.STR_COLON_WITH_SPACE); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(_text, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(_text, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } _value.append(StringConstants.STR_BULLET); - _value.append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._duration), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._duration), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } } @@ -258,7 +258,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con if (!ApplicationPreferences.applicationEventNotificationDisabledScannigByProfile) { summary = "* " + context.getString(R.string.array_pref_applicationDisableScanning_disabled) + "! *"+StringConstants.STR_DOUBLE_NEWLINE + context.getString(R.string.phone_profiles_pref_eventNotificationAppSettings_summary); - titleColor = ContextCompat.getColor(context, R.color.error_color); + titleColor = ContextCompat.getColor(context, R.color.errorColor); } else { summary = context.getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile) + StringConstants.STR_DOUBLE_NEWLINE + @@ -306,7 +306,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con if (!PPNotificationListenerService.isNotificationListenerServiceEnabled(context.getApplicationContext(), true)) { summary = "* " + context.getString(R.string.event_preferences_notificationsAccessSettings_disabled_summary) + "! *"+StringConstants.STR_DOUBLE_NEWLINE+ summary; - titleColor = ContextCompat.getColor(context, R.color.error_color); + titleColor = ContextCompat.getColor(context, R.color.errorColor); } else { summary = context.getString(R.string.event_preferences_notificationsAccessSettings_enabled_summary) + StringConstants.STR_DOUBLE_NEWLINE_WITH_DOT+ @@ -474,8 +474,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_NOTIFICATION_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_NOTIFICATION_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesNotification tmp = new EventPreferencesNotification(this._event, this._enabled, this._applications, this._inCall, this._missedCall, this._duration, this._checkContacts, this._contactGroups, this._contacts, @@ -513,22 +513,20 @@ boolean isRunnable(Context context) boolean runnable = super.isRunnable(context); boolean okCheck = false; + if (_inCall || _missedCall || (!_applications.isEmpty())) { + if (_checkContacts) { + runnable = runnable && ((_contactListType == EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) || + (!(_contacts.isEmpty() && _contactGroups.isEmpty()))); + okCheck = true; + } - if (_checkContacts) { - runnable = runnable && ((_contactListType == EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) || - (!(_contacts.isEmpty() && _contactGroups.isEmpty()))); - okCheck = true; - } - - if (_checkText) { - runnable = runnable && (!_text.isEmpty()); - okCheck = true; + if (_checkText) { + runnable = runnable && (!_text.isEmpty()); + okCheck = true; + } } - if (!okCheck) - runnable = runnable && (_inCall || _missedCall || (!_applications.isEmpty())); - - return runnable; + return runnable && okCheck; } @Override @@ -536,6 +534,8 @@ boolean isAllConfigured(Context context) { boolean allConfigured = super.isAllConfigured(context); + allConfigured = allConfigured && isRunnable(context); + allConfigured = allConfigured && (ApplicationPreferences.applicationEventNotificationEnableScanning || ApplicationPreferences.applicationEventNotificationDisabledScannigByProfile); @@ -950,18 +950,20 @@ private boolean isNotificationVisible(Context context) { StatusBarNotification[] statusBarNotifications = service.getActiveNotifications(); //noinspection RedundantLengthCheck if ((statusBarNotifications != null) && (statusBarNotifications.length > 0)) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesNotification.isNotificationVisible", "PPApplicationStatic.getContactsCache()"); ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); if (contactsCache == null) return false; List contactList; // PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesNotification.isNotificationVisible", "PPApplication.contactsCacheMutex"); - synchronized (PPApplication.contactsCacheMutex) { - contactList = contactsCache.getList(/*false*/); - } +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesNotification.isNotificationVisible", "contactsCache.getList()"); + contactList = contactsCache.getList(/*false*/); for (StatusBarNotification statusBarNotification : statusBarNotifications) { // ignore PPP notification + if (statusBarNotification.getPackageName().equals(PPApplication.PACKAGE_NAME_PP)) + continue; if (statusBarNotification.getPackageName().equals(PPApplication.PACKAGE_NAME)) continue; if (statusBarNotification.getPackageName().equals(PPApplication.PACKAGE_NAME_PP)) @@ -1151,14 +1153,14 @@ private StatusBarNotification getNewestVisibleNotification(Context context) { StatusBarNotification newestNotification = null; StatusBarNotification activeNotification; +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesNotification.getNewestVisibleNotification", "PPApplicationStatic.getContactsCache()"); ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); if (contactsCache == null) return null; List contactList; // PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesNotification.getNewestVisibleNotification", "PPApplication.contactsCacheMutex"); - synchronized (PPApplication.contactsCacheMutex) { - contactList = contactsCache.getList(/*false*/); - } +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventPreferencesNotification.getNewestVisibleNotification", "contactsCache.getList()"); + contactList = contactsCache.getList(/*false*/); for (StatusBarNotification statusBarNotification : statusBarNotifications) { if (this._inCall) { @@ -1305,7 +1307,7 @@ private boolean isContactConfigured(String text, List contactList) { void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesNotification.PREF_EVENT_NOTIFICATION_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesNotification.PREF_EVENT_NOTIFICATION_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { boolean scanningPaused = ApplicationPreferences.applicationEventNotificationScanInTimeMultiply.equals("2") && GlobalUtils.isNowTimeBetweenTimes( diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesOrientation.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesOrientation.java index afde9624c3..8b59499c98 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesOrientation.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesOrientation.java @@ -155,7 +155,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_orientation_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_ORIENTATION_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_ORIENTATION_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_orientation), addPassStatus, DatabaseHandler.ETYPE_ORIENTATION, context)); @@ -195,7 +195,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } selectedValues = __value.toString(); } - _value.append(context.getString(R.string.event_preferences_orientation_display)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedValues, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.event_preferences_orientation_display)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedValues, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); //SensorManager sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE); @@ -217,22 +217,22 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } selectedValues = __value.toString(); } - _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_orientation_sides)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedValues, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_orientation_sides)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedValues, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } String[] distanceValues = context.getResources().getStringArray(R.array.eventOrientationDistanceTypeValues); String[] distanceNames = context.getResources().getStringArray(R.array.eventOrientationDistanceTypeArray); int i = Arrays.asList(distanceValues).indexOf(String.valueOf(this._distance)); if (i != -1) - _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_orientation_distance)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(distanceNames[i], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_orientation_distance)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(distanceNames[i], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); if (this._checkLight) { _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_orientation_light)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(this._lightMin + "-" + this._lightMax, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + .append(getColorForChangedPreferenceValue(this._lightMin + "-" + this._lightMax, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } else { _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_orientation_light)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_orientation_light_not_enabled), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + .append(getColorForChangedPreferenceValue(context.getString(R.string.event_preferences_orientation_light_not_enabled), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } String selectedApplications = context.getString(R.string.applications_multiselect_summary_text_not_selected); @@ -260,7 +260,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole ApplicationInfo app; try { app = packageManager.getApplicationInfo(packageName, PackageManager.MATCH_ALL); - if (app != null) + //if (app != null) selectedApplications = packageManager.getApplicationLabel(app).toString(); } catch (Exception e) { selectedApplications = context.getString(R.string.applications_multiselect_summary_text_selected) + StringConstants.STR_COLON_WITH_SPACE + splits.length; @@ -275,7 +275,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } else selectedApplications = context.getString(R.string.applications_multiselect_summary_text_selected) + StringConstants.STR_COLON_WITH_SPACE + splits.length; } - _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_orientation_ignoreForApplications)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedApplications, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_orientation_ignoreForApplications)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedApplications, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } @@ -306,7 +306,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con if (!ApplicationPreferences.applicationEventOrientationDisabledScannigByProfile) { summary = "* " + context.getString(R.string.array_pref_applicationDisableScanning_disabled) + "! *"+StringConstants.STR_DOUBLE_NEWLINE + context.getString(R.string.phone_profiles_pref_eventOrientationAppSettings_summary); - titleColor = ContextCompat.getColor(context, R.color.error_color); + titleColor = ContextCompat.getColor(context, R.color.errorColor); } else { summary = context.getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile) + StringConstants.STR_DOUBLE_NEWLINE + @@ -636,8 +636,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_ORIENTATION_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_ORIENTATION_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesOrientation tmp = new EventPreferencesOrientation(this._event, this._enabled, this._display, this._sides, this._distance, this._checkLight, this._lightMin, this._lightMax, this._ignoredApplications); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -940,7 +940,7 @@ static float convertPercentsToLight(long percentage, float maxLight) { void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesOrientation.PREF_EVENT_ORIENTATION_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesOrientation.PREF_EVENT_ORIENTATION_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { //PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); boolean inCall = false; TelephonyManager telephony = (TelephonyManager) eventsHandler.context.getSystemService(Context.TELEPHONY_SERVICE); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesPeriodic.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesPeriodic.java index 1394d8136a..45a060756a 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesPeriodic.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesPeriodic.java @@ -87,7 +87,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_periodic_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_PERIODIC_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_PERIODIC_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_periodic), addPassStatus, DatabaseHandler.ETYPE_PERIODIC, context)); @@ -109,17 +109,17 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(context.getString(R.string.phone_profiles_pref_applicationEventScanningPaused)).append(StringConstants.TAG_BREAK_HTML); } else { _value.append(context.getString(R.string.phone_profiles_pref_applicationEventBackgroundScanningScanInterval)).append(StringConstants.STR_COLON_WITH_SPACE) - .append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(String.valueOf(ApplicationPreferences.applicationEventPeriodicScanningScanInterval), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + .append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(String.valueOf(ApplicationPreferences.applicationEventPeriodicScanningScanInterval), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); _value.append(StringConstants.STR_BULLET); } } - _value.append(context.getString(R.string.pref_event_periodic_multiple_interval)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(String.valueOf(this._multipleInterval), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.pref_event_periodic_multiple_interval)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(String.valueOf(this._multipleInterval), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); _value.append(StringConstants.STR_BULLET); int resultingInterval = this._multipleInterval * ApplicationPreferences.applicationEventPeriodicScanningScanInterval; - _value.append(context.getString(R.string.pref_event_periodic_resulting_interval)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(String.valueOf(resultingInterval), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.pref_event_periodic_resulting_interval)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(String.valueOf(resultingInterval), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); _value.append(StringConstants.STR_BULLET); - _value.append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._duration), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._duration), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } @@ -149,7 +149,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con if (!ApplicationPreferences.applicationEventPeriodicScanningDisabledScannigByProfile) { summary = "* " + context.getString(R.string.array_pref_applicationDisableScanning_disabled) + "! *"+StringConstants.STR_DOUBLE_NEWLINE + context.getString(R.string.phone_profiles_pref_eventBackgroundScanningAppSettings_summary); - titleColor = ContextCompat.getColor(context, R.color.error_color); + titleColor = ContextCompat.getColor(context, R.color.errorColor); } else { summary = context.getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile) + StringConstants.STR_DOUBLE_NEWLINE + @@ -261,8 +261,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_PERIODIC_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_PERIODIC_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesPeriodic tmp = new EventPreferencesPeriodic(this._event, this._enabled, this._multipleInterval, this._duration); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -464,7 +464,7 @@ void saveStartTime(DataWrapper dataWrapper) { void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesPeriodic.PREF_EVENT_PERIODIC_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesPeriodic.PREF_EVENT_PERIODIC_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { // compute start time diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesRadioSwitch.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesRadioSwitch.java index 1135e98de4..4e9d3b2032 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesRadioSwitch.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesRadioSwitch.java @@ -16,6 +16,8 @@ import androidx.preference.PreferenceManager; import androidx.preference.SwitchPreferenceCompat; +import java.util.List; + class EventPreferencesRadioSwitch extends EventPreferences { int _wifi; @@ -128,7 +130,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_radioSwitch_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_radioSwitch), addPassStatus, DatabaseHandler.ETYPE_RADIO_SWITCH, context)); @@ -138,21 +140,21 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole boolean _addBullet = false; if (this._wifi != 0) { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_WIFI, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_WIFI, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { _value.append(context.getString(R.string.event_preferences_radioSwitch_wifi)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.eventRadioSwitchWithConnectionArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._wifi], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._wifi], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); _addBullet = true; } } if (this._bluetooth != 0) { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_BLUETOOTH, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_BLUETOOTH, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (_addBullet) _value.append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_radioSwitch_bluetooth)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.eventRadioSwitchWithConnectionArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._bluetooth], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._bluetooth], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); _addBullet = true; } } @@ -176,12 +178,12 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (phoneCount > 1) { if (this._simOnOff != 0) { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_SIM_ON_OFF, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_SIM_ON_OFF, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (_addBullet) _value.append(StringConstants.STR_BULLET); String[] fields = context.getResources().getStringArray(R.array.eventRadioSwitchSIMOnOffArray); _value.append(context.getString(R.string.event_preferences_radioSwitch_simOnOff)).append(StringConstants.STR_COLON_WITH_SPACE); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._simOnOff], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._simOnOff], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); _addBullet = true; } } @@ -189,29 +191,29 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (twoSimCards) { if (this._defaultSIMForCalls != 0) { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (_addBullet) _value.append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_radioSwitch_defaultSIMForCalls)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.eventRadioSwitchDefaultSIMArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._defaultSIMForCalls], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._defaultSIMForCalls], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); _addBullet = true; } } if (this._defaultSIMForSMS != 0) { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (_addBullet) _value.append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_radioSwitch_defaultSIMForSMS)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.eventRadioSwitchDefaultSIMArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._defaultSIMForSMS], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._defaultSIMForSMS], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); _addBullet = true; } } } if (this._mobileData != 0) { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_MOBILE_DATA, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_MOBILE_DATA, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (_addBullet) _value.append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_radioSwitch_mobileData)).append(StringConstants.STR_COLON_WITH_SPACE); @@ -238,39 +240,39 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } } if (index != -1) - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fieldArray[index], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fieldArray[index], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); _addBullet = true; } } if (this._gps != 0) { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_BLUETOOTH, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_BLUETOOTH, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (_addBullet) _value.append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_radioSwitch_gps)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.eventRadioSwitchArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._gps], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._gps], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); _addBullet = true; } } if (this._nfc != 0) { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_NFC, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_NFC, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (_addBullet) _value.append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_radioSwitch_nfc)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.eventRadioSwitchArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._nfc], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._nfc], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); _addBullet = true; } } if (this._airplaneMode != 0) { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_AIRPLANE_MODE, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_AIRPLANE_MODE, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (_addBullet) _value.append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_radioSwitch_airplaneMode)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.eventRadioSwitchArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._airplaneMode], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._airplaneMode], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } } @@ -312,7 +314,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con Preference preference = prefMng.findPreference(key); if (preference != null) { PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); @@ -323,7 +325,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con Preference preference = prefMng.findPreference(key); if (preference != null) { PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); @@ -334,7 +336,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con Preference preference = prefMng.findPreference(key); if (preference != null) { PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); @@ -345,7 +347,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con Preference preference = prefMng.findPreference(key); if (preference != null) { PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); @@ -354,8 +356,8 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con } if (key.equals(PREF_EVENT_RADIO_SWITCH_MOBILE_DATA)) { if (PPApplication.HAS_FEATURE_TELEPHONY) { - mobileDataPreferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_MOBILE_DATA, context); - if (mobileDataPreferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + mobileDataPreferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_MOBILE_DATA, false, context); + if (mobileDataPreferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { PPListPreference listPreference = prefMng.findPreference(key); if (listPreference != null) { int phoneCount = 1; @@ -385,7 +387,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con } else { Preference preference = prefMng.findPreference(key); if (preference != null) { - if (mobileDataPreferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { + if (mobileDataPreferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + mobileDataPreferenceAllowed.getNotAllowedPreferenceReasonString(context)); } @@ -396,7 +398,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con Preference preference = prefMng.findPreference(key); if (preference != null) { PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); @@ -408,8 +410,8 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con key.equals(PREF_EVENT_RADIO_SWITCH_DEFAULT_SIM_FOR_SMS)) { Preference preference = prefMng.findPreference(key); if (preference != null) { - defaultSIMPreferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, context); - if (defaultSIMPreferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { + defaultSIMPreferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, false, context); + if (defaultSIMPreferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + defaultSIMPreferenceAllowed.getNotAllowedPreferenceReasonString(context)); hasHardware = false; @@ -420,8 +422,8 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con Preference preference = prefMng.findPreference(key); if (PPApplication.HAS_FEATURE_TELEPHONY) { if (preference != null) { - swithSIMOnOffPreferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_SIM_ON_OFF, context); - if (swithSIMOnOffPreferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { + swithSIMOnOffPreferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_SIM_ON_OFF, false, context); + if (swithSIMOnOffPreferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + swithSIMOnOffPreferenceAllowed.getNotAllowedPreferenceReasonString(context)); hasHardware = false; @@ -430,7 +432,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con } else { if (preference != null) { PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); @@ -478,8 +480,8 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con __enabled = false; else { if (swithSIMOnOffPreferenceAllowed == null) - swithSIMOnOffPreferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_SIM_ON_OFF, context); - if (swithSIMOnOffPreferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + swithSIMOnOffPreferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_SIM_ON_OFF, false, context); + if (swithSIMOnOffPreferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) __enabled = false; } int index = preference.findIndexOfValue(preference.getValue()); @@ -492,8 +494,8 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con __enabled = false; else { if (defaultSIMPreferenceAllowed == null) - defaultSIMPreferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, context); - if (defaultSIMPreferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + defaultSIMPreferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, false, context); + if (defaultSIMPreferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) __enabled = false; } int index = preference.findIndexOfValue(preference.getValue()); @@ -506,8 +508,8 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con __enabled = false; else { if (defaultSIMPreferenceAllowed == null) - defaultSIMPreferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, context); - if (defaultSIMPreferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + defaultSIMPreferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, false, context); + if (defaultSIMPreferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) __enabled = false; } int index = preference.findIndexOfValue(preference.getValue()); @@ -520,8 +522,8 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con __enabled = false; else { if (mobileDataPreferenceAllowed == null) - mobileDataPreferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_MOBILE_DATA, context); - if (mobileDataPreferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + mobileDataPreferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED_MOBILE_DATA, false, context); + if (mobileDataPreferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) __enabled = false; } int index = preference.findIndexOfValue(preference.getValue()); @@ -606,8 +608,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesRadioSwitch tmp = new EventPreferencesRadioSwitch(this._event, this._enabled, this._wifi, this._bluetooth, this._simOnOff, this._defaultSIMForCalls, this._defaultSIMForSMS, this._mobileData, this._gps, this._nfc, this._airplaneMode); @@ -687,7 +689,7 @@ void checkPreferences(PreferenceManager prefMng, boolean onlyCategory, Context c if (!onlyCategory) { if (prefMng.findPreference(PREF_EVENT_RADIO_SWITCH_ENABLED) != null) { - boolean enabled = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED; + boolean enabled = EventStatic.isEventPreferenceAllowed(PREF_EVENT_RADIO_SWITCH_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; Preference preference = prefMng.findPreference(PREF_EVENT_RADIO_SWITCH_WIFI); if (preference != null) @@ -803,7 +805,7 @@ void removeSystemEvent(Context context) void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { eventsHandler.radioSwitchPassed = true; boolean tested = false; @@ -894,8 +896,8 @@ void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { boolean connected = false; if ((_bluetooth == 3) || (_bluetooth == 4)) { - BluetoothConnectionBroadcastReceiver.getConnectedDevices(eventsHandler.context); - connected = BluetoothConnectionBroadcastReceiver.isBluetoothConnected(null, ""); + List connectedDevices = BluetoothConnectionBroadcastReceiver.getConnectedDevices(eventsHandler.context); + connected = BluetoothConnectionBroadcastReceiver.isBluetoothConnected(connectedDevices, null, ""); } tested = true; if (_bluetooth == 1) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesRoaming.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesRoaming.java index e03c420cac..8f01d33945 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesRoaming.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesRoaming.java @@ -101,15 +101,15 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(StringConstants.TAG_BOLD_END_WITH_SPACE_HTML); } - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_ROAMING_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_ROAMING_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (this._checkNetwork) { - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_roaming_check_network), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_roaming_check_network), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } if (this._checkData) { if (this._checkNetwork) _value.append(StringConstants.STR_BULLET); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_roaming_check_data), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_roaming_check_data), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } boolean hasSIMCard = false; @@ -132,7 +132,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (hasSIMCard) { _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_roaming_forSimCard)); String[] forSimCard = context.getResources().getStringArray(R.array.eventRoamingForSimCardArray); - _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(forSimCard[this._forSIMCard], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(forSimCard[this._forSIMCard], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } else { @@ -185,7 +185,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con Preference preference = prefMng.findPreference(PREF_EVENT_ROAMING_FOR_SIM_CARD); if (preference != null) { PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); @@ -195,7 +195,7 @@ else if (!hasSIMCard) { Preference preference = prefMng.findPreference(PREF_EVENT_ROAMING_FOR_SIM_CARD); if (preference != null) { PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_TWO_SIM_CARDS; preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); @@ -251,8 +251,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_ROAMING_ENABLED_NO_CHECK_SIM, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_ROAMING_ENABLED_NO_CHECK_SIM, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesRoaming tmp = new EventPreferencesRoaming(this._event, this._enabled, this._checkNetwork, this._checkData, this._forSIMCard); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -406,7 +406,7 @@ static void setEventRoamingInSIMSlot(Context context, int simSlot, boolean netwo void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesRoaming.PREF_EVENT_ROAMING_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesRoaming.PREF_EVENT_ROAMING_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { this._networkRoamingInSIMSlot0 = ApplicationPreferences.prefEventRoamingNetworkInSIMSlot0; this._dataRoamingInSIMSlot0 = ApplicationPreferences.prefEventRoamingDataInSIMSlot0; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesSMS.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesSMS.java index 35b97755fa..a4d60a39cc 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesSMS.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesSMS.java @@ -136,8 +136,8 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(StringConstants.TAG_BOLD_END_WITH_SPACE_HTML); } - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_SMS_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_SMS_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { int extenderVersion = PPExtenderBroadcastReceiver.isExtenderInstalled(context.getApplicationContext()); if (extenderVersion == 0) { _value.append(context.getString(R.string.profile_preferences_device_not_allowed)) @@ -158,14 +158,14 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole //descr = descr + ": " + smsEvents[tmp._smsEvent] + "; "; _value.append(context.getString(R.string.event_preferences_sms_contact_groups)).append(StringConstants.STR_COLON_WITH_SPACE); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(ContactGroupsMultiSelectDialogPreference.getSummary(_contactGroups, context), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(ContactGroupsMultiSelectDialogPreference.getSummary(_contactGroups, context), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.event_preferences_sms_contacts)).append(StringConstants.STR_COLON_WITH_SPACE); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(ContactsMultiSelectDialogPreference.getSummary(_contacts, false, context), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(ContactsMultiSelectDialogPreference.getSummary(_contacts, false, context), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); _value.append(context.getString(R.string.pref_event_sms_contactListType)); String[] contactListTypes = context.getResources().getStringArray(R.array.eventSMSContactListTypeArray); - _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(contactListTypes[this._contactListType], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(contactListTypes[this._contactListType], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); boolean hasSIMCard = false; final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); @@ -187,13 +187,13 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (hasSIMCard) { _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_sms_forSimCard)); String[] forSimCard = context.getResources().getStringArray(R.array.eventSMSForSimCardArray); - _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(forSimCard[this._forSIMCard], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(forSimCard[this._forSIMCard], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } if (this._permanentRun) - _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_permanentRun), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_permanentRun), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); else - _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._duration), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.pref_event_duration)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(StringFormatUtils.getDurationString(this._duration), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } else { @@ -277,7 +277,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con Preference preference = prefMng.findPreference(PREF_EVENT_SMS_FOR_SIM_CARD); if (preference != null) { PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); @@ -287,7 +287,7 @@ else if (!hasSIMCard) { Preference preference = prefMng.findPreference(PREF_EVENT_SMS_FOR_SIM_CARD); if (preference != null) { PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_TWO_SIM_CARDS; preference.setSummary(context.getString(R.string.profile_preferences_device_not_allowed) + StringConstants.STR_COLON_WITH_SPACE + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); @@ -414,8 +414,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_SMS_ENABLED_NO_CHECK_SIM, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_SMS_ENABLED_NO_CHECK_SIM, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesSMS tmp = new EventPreferencesSMS(this._event, this._enabled, this._contacts, this._contactGroups, this._contactListType, this._permanentRun, this._duration, this._forSIMCard); if (preferences != null) @@ -732,7 +732,7 @@ void saveStartTime(List contactList, DataWrapper dataWrapper, String ph void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesSMS.PREF_EVENT_SMS_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesSMS.PREF_EVENT_SMS_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) // permissions are checked in EditorActivity.displayRedTextToPreferencesNotification() /*&& Permissions.checkEventSMSContacts(context, event, null)*/ /* moved to Extender && Permissions.checkEventSMSBroadcast(context, event, null)*/) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesScreen.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesScreen.java index 66cc570ff8..9633fcf476 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesScreen.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesScreen.java @@ -67,7 +67,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_screen_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_SCREEN_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_SCREEN_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_screen), addPassStatus, DatabaseHandler.ETYPE_SCREEN, context)); @@ -79,14 +79,14 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (index != -1) { _value.append(context.getString(R.string.event_preferences_screen_event_type)).append(StringConstants.STR_COLON_WITH_SPACE); String[] eventListTypeNames = context.getResources().getStringArray(R.array.eventScreenEventTypeArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(eventListTypeNames[index], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(eventListTypeNames[index], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } if (this._whenUnlocked) { if (this._eventType == EventPreferencesScreen.ETYPE_SCREENON) - _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_screen_startWhenUnlocked), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_screen_startWhenUnlocked), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); else - _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_screen_startWhenLocked), disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(context.getString(R.string.pref_event_screen_startWhenLocked), disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } } @@ -155,8 +155,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences/*, C } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_SCREEN_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_SCREEN_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesScreen tmp = new EventPreferencesScreen(this._event, this._enabled, this._eventType, this._whenUnlocked); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -247,7 +247,7 @@ void removeSystemEvent(Context context) void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesScreen.PREF_EVENT_SCREEN_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesScreen.PREF_EVENT_SCREEN_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { //boolean isScreenOn; //PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE); boolean keyguardShowing = false; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesSoundProfile.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesSoundProfile.java index b6d4b761a1..f0a60b403e 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesSoundProfile.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesSoundProfile.java @@ -95,7 +95,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_soundProfile_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_SOUND_PROFILE_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_SOUND_PROFILE_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_soundProfile), addPassStatus, DatabaseHandler.ETYPE_SOUND_PROFILE, context)); @@ -122,7 +122,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } selectedValues = __value.toString(); } - _value.append(context.getString(R.string.event_preferences_soundProfile_ringerModes)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedValues, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(context.getString(R.string.event_preferences_soundProfile_ringerModes)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedValues, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); if (dndChecked) { selectedValues = context.getString(R.string.applications_multiselect_summary_text_not_selected); @@ -142,7 +142,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } selectedValues = __value.toString(); } - _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_soundProfile_zenModes)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedValues, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.STR_BULLET).append(context.getString(R.string.event_preferences_soundProfile_zenModes)).append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedValues, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } } @@ -290,8 +290,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_SOUND_PROFILE_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_SOUND_PROFILE_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesSoundProfile tmp = new EventPreferencesSoundProfile(this._event, this._enabled, this._ringerModes, this._zenModes); if (preferences != null) @@ -338,7 +338,7 @@ void checkPreferences(PreferenceManager prefMng, boolean onlyCategory, Context c SharedPreferences preferences = prefMng.getSharedPreferences(); if (!onlyCategory) { if (prefMng.findPreference(PREF_EVENT_SOUND_PROFILE_ENABLED) != null) { - boolean enabled = EventStatic.isEventPreferenceAllowed(PREF_EVENT_SOUND_PROFILE_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED; + boolean enabled = EventStatic.isEventPreferenceAllowed(PREF_EVENT_SOUND_PROFILE_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; PPMultiSelectListPreference ringerModesPreference = prefMng.findPreference(PREF_EVENT_SOUND_PROFILE_RINGER_MODES); if (ringerModesPreference != null) @@ -398,7 +398,7 @@ void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesSoundProfile.PREF_EVENT_SOUND_PROFILE_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesSoundProfile.PREF_EVENT_SOUND_PROFILE_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { eventsHandler.soundProfilePassed = false; //boolean tested = false; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesTime.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesTime.java index 35dc652d64..1a4259f06f 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesTime.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesTime.java @@ -171,7 +171,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_time_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_TIME_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_TIME_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_time), addPassStatus, DatabaseHandler.ETYPE_TIME, context)); @@ -216,7 +216,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole value.append(namesOfDay[dayOfWeek + 1]).append(" "); } _descr = value.toString(); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(_descr, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(_descr, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } _value.append(StringConstants.CHAR_BULLET).append(" ").append(context.getString(R.string.event_preferences_time_timeType)).append(StringConstants.STR_COLON_WITH_SPACE); @@ -232,7 +232,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _descr = _descr + context.getString(R.string.event_preference_sensor_time_type_sunset_sunrise); break; } - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(_descr, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(_descr, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); if (_timeType == TIME_TYPE_EXACT) { _value.append(StringConstants.STR_BULLET); @@ -251,7 +251,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _descr = _descr + "-"; _descr = _descr + DateFormat.getTimeFormat(context).format(new Date(calendar.getTimeInMillis())); //} - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(_descr, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(_descr, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); if (addBullet) { if (EventStatic.getGlobalEventsRunning(context)) { @@ -298,7 +298,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole calendar.setTimeInMillis(endTime); _descr = _descr + "-"; _descr = _descr + DateFormat.getTimeFormat(context).format(new Date(calendar.getTimeInMillis())); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(_descr, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(_descr, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); if (addBullet) { if (EventStatic.getGlobalEventsRunning(context)) { @@ -441,7 +441,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con if (_timeType != TIME_TYPE_EXACT) { summary = "* " + context.getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary) + "! *"+StringConstants.STR_DOUBLE_NEWLINE+ summary; - titleColor = ContextCompat.getColor(context, R.color.error_color); + titleColor = ContextCompat.getColor(context, R.color.errorColor); } else { summary = context.getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary) + StringConstants.STR_DOUBLE_NEWLINE+ summary; @@ -522,8 +522,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_TIME_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_TIME_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesTime tmp = new EventPreferencesTime(this._event, this._enabled, this._sunday, this._monday, this._tuesday, this._wednesday, this._thursday, this._friday, this._saturday, this._startTime, this._endTime, this._timeType); if (preferences != null) @@ -1159,7 +1159,7 @@ private void setAlarm(boolean startEvent, long alarmTime, Context context) void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesTime.PREF_EVENT_TIME_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesTime.PREF_EVENT_TIME_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) // permissions are checked in EditorActivity.displayRedTextToPreferencesNotification() /*&& Permissions.checkEventLocation(context, event, null)*/) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesVPN.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesVPN.java index f64c6f177a..533e9c5782 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesVPN.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesVPN.java @@ -56,11 +56,11 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(StringConstants.TAG_BOLD_END_WITH_SPACE_HTML); } - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_VPN_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_VPN_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { _value.append(context.getString(R.string.pref_event_vpn_connection_status)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.eventVPNArray); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._connectionStatus], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(fields[this._connectionStatus], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } else { @@ -132,8 +132,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_VPN_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_VPN_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesVPN tmp = new EventPreferencesVPN(this._event, this._enabled, this._connectionStatus); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -204,7 +204,7 @@ void removeSystemEvent(Context context) void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesVPN.PREF_EVENT_VPN_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesVPN.PREF_EVENT_VPN_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (_connectionStatus == 0) eventsHandler.vpnPassed = PPApplication.vpnNetworkConnected; else @@ -213,10 +213,12 @@ void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { else eventsHandler.vpnPassed = false; - if (eventsHandler.vpnPassed) - setSensorPassed(EventPreferences.SENSOR_PASSED_PASSED); - else - setSensorPassed(EventPreferences.SENSOR_PASSED_NOT_PASSED); + if (!eventsHandler.notAllowedVPN) { + if (eventsHandler.vpnPassed) + setSensorPassed(EventPreferences.SENSOR_PASSED_PASSED); + else + setSensorPassed(EventPreferences.SENSOR_PASSED_NOT_PASSED); + } } else eventsHandler.notAllowedVPN = true; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesVolumes.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesVolumes.java index 7db2176ed6..0340979852 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesVolumes.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesVolumes.java @@ -147,7 +147,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_volumes_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_VOLUMES_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_VOLUMES_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_volumes), addPassStatus, DatabaseHandler.ETYPE_VOLUMES, context)); @@ -179,10 +179,10 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(context.getString(R.string.profile_preferences_volumeRingtone)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.volumesSensorOperatorArray); _value.append(StringConstants.TAG_BOLD_START_HTML); - _value.append(getColorForChangedPreferenceValue(fields[operatorFrom] + " " + splitsFrom[0], disabled, context)); + _value.append(getColorForChangedPreferenceValue(fields[operatorFrom] + " " + splitsFrom[0], disabled, addBullet, context)); if (operatorTo != 0) { _value.append(StringConstants.STR_HARD_SPACE_DASH); - _value.append(getColorForChangedPreferenceValue(fields[operatorTo] + " " + splitsTo[0], disabled, context)); + _value.append(getColorForChangedPreferenceValue(fields[operatorTo] + " " + splitsTo[0], disabled, addBullet, context)); } _value.append(StringConstants.TAG_BOLD_END_HTML); _addBullet = true; @@ -208,10 +208,10 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(context.getString(R.string.profile_preferences_volumeNotification)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.volumesSensorOperatorArray); _value.append(StringConstants.TAG_BOLD_START_HTML); - _value.append(getColorForChangedPreferenceValue(fields[operatorFrom] + " " + splitsFrom[0], disabled, context)); + _value.append(getColorForChangedPreferenceValue(fields[operatorFrom] + " " + splitsFrom[0], disabled, addBullet, context)); if (operatorTo != 0) { _value.append(StringConstants.STR_HARD_SPACE_DASH); - _value.append(getColorForChangedPreferenceValue(fields[operatorTo] + " " + splitsTo[0], disabled, context)); + _value.append(getColorForChangedPreferenceValue(fields[operatorTo] + " " + splitsTo[0], disabled, addBullet, context)); } _value.append(StringConstants.TAG_BOLD_END_HTML); _addBullet = true; @@ -237,10 +237,10 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(context.getString(R.string.profile_preferences_volumeMedia)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.volumesSensorOperatorArray); _value.append(StringConstants.TAG_BOLD_START_HTML); - _value.append(getColorForChangedPreferenceValue(fields[operatorFrom] + " " + splitsFrom[0], disabled, context)); + _value.append(getColorForChangedPreferenceValue(fields[operatorFrom] + " " + splitsFrom[0], disabled, addBullet, context)); if (operatorTo != 0) { _value.append(StringConstants.STR_HARD_SPACE_DASH); - _value.append(getColorForChangedPreferenceValue(fields[operatorTo] + " " + splitsTo[0], disabled, context)); + _value.append(getColorForChangedPreferenceValue(fields[operatorTo] + " " + splitsTo[0], disabled, addBullet, context)); } _value.append(StringConstants.TAG_BOLD_END_HTML); _addBullet = true; @@ -266,10 +266,10 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(context.getString(R.string.profile_preferences_volumeAlarm)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.volumesSensorOperatorArray); _value.append(StringConstants.TAG_BOLD_START_HTML); - _value.append(getColorForChangedPreferenceValue(fields[operatorFrom] + " " + splitsFrom[0], disabled, context)); + _value.append(getColorForChangedPreferenceValue(fields[operatorFrom] + " " + splitsFrom[0], disabled, addBullet, context)); if (operatorTo != 0) { _value.append(StringConstants.STR_HARD_SPACE_DASH); - _value.append(getColorForChangedPreferenceValue(fields[operatorTo] + " " + splitsTo[0], disabled, context)); + _value.append(getColorForChangedPreferenceValue(fields[operatorTo] + " " + splitsTo[0], disabled, addBullet, context)); } _value.append(StringConstants.TAG_BOLD_END_HTML); _addBullet = true; @@ -295,10 +295,10 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(context.getString(R.string.profile_preferences_volumeSystem)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.volumesSensorOperatorArray); _value.append(StringConstants.TAG_BOLD_START_HTML); - _value.append(getColorForChangedPreferenceValue(fields[operatorFrom] + " " + splitsFrom[0], disabled, context)); + _value.append(getColorForChangedPreferenceValue(fields[operatorFrom] + " " + splitsFrom[0], disabled, addBullet, context)); if (operatorTo != 0) { _value.append(StringConstants.STR_HARD_SPACE_DASH); - _value.append(getColorForChangedPreferenceValue(fields[operatorTo] + " " + splitsTo[0], disabled, context)); + _value.append(getColorForChangedPreferenceValue(fields[operatorTo] + " " + splitsTo[0], disabled, addBullet, context)); } _value.append(StringConstants.TAG_BOLD_END_HTML); _addBullet = true; @@ -324,10 +324,10 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(context.getString(R.string.profile_preferences_volumeVoiceCall)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.volumesSensorOperatorArray); _value.append(StringConstants.TAG_BOLD_START_HTML); - _value.append(getColorForChangedPreferenceValue(fields[operatorFrom] + " " + splitsFrom[0], disabled, context)); + _value.append(getColorForChangedPreferenceValue(fields[operatorFrom] + " " + splitsFrom[0], disabled, addBullet, context)); if (operatorTo != 0) { _value.append(StringConstants.STR_HARD_SPACE_DASH); - _value.append(getColorForChangedPreferenceValue(fields[operatorTo] + " " + splitsTo[0], disabled, context)); + _value.append(getColorForChangedPreferenceValue(fields[operatorTo] + " " + splitsTo[0], disabled, addBullet, context)); } _value.append(StringConstants.TAG_BOLD_END_HTML); _addBullet = true; @@ -353,10 +353,10 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole _value.append(context.getString(R.string.profile_preferences_volumeBluetoothSCO)).append(StringConstants.STR_COLON_WITH_SPACE); String[] fields = context.getResources().getStringArray(R.array.volumesSensorOperatorArray); _value.append(StringConstants.TAG_BOLD_START_HTML); - _value.append(getColorForChangedPreferenceValue(fields[operatorFrom] + " " + splitsFrom[0], disabled, context)); + _value.append(getColorForChangedPreferenceValue(fields[operatorFrom] + " " + splitsFrom[0], disabled, addBullet, context)); if (operatorTo != 0) { _value.append(StringConstants.STR_HARD_SPACE_DASH); - _value.append(getColorForChangedPreferenceValue(fields[operatorTo] + " " + splitsTo[0], disabled, context)); + _value.append(getColorForChangedPreferenceValue(fields[operatorTo] + " " + splitsTo[0], disabled, addBullet, context)); } _value.append(StringConstants.TAG_BOLD_END_HTML); //_addBullet = true; @@ -547,8 +547,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_VOLUMES_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_VOLUMES_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesVolumes tmp = new EventPreferencesVolumes(this._event, this._enabled, this._volumeRingtoneFrom, this._volumeNotificationFrom, this._volumeMediaFrom, this._volumeAlarmFrom, this._volumeSystemFrom, this._volumeVoiceFrom, @@ -672,7 +672,7 @@ void checkPreferences(PreferenceManager prefMng, boolean onlyCategory, Context c SharedPreferences preferences = prefMng.getSharedPreferences(); if (!onlyCategory) { if (prefMng.findPreference(PREF_EVENT_VOLUMES_ENABLED) != null) { - boolean enabled = EventStatic.isEventPreferenceAllowed(PREF_EVENT_VOLUMES_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED; + boolean enabled = EventStatic.isEventPreferenceAllowed(PREF_EVENT_VOLUMES_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; //Log.e("EventPreferencesVolumes.checkPreferences", "value="+preferences.getString(PREF_EVENT_VOLUMES_RINGTONE_FROM, "0|0|0")); String[] splits = preferences.getString(PREF_EVENT_VOLUMES_RINGTONE_FROM, "0|0|0").split(StringConstants.STR_SPLIT_REGEX); @@ -787,7 +787,7 @@ void removeSystemEvent(Context context) void doHandleEvent(EventsHandler eventsHandler/*, boolean forRestartEvents*/) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesVolumes.PREF_EVENT_VOLUMES_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(EventPreferencesVolumes.PREF_EVENT_VOLUMES_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { AudioManager audioManager = (AudioManager)eventsHandler.context.getSystemService(Context.AUDIO_SERVICE); if (audioManager != null) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesWifi.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesWifi.java index 57a510bf23..8a61b7d441 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesWifi.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesWifi.java @@ -87,7 +87,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (!addBullet) _value.append(context.getString(R.string.event_preference_sensor_wifi_summary)); } else { - if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_WIFI_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (EventStatic.isEventPreferenceAllowed(PREF_EVENT_WIFI_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (addBullet) { _value.append(StringConstants.TAG_BOLD_START_HTML); _value.append(getPassStatusString(context.getString(R.string.event_type_wifi), addPassStatus, DatabaseHandler.ETYPE_WIFI, context)); @@ -126,7 +126,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole if (index != -1) { _value.append(context.getString(R.string.event_preferences_wifi_connection_type)); String[] connectionListTypeNames = context.getResources().getStringArray(R.array.eventWifiConnectionTypeArray); - _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(connectionListTypeNames[index], disabled, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); + _value.append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(connectionListTypeNames[index], disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML).append(StringConstants.STR_BULLET); } _value.append(context.getString(R.string.pref_event_wifi_ssid)).append(StringConstants.STR_COLON_WITH_SPACE); @@ -161,7 +161,7 @@ String getPreferencesDescription(boolean addBullet, boolean addPassStatus, boole } } selectedSSIDs = value.toString(); - _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedSSIDs, disabled, context)).append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML).append(getColorForChangedPreferenceValue(selectedSSIDs, disabled, addBullet, context)).append(StringConstants.TAG_BOLD_END_HTML); } } @@ -193,7 +193,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con if ((connectionType == 1) || (connectionType == 3)) { summary = "* " + context.getString(R.string.array_pref_applicationDisableScanning_disabled) + "! *"+StringConstants.STR_DOUBLE_NEWLINE + context.getString(R.string.phone_profiles_pref_eventWifiAppSettings_summary); - titleColor = ContextCompat.getColor(context, R.color.error_color); + titleColor = ContextCompat.getColor(context, R.color.errorColor); } else { summary = context.getString(R.string.array_pref_applicationDisableScanning_disabled) + StringConstants.STR_DOUBLE_NEWLINE + context.getString(R.string.phone_profiles_pref_eventWifiAppSettings_summary); @@ -251,7 +251,7 @@ private void setSummary(PreferenceManager prefMng, String key, String value, Con if (!GlobalUtils.isLocationEnabled(context.getApplicationContext())) { summary = "* " + context.getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary) + "! *"+StringConstants.STR_DOUBLE_NEWLINE+ summary; - titleColor = ContextCompat.getColor(context, R.color.error_color); + titleColor = ContextCompat.getColor(context, R.color.errorColor); } else { summary = context.getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsEnabled_summary) + StringConstants.STR_DOUBLE_NEWLINE_WITH_DOT+ @@ -348,7 +348,7 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con setSummary(prefMng, PREF_EVENT_WIFI_LOCATION_SYSTEM_SETTINGS, preferences, context); setSummary(prefMng, PREF_EVENT_WIFI_KEEP_ON_SYSTEM_SETTINGS, preferences, context); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, context).allowed + if (EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false, context).preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { Preference preference = prefMng.findPreference(PREF_EVENT_WIFI_ENABLED); @@ -362,8 +362,8 @@ void setAllSummary(PreferenceManager prefMng, SharedPreferences preferences, Con } void setCategorySummary(PreferenceManager prefMng, /*String key,*/ SharedPreferences preferences, Context context) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_WIFI_ENABLED, context); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(PREF_EVENT_WIFI_ENABLED, false, context); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { EventPreferencesWifi tmp = new EventPreferencesWifi(this._event, this._enabled, this._SSID, this._connectionType); if (preferences != null) tmp.saveSharedPreferences(preferences); @@ -455,7 +455,7 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { if (_enabled) { int oldSensorPassed = getSensorPassed(); - if ((EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, eventsHandler.context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) + if ((EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false, eventsHandler.context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) // permissions are checked in EditorActivity.displayRedTextToPreferencesNotification() /*&& Permissions.checkEventLocation(context, event, null)*/) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventStatic.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventStatic.java index 3a978f830a..7c660b17ef 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventStatic.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventStatic.java @@ -30,18 +30,18 @@ private EventStatic() { // private constructor to prevent instantiation } - static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context context) + static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, boolean notCheckPreferences, Context context) { Context appContext = context.getApplicationContext(); PreferenceAllowed preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; //boolean checked = false; if (preferenceKey.equals(EventPreferencesCalendar.PREF_EVENT_CALENDAR_ENABLED)) { - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; return preferenceAllowed; } @@ -51,9 +51,9 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context // device has Wifi WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); if (wifiManager == null) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; else - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; } else preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; @@ -68,12 +68,16 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context // device has bluetooth BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter(); //BluetoothScanWorker.getBluetoothAdapter(context); if (bluetooth != null) { - if (Permissions.hasPermission(context, Manifest.permission.BLUETOOTH) && - (Permissions.hasPermission(context, Manifest.permission.BLUETOOTH_ADMIN))) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + if (notCheckPreferences) + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; else { - preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_not_granted_bluetooth_permission); + if (Permissions.hasPermission(context, Manifest.permission.BLUETOOTH) && + Permissions.hasPermission(context, Manifest.permission.BLUETOOTH_ADMIN)) + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; + else { + preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_not_granted_bluetooth_permission); + } } } else preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; @@ -88,7 +92,7 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context if (preferenceKey.equals(EventPreferencesNotification.PREF_EVENT_NOTIFICATION_ENABLED)) { //if (android.os.Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; /*else { PPApplication.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; PPApplication.notAllowedReasonDetail = context.getString(R.string.preference_not_allowed_reason_detail_old_android); @@ -101,7 +105,7 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context if (preferenceKey.equals(EventPreferencesApplication.PREF_EVENT_APPLICATION_ENABLED)) { //if (PPExtenderBroadcastReceiver.isExtenderInstalled(context.getApplicationContext())) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; //else // PPApplication.notAllowedReason = PPApplication.PREFERENCE_NOT_ALLOWED_NO_EXTENDER_INSTALLED; return preferenceAllowed; @@ -121,7 +125,7 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context if (enabled) { //if (PPExtenderBroadcastReceiver.isExtenderInstalled(context.getApplicationContext())) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; //else // PPApplication.notAllowedReason = PPApplication.PREFERENCE_NOT_ALLOWED_NO_EXTENDER_INSTALLED; } @@ -141,21 +145,26 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context if (telephonyManager != null) { if (preferenceKey.equals(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED)) { // Log.e("EventStatic.isEventPreferenceAllowed", "("+preferenceKey+") called hasSIMCard"); - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); - boolean simExists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; +// HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); +// boolean simExists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + boolean simExists = telephonyManager.getPhoneCount() > 0; +// Log.e("EventStatic.isEventPreferenceAllowed", "simExists="+simExists); if (simExists) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; else { - if (!Permissions.checkPhone(appContext)) { - preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_PHONE_PERMISSION; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_not_granted_phone_permission); + if (notCheckPreferences) + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + else { + if (!Permissions.checkPhone(appContext)) { + preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_PHONE_PERMISSION; + preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_not_granted_phone_permission); + } else + preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } - else - preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } } else - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; } else preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; @@ -173,9 +182,9 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context // device has nfc NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(context); if (nfcAdapter == null) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; else - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; } else preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; @@ -193,21 +202,25 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context if (telephonyManager != null) { if (preferenceKey.equals(EventPreferencesSMS.PREF_EVENT_SMS_ENABLED)) { // Log.e("EventStatic.isEventPreferenceAllowed", "("+preferenceKey+") called hasSIMCard"); - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); - boolean simExists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; +// HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); +// boolean simExists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + boolean simExists = telephonyManager.getPhoneCount() > 0; if (simExists) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; else { - if (!Permissions.checkPhone(appContext)) { - preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_PHONE_PERMISSION; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_not_granted_phone_permission); + if (notCheckPreferences) + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + else { + if (!Permissions.checkPhone(appContext)) { + preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_PHONE_PERMISSION; + preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_not_granted_phone_permission); + } else + preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } - else - preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } } else - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; } else preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; @@ -228,21 +241,25 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context if (telephonyManager != null) { if (preferenceKey.equals(EventPreferencesCall.PREF_EVENT_CALL_ENABLED)) { // Log.e("EventStatic.isEventPreferenceAllowed", "("+preferenceKey+") called hasSIMCard"); - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); - boolean simExists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; +// HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); +// boolean simExists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + boolean simExists = telephonyManager.getPhoneCount() > 0; if (simExists) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; else { - if (!Permissions.checkPhone(appContext)) { - preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_PHONE_PERMISSION; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_not_granted_phone_permission); + if (notCheckPreferences) + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; + else { + if (!Permissions.checkPhone(appContext)) { + preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_PHONE_PERMISSION; + preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_not_granted_phone_permission); + } else + preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } - else - preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } } else - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; } else preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; @@ -260,9 +277,9 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context // device has location LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); if (locationManager == null) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; else - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; } else preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; @@ -290,21 +307,25 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context if (telephonyManager != null) { if (preferenceKey.equals(EventPreferencesRoaming.PREF_EVENT_ROAMING_ENABLED)) { // Log.e("EventStatic.isEventPreferenceAllowed", "("+preferenceKey+") called hasSIMCard"); - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); - boolean simExists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; +// HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); +// boolean simExists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + boolean simExists = telephonyManager.getPhoneCount() > 0; if (simExists) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; else { - if (!Permissions.checkPhone(appContext)) { - preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_PHONE_PERMISSION; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_not_granted_phone_permission); + if (notCheckPreferences) + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + else { + if (!Permissions.checkPhone(appContext)) { + preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_PHONE_PERMISSION; + preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_not_granted_phone_permission); + } else + preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } - else - preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } } else - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; } else preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; @@ -320,9 +341,9 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context if (PPApplication.HAS_FEATURE_WIFI) { WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); if (wifiManager == null) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; else - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; } else preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; @@ -332,9 +353,9 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context if (PPApplication.HAS_FEATURE_BLUETOOTH) { BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter(); //BluetoothScanWorker.getBluetoothAdapter(context); if (bluetoothAdapter == null) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; else - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; } else preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; @@ -351,29 +372,35 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context try { connManager = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); } catch (Exception e) { - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; } if (connManager == null) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; else { TelephonyManager telephonyManager = (TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null) { //if (!preferenceKey.equals(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_NO_CHECK_SIM)) { -// Log.e("EventStatic.isEventPreferenceAllowed", "("+preferenceKey+") called hasSIMCard"); - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); boolean simExists; if (preferenceKey.equals(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM)) { +// Log.e("EventStatic.isEventPreferenceAllowed", "("+preferenceKey+") called hasSIMCard"); + HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); simExists = hasSIMCardData.hasSIM1 && hasSIMCardData.hasSIM2; - } else - simExists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + } else { +// simExists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + simExists = telephonyManager.getPhoneCount() > 0; + } if (simExists) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; else { - if (!Permissions.checkPhone(appContext)) { - preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_PHONE_PERMISSION; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_not_granted_phone_permission); - } else - preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + if (notCheckPreferences) + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + else { + if (!Permissions.checkPhone(appContext)) { + preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_PHONE_PERMISSION; + preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_not_granted_phone_permission); + } else + preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + } } //} //else @@ -390,9 +417,9 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context if (PPApplication.HAS_FEATURE_LOCATION_GPS) { LocationManager locationManager = (LocationManager) context.getSystemService(Context.LOCATION_SERVICE); if (locationManager == null) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; else - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; } else preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; @@ -402,9 +429,9 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context if (PPApplication.HAS_FEATURE_NFC) { NfcAdapter nfcAdapter = NfcAdapter.getDefaultAdapter(context); if (nfcAdapter == null) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; else - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; } else preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; @@ -412,27 +439,36 @@ static PreferenceAllowed isEventPreferenceAllowed(String preferenceKey, Context } //noinspection IfStatementWithIdenticalBranches if (preferenceKey.equals(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_AIRPLANE_MODE)) { - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; return preferenceAllowed; } if (preferenceKey.equals(EventPreferencesMusic.PREF_EVENT_MUSIC_ENABLED)) { AudioManager audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE); if (audioManager == null) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; else - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; return preferenceAllowed; } if (preferenceKey.equals(EventPreferencesScreen.PREF_EVENT_SCREEN_ENABLED)) { KeyguardManager kgMgr = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE); if (kgMgr == null) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; else - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; + return preferenceAllowed; + } + if (preferenceKey.equals(EventPreferencesCallScreening.PREF_EVENT_CALL_SCREENING_ENABLED)) + { + if (PPApplication.HAS_FEATURE_TELEPHONY) { + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; + } + else + preferenceAllowed.notAllowedReason = PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NO_HARDWARE; return preferenceAllowed; } - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; return preferenceAllowed; } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventStatusPopupWindow.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventStatusPopupWindow.java index e1a330a2c7..e2a1d0491f 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventStatusPopupWindow.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventStatusPopupWindow.java @@ -21,6 +21,7 @@ class EventStatusPopupWindow extends GuiInfoPopupWindow { //setAnimationStyle(0); final TextView textView = popupView.findViewById(R.id.event_status_popup_window_text7); + //noinspection DataFlowIssue textView.setText(fragment.getString(R.string.popup_window_events_status_show_info) + StringConstants.STR_HARD_SPACE_DOUBLE_ARROW); textView.setClickable(true); textView.setOnClickListener(v -> { @@ -39,6 +40,7 @@ class EventStatusPopupWindow extends GuiInfoPopupWindow { final Event _event = event; TextView eventName = popupView.findViewById(R.id.event_status_popup_window_text0); + //noinspection DataFlowIssue eventName.setText(fragment.getString(R.string.event_string_0)+StringConstants.STR_COLON_WITH_SPACE+event._name); Context context = fragment.getContext(); @@ -52,7 +54,7 @@ class EventStatusPopupWindow extends GuiInfoPopupWindow { boolean manualProfileActivation = DataWrapperStatic.getIsManualProfileActivation(false, context.getApplicationContext()); int imageStatusRes = R.drawable.ic_event_status_stop; //GlobalGUIRoutines.getThemeEventStopStatusIndicator(context); - int colorRes = R.color.event_status_stop; + int colorRes = R.color.eventStatusStopColor; int textStatusRes = R.string.popup_event_states_stopped; /*if (!Event.getGlobalEventsRunning()) { @@ -65,26 +67,26 @@ class EventStatusPopupWindow extends GuiInfoPopupWindow { case Event.ESTATUS_RUNNING: if (event._isInDelayEnd) { imageStatusRes = R.drawable.ic_event_status_running_delay; - colorRes = R.color.altype_eventDelayStartEnd; + colorRes = R.color.altypeEventDelayStartEndColor; textStatusRes = R.string.popup_event_states_running_delay; } else { imageStatusRes = R.drawable.ic_event_status_running; - colorRes = R.color.altype_eventStart; + colorRes = R.color.altypeEventStartColor; textStatusRes = R.string.popup_event_states_running; } break; case Event.ESTATUS_PAUSE: if (/*!Event.getGlobalEventsRunning() ||*/ (manualProfileActivation && !event._ignoreManualActivation)) { imageStatusRes = R.drawable.ic_event_status_pause_manual_activation; - colorRes = R.color.altype_eventEnd; + colorRes = R.color.altypeEventEndColor; textStatusRes = R.string.popup_event_states_paused; } else if (event._isInDelayStart) { imageStatusRes = R.drawable.ic_event_status_pause_delay; - colorRes = R.color.altype_eventDelayStartEnd; + colorRes = R.color.altypeEventDelayStartEndColor; textStatusRes = R.string.popup_event_states_paused_delay; } else { imageStatusRes = R.drawable.ic_event_status_pause; - colorRes = R.color.altype_eventEnd; + colorRes = R.color.altypeEventEndColor; textStatusRes = R.string.popup_event_states_paused; } break; @@ -93,7 +95,7 @@ class EventStatusPopupWindow extends GuiInfoPopupWindow { //noinspection ConstantConditions imageStatusRes = R.drawable.ic_event_status_stop; //noinspection ConstantConditions - colorRes = R.color.event_status_stop; + colorRes = R.color.eventStatusStopColor; //statusRes = GlobalGUIRoutines.getThemeEventStopStatusIndicator(context); //else // statusRes = R.drawable.ic_event_status_stop_not_runnable; @@ -102,18 +104,24 @@ class EventStatusPopupWindow extends GuiInfoPopupWindow { break; } } + //noinspection DataFlowIssue eventStatusImage.setImageResource(imageStatusRes); eventStatusImage.setColorFilter(ContextCompat.getColor(context, colorRes)); + //noinspection DataFlowIssue eventSateDescription.setText(textStatusRes); } else { + //noinspection DataFlowIssue eventSateText.setVisibility(View.GONE); + //noinspection DataFlowIssue eventStatusImage.setVisibility(View.GONE); + //noinspection DataFlowIssue eventSateDescription.setVisibility(View.GONE); } final SwitchCompat checkBox = popupView.findViewById(R.id.event_status_popup_window_checkbox); + //noinspection DataFlowIssue checkBox.setChecked(event.getStatus() != Event.ESTATUS_STOP); checkBox.setOnCheckedChangeListener((compoundButton, isChecked) -> { //noinspection ConstantConditions diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsHandler.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsHandler.java index 3a3e6ef198..47ec4574aa 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsHandler.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsHandler.java @@ -42,6 +42,8 @@ class EventsHandler { private long eventDeviceBootDate; private String eventApplicationPackageName; private long eventApplicationDate; + //private String eventCallScreeningPhoneNumber; + //private long eventCallScreeningDate; private boolean startProfileMerged; private boolean endProfileMerged; @@ -72,6 +74,7 @@ class EventsHandler { boolean notAllowedRoaming; boolean notAllowedVPN; boolean notAllowedMusic; + boolean notAllowedCallScreening; boolean timePassed; boolean batteryPassed; @@ -99,6 +102,7 @@ class EventsHandler { boolean roamingPassed; boolean vpnPassed; boolean musicPassed; + boolean callScreeningPassed; static final int SENSOR_TYPE_RADIO_SWITCH = 1; static final int SENSOR_TYPE_RESTART_EVENTS = 2; @@ -156,6 +160,8 @@ class EventsHandler { static final int SENSOR_TYPE_BRIGHTNESS = 54; static final int SENSOR_TYPE_APPLICATION_EVENT_END = 55; static final int SENSOR_TYPE_MUSIC = 56; + static final int SENSOR_TYPE_CALL_SCREENING = 57; + static final int SENSOR_TYPE_CALL_SCREENING_EVENT_END = 58; static final int SENSOR_TYPE_ALL = 999; EventsHandler(Context context) { @@ -193,21 +199,24 @@ void handleEvents(int[] sensorType) { //oldRingerMode = ApplicationPreferences.prefRingerMode; //oldZenMode = ApplicationPreferences.prefZenMode; AudioManager audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE); - switch (audioManager.getRingerMode()) { - case AudioManager.RINGER_MODE_SILENT: - oldRingerMode = Profile.RINGERMODE_SILENT; + if (audioManager != null) { + switch (audioManager.getRingerMode()) { + case AudioManager.RINGER_MODE_SILENT: + oldRingerMode = Profile.RINGERMODE_SILENT; // PPApplicationStatic.logE("[RINGING_SIMULATION] EventsHandler.handleEvents", "oldRingerMode=SILENT"); - break; - case AudioManager.RINGER_MODE_VIBRATE: + break; + case AudioManager.RINGER_MODE_VIBRATE: // PPApplicationStatic.logE("[RINGING_SIMULATION] EventsHandler.handleEvents", "oldRingerMode=VIBRATE"); - oldRingerMode = Profile.RINGERMODE_VIBRATE; - break; - //case AudioManager.RINGER_MODE_NORMAL: - default: - oldRingerMode = Profile.RINGERMODE_RING; + oldRingerMode = Profile.RINGERMODE_VIBRATE; + break; + //case AudioManager.RINGER_MODE_NORMAL: + default: + oldRingerMode = Profile.RINGERMODE_RING; // PPApplicationStatic.logE("[RINGING_SIMULATION] EventsHandler.handleEvents", "oldRingerMode=RING"); - break; - } + break; + } + } else + oldRingerMode = Profile.RINGERMODE_RING; switch (ActivateProfileHelper.getSystemZenMode(context)) { case ActivateProfileHelper.SYSTEM_ZENMODE_ALARMS: oldZenMode = Profile.ZENMODE_ALARMS; @@ -321,6 +330,9 @@ void handleEvents(int[] sensorType) { return; } + PPApplicationStatic.getProfileBeforeActivation(context.getApplicationContext()); +// Log.e("EventsHandler.handleEvents", "getProfileBeforeActivation="+PPApplication.prefProfileBeforeActivation); + DataWrapper dataWrapper = new DataWrapper(context.getApplicationContext(), false, 0, false, 0, 0, 0f); dataWrapper.fillEventList(); dataWrapper.fillEventTimelineList(); @@ -329,7 +341,7 @@ void handleEvents(int[] sensorType) { // ---- Special for sensors which requires calendar data - START ----------- boolean saveCalendarStartEndTime = false; if (isRestart) { - if (EventStatic.isEventPreferenceAllowed(EventPreferencesCalendar.PREF_EVENT_CALENDAR_ENABLED, context.getApplicationContext()).allowed == + if (EventStatic.isEventPreferenceAllowed(EventPreferencesCalendar.PREF_EVENT_CALENDAR_ENABLED, false, context.getApplicationContext()).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { for (Event _event : dataWrapper.eventList) { if ((_event.getStatus() != Event.ESTATUS_STOP) && @@ -368,13 +380,13 @@ void handleEvents(int[] sensorType) { (i == SENSOR_TYPE_SMS) || (i == SENSOR_TYPE_CONTACTS_CACHE_CHANGED))) { // search for sms events, save start time +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventsHandler.handleEvents", "(1) PPApplicationStatic.getContactsCache()"); ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); if (contactsCache != null) { List contactList; // PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCall.doHandleEvent", "PPApplication.contactsCacheMutex"); - synchronized (PPApplication.contactsCacheMutex) { - contactList = contactsCache.getList(/*false*/); - } +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventsHandler.handleEvents", "(1) contactsCache.getList()"); + contactList = contactsCache.getList(/*false*/); for (Event _event : dataWrapper.eventList) { if (_event.getStatus() != Event.ESTATUS_STOP) { if (_event._eventPreferencesSMS._enabled) { @@ -411,13 +423,13 @@ void handleEvents(int[] sensorType) { (i == SENSOR_TYPE_PHONE_CALL) || (i == SENSOR_TYPE_CONTACTS_CACHE_CHANGED))) { // search for call events, save start time +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventsHandler.handleEvents", "(2) PPApplicationStatic.getContactsCache()"); ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); if (contactsCache != null) { List contactList; // PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCall.doHandleEvent", "PPApplication.contactsCacheMutex"); - synchronized (PPApplication.contactsCacheMutex) { - contactList = contactsCache.getList(/*false*/); - } +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventsHandler.handleEvents", "(2) contactsCache.getList()"); + contactList = contactsCache.getList(/*false*/); for (Event _event : dataWrapper.eventList) { if (_event.getStatus() != Event.ESTATUS_STOP) { if (_event._eventPreferencesCall._enabled) { @@ -473,6 +485,34 @@ void handleEvents(int[] sensorType) { } } } + if (Arrays.stream(sensorType).anyMatch(i -> + (i == SENSOR_TYPE_CALL_SCREENING) || + (i == SENSOR_TYPE_CONTACTS_CACHE_CHANGED))) { + // search for sms events, save start time +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventsHandler.handleEvents", "(3) PPApplicationStatic.getContactsCache()"); + ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); + if (contactsCache != null) { + List contactList; +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCallScreening.doHandleEvent", "PPApplication.contactsCacheMutex"); +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventsHandler.handleEvents", "(3) contactsCache.getList()"); + contactList = contactsCache.getList(/*false*/); + for (Event _event : dataWrapper.eventList) { + if (_event.getStatus() != Event.ESTATUS_STOP) { + if (_event._eventPreferencesCallScreening._enabled) { + EventPreferencesCallScreening.getEventCallScreeningTime(context); + EventPreferencesCallScreening.getEventCallScreeningPhoneNumber(context); + EventPreferencesCallScreening.getEventCallScreeningCallDirection(context); + _event._eventPreferencesCallScreening.saveStartTime(contactList, dataWrapper, + ApplicationPreferences.prefEventCallScreeningPhoneNumber, + ApplicationPreferences.prefEventCallScreeningTime); + } + } + } + if (contactList != null) + contactList.clear(); + } + } + } boolean forDelayStartAlarm = Arrays.stream(sensorType).anyMatch(i -> i == SENSOR_TYPE_EVENT_DELAY_START); @@ -980,6 +1020,9 @@ private int getEventTypeForSensor(int sensorType) { return DatabaseHandler.ETYPE_BRIGHTNESS; case SENSOR_TYPE_MUSIC: return DatabaseHandler.ETYPE_MUSIC; + case SENSOR_TYPE_CALL_SCREENING: + case SENSOR_TYPE_CALL_SCREENING_EVENT_END: + return DatabaseHandler.ETYPE_CALL_SCREENING; default: return DatabaseHandler.ETYPE_ALL; } @@ -1002,13 +1045,13 @@ private void doEndHandler(DataWrapper dataWrapper, Profile mergedProfile) { boolean simulateRingingCall = false; String phoneNumber = ApplicationPreferences.prefEventCallPhoneNumber; +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventsHandler.doEndHandler", "PPApplicationStatic.getContactsCache()"); ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); if (contactsCache != null) { List contactList; // PPApplicationStatic.logE("[SYNCHRONIZED] EventsHandler.doEndHandler", "PPApplication.contactsCacheMutex"); - synchronized (PPApplication.contactsCacheMutex) { - contactList = contactsCache.getList(/*false*/); - } +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventsHandler.doEndHandler", "contactsCache.getList()"); + contactList = contactsCache.getList(/*false*/); for (Event _event : dataWrapper.eventList) { if (_event._eventPreferencesCall._enabled && _event.getStatus() == Event.ESTATUS_RUNNING) { if (_event._eventPreferencesCall.isPhoneNumberConfigured(contactList, phoneNumber/*, dataWrapper*/)) { @@ -1117,6 +1160,7 @@ private void doHandleEvent(Event event, boolean statePause, notAllowedRoaming = false; notAllowedVPN = false; notAllowedMusic = false; + notAllowedCallScreening = false; timePassed = true; batteryPassed = true; @@ -1144,6 +1188,7 @@ private void doHandleEvent(Event event, boolean statePause, roamingPassed = true; vpnPassed = true; musicPassed = true; + callScreeningPassed = true; event._eventPreferencesTime.doHandleEvent(this/*, forRestartEvents*/); event._eventPreferencesBattery.doHandleEvent(this/*, sensorType, forRestartEvents*/); @@ -1171,6 +1216,7 @@ private void doHandleEvent(Event event, boolean statePause, event._eventPreferencesRoaming.doHandleEvent(this/*, forRestartEvents*/); event._eventPreferencesVPN.doHandleEvent(this/*, forRestartEvents*/); event._eventPreferencesMusic.doHandleEvent(this/*, forRestartEvents*/); + event._eventPreferencesCallScreening.doHandleEvent(this/*, forRestartEvents*/); boolean allPassed = true; boolean someNotAllowed = false; @@ -1358,6 +1404,13 @@ private void doHandleEvent(Event event, boolean statePause, else someNotAllowed = true; } + if (event._eventPreferencesCallScreening._enabled) { + anySensorEnabled = true; + if (!notAllowedCallScreening) + allPassed &= callScreeningPassed; + else + someNotAllowed = true; + } if (!anySensorEnabled) { // force set event as paused @@ -1536,6 +1589,12 @@ void setEventDeviceBootParameters(long date) { eventDeviceBootDate = date; } + void setEventCallScreeningParameters(String phoneNumber, long date, int direction) { + EventPreferencesCallScreening.setEventCallScreeningPhoneNumber(context, phoneNumber); + EventPreferencesCallScreening.setEventCallScreeningTime(context, date); + EventPreferencesCallScreening.setEventCallScreeningCallDirection(context, direction); + } + /* void sortEventsByStartOrderAsc(List eventList) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsPrefsActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsPrefsActivity.java index 890c09889e..377a6596c0 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsPrefsActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsPrefsActivity.java @@ -21,6 +21,7 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; +import androidx.core.view.WindowCompat; import androidx.fragment.app.Fragment; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.preference.PreferenceManager; @@ -51,7 +52,7 @@ public class EventsPrefsActivity extends AppCompatActivity private Toolbar toolbar; LinearLayout settingsLinearLayout; - LinearLayout progressLinearLayout; + //LinearLayout progressLinearLayout; private StartPreferencesActivityAsyncTask startPreferencesActivityAsyncTask = null; private FinishPreferencesActivityAsyncTask finishPreferencesActivityAsyncTask = null; @@ -80,6 +81,10 @@ protected void onCreate(Bundle savedInstanceState) { GlobalGUIRoutines.setTheme(this, false, false, false, false, false, true); //GlobalGUIRoutines.setLanguage(this); + //if (Build.VERSION.SDK_INT >= 34) + // EdgeToEdge.enable(this); + WindowCompat.setDecorFitsSystemWindows(this.getWindow(), false); + super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile_events_preferences); @@ -87,15 +92,16 @@ protected void onCreate(Bundle savedInstanceState) { toolbar = findViewById(R.id.activity_preferences_toolbar); setSupportActionBar(toolbar); - if (getSupportActionBar() != null) { getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setElevation(0/*GlobalGUIRoutines.dpToPx(1)*/); } + toolbar.setSubtitle(getString(R.string.title_activity_event_preferences)); + toolbar.setTitle(getString(R.string.event_string_0)); settingsLinearLayout = findViewById(R.id.activity_preferences_settings); - progressLinearLayout = findViewById(R.id.activity_preferences_settings_linla_progress); + //progressLinearLayout = findViewById(R.id.activity_preferences_settings_linla_progress); event_id = getIntent().getLongExtra(PPApplication.EXTRA_EVENT_ID, 0L); old_event_status = getIntent().getIntExtra(PPApplication.EXTRA_EVENT_STATUS, -1); @@ -111,15 +117,17 @@ protected void onCreate(Bundle savedInstanceState) { PPApplication.showToast(getApplicationContext(), getString(R.string.event_preferences_event_not_found), Toast.LENGTH_SHORT); - PPApplication.blockContactContentObserver = false; - ContactsContentObserver.enqueueContactsContentObserverWorker(); +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] EventsPrefsActivity.onCreate", "(1) PPApplication.blockContactContentObserver=false"); +// PPApplication.blockContactContentObserver = false; +// ContactsContentObserver.enqueueContactsContentObserverWorker(); super.finish(); return; } } if (savedInstanceState == null) { - PPApplication.blockContactContentObserver = true; +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] EventsPrefsActivity.onCreate", "(2) PPApplication.blockContactContentObserver=true"); +// PPApplication.blockContactContentObserver = true; startPreferencesActivityAsyncTask = new StartPreferencesActivityAsyncTask(this, newEventMode, predefinedEventIndex); @@ -155,11 +163,12 @@ protected void onStart() { new IntentFilter(PPApplication.ACTION_REFRESH_EVENTS_PREFS_GUI_BROADCAST_RECEIVER)); } - @Override - protected void onPause() { - super.onPause(); - PPApplication.blockContactContentObserver = false; - } +// @Override +// protected void onPause() { +// super.onPause(); +// PPApplicationStatic.logE("[CONTACTS_CACHE] EventsPrefsActivity.onPause", "PPApplication.blockContactContentObserver=false"); +// PPApplication.blockContactContentObserver = false; +// } @Override protected void onStop() { @@ -174,7 +183,8 @@ protected void onStop() { @Override public void onResume() { super.onResume(); - PPApplication.blockContactContentObserver = true; +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] EventsPrefsActivity.onResume", "PPApplication.blockContactContentObserver=true"); +// PPApplication.blockContactContentObserver = true; List fragments = getSupportFragmentManager().getFragments(); //if (fragments == null) @@ -292,6 +302,7 @@ private void finishActivity() { true, true, false, false, true, + false, this ); @@ -363,8 +374,9 @@ public void onSaveInstanceState(@NonNull Bundle savedInstanceState) { @Override public void finish() { - PPApplication.blockContactContentObserver = false; - ContactsContentObserver.enqueueContactsContentObserverWorker(); +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] EventsPrefsActivity.finish", "PPApplication.blockContactContentObserver=false"); +// PPApplication.blockContactContentObserver = false; +// ContactsContentObserver.enqueueContactsContentObserverWorker(); // for startActivityForResult Intent returnIntent = new Intent(); @@ -507,6 +519,7 @@ private boolean checkPreferences(final int new_event_mode, final int predefinedE true, true, false, true, false, + false, this ); @@ -684,34 +697,25 @@ private void showTargetHelps() { Toolbar toolbar = findViewById(R.id.activity_preferences_toolbar); - //TypedValue tv = new TypedValue(); - //getTheme().resolveAttribute(R.attr.colorAccent, tv, true); - - //final Display display = getWindowManager().getDefaultDisplay(); - - //String appTheme = ApplicationPreferences.applicationTheme(getApplicationContext(), true); int outerCircleColor = R.color.tabTargetHelpOuterCircleColor; -// if (appTheme.equals("dark")) -// outerCircleColor = R.color.tabTargetHelpOuterCircleColor_dark; int targetCircleColor = R.color.tabTargetHelpTargetCircleColor; -// if (appTheme.equals("dark")) -// targetCircleColor = R.color.tabTargetHelpTargetCircleColor_dark; int titleTextColor = R.color.tabTargetHelpTitleTextColor; int descriptionTextColor = R.color.tabTargetHelpDescriptionTextColor; -// if (appTheme.equals("dark")) -// textColor = R.color.tabTargetHelpTextColor_dark; - //boolean tintTarget = !appTheme.equals("white"); final TapTargetSequence sequence = new TapTargetSequence(this); List targets = new ArrayList<>(); int id = 1; try { + //noinspection DataFlowIssue targets.add( TapTarget.forToolbarMenuItem(toolbar, R.id.event_preferences_save, getString(R.string.event_preference_activity_targetHelps_save_title), getString(R.string.event_preference_activity_targetHelps_save_description)) .outerCircleColor(outerCircleColor) .targetCircleColor(targetCircleColor) .titleTextColor(titleTextColor) .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) .textTypeface(Typeface.DEFAULT_BOLD) .tintTarget(true) .drawShadow(true) @@ -722,19 +726,17 @@ private void showTargetHelps() { //PPApplicationStatic.recordException(e); } + for (TapTarget target : targets) { + target.setDrawBehindStatusBar(true); + target.setDrawBehindNavigationBar(true); + } + sequence.targets(targets); sequence.listener(new TapTargetSequence.Listener() { // This listener will tell us when interesting(tm) events happen in regards // to the sequence @Override public void onSequenceFinish() { - //targetHelpsSequenceStarted = false; - - //SharedPreferences.Editor editor = ApplicationPreferences.getEditor(getApplicationContext()); - //editor.putBoolean(PREF_START_TARGET_HELPS_FINISHED, true); - //editor.apply(); - //ApplicationPreferences.prefEventPrefsActivityStartTargetHelpsFinished = true; - } @Override @@ -744,17 +746,10 @@ public void onSequenceStep(TapTarget lastTarget, boolean targetClicked) { @Override public void onSequenceCanceled(TapTarget lastTarget) { - //targetHelpsSequenceStarted = false; } }); sequence.continueOnCancel(true) .considerOuterCircleCanceled(true); - //targetHelpsSequenceStarted = true; - - //editor = ApplicationPreferences.getEditor(getApplicationContext()); - //editor.putBoolean(PREF_START_TARGET_HELPS_FINISHED, false); - //editor.apply(); - //ApplicationPreferences.prefEventPrefsActivityStartTargetHelpsFinished = false; sequence.start(); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsPrefsCallScreeningParameters.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsPrefsCallScreeningParameters.java new file mode 100644 index 0000000000..fe9da7a7b9 --- /dev/null +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsPrefsCallScreeningParameters.java @@ -0,0 +1,12 @@ +package sk.henrichg.phoneprofilesplus; + +import android.os.Bundle; + +public class EventsPrefsCallScreeningParameters extends EventsPrefsFragment { + + @Override + public void onCreatePreferences(Bundle bundle, String rootKey) { + setPreferencesFromResource(R.xml.event_prefs_call_screening_sensor, rootKey); + } + +} diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsPrefsFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsPrefsFragment.java index 2ea3fcd569..ef066e0cfb 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsPrefsFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventsPrefsFragment.java @@ -99,6 +99,7 @@ public class EventsPrefsFragment extends PreferenceFragmentCompat private static final String PREF_EVENT_MOBILE_CELLS_CELLS_REGISTRATION = "eventMobileCellsCellsRegistration"; private static final String PREF_EVENT_HIDE_NOT_USED_SENSORS = "eventHideNotUsedSensors"; private static final int RESULT_MUSIC_NOTIFICATION_ACCESS_SYSTEM_SETTINGS = 1999; + private static final int RESULT_SET_CALL_SCREENING_ROLE = 2000; @Override public void onCreate(Bundle savedInstanceState) { @@ -337,6 +338,24 @@ public void onDisplayPreferenceDialog(@NonNull Preference preference) { bundle.putString(PPApplication.BUNDLE_KEY, preference.getKey()); dialogFragment.setArguments(bundle); } + else + if ((Build.VERSION.SDK_INT >= 29) && (preference instanceof SendSMSDialogPreference)) + { + ((SendSMSDialogPreference)preference).fragment = new SendSMSDialogPreferenceFragment(); + dialogFragment = ((SendSMSDialogPreference)preference).fragment; + Bundle bundle = new Bundle(1); + bundle.putString(PPApplication.BUNDLE_KEY, preference.getKey()); + dialogFragment.setArguments(bundle); + } + else + if (preference instanceof PPEditTextDialogPreference) + { + ((PPEditTextDialogPreference)preference).fragment = new PPEditTextDialogPreferenceFragment(); + dialogFragment = ((PPEditTextDialogPreference)preference).fragment; + Bundle bundle = new Bundle(1); + bundle.putString(PPApplication.BUNDLE_KEY, preference.getKey()); + dialogFragment.setArguments(bundle); + } if (dialogFragment != null) { if ((getActivity() != null) && (!getActivity().isFinishing())) { @@ -360,43 +379,47 @@ public void onActivityCreated(Bundle savedInstanceState) { if (getActivity() == null) return; + EventsPrefsActivity activity = (EventsPrefsActivity) getActivity(); // PPApplication.forceStartOrientationScanner(context); // forceStart = true; // must be used handler for rewrite toolbar title/subtitle - final Handler handler = new Handler(getActivity().getMainLooper()); - final WeakReference activityWeakRef = new WeakReference<>((EventsPrefsActivity) getActivity()); + final Handler handler = new Handler(activity.getMainLooper()); + final WeakReference activityWeakRef = new WeakReference<>(activity); handler.postDelayed(() -> { // PPApplicationStatic.logE("[IN_THREAD_HANDLER] PPApplication.startHandlerThread", "START run - from=EventsPrefsFragment.onActivityCreated"); - EventsPrefsActivity activity = activityWeakRef.get(); - if ((activity == null) || activity.isFinishing() || activity.isDestroyed()) + EventsPrefsActivity __activity = activityWeakRef.get(); + if ((__activity == null) || __activity.isFinishing() || __activity.isDestroyed()) return; - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()); + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(__activity.getApplicationContext()); final String eventName = preferences.getString(Event.PREF_EVENT_NAME, ""); - Toolbar toolbar = activity.findViewById(R.id.activity_preferences_toolbar); - toolbar.setSubtitle(activity.getString(R.string.title_activity_event_preferences)); - toolbar.setTitle(activity.getString(R.string.event_string_0) + StringConstants.STR_COLON_WITH_SPACE + eventName); + Toolbar toolbar = __activity.findViewById(R.id.activity_preferences_toolbar); + //noinspection DataFlowIssue + toolbar.setSubtitle(__activity.getString(R.string.title_activity_event_preferences)); + toolbar.setTitle(__activity.getString(R.string.event_string_0) + StringConstants.STR_COLON_WITH_SPACE + eventName); }, 200); - final EventsPrefsActivity activity = (EventsPrefsActivity) getActivity(); + //final EventsPrefsActivity activity = (EventsPrefsActivity) getActivity(); final Context context = activity.getBaseContext(); final EventsPrefsFragment fragment = this; - final TextView preferenceSubTitle = getActivity().findViewById(R.id.activity_preferences_subtitle); + final TextView preferenceSubTitle = activity.findViewById(R.id.activity_preferences_subtitle); // subtitle if (nestedFragment) { + //noinspection DataFlowIssue preferenceSubTitle.setVisibility(View.VISIBLE); - Drawable triangle = ContextCompat.getDrawable(getActivity(), R.drawable.ic_submenu_triangle); + Drawable triangle = ContextCompat.getDrawable(activity, R.drawable.ic_submenu_triangle); if (triangle != null) { - triangle.setTint(ContextCompat.getColor(getActivity(), R.color.activityNormalTextColor)); + triangle.setTint(ContextCompat.getColor(activity, R.color.activityNormalTextColor)); SpannableString headerTitle = new SpannableString(" " + fragment.getPreferenceScreen().getTitle()); - triangle.setBounds(0, + triangle.setBounds( + GlobalGUIRoutines.sip(2), GlobalGUIRoutines.sip(1), - GlobalGUIRoutines.sip(11), + GlobalGUIRoutines.sip(13), GlobalGUIRoutines.sip(10)); headerTitle.setSpan(new ImageSpan(triangle, ImageSpan.ALIGN_BASELINE), 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); preferenceSubTitle.setText(headerTitle); @@ -406,6 +429,7 @@ public void onActivityCreated(Bundle savedInstanceState) { //toolbar.setTitle(fragment.getPreferenceScreen().getTitle()); } else { + //noinspection DataFlowIssue preferenceSubTitle.setVisibility(View.GONE); SwitchPreferenceCompat preference = prefMng.findPreference(PREF_EVENT_HIDE_NOT_USED_SENSORS); @@ -427,7 +451,7 @@ public void onActivityCreated(Bundle savedInstanceState) { (!ApplicationPreferences.applicationEventHideNotUsedSensors)); } - activity.progressLinearLayout.setVisibility(View.GONE); + //activity.progressLinearLayout.setVisibility(View.GONE); activity.settingsLinearLayout.setVisibility(View.VISIBLE); setDivider(null); // this remove dividers for categories @@ -435,8 +459,8 @@ public void onActivityCreated(Bundle savedInstanceState) { //setRedTextToPreferences(); // update preference summary and also category summary - //event.checkSensorsPreferences(prefMng, !nestedFragment, getActivity().getBaseContext()); - //event.setAllSummary(prefMng, preferences, getActivity().getBaseContext()); + //event.checkSensorsPreferences(prefMng, !nestedFragment, activity.getBaseContext()); + //event.setAllSummary(prefMng, preferences, activity.getBaseContext()); Preference notificationAccessPreference = prefMng.findPreference(EventPreferencesNotification.PREF_EVENT_NOTIFICATION_NOTIFICATION_ACCESS); if (notificationAccessPreference != null) { @@ -461,7 +485,7 @@ public void onActivityCreated(Bundle savedInstanceState) { } } if (!ok) { - if (getActivity() != null) { + //if (getActivity() != null) { PPAlertDialog dialog = new PPAlertDialog( preference.getTitle(), getString(R.string.setting_screen_not_found_alert), @@ -476,12 +500,12 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); - } + //} } */ return false; @@ -492,7 +516,7 @@ public void onActivityCreated(Bundle savedInstanceState) { if (extenderPreference != null) { //extenderPreference.setWidgetLayoutResource(R.layout.start_activity_preference); extenderPreference.setOnPreferenceClickListener(preference -> { - ExtenderDialogPreferenceFragment.installPPPExtender(getActivity(), null); + ExtenderDialogPreferenceFragment.installPPPExtender(activity, null); return false; }); } @@ -535,7 +559,7 @@ public void onActivityCreated(Bundle savedInstanceState) { } } if (!ok) { - if (getActivity() != null) { + //if (getActivity() != null) { PPAlertDialog dialog = new PPAlertDialog( preference12.getTitle(), getString(R.string.setting_screen_not_found_alert), @@ -550,12 +574,13 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); - } + //} } return false; }); @@ -588,7 +613,7 @@ public void onActivityCreated(Bundle savedInstanceState) { } } if (!ok) { - if (getActivity() != null) { + //if (getActivity() != null) { PPAlertDialog dialog = new PPAlertDialog( preference14.getTitle(), getString(R.string.setting_screen_not_found_alert), @@ -603,12 +628,13 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); - } + //} } return false; }); @@ -629,7 +655,7 @@ public void onActivityCreated(Bundle savedInstanceState) { } } if (!ok) { - if (getActivity() != null) { + //if (getActivity() != null) { PPAlertDialog dialog = new PPAlertDialog( preference15.getTitle(), getString(R.string.setting_screen_not_found_alert), @@ -644,12 +670,13 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); - } + //} } return false; }); @@ -680,7 +707,7 @@ public void onActivityCreated(Bundle savedInstanceState) { } } if (!ok) { - if (getActivity() != null) { + //if (getActivity() != null) { PPAlertDialog dialog = new PPAlertDialog( preference16.getTitle(), getString(R.string.setting_screen_not_found_alert), @@ -695,12 +722,13 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); - } + //} } return false; }); @@ -734,7 +762,7 @@ public void onActivityCreated(Bundle savedInstanceState) { } } if (!ok) { - if (getActivity() != null) { + //if (getActivity() != null) { PPAlertDialog dialog = new PPAlertDialog( preference18.getTitle(), getString(R.string.setting_screen_not_found_alert), @@ -749,12 +777,13 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); - } + //} } return false; }); @@ -776,7 +805,7 @@ public void onActivityCreated(Bundle savedInstanceState) { if (extenderPreference != null) { //extenderPreference.setWidgetLayoutResource(R.layout.start_activity_preference); extenderPreference.setOnPreferenceClickListener(preference110 -> { - ExtenderDialogPreferenceFragment.installPPPExtender(getActivity(), null); + ExtenderDialogPreferenceFragment.installPPPExtender(activity, null); return false; }); } @@ -819,7 +848,7 @@ public void onActivityCreated(Bundle savedInstanceState) { } } if (!ok) { - if (getActivity() != null) { + //if (getActivity() != null) { PPAlertDialog dialog = new PPAlertDialog( preference113.getTitle(), getString(R.string.setting_screen_not_found_alert), @@ -834,12 +863,13 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); - } + //} } return false; }); @@ -947,7 +977,7 @@ public void onActivityCreated(Bundle savedInstanceState) { if (extenderPreference != null) { //extenderPreference.setWidgetLayoutResource(R.layout.start_activity_preference); extenderPreference.setOnPreferenceClickListener(preference118 -> { - ExtenderDialogPreferenceFragment.installPPPExtender(getActivity(), null); + ExtenderDialogPreferenceFragment.installPPPExtender(activity, null); return false; }); } @@ -981,7 +1011,7 @@ public void onActivityCreated(Bundle savedInstanceState) { } } else { - if (getActivity() != null) { + //if (getActivity() != null) { PPAlertDialog dialog = new PPAlertDialog( preference120.getTitle(), getString(R.string.event_preferences_extender_not_installed), @@ -996,12 +1026,12 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); - } + //} } return false; }); @@ -1012,7 +1042,7 @@ public void onActivityCreated(Bundle savedInstanceState) { if (extenderPreference != null) { //extenderPreference.setWidgetLayoutResource(R.layout.start_activity_preference); extenderPreference.setOnPreferenceClickListener(preference121 -> { - ExtenderDialogPreferenceFragment.installPPPExtender(getActivity(), null); + ExtenderDialogPreferenceFragment.installPPPExtender(activity, null); return false; }); } @@ -1046,7 +1076,7 @@ public void onActivityCreated(Bundle savedInstanceState) { } } else { - if (getActivity() != null) { + //if (getActivity() != null) { PPAlertDialog dialog = new PPAlertDialog( preference123.getTitle(), getString(R.string.event_preferences_extender_not_installed), @@ -1061,12 +1091,12 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); - } + //} } return false; }); @@ -1091,7 +1121,7 @@ public void onActivityCreated(Bundle savedInstanceState) { } } else { - if (getActivity() != null) { + //if (getActivity() != null) { PPAlertDialog dialog = new PPAlertDialog( preference124.getTitle(), getString(R.string.event_preferences_extender_not_installed), @@ -1106,12 +1136,12 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); - } + //} } return false; }); @@ -1136,7 +1166,7 @@ public void onActivityCreated(Bundle savedInstanceState) { } } else { - if (getActivity() != null) { + //if (getActivity() != null) { PPAlertDialog dialog = new PPAlertDialog( preference125.getTitle(), getString(R.string.event_preferences_extender_not_installed), @@ -1151,12 +1181,12 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); - } + //} } return false; }); @@ -1188,7 +1218,7 @@ public void onActivityCreated(Bundle savedInstanceState) { } } if (!activityExists) { - if (getActivity() != null) { + //if (getActivity() != null) { PPAlertDialog dialog = new PPAlertDialog( preference126.getTitle(), getString(R.string.setting_screen_not_found_alert), @@ -1203,12 +1233,13 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); - } + //} } return false; }); @@ -1242,7 +1273,7 @@ public void onActivityCreated(Bundle savedInstanceState) { int receiverFlags = 0; if (Build.VERSION.SDK_INT >= 34) receiverFlags = RECEIVER_NOT_EXPORTED; - getActivity().registerReceiver(shortcutToReadNFCTagAddedReceiver, shortcutAddedFilter, receiverFlags); + activity.registerReceiver(shortcutToReadNFCTagAddedReceiver, shortcutAddedFilter, receiverFlags); } preference.setVisible(true); @@ -1284,7 +1315,7 @@ public void onActivityCreated(Bundle savedInstanceState) { ShortcutInfoCompat shortcutInfo = shortcutBuilderCompat.build(); ShortcutManagerCompat.requestPinShortcut(appContext, shortcutInfo, successCallback.getIntentSender()); - //fragment.getActivity().setResult(Activity.RESULT_OK, intent); + //activity.setResult(Activity.RESULT_OK, intent); } catch (Exception e) { // show dialog about this crash // for Microsft laucher it is: @@ -1313,7 +1344,7 @@ public void onActivityCreated(Bundle savedInstanceState) { boolean ok = false; String action; action = Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS; - if (GlobalGUIRoutines.activityActionExists(action, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityActionExists(action, activity.getApplicationContext())) { try { Intent intent = new Intent(action); startActivityForResult(intent, RESULT_MUSIC_NOTIFICATION_ACCESS_SYSTEM_SETTINGS); @@ -1337,10 +1368,11 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -1370,6 +1402,22 @@ public void onActivityCreated(Bundle savedInstanceState) { }); } } + + if (Build.VERSION.SDK_INT >= 29) { + preference = prefMng.findPreference(EventPreferencesCallScreening.PREF_EVENT_CALL_SCREENING_SET_CALL_SCREENING_ROLE); + if (preference != null) { + preference.setOnPreferenceClickListener(preference1 -> { + // start preferences activity for default profile + //if (getActivity() != null) { + Intent intent = new Intent(activity.getBaseContext(), PhoneProfilesPrefsActivity.class); + intent.putExtra(PhoneProfilesPrefsActivity.EXTRA_SCROLL_TO, PhoneProfilesPrefsFragment.PREF_CALL_SCREENING_CATEGORY_ROOT); + getActivity().startActivityForResult(intent, RESULT_SET_CALL_SCREENING_ROLE); + //} + return false; + }); + } + } + } @Override @@ -1443,7 +1491,7 @@ public void onDestroy() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { - if (key.equals(Event.PREF_EVENT_NAME)) { + if ((key != null) && key.equals(Event.PREF_EVENT_NAME)) { String value = sharedPreferences.getString(key, ""); if (getActivity() != null) { @@ -1459,6 +1507,7 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin Toolbar toolbar = activity.findViewById(R.id.activity_preferences_toolbar); //toolbar.setSubtitle(getString(R.string.event_string_0) + ": " + _value); + //noinspection DataFlowIssue toolbar.setTitle(activity.getString(R.string.event_string_0) + StringConstants.STR_COLON_WITH_SPACE + _value); }, 200); } @@ -1467,7 +1516,7 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin if (getActivity() == null) return; - if (key.equals(PREF_EVENT_HIDE_NOT_USED_SENSORS)) { + if ((key != null) && key.equals(PREF_EVENT_HIDE_NOT_USED_SENSORS)) { // save PREF_EVENT_HIDE_NOT_USED_SENSORS into Application preferences boolean hideNotUsedSensors = preferences.getBoolean(PREF_EVENT_HIDE_NOT_USED_SENSORS, false); //Log.e("EventPrefsFragment.onSharedPreferenceChanged", "hideNotUsedSensors="+hideNotUsedSensors); @@ -1484,13 +1533,14 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin if (event != null) { event.checkSensorsPreferences(prefMng, !nestedFragment, getActivity().getBaseContext()); - //Log.e("EventPrefsFragment.onSharedPreferenceChanged", "called Event.setSummary (1)"); - event.setSummary(prefMng, key, sharedPreferences, getActivity(), true); + if (key != null) + //Log.e("EventPrefsFragment.onSharedPreferenceChanged", "called Event.setSummary (1)"); + event.setSummary(prefMng, key, sharedPreferences, getActivity(), true); } setRedTextToPreferences(); - if (!key.equals(PREF_EVENT_HIDE_NOT_USED_SENSORS)) { + if ((key != null) && (!key.equals(PREF_EVENT_HIDE_NOT_USED_SENSORS))) { EventsPrefsActivity activity = (EventsPrefsActivity) getActivity(); if (activity != null) { activity.showSaveMenu = true; @@ -1508,6 +1558,8 @@ void doOnActivityResult(int requestCode, int resultCode, Intent data) { final Context context = getActivity().getBaseContext(); + //EventsPrefsActivity activity = (EventsPrefsActivity) getActivity(); + if (requestCode == (Permissions.REQUEST_CODE + Permissions.GRANT_TYPE_EVENT)) { setRedTextToPreferences(); } @@ -1664,16 +1716,16 @@ void doOnActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == (Permissions.REQUEST_CODE + Permissions.GRANT_TYPE_CONTACT_DIALOG)) { ContactsMultiSelectDialogPreference preference1 = prefMng.findPreference(EventPreferencesCall.PREF_EVENT_CALL_CONTACTS); if (preference1 != null) - preference1.refreshListView(true); + preference1.refreshListView(false); preference1 = prefMng.findPreference(EventPreferencesSMS.PREF_EVENT_SMS_CONTACTS); if (preference1 != null) - preference1.refreshListView(true); + preference1.refreshListView(false); ContactGroupsMultiSelectDialogPreference preference2 = prefMng.findPreference(EventPreferencesCall.PREF_EVENT_CALL_CONTACT_GROUPS); if (preference2 != null) - preference2.refreshListView(true); + preference2.refreshListView(false); preference2 = prefMng.findPreference(EventPreferencesSMS.PREF_EVENT_SMS_CONTACT_GROUPS); if (preference2 != null) - preference2.refreshListView(true); + preference2.refreshListView(false); } /*if (requestCode == NFCTagPreference.RESULT_NFC_TAG_READ_EDITOR) { if (resultCode == Activity.RESULT_OK) { @@ -1712,6 +1764,15 @@ void doOnActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == RESULT_MUSIC_NOTIFICATION_ACCESS_SYSTEM_SETTINGS) { event._eventPreferencesMusic.checkPreferences(prefMng, !nestedFragment, context); } + + if (requestCode == RESULT_SET_CALL_SCREENING_ROLE) { + if (Build.VERSION.SDK_INT >= 29) { + event._eventPreferencesCallScreening.checkPreferences(prefMng, !nestedFragment, context); + setRedTextToPreferences(); + + PPApplication.updateGUI(true, false, context); + } + } } @SuppressWarnings("deprecation") @@ -2034,6 +2095,7 @@ private void doEventHideNotUsedSensors(boolean hideSensors, boolean saveDisplaye boolean showVPNSensor; boolean showWifiSensor; boolean showMusicSensor; + boolean showCallScreeningSensor; if ((activity != null) && (!saveDisplayed) && (!activity.displayedSensors.isEmpty())) { showAccessoriesSensor = activity.displayedSensors.contains(EventPreferencesAccessories.PREF_EVENT_ACCESSORIES_ENABLED); @@ -2062,6 +2124,7 @@ private void doEventHideNotUsedSensors(boolean hideSensors, boolean saveDisplaye showVPNSensor = activity.displayedSensors.contains(EventPreferencesVPN.PREF_EVENT_VPN_ENABLED); showWifiSensor= activity.displayedSensors.contains(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED); showMusicSensor = activity.displayedSensors.contains(EventPreferencesMusic.PREF_EVENT_MUSIC_ENABLED); + showCallScreeningSensor = activity.displayedSensors.contains(EventPreferencesCallScreening.PREF_EVENT_CALL_SCREENING_ENABLED); } else { showAccessoriesSensor = preferences.getBoolean(EventPreferencesAccessories.PREF_EVENT_ACCESSORIES_ENABLED, false); @@ -2090,6 +2153,7 @@ private void doEventHideNotUsedSensors(boolean hideSensors, boolean saveDisplaye showVPNSensor = preferences.getBoolean(EventPreferencesVPN.PREF_EVENT_VPN_ENABLED, false); showWifiSensor= preferences.getBoolean(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false); showMusicSensor = preferences.getBoolean(EventPreferencesMusic.PREF_EVENT_MUSIC_ENABLED, false); + showCallScreeningSensor = preferences.getBoolean(EventPreferencesCallScreening.PREF_EVENT_CALL_SCREENING_ENABLED, false); } if (saveDisplayed && (activity != null)) { @@ -2146,6 +2210,8 @@ private void doEventHideNotUsedSensors(boolean hideSensors, boolean saveDisplaye activity.displayedSensors.add(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED); if (showMusicSensor) activity.displayedSensors.add(EventPreferencesMusic.PREF_EVENT_MUSIC_ENABLED); + if (showCallScreeningSensor) + activity.displayedSensors.add(EventPreferencesCallScreening.PREF_EVENT_CALL_SCREENING_ENABLED); } Preference preference = prefMng.findPreference(PREF_EVENT_HIDE_NOT_USED_SENSORS); @@ -2174,7 +2240,8 @@ private void doEventHideNotUsedSensors(boolean hideSensors, boolean saveDisplaye (!showVolumesSensor) && (!showVPNSensor) && (!showWifiSensor) && - (!showMusicSensor)) { + (!showMusicSensor) && + (!showCallScreeningSensor)) { hideSensors = false; if (preference != null) preference.setEnabled(false); @@ -2365,6 +2432,13 @@ private void doEventHideNotUsedSensors(boolean hideSensors, boolean saveDisplaye showSensor = showMusicSensor; preference.setVisible(showSensor); } + preference = prefMng.findPreference(EventPreferencesCallScreening.PREF_EVENT_CALL_SCREENING_CATEGORY); + if (preference != null) { + boolean showSensor = !hideSensors; + if (hideSensors) + showSensor = showCallScreeningSensor; + preference.setVisible(showSensor); + } } } @@ -2428,7 +2502,7 @@ protected void onPostExecute(Void result) { if ((context != null) && (activity != null) && (fragment != null) && (prefMng != null)) { String rootScreen = PPApplication.PREF_ROOT_SCREEN; - int errorColor = ContextCompat.getColor(context, R.color.error_color); + int errorColor = ContextCompat.getColor(context, R.color.errorColor); if (event != null) { int order = 1; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ExitApplicationActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ExitApplicationActivity.java index 37ec0681f8..a0b14d7294 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ExitApplicationActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ExitApplicationActivity.java @@ -60,6 +60,7 @@ protected void onStart() true, true, false, false, true, + false, this ); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ExtenderDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ExtenderDialogPreference.java index 01276c8cce..61d14a1744 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ExtenderDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ExtenderDialogPreference.java @@ -226,8 +226,8 @@ public void writeToParcel(Parcel dest, int flags) super(superState); } - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator<>() { public ExtenderDialogPreference.SavedState createFromParcel(Parcel in) { return new ExtenderDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ExtenderDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ExtenderDialogPreferenceFragment.java index 0998029305..d2cf568586 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ExtenderDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ExtenderDialogPreferenceFragment.java @@ -34,7 +34,7 @@ public class ExtenderDialogPreferenceFragment extends PreferenceDialogFragmentCo private AlertDialog mDialog; private TextView extenderVersionText = null; private TextView extenderLaunchText = null; - private View extenderLaunchDivider = null; +// private View extenderLaunchDivider = null; private TextView extenderAccessibilitySettings = null; private TextView extenderAccessibilitySettingsValue = null; private TextView extenderAccessibilitySettingsSummary = null; @@ -61,18 +61,21 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { extenderVersionText = layout.findViewById(R.id.extenderPrefDialog_extender_version); extenderLaunchText = layout.findViewById(R.id.extenderPrefDialog_extender_launch); - extenderLaunchDivider = layout.findViewById(R.id.extenderPrefDialog_extender_launch_divider); +// extenderLaunchDivider = layout.findViewById(R.id.extenderPrefDialog_extender_launch_divider); extenderAccessibilitySettings = layout.findViewById(R.id.extenderPrefDialog_accessibility_settings); extenderAccessibilitySettingsValue = layout.findViewById(R.id.extenderPrefDialog_accessibility_settings_value); extenderAccessibilitySettingsSummary = layout.findViewById(R.id.extenderPrefDialog_accessibility_settings_summary); Button extenderInstallButton = layout.findViewById(R.id.extenderPrefDialog_extender_install_button); + //noinspection DataFlowIssue extenderInstallButton.setOnClickListener(v -> installPPPExtender(getActivity(), preference, false)); Button extenderLaunchButton = layout.findViewById(R.id.extenderPrefDialog_extender_launch_button); + //noinspection DataFlowIssue extenderLaunchButton.setOnClickListener(v -> launchPPPExtender()); Button extenderAccessibilitySettingsButton = layout.findViewById(R.id.extenderPrefDialog_accessibiloty_settings_button); + //noinspection DataFlowIssue extenderAccessibilitySettingsButton.setOnClickListener(v -> enableExtender(getActivity(), preference)); mDialog = dialogBuilder.create(); @@ -94,19 +97,19 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { " "+StringConstants.TAG_BOLD_START_HTML + PPApplication.VERSION_NAME_EXTENDER_REQUIRED + " (" + PPApplication.VERSION_CODE_EXTENDER_REQUIRED + ")"+StringConstants.TAG_BOLD_END_HTML; if (extenderVersion < PPApplication.VERSION_CODE_EXTENDER_REQUIRED) prefVolumeDataSummary = prefVolumeDataSummary + StringConstants.TAG_DOUBLE_BREAK_HTML + prefContext.getString(R.string.event_preferences_applications_PPPExtender_new_version_summary); - else - prefVolumeDataSummary = prefVolumeDataSummary + StringConstants.TAG_BREAK_HTML+StringConstants.CHAR_HARD_SPACE_HTML; // "

" + prefContext.getString(R.string.pppextender_pref_dialog_PPPExtender_upgrade_summary); + //else + // prefVolumeDataSummary = prefVolumeDataSummary + StringConstants.TAG_BREAK_HTML+StringConstants.CHAR_HARD_SPACE_HTML; // "

" + prefContext.getString(R.string.pppextender_pref_dialog_PPPExtender_upgrade_summary); } extenderVersionText.setText(StringFormatUtils.fromHtml(prefVolumeDataSummary, false, false, 0, 0, true)); if ((preference.lauchSummary != null) && (!preference.lauchSummary.isEmpty())) { prefVolumeDataSummary = preference.lauchSummary; - extenderLaunchDivider.setVisibility(View.GONE); + //extenderLaunchDivider.setVisibility(View.GONE); extenderLaunchText.setVisibility(View.VISIBLE); extenderLaunchText.setText(prefVolumeDataSummary); } else { extenderLaunchText.setVisibility(View.GONE); - extenderLaunchDivider.setVisibility(View.VISIBLE); + //extenderLaunchDivider.setVisibility(View.VISIBLE); } //----- @@ -244,6 +247,7 @@ private static void installExtenderFromGitHub(final Activity activity, dialogText = dialogText + StringConstants.TAG_BOLD_START_HTML + activity.getString(R.string.install_pppps_text5) + StringConstants.TAG_BOLD_END_HTML+StringConstants.TAG_DOUBLE_BREAK_HTML; dialogText = dialogText.replace(StringConstants.CHAR_NEW_LINE, StringConstants.TAG_BREAK_HTML); + //noinspection DataFlowIssue text.setText(StringFormatUtils.fromHtml(dialogText, false, false, 0, 0, true)); text = layout.findViewById(R.id.install_ppp_pppe_from_github_dialog_github_releases); @@ -280,11 +284,13 @@ public void onClick(@NonNull View textView) { }; sbt.setSpan(clickableSpan, str1.length()+1, str2.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); //sbt.setSpan(new UnderlineSpan(), str1.length()+1, str2.length(), 0); + //noinspection DataFlowIssue text.setText(sbt); text.setMovementMethod(LinkMovementMethod.getInstance()); if (Build.VERSION.SDK_INT >= 33) { TextView text2 = layout.findViewById(R.id.install_ppp_pppe_from_github_dialog_apk_installation); + //noinspection DataFlowIssue text2.setVisibility(View.VISIBLE); String str = activity.getString(R.string.check_releases_install_from_apk_note1) + " " + activity.getString(R.string.install_ppp_store_droidify) + @@ -395,6 +401,7 @@ private static void installDroidIfy(final Activity activity, dialogText = dialogText + activity.getString(R.string.install_extender_required_version) + " "+StringConstants.TAG_BOLD_START_HTML + PPApplication.VERSION_NAME_EXTENDER_REQUIRED + " (" + PPApplication.VERSION_CODE_EXTENDER_REQUIRED + ")"+StringConstants.TAG_BOLD_END_HTML+StringConstants.TAG_DOUBLE_BREAK_HTML; dialogText = dialogText + activity.getString(R.string.install_extender_install_droidify_text); + //noinspection DataFlowIssue text.setText(StringFormatUtils.fromHtml(dialogText, false, false, 0, 0, true)); //dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert); @@ -479,6 +486,7 @@ static void installPPPExtender(final Activity activity, final ExtenderDialogPref " "+StringConstants.TAG_BOLD_START_HTML + PPApplication.VERSION_NAME_EXTENDER_REQUIRED + " (" + PPApplication.VERSION_CODE_EXTENDER_REQUIRED + ")"+StringConstants.TAG_BOLD_END_HTML+StringConstants.TAG_DOUBLE_BREAK_HTML; dialogText = dialogText + activity.getString(R.string.install_extender_text1) + " \"" + activity.getString(R.string.alert_button_install) + "\"."+StringConstants.TAG_DOUBLE_BREAK_HTML; dialogText = dialogText + StringConstants.TAG_BOLD_START_HTML + activity.getString(R.string.install_pppps_text5) + StringConstants.TAG_BOLD_END_HTML+StringConstants.TAG_DOUBLE_BREAK_HTML; + //noinspection DataFlowIssue text.setText(StringFormatUtils.fromHtml(dialogText, false, false, 0, 0, true)); /* @@ -662,6 +670,7 @@ private void launchPPPExtender() { true, true, false, false, true, + false, getActivity() ); @@ -705,6 +714,7 @@ static void enableExtender(final Activity activity, final ExtenderDialogPreferen true, true, false, false, true, + false, activity ); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GenerateNotificationAfterClickDialog.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GenerateNotificationAfterClickDialog.java index d3d2f1e926..5ed02d8c55 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GenerateNotificationAfterClickDialog.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GenerateNotificationAfterClickDialog.java @@ -37,22 +37,29 @@ class GenerateNotificationAfterClickDialog dialogBuilder.setPositiveButton(android.R.string.ok, (dialog, which) -> { if (!activity.isFinishing()) { + //noinspection DataFlowIssue if (startActivatorRb.isChecked()) { Intent launcherIntent = new Intent(activity.getApplicationContext(), ActivatorActivity.class); launcherIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK/*|Intent.FLAG_ACTIVITY_NO_ANIMATION*/); launcherIntent.putExtra(PPApplication.EXTRA_STARTUP_SOURCE, PPApplication.STARTUP_SOURCE_NOTIFICATION); activity.startActivity(launcherIntent); activity.finish(); - } else if (startEditorRb.isChecked()) { + } else + //noinspection DataFlowIssue + if (startEditorRb.isChecked()) { Intent launcherIntent = new Intent(activity.getApplicationContext(), EditorActivity.class); launcherIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK/*|Intent.FLAG_ACTIVITY_NO_ANIMATION*/); launcherIntent.putExtra(PPApplication.EXTRA_STARTUP_SOURCE, PPApplication.STARTUP_SOURCE_NOTIFICATION); activity.startActivity(launcherIntent); activity.finish(); - } else if (restartEventsRb.isChecked()) { + } else + //noinspection DataFlowIssue + if (restartEventsRb.isChecked()) { DataWrapper dataWrapper = new DataWrapper(activity.getApplicationContext(), false, 0, false, DataWrapper.IT_FOR_EDITOR, 0, 0f); dataWrapper.restartEventsWithAlert(activity); - } else if (runStopEventsRunRb.isChecked()) { + } else + //noinspection DataFlowIssue + if (runStopEventsRunRb.isChecked()) { DataWrapper dataWrapper = new DataWrapper(activity.getApplicationContext(), false, 0, false, DataWrapper.IT_FOR_EDITOR, 0, 0f); dataWrapper.runStopEventsFronGeneratedNotification(activity); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GenerateNotificationDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GenerateNotificationDialogPreference.java index b65aaf1b37..f9cc1ca7b6 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GenerateNotificationDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GenerateNotificationDialogPreference.java @@ -232,8 +232,8 @@ public void writeToParcel(Parcel dest, int flags) super(superState); } - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator<>() { public GenerateNotificationDialogPreference.SavedState createFromParcel(Parcel in) { return new GenerateNotificationDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GenerateNotificationDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GenerateNotificationDialogPreferenceFragment.java index e576267b37..dbef3578db 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GenerateNotificationDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GenerateNotificationDialogPreferenceFragment.java @@ -117,7 +117,8 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { showLargeIconChBtn = layout.findViewById(R.id.generateNotificationPrefDialogShowLargeIcon); notificationTitleEdtText = layout.findViewById(R.id.generateNotificationPrefDialogNotificationTitle); - notificationTitleEdtText.setBackgroundTintList(ContextCompat.getColorStateList(preference._context, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + notificationTitleEdtText.setBackgroundTintList(ContextCompat.getColorStateList(preference._context, R.color.edit_text_color)); notificationTitleEdtText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -138,7 +139,8 @@ public void afterTextChanged(Editable s) { }); notificationBodyEdtText = layout.findViewById(R.id.generateNotificationPrefDialogNotificationBody); - notificationBodyEdtText.setBackgroundTintList(ContextCompat.getColorStateList(preference._context, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + notificationBodyEdtText.setBackgroundTintList(ContextCompat.getColorStateList(preference._context, R.color.edit_text_color)); generateChBtn.setOnCheckedChangeListener((buttonView, isChecked) -> enableViews()); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GitHubAssetsScreenshotActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GitHubAssetsScreenshotActivity.java index d7f8f91090..bd11ca1e42 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GitHubAssetsScreenshotActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GitHubAssetsScreenshotActivity.java @@ -8,6 +8,7 @@ import android.widget.ImageView; import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; public class GitHubAssetsScreenshotActivity extends AppCompatActivity { @@ -16,7 +17,7 @@ public class GitHubAssetsScreenshotActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { - GlobalGUIRoutines.setTheme(this, false, false, false, false, false, false); // must by called before super.onCreate() + GlobalGUIRoutines.setTheme(this, false, true, false, false, false, false); // must by called before super.onCreate() //GlobalGUIRoutines.setLanguage(this); super.onCreate(savedInstanceState); @@ -24,6 +25,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_github_assets_screenshot); setTaskDescription(new ActivityManager.TaskDescription(getString(R.string.ppp_app_name))); + Toolbar toolbar = findViewById(R.id.github_assets_screenshot_activity_toolbar); + setSupportActionBar(toolbar); final String ASSETS = "GitHub \"Assets\" "; if (getSupportActionBar() != null) { getSupportActionBar().setHomeButtonEnabled(true); @@ -33,11 +36,13 @@ protected void onCreate(Bundle savedInstanceState) { } ImageView imageView = findViewById(R.id.github_assets_screenshot_activity_image); + //noinspection DataFlowIssue imageView.setContentDescription(ASSETS + getString(R.string.github_assets_screenshot_label)); int image = getIntent().getIntExtra(EXTRA_IMAGE, R.drawable.ic_empty); imageView.setImageResource(image); Button closeButton = findViewById(R.id.github_assets_screenshot_activity_close); + //noinspection DataFlowIssue closeButton.setOnClickListener(v -> finish()); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GlobalGUIRoutines.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GlobalGUIRoutines.java index bfea818a09..7968f2dabd 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GlobalGUIRoutines.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GlobalGUIRoutines.java @@ -28,7 +28,6 @@ import androidx.appcompat.app.AppCompatDelegate; import androidx.appcompat.widget.AppCompatImageButton; import androidx.core.content.ContextCompat; - import com.google.android.material.color.DynamicColors; import java.lang.ref.WeakReference; @@ -50,6 +49,11 @@ class GlobalGUIRoutines { static final String OPAQUENESS_LIGHTNESS_87 = "87"; static final String OPAQUENESS_LIGHTNESS_100 = "100"; + // do not used because some dynamic notification, widgets has its own laypouts and in it + // are colors configured = keep material componets lib to 1.10.0 + //static DynamicTonalPaletteSamsung.ColorScheme lightColorScheme = null; + //static DynamicTonalPaletteSamsung.ColorScheme darkColorScheme = null; + private GlobalGUIRoutines() { // private constructor to prevent instantiation } @@ -76,17 +80,22 @@ static int getTheme(boolean forPopup, boolean withToolbar, // if (forEditor) // Log.e("GlobalGUIRoutines.getTheme", "applicationTheme="+applicationTheme); + /* int miuiVersion = -1; if (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) { // Log.e("GlobalGUIRoutines.getTheme", "Build.VERSION.INCREMENTAL="+Build.VERSION.INCREMENTAL); String[] splits = Build.VERSION.INCREMENTAL.split("\\."); // Log.e("GlobalGUIRoutines.getTheme", "splits[0]="+splits[0]); - miuiVersion = Integer.parseInt(splits[0].substring(1)); -// Log.e("GlobalGUIRoutines.getTheme", "miuiVersion="+miuiVersion); + try { + miuiVersion = Integer.parseInt(splits[0].substring(1)); +// Log.e("GlobalGUIRoutines.getTheme", "miuiVersion="+miuiVersion); + } + catch (Exception ignored) {} } + */ if (forActivator) { - if (PPApplication.deviceIsOnePlus) { + /*if (PPApplication.deviceIsOnePlus) { if (Build.VERSION.SDK_INT >= 33) return R.style.ActivatorTheme_dayNight; else @@ -102,11 +111,12 @@ static int getTheme(boolean forPopup, boolean withToolbar, return R.style.ActivatorTheme_dayNight_samsung; else return R.style.ActivatorTheme_dayNight; - } + }*/ + return R.style.ActivatorTheme_dayNight; } else if (forDialog) { - if (PPApplication.deviceIsOnePlus) { + /*if (PPApplication.deviceIsOnePlus) { if (Build.VERSION.SDK_INT >= 33) return R.style.DialogTheme_dayNight; else @@ -122,11 +132,12 @@ static int getTheme(boolean forPopup, boolean withToolbar, return R.style.DialogTheme_dayNight_samsung; else return R.style.DialogTheme_dayNight; - } + }*/ + return R.style.DialogTheme_dayNight; } else if (forLocationEditor) { - if (PPApplication.deviceIsOnePlus) { + /*if (PPApplication.deviceIsOnePlus) { if (Build.VERSION.SDK_INT >= 33) return R.style.Theme_PhoneProfilesTheme_locationeditor_dayNight; else @@ -136,12 +147,12 @@ static int getTheme(boolean forPopup, boolean withToolbar, if (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI && miuiVersion >= 14) { return R.style.Theme_PhoneProfilesTheme_locationeditor_dayNight_noRipple; } - else + else*/ return R.style.Theme_PhoneProfilesTheme_locationeditor_dayNight; } else if (forPreferences) { - if (PPApplication.deviceIsOnePlus) { + /*if (PPApplication.deviceIsOnePlus) { if (Build.VERSION.SDK_INT >= 33) return R.style.Theme_PhoneProfilesTheme_preferences_dayNight; else @@ -151,12 +162,12 @@ static int getTheme(boolean forPopup, boolean withToolbar, if (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI && miuiVersion >= 14) { return R.style.Theme_PhoneProfilesTheme_preferences_dayNight_noRipple; } - else + else*/ return R.style.Theme_PhoneProfilesTheme_preferences_dayNight; } else if (forPopup) { - if (PPApplication.deviceIsOnePlus) { + /*if (PPApplication.deviceIsOnePlus) { if (Build.VERSION.SDK_INT >= 33) { if (withToolbar) return R.style.PopupTheme_withToolbar_dayNight; @@ -176,15 +187,15 @@ static int getTheme(boolean forPopup, boolean withToolbar, else return R.style.PopupTheme_dayNight_noRipple; } - else { + else {*/ if (withToolbar) return R.style.PopupTheme_withToolbar_dayNight; else return R.style.PopupTheme_dayNight; - } + //} } else { - if (PPApplication.deviceIsOnePlus) { + /*if (PPApplication.deviceIsOnePlus) { if (Build.VERSION.SDK_INT >= 33) { if (withToolbar) { return R.style.Theme_PhoneProfilesTheme_withToolbar_dayNight; @@ -204,12 +215,12 @@ static int getTheme(boolean forPopup, boolean withToolbar, } else return R.style.Theme_PhoneProfilesTheme_dayNight_noRipple; } - else { + else {*/ if (withToolbar) { return R.style.Theme_PhoneProfilesTheme_withToolbar_dayNight; } else return R.style.Theme_PhoneProfilesTheme_dayNight; - } + //} } } @@ -347,13 +358,14 @@ static void setPreferenceTitleStyleX(androidx.preference.Preference preference, // Log.e("GlobalGUIRoutines.setPreferenceTitleStyleX", "enabled="+enabled); // } if (errorColor && enabled) - sbt.setSpan(new ForegroundColorSpan(ContextCompat.getColor(preference.getContext(), R.color.error_color)), 0, sbt.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + sbt.setSpan(new ForegroundColorSpan(ContextCompat.getColor(preference.getContext(), R.color.errorColor)), 0, sbt.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } preference.setTitle(sbt); } } } + // WARNING: DO NOT CALL IT WITH APPLICATION CONTEXT, LINGT/DARK COLOR NOT WORKING WITH IT static void setImageButtonEnabled(boolean enabled, AppCompatImageButton item, /*int iconResId,*/ Context context) { item.setEnabled(enabled); //Drawable originalIcon = ContextCompat.getDrawable(context, iconResId); @@ -362,7 +374,7 @@ static void setImageButtonEnabled(boolean enabled, AppCompatImageButton item, /* if (enabled) item.setColorFilter(null); else - item.setColorFilter(context.getColor(R.color.activityDisabledTextColor), PorterDuff.Mode.SRC_IN); + item.setColorFilter(ContextCompat.getColor(context, R.color.activityDisabledTextColor), PorterDuff.Mode.SRC_IN); } /* private static Drawable convertDrawableToGrayScale(Drawable drawable) { @@ -632,11 +644,11 @@ static int getThemeSensorPassStatusColor(final int passStatus, final Context con context.getTheme().resolveAttribute(R.attr.sensorPassStatusWaiting, value, true); return value.data;*/ if (passStatus == EventPreferences.SENSOR_PASSED_PASSED) - return ContextCompat.getColor(context, R.color.sensor_pass_status_passed); + return ContextCompat.getColor(context, R.color.sensorPassStatusPassedColor); else if (passStatus == EventPreferences.SENSOR_PASSED_NOT_PASSED) - return ContextCompat.getColor(context, R.color.sensor_pass_status_not_passed); + return ContextCompat.getColor(context, R.color.sensorPassStatusNotPassedColor); else - return ContextCompat.getColor(context, R.color.sensor_pass_status_waiting); + return ContextCompat.getColor(context, R.color.sensorPassStatusWaitingColor); } /* @@ -705,7 +717,8 @@ static void setThemeTimeDurationPickerDisplay(TimeDurationPicker timeDurationPic //timeDurationPicker.setDurationDisplayBackgroundColor(getThemeDialogBackgroundColor(context)); timeDurationPicker.setDurationDisplayBackgroundColor(ContextCompat.getColor(context, R.color.activityBackgroundColor)); //timeDurationPicker.setSeparatorColor(GlobalGUIRoutines.getThemeDialogDividerColor(context)); - timeDurationPicker.setSeparatorColor(ContextCompat.getColor(context, R.color.dialog_divider)); + timeDurationPicker.setDisplaySeparatorColor(ContextCompat.getColor(context, R.color.timeDurationPickerDisplayDividerColor)); + timeDurationPicker.setButtonsSeparatorColor(ContextCompat.getColor(context, R.color.dialogDividerColor)); } /* static int getThemeSecondaryTextColor(final Context context) { @@ -757,6 +770,37 @@ static int getDynamicColor(int colorAttr, Context context) { int color = ta.getColor(0, 0); ta.recycle(); // recycle TypedArray + /* + if (PPApplication.deviceIsSamsung) { + // One UI 6.0 would be 60000, 6.1 would be 60100, 6.1.1 is 60101. + if (!PPApplication.romIsGalaxy611) { + // [retrieve pre-U palette tokens] else [normal logic] + Log.e("GlobalGUIRoutines.getDynamicColor", "before 6.1.1"); + + }// else { + // Log.e("GlobalGUIRoutines.getDynamicColor", "is 6.1.1"); + //} + } + */ + /* + PackageManager packageManager = context.getPackageManager(); + boolean isOneUI = + ( packageManager.hasSystemFeature("com.samsung.feature.samsung_experience_mobile") + || packageManager.hasSystemFeature("com.samsung.feature.samsung_experience_mobile_lite")); + String systemProperty = SystemProperties.get("ro.build.version.oneui"); + Log.e("GlobalGUIRoutines.getDynamicColor", "systemProperty="+systemProperty); + boolean isBeforeOneUI611 = false; + try { + //(systemProperty != null) && + isBeforeOneUI611 = (Integer.parseInt(systemProperty) < 60101); + } catch (Exception ignored) {} + // One UI 6.0 would be 60000, 6.1 would be 60100, 6.1.1 is 60101. + if (isOneUI && isBeforeOneUI611) { + // [retrieve pre-U palette tokens] else [normal logic] + Log.e("GlobalGUIRoutines.getDynamicColor", "before 6.1.1"); + } + */ + return color; } } @@ -1008,6 +1052,7 @@ static void showDialogAboutRedText(final Profile profile, final Event event, true/*!forActivator*/, true/*!forActivator*/, false, false, false, + false, activity ); @@ -1049,4 +1094,96 @@ static Intent getIntentForStartupSource(Context context, int startupSource) { } */ + /** + * Converts an HSL color value to RGB. Conversion formula + * adapted from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes h, s, and l are contained in the set [0, 1] and + * returns r, g, and b in the set [0, 255]. + * + * @param h The hue + * @param s The saturation + * @param l The lightness + * @return int array, the RGB representation + * @noinspection JavadocLinkAsPlainText + */ + static int[] hslToRgb(float h, float s, float l){ + float r, g, b; + + if (s == 0f) { + r = g = b = l; // achromatic + } else { + float q = l < 0.5f ? l * (1 + s) : l + s - l * s; + float p = 2 * l - q; + r = hueToRgb(p, q, h + 1f/3f); + g = hueToRgb(p, q, h); + b = hueToRgb(p, q, h - 1f/3f); + } + //noinspection UnnecessaryLocalVariable + int[] rgb = {to255(r), to255(g), to255(b)}; + return rgb; + } + static int to255(float v) { + return (int)Math.min(255,256*v); + } + /** Helper method that converts hue to rgb */ + static float hueToRgb(float p, float q, float t) { + if (t < 0f) + t += 1f; + if (t > 1f) + t -= 1f; + if (t < 1f/6f) + return p + (q - p) * 6f * t; + if (t < 1f/2f) + return q; + if (t < 2f/3f) + return p + (q - p) * (2f/3f - t) * 6f; + return p; + } + + /** + * Converts an RGB color value to HSL. Conversion formula + * adapted from http://en.wikipedia.org/wiki/HSL_color_space. + * Assumes pR, pG, and bpBare contained in the set [0, 255] and + * returns h, s, and l in the set [0, 1]. + * + * @param pR The red color value + * @param pG The green color value + * @param pB The blue color value + * @return float array, the HSL representation + * @noinspection JavadocLinkAsPlainText + */ + static float[] rgbToHsl(int pR, int pG, int pB) { + float r = pR / 255f; + float g = pG / 255f; + float b = pB / 255f; + + float max = (r > g && r > b) ? r : Math.max(g, b); + float min = (r < g && r < b) ? r : Math.min(g, b); + + float h, s, l; + l = (max + min) / 2.0f; + + if (max == min) { + h = s = 0.0f; + } else { + float d = max - min; + s = (l > 0.5f) ? d / (2.0f - max - min) : d / (max + min); + + if (r > g && r > b) + h = (g - b) / d + (g < b ? 6.0f : 0.0f); + + else if (g > b) + h = (b - r) / d + 2.0f; + + else + h = (r - g) / d + 4.0f; + + h /= 6.0f; + } + + //noinspection UnnecessaryLocalVariable + float[] hsl = {h, s, l}; + return hsl; + } + } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GlobalUtils.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GlobalUtils.java index 53fe192580..d82baf38a9 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GlobalUtils.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GlobalUtils.java @@ -352,7 +352,7 @@ static String getRealPath(Uri treeUri) if (treeUri == null) return ""; String path1 = treeUri.getPath(); - if (path1.startsWith("/tree/")) + if ((path1 != null) && path1.startsWith("/tree/")) { String path2 = path1.substring("/tree/".length()); if (path2.startsWith("primary:")) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GrantDrawOverAppsActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GrantDrawOverAppsActivity.java index 719189dd8e..c7dce44e1f 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GrantDrawOverAppsActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GrantDrawOverAppsActivity.java @@ -1,9 +1,11 @@ package sk.henrichg.phoneprofilesplus; import android.annotation.SuppressLint; +import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; +import android.os.Build; import android.os.Bundle; import android.provider.Settings; import android.text.Spannable; @@ -45,6 +47,8 @@ protected void onStart() { super.onStart(); + final Activity activity = this; + GlobalGUIRoutines.lockScreenOrientation(this, true); // set theme and language for dialog alert ;-) @@ -66,7 +70,7 @@ protected void onStart() } catch (Exception e) { PPApplicationStatic.recordException(e); } - finish(); + activity.finish(); } if (!ok) { PPAlertDialog dialog2 = new PPAlertDialog( @@ -83,10 +87,11 @@ protected void onStart() true, true, false, false, true, - this + false, + activity ); - if (!isFinishing()) + if (!activity.isFinishing()) dialog2.show(); } }); @@ -96,35 +101,65 @@ protected void onStart() View layout = inflater.inflate(R.layout.dialog_draw_over_apps, null); dialogBuilder.setView(layout); - TextView text = layout.findViewById(R.id.dialog_draw_over_apps_when_not_possible_text); - CharSequence str1 = getString(R.string.grant_draw_over_apps_dialog_when_not_possible_text) + StringConstants.CHAR_NEW_LINE; - CharSequence str2 = str1 + "https://techforesta.com/display-over-other-apps-feature-not-available/" + StringConstants.STR_HARD_SPACE_DOUBLE_ARROW; - Spannable sbt = new SpannableString(str2); - sbt.setSpan(new StyleSpan(android.graphics.Typeface.NORMAL), 0, str1.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - ClickableSpan clickableSpan = new ClickableSpan() { - @Override - public void updateDrawState(TextPaint ds) { - ds.setColor(ds.linkColor); // you can use custom color - ds.setUnderlineText(false); // this remove the underline - } + if (Build.VERSION.SDK_INT >= 33) { + TextView text = layout.findViewById(R.id.dialog_draw_over_apps_when_not_possible_text); + CharSequence str1 = getString(R.string.grant_draw_over_apps_dialog_when_not_possible_text) + StringConstants.STR_HARD_SPACE_DOUBLE_ARROW; + Spannable sbt = new SpannableString(str1); + sbt.setSpan(new StyleSpan(android.graphics.Typeface.NORMAL), 0, str1.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + ClickableSpan clickableSpan = new ClickableSpan() { + @Override + public void updateDrawState(TextPaint ds) { + ds.setColor(ds.linkColor); // you can use custom color + ds.setUnderlineText(false); // this remove the underline + } - @Override - public void onClick(@NonNull View textView) { - String url = "https://techforesta.com/display-over-other-apps-feature-not-available/"; - Intent i = new Intent(Intent.ACTION_VIEW); - i.setData(Uri.parse(url)); - try { - startActivity(Intent.createChooser(i, getString(R.string.web_browser_chooser))); - finish(); - } catch (Exception e) { - PPApplicationStatic.recordException(e); + @Override + public void onClick(@NonNull View textView) { + String restrictedSettingsText = StringConstants.TAG_URL_LINK_START_HTML + InfoDialogPreference.PPP_APP_INFO_SCREEN + StringConstants.TAG_URL_LINK_START_URL_END_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_2) + StringConstants.STR_HARD_SPACE_DOUBLE_ARROW_HTML + StringConstants.TAG_URL_LINK_END_HTML + StringConstants.TAG_DOUBLE_BREAK_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_3) + StringConstants.TAG_DOUBLE_BREAK_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_4) + StringConstants.TAG_DOUBLE_BREAK_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_5) + StringConstants.TAG_BREAK_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_6) + StringConstants.TAG_DOUBLE_BREAK_HTML + + StringConstants.TAG_URL_LINK_START_HTML + InfoDialogPreference.DROIDIFY_INSTALLATION_SITE + StringConstants.TAG_URL_LINK_START_URL_END_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_10) + StringConstants.STR_HARD_SPACE_DOUBLE_ARROW_HTML + StringConstants.TAG_URL_LINK_END_HTML + StringConstants.TAG_DOUBLE_BREAK_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_7) + " " + + "\"" + getString(R.string.menu_import_export) + "\"/\"" + getString(R.string.menu_export) + "\"." + StringConstants.TAG_DOUBLE_BREAK_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_8) + " " + + "\"" + getString(R.string.menu_import_export) + "\"/\"" + getString(R.string.menu_import) + "\"."; + + PPAlertDialog dialog2 = new PPAlertDialog( + getString(R.string.phone_profiles_pref_drawOverlaysPermissions), + StringFormatUtils.fromHtml(restrictedSettingsText, true, false, 0, 0, true), + getString(android.R.string.ok), + null, + null, null, + null, + null, + null, + null, + null, + true, true, + false, false, + true, + true, + activity + ); + + dialog2.show(); } - } - }; - sbt.setSpan(clickableSpan, str1.length(), str2.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - //sbt.setSpan(new UnderlineSpan(), str1.length()+1, str2.length(), 0); - text.setText(sbt); - text.setMovementMethod(LinkMovementMethod.getInstance()); + }; + sbt.setSpan(clickableSpan, 0, str1.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + //sbt.setSpan(new UnderlineSpan(), str1.length()+1, str2.length(), 0); + //noinspection DataFlowIssue + text.setVisibility(View.VISIBLE); + text.setText(sbt); + text.setMovementMethod(LinkMovementMethod.getInstance()); + } else { + TextView text = layout.findViewById(R.id.dialog_draw_over_apps_when_not_possible_text); + //noinspection DataFlowIssue + text.setVisibility(View.GONE); + } mDialog = dialogBuilder.create(); mDialog.setCancelable(false); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GrantPermissionActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GrantPermissionActivity.java index 53d4f3d6dc..c0fb462fb2 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GrantPermissionActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GrantPermissionActivity.java @@ -615,6 +615,7 @@ else if (showRequestDrawOverlays) true, true, false, false, false, + false, this ); @@ -629,6 +630,7 @@ else if (showRequestDrawOverlays) if (permissions != null) { for (PermissionType permissionType : permissions) { + //noinspection IfStatementMissingBreakInLoop if (permissionType.permission.equals(Manifest.permission.WRITE_SETTINGS)) { showRequestWriteSettings = true; } @@ -646,8 +648,8 @@ else if (showRequestDrawOverlays) iteration = 1; //else if (showRequestAccessNotificationPolicy) // iteration = 2; - else if (showRequestDrawOverlays) - iteration = 3; + //else if (showRequestDrawOverlays) + // iteration = 3; requestPermissions(iteration, canShowRationale(context, false)); } @@ -818,8 +820,27 @@ private String getWhyPermissionString(boolean[] whyPermissionTypes) { case Permissions.PERMISSION_TYPE_PROFILE_RINGTONES_DUAL_SIM: s = getString(R.string.permission_why_profile_ringtones_dual_sim); break; - case Permissions.PERMISSION_TYPE_PROFILE_PHONE_CALLS: - s = getString(R.string.permission_why_profile_phone_calls); + case Permissions.PERMISSION_TYPE_PROFILE_SEND_SMS: + s = getString(R.string.permission_why_profile_send_sms); + break; + case Permissions.PERMISSION_TYPE_EVENT_CALL_SCREENING_PREFERENCES: + s = getString(R.string.permission_why_event_call_screening); + break; + case Permissions.PERMISSION_TYPE_PROFILE_CLEAR_NOTIFICATIONS: + s = getString(R.string.permission_why_profile_clear_notifications); + break; + case Permissions.PERMISSION_TYPE_PROFILE_SCREEN_NIGHT_LIGHT: + //if (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) + // s = getString(R.string.permission_why_profile_screen_night_light_xiaomi); + //else + if (PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) + s = getString(R.string.permission_why_profile_screen_night_huawei); + break; + case Permissions.PERMISSION_TYPE_PROFILE_VPN: + s = getString(R.string.permission_why_profile_vpn); + break; + case Permissions.PERMISSION_TYPE_PROFILE_SCREEN_ON_OFF: + s = getString(R.string.permission_why_profile_screen_on_off); break; } } @@ -857,7 +878,7 @@ private void showNotification() { String nTitle = context.getString(R.string.permissions_notification_text); String nText = context.getString(R.string.permissions_for_play_ringtone_notification_big_text_notification); mBuilder = new NotificationCompat.Builder(context.getApplicationContext(), PPApplication.GRANT_PERMISSION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.error_color)) + .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.errorColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_exclamation_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(context.getApplicationContext().getResources(), R.drawable.ic_exclamation_notification)) .setContentTitle(nTitle) // title for notification @@ -892,7 +913,7 @@ private void showNotification() { nText = nText + context.getString(R.string.permissions_for_event_big_text_notification); //} mBuilder = new NotificationCompat.Builder(context.getApplicationContext(), PPApplication.GRANT_PERMISSION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.error_color)) + .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.errorColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_exclamation_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(context.getApplicationContext().getResources(), R.drawable.ic_exclamation_notification)) .setContentTitle(nTitle) // title for notification @@ -924,7 +945,7 @@ private void showNotification() { nText = nText + context.getString(R.string.permissions_for_profile_big_text_notification); } mBuilder = new NotificationCompat.Builder(context.getApplicationContext(), PPApplication.GRANT_PERMISSION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.error_color)) + .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.errorColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_exclamation_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(context.getApplicationContext().getResources(), R.drawable.ic_exclamation_notification)) .setContentTitle(nTitle) // title for notification @@ -1086,6 +1107,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { true, true, false, false, false, + false, this ); @@ -1243,6 +1265,7 @@ public void onCancel(DialogInterface dialog) { true, true, false, false, false, + false, this ); @@ -1458,43 +1481,6 @@ private void requestPermissions(int iteration, boolean withRationale) { intent.putExtra(EXTRA_WITH_RATIONALE, withRationale); //noinspection deprecation startActivityForResult(intent, DRAW_OVERLAYS_REQUEST_CODE); - - //if (!PPApplication.romIsMIUI) { - /*if (GlobalGUIRoutines.activityActionExists(android.provider.Settings.ACTION_MANAGE_OVERLAY_PERMISSION, getApplicationContext())) { - drawOverlaysFound = true; - final Intent intent = new Intent(android.provider.Settings.ACTION_MANAGE_OVERLAY_PERMISSION); - intent.setData(Uri.parse(PPApplication.INTENT_DATA_PACKAGE + PPApplication.PACKAGE_NAME)); - intent.putExtra(EXTRA_WITH_RATIONALE, withRationale); - startActivityForResult(intent, DRAW_OVERLAYS_REQUEST_CODE); - break; - } - */ - /*} - else { - try { - // MIUI 8 - Intent localIntent = new Intent("miui.intent.action.APP_PERM_EDITOR"); - localIntent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.PermissionsEditorActivity"); - localIntent.putExtra(PPApplication.EXTRA_PKG_NAME, PPApplication.PACKAGE_NAME); - intent.putExtra(EXTRA_WITH_RATIONALE, withRationale); - startActivityForResult(localIntent, DRAW_OVERLAYS_REQUEST_CODE); - drawOverlaysFound = true; - break; - } catch (Exception e) { - try { - // MIUI 5/6/7 - Intent localIntent = new Intent("miui.intent.action.APP_PERM_EDITOR"); - localIntent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.AppPermissionsEditorActivity"); - localIntent.putExtra(PPApplication.EXTRA_PKG_NAME, PPApplication.PACKAGE_NAME); - intent.putExtra(EXTRA_WITH_RATIONALE, withRationale); - startActivityForResult(localIntent, DRAW_OVERLAYS_REQUEST_CODE); - drawOverlaysFound = true; - break; - } catch (Exception e1) { - drawOverlaysFound = false; - } - } - }*/ } } if (!drawOverlaysFound) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GrantShizukuPermissionActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GrantShizukuPermissionActivity.java index 0b95a41e30..73d1d7629a 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GrantShizukuPermissionActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/GrantShizukuPermissionActivity.java @@ -205,6 +205,7 @@ private void showRationale() { true, true, false, false, false, + false, this ); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/IgnoreBatteryOptimizationNotification.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/IgnoreBatteryOptimizationNotification.java index 0972329484..4b8269e6bc 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/IgnoreBatteryOptimizationNotification.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/IgnoreBatteryOptimizationNotification.java @@ -93,7 +93,7 @@ static void showNotification(Context context, boolean useHandler) { static private void showNotification(Context context, String title, String text) { PPApplicationStatic.createExclamationNotificationChannel(context.getApplicationContext(), false); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context.getApplicationContext(), PPApplication.EXCLAMATION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.error_color)) + .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.errorColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_exclamation_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(context.getApplicationContext().getResources(), R.drawable.ic_exclamation_notification)) .setContentTitle(title) // title for notification diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoActivity.java index 8b6da4da0b..41fd992df9 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoActivity.java @@ -7,7 +7,6 @@ import android.net.Uri; import android.os.Bundle; import android.view.MenuItem; -import android.widget.Button; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; @@ -45,7 +44,6 @@ protected void onCreate(Bundle savedInstanceState) { Toolbar toolbar = findViewById(R.id.activity_important_info_toolbar); setSupportActionBar(toolbar); - if (getSupportActionBar() != null) { getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -54,12 +52,14 @@ protected void onCreate(Bundle savedInstanceState) { } TabLayout tabLayout = findViewById(R.id.activity_important_info_tab_layout); + //noinspection DataFlowIssue tabLayout.addTab(tabLayout.newTab().setText(R.string.important_info_important_info_tab)); tabLayout.addTab(tabLayout.newTab().setText(R.string.important_info_quick_guide_tab)); tabLayout.setTabGravity(TabLayout.GRAVITY_FILL); final ViewPager2 viewPager = findViewById(R.id.activity_important_info_pager); ImportantInfoActivityFragmentStateAdapter adapter = new ImportantInfoActivityFragmentStateAdapter(getSupportFragmentManager(), getLifecycle()); + //noinspection DataFlowIssue viewPager.setAdapter(adapter); // this fixes cropped fragment in Quick guide viewPager.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() { @@ -80,8 +80,11 @@ public void onPageSelected(int position) { } }); + /* Button closeButton = findViewById(R.id.activity_important_info_close); + //noinspection DataFlowIssue closeButton.setOnClickListener(v -> finish()); + */ Intent intent = getIntent(); boolean firstInstallation = intent.getBooleanExtra(ImportantInfoNotification.EXTRA_FIRST_INSTALLATION, false); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoActivityForceScroll.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoActivityForceScroll.java index 31dd65899e..e8d1bbdb37 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoActivityForceScroll.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoActivityForceScroll.java @@ -29,7 +29,6 @@ protected void onCreate(Bundle savedInstanceState) { Toolbar toolbar = findViewById(R.id.activity_important_info_force_scroll_toolbar); setSupportActionBar(toolbar); - if (getSupportActionBar() != null) { getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -53,6 +52,7 @@ protected void onCreate(Bundle savedInstanceState) { .commitAllowingStateLoss(); Button closeButton = findViewById(R.id.activity_important_info_force_scroll_close); + //noinspection DataFlowIssue closeButton.setOnClickListener(v -> finish()); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoHelpFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoHelpFragment.java index f15719a534..4c8bc338b4 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoHelpFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoHelpFragment.java @@ -1,6 +1,7 @@ package sk.henrichg.phoneprofilesplus; import android.annotation.SuppressLint; +import android.app.Activity; import android.content.Context; import android.content.Intent; import android.content.pm.PackageInfo; @@ -113,42 +114,74 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { if ((!firstInstallation) && (extenderVersion != 0) && (extenderVersion < PPApplication.VERSION_CODE_EXTENDER_REQUIRED)) { news = true; TextView infoText1 = view.findViewById(R.id.activity_info_notification_accessibility_service_new_version); + //noinspection DataFlowIssue infoText1.setVisibility(View.VISIBLE); infoText1 = view.findViewById(R.id.activity_info_notification_accessibility_service_new_version_2); + //noinspection DataFlowIssue infoText1.setText(getString(R.string.important_info_accessibility_service_new_version_2) + StringConstants.STR_HARD_SPACE_DOUBLE_ARROW); infoText1.setVisibility(View.VISIBLE); infoText1.setOnClickListener(v -> ExtenderDialogPreferenceFragment.installPPPExtender(getActivity(), null, false)); } else { TextView infoText1 = view.findViewById(R.id.activity_info_notification_accessibility_service_new_version); + //noinspection DataFlowIssue infoText1.setVisibility(View.GONE); infoText1 = view.findViewById(R.id.activity_info_notification_accessibility_service_new_version_2); + //noinspection DataFlowIssue infoText1.setVisibility(View.GONE); } if ((!firstInstallation) && (ppppsVersion != 0) && (ppppsVersion < PPApplication.VERSION_CODE_PPPPS_REQUIRED)) { news = true; TextView infoText1 = view.findViewById(R.id.activity_info_notification_pppps_new_version); + //noinspection DataFlowIssue infoText1.setVisibility(View.VISIBLE); infoText1 = view.findViewById(R.id.activity_info_notification_pppps_new_version_2); + //noinspection DataFlowIssue infoText1.setText(getString(R.string.important_info_pppps_new_version_2) + StringConstants.STR_HARD_SPACE_DOUBLE_ARROW); infoText1.setVisibility(View.VISIBLE); infoText1.setOnClickListener(v -> PPPPSDialogPreferenceFragment.installPPPPutSettings(getActivity(), null, false)); } else { TextView infoText1 = view.findViewById(R.id.activity_info_notification_pppps_new_version); + //noinspection DataFlowIssue infoText1.setVisibility(View.GONE); infoText1 = view.findViewById(R.id.activity_info_notification_pppps_new_version_2); + //noinspection DataFlowIssue infoText1.setVisibility(View.GONE); } TextView infoTextNews = view.findViewById(R.id.activity_info_notification_news); + TextView infoTextnews1 = view.findViewById(R.id.important_info_news_1); + TextView infoTextnews2 = view.findViewById(R.id.important_info_news_2); + TextView infoTextnews3 = view.findViewById(R.id.important_info_news_3); + TextView infoTextnews4 = view.findViewById(R.id.important_info_news_4); if (!news) { + //noinspection DataFlowIssue infoTextNews.setVisibility(View.GONE); + if (infoTextnews1 != null) + infoTextnews1.setVisibility(View.GONE); + if (infoTextnews2 != null) + infoTextnews2.setVisibility(View.GONE); + if (infoTextnews3 != null) + infoTextnews3.setVisibility(View.GONE); + if (infoTextnews4 != null) + infoTextnews4.setVisibility(View.GONE); } else { + //noinspection DataFlowIssue infoTextNews.setVisibility(View.VISIBLE); infoTextNews.setText("*** " + getString(R.string.important_info_news) + " ***"); + + //TODO add textVews of News + if (infoTextnews1 != null) + infoTextnews1.setVisibility(View.VISIBLE); + if (infoTextnews2 != null) + infoTextnews2.setVisibility(View.VISIBLE); + if (infoTextnews3 != null) + infoTextnews3.setVisibility(View.VISIBLE); + if (infoTextnews4 != null) + infoTextnews4.setVisibility(View.VISIBLE); } } @@ -156,7 +189,7 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { @SuppressLint("SetTextI18n") static void doOnViewCreated(@NonNull View view, Fragment fragment) { - final ImportantInfoActivity activity = (ImportantInfoActivity) fragment.getActivity(); + final Activity activity = fragment.getActivity(); if (activity == null) return; @@ -193,6 +226,7 @@ static void doOnViewCreated(@NonNull View view, Fragment fragment) { true, true, false, false, true, + false, activity ); @@ -236,6 +270,7 @@ static void doOnViewCreated(@NonNull View view, Fragment fragment) { true, true, false, false, true, + false, activity ); @@ -274,6 +309,7 @@ static void doOnViewCreated(@NonNull View view, Fragment fragment) { true, true, false, false, true, + false, activity ); @@ -318,6 +354,7 @@ static void doOnViewCreated(@NonNull View view, Fragment fragment) { true, true, false, false, true, + false, activity ); @@ -377,6 +414,7 @@ static void doOnViewCreated(@NonNull View view, Fragment fragment) { infoText100.setText(text); } + /* infoText100 = view.findViewById(R.id.activity_info_profile_activation9); if (infoText100 != null) { String text = StringConstants.TAG_LIST_START_FIRST_ITEM_HTML + @@ -395,6 +433,7 @@ static void doOnViewCreated(@NonNull View view, Fragment fragment) { StringConstants.TAG_LIST_END_LAST_ITEM_HTML; infoText100.setText(StringFormatUtils.fromHtml(text, true, false, 0, 0, false)); } + */ infoText100 = view.findViewById(R.id.activity_info_notification_profile_preference_types); if (infoText100 != null) { @@ -654,7 +693,8 @@ static void doOnViewCreated(@NonNull View view, Fragment fragment) { } } - popup.setOnMenuItemClickListener(activity::supportMenu); + ImportantInfoActivity importantInfoActivity = (ImportantInfoActivity) activity; + popup.setOnMenuItemClickListener(importantInfoActivity::supportMenu); if (!activity.isFinishing()) popup.show(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoNotification.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoNotification.java index 5d6c930bef..166cadf4bd 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoNotification.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoNotification.java @@ -53,6 +53,8 @@ static void showInfoNotification(Context context) { boolean showExtender = false; boolean showPPPPS = false; if (packageVersionCode > savedVersionCode) { + // show notification only when is new version of package, not saved + // result = notification will be displayed only once showInfo = canShowInfoNotification(packageVersionCode, savedVersionCode); } int extenderVersion = PPExtenderBroadcastReceiver.isExtenderInstalled(context); @@ -67,6 +69,9 @@ static void showInfoNotification(Context context) { //Log.e("ImportantInfoNotification.showInfoNotification", "showExtender="+showExtender); //Log.e("ImportantInfoNotification.showInfoNotification", "showPPPPS="+showPPPPS); + // Save package version, in future notification will be displayed only when pacakage + // version will be changed. + // But this may be disabled by PPApplication.SHOW_IMPORTANT_INFO_NOTIFICATION_NEWS = false. setShowInfoNotificationOnStart(context, showInfo || showExtender || showPPPPS, packageVersionCode); if (/*(savedVersionCode == 0) ||*/ getShowInfoNotificationOnStart(context, packageVersionCode)) { @@ -165,7 +170,7 @@ static private void showNotification(Context context, String notificationTag) { PPApplicationStatic.createExclamationNotificationChannel(context.getApplicationContext(), false); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context.getApplicationContext(), PPApplication.EXCLAMATION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.information_color)) + .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.informationColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_exclamation_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(context.getApplicationContext().getResources(), R.drawable.ic_information_notification)) .setContentTitle(title) // title for notification diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoQuickGuideHelpFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoQuickGuideHelpFragment.java index a85797029b..7b87f7f486 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoQuickGuideHelpFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ImportantInfoQuickGuideHelpFragment.java @@ -63,6 +63,7 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { text = text + StringConstants.TAG_LIST_ITEM_START_HTML + getString(R.string.important_info_quick_guide_sensors_8) + StringConstants.TAG_LIST_ITEM_END_HTML; text = text + StringConstants.TAG_LIST_ITEM_START_HTML + getString(R.string.important_info_quick_guide_sensors_9); text = text + StringConstants.TAG_LIST_END_LAST_ITEM_HTML; + //noinspection DataFlowIssue textView.setText(StringFormatUtils.fromHtml(text, true, false, 0, 0, false)); textView = view.findViewById(R.id.activity_info_quick_guide_text_2); @@ -70,6 +71,7 @@ public void onViewCreated(@NonNull View view, Bundle savedInstanceState) { text = text + getString(R.string.important_info_quick_guide_2) + StringConstants.TAG_LIST_ITEM_END_HTML; text = text + StringConstants.TAG_LIST_ITEM_START_HTML + getString(R.string.important_info_quick_guide_3); text = text + StringConstants.TAG_NUMBERED_LIST_END_LAST_ITEM_HTML; + //noinspection DataFlowIssue textView.setText(StringFormatUtils.fromHtml(text, false, true, 1, 17, false)); /* @@ -140,6 +142,7 @@ public void onClick(@NonNull View textView) { }; spannable.setSpan(clickableSpan, str1.length()+1, str2.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); //sbt.setSpan(new UnderlineSpan(), str1.length()+1, str2.length(), 0); + //noinspection DataFlowIssue translationTextView.setText(spannable); translationTextView.setMovementMethod(LinkMovementMethod.getInstance()); /*AboutApplicationActivity.emailMe((TextView) view.findViewById(R.id.activity_info_translations), diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/InfoDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/InfoDialogPreferenceFragment.java index da311eed23..516347d97f 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/InfoDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/InfoDialogPreferenceFragment.java @@ -1,6 +1,7 @@ package sk.henrichg.phoneprofilesplus; import android.annotation.SuppressLint; +import android.app.Activity; import android.content.Context; import android.content.Intent; import android.net.Uri; @@ -35,10 +36,12 @@ protected void onBindDialogView(@NonNull View view) { final TextView infoTextView = view.findViewById(R.id.info_pref_dialog_info_text); if (preference.isHtml) { + //noinspection DataFlowIssue infoTextView.setText(StringFormatUtils.fromHtml(preference.infoText, true, false, 0, 0, true)); infoTextView.setClickable(true); infoTextView.setMovementMethod(new PPLinkMovementMethod(this, context)); } else + //noinspection DataFlowIssue infoTextView.setText(preference.infoText); } @@ -50,6 +53,14 @@ public void onDialogClosed(boolean positiveResult) { @Override public void onLinkClicked(final String linkUrl, PPLinkMovementMethod.LinkType linkTypeUrl, final String linkText, PPLinkMovementMethod.LinkType linkTypeText) { + onLinkClickedListener(linkUrl, linkTypeUrl, linkText, linkTypeText, + preference.getTitle(), context, getActivity()); + } + + /** @noinspection unused*/ + static void onLinkClickedListener(final String linkUrl, PPLinkMovementMethod.LinkType linkTypeUrl, + final String linkText, PPLinkMovementMethod.LinkType linkTypeText, + CharSequence dialodTitle, Context context, Activity activity) { boolean showImportantInfoProfiles = linkUrl.startsWith(InfoDialogPreference.ACTIVITY_IMPORTANT_INFO_PROFILES); boolean showPPPAppInfoScreen = linkUrl.startsWith(InfoDialogPreference.PPP_APP_INFO_SCREEN); boolean showDroidifyInstallationSite = linkUrl.startsWith(InfoDialogPreference.DROIDIFY_INSTALLATION_SITE); @@ -72,7 +83,7 @@ public void onLinkClicked(final String linkUrl, PPLinkMovementMethod.LinkType li intentLaunch.putExtra(ImportantInfoActivity.EXTRA_SHOW_QUICK_GUIDE, iiQuickGuide); intentLaunch.putExtra(ImportantInfoActivityForceScroll.EXTRA_SHOW_FRAGMENT, iiFragment); intentLaunch.putExtra(ImportantInfoActivityForceScroll.EXTRA_SCROLL_TO, scrollTo); - startActivity(intentLaunch); + context.startActivity(intentLaunch); } if (showPPPAppInfoScreen) { Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); @@ -80,12 +91,12 @@ public void onLinkClicked(final String linkUrl, PPLinkMovementMethod.LinkType li intent.setData(Uri.parse(PPApplication.INTENT_DATA_PACKAGE +PPApplication.PACKAGE_NAME)); if (GlobalGUIRoutines.activityIntentExists(intent, context)) { //noinspection deprecation - startActivity(intent); + context.startActivity(intent); } else { PPAlertDialog dialog2 = new PPAlertDialog( - preference.getTitle(), - getString(R.string.setting_screen_not_found_alert), - getString(android.R.string.ok), + dialodTitle, + context.getString(R.string.setting_screen_not_found_alert), + context.getString(android.R.string.ok), null, null, null, null, @@ -96,7 +107,8 @@ public void onLinkClicked(final String linkUrl, PPLinkMovementMethod.LinkType li true, true, false, false, true, - getActivity() + false, + activity ); dialog2.show(); @@ -107,7 +119,7 @@ public void onLinkClicked(final String linkUrl, PPLinkMovementMethod.LinkType li Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(url)); try { - startActivity(Intent.createChooser(i, getString(R.string.web_browser_chooser))); + context.startActivity(Intent.createChooser(i, context.getString(R.string.web_browser_chooser))); } catch (Exception ignored) {} } if (grantRoot) { @@ -119,7 +131,7 @@ public void onLinkClicked(final String linkUrl, PPLinkMovementMethod.LinkType li rooted = RootUtils._isRooted(); } if (rooted) { - Permissions.grantRootX(null, getActivity()); + Permissions.grantRootX(null, activity); } } } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LiveWallpapersDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LiveWallpapersDialogPreference.java index 677f586247..7af41a0cb3 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LiveWallpapersDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LiveWallpapersDialogPreference.java @@ -174,7 +174,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public LiveWallpapersDialogPreference.SavedState createFromParcel(Parcel in) { return new LiveWallpapersDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationGeofenceEditorActivityOSM.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationGeofenceEditorActivityOSM.java index 01aee831d4..1defd16e22 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationGeofenceEditorActivityOSM.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationGeofenceEditorActivityOSM.java @@ -28,6 +28,7 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.content.res.AppCompatResources; import androidx.appcompat.widget.AppCompatImageButton; +import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.TooltipCompat; import androidx.core.content.ContextCompat; import androidx.localbroadcastmanager.content.LocalBroadcastManager; @@ -136,6 +137,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_location_geofence_editor_osm); setTaskDescription(new ActivityManager.TaskDescription(getString(R.string.ppp_app_name))); + Toolbar toolbar = findViewById(R.id.location_editor_toolbar); + setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -165,6 +168,7 @@ protected void onCreate(Bundle savedInstanceState) { mapIsLoading = findViewById(R.id.location_editor_map_loading); mMap = findViewById(R.id.location_editor_map); + //noinspection DataFlowIssue mMap.setTileSource(TileSourceFactory.MAPNIK); //mMap.getZoomController().setVisibility(CustomZoomButtonsController.Visibility.NEVER); mMap.getZoomController().setVisibility(CustomZoomButtonsController.Visibility.ALWAYS); @@ -259,9 +263,11 @@ public boolean longPressHelper(GeoPoint p) { //radiusLabel = findViewById(R.id.location_pref_dlg_radius_seekbar_label); TextView radiusLabel = findViewById(R.id.location_pref_dlg_radius_label); + //noinspection DataFlowIssue radiusLabel.setText(getString(R.string.event_preferences_location_radius_label) + ":"); radiusValue = findViewById(R.id.location_pref_dlg_radius_value); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(radiusValue, getString(R.string.location_pref_dlg_edit_radius_tooltip)); radiusValue.setText(String.valueOf(Math.round(geofence._radius))); @@ -303,6 +309,7 @@ public boolean longPressHelper(GeoPoint p) { numberPicker = layout.findViewById(R.id.better_number_picker); // Initialize state + //noinspection DataFlowIssue numberPicker.setMin(BigDecimal.valueOf(MIN_RADIUS)); numberPicker.setMax(BigDecimal.valueOf(MAX_RADIUS)); numberPicker.setPlusMinusVisibility(View.INVISIBLE); @@ -363,12 +370,14 @@ public void onStopTrackingTouch(SeekBar seekBar) { */ geofenceNameEditText = findViewById(R.id.location_editor_geofence_name); - geofenceNameEditText.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + geofenceNameEditText.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); geofenceNameEditText.setText(geofence._name); addressText = findViewById(R.id.location_editor_address_text); okButton = findViewById(R.id.location_editor_ok); + //noinspection DataFlowIssue okButton.setOnClickListener(v -> { String name = geofenceNameEditText.getText().toString(); if ((!name.isEmpty()) && (mLocation != null)) { @@ -398,6 +407,7 @@ public void onStopTrackingTouch(SeekBar seekBar) { }); Button cancelButton = findViewById(R.id.location_editor_cancel); + //noinspection DataFlowIssue cancelButton.setOnClickListener(v -> { Intent returnIntent = new Intent(); setResult(Activity.RESULT_CANCELED, returnIntent); @@ -405,6 +415,7 @@ public void onStopTrackingTouch(SeekBar seekBar) { }); AppCompatImageButton myLocationButton = findViewById(R.id.location_editor_my_location); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(myLocationButton, getString(R.string.location_editor_change_location_dialog_title)); myLocationButton.setOnClickListener(v -> { SingleSelectListDialog changeLocationDialog = new SingleSelectListDialog( @@ -441,6 +452,7 @@ public void onStopTrackingTouch(SeekBar seekBar) { }); addressButton = findViewById(R.id.location_editor_address_btn); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(addressButton, getString(R.string.location_editor_rename_with_address_button_tooltip)); addressButton.setOnClickListener(v -> { SingleSelectListDialog renameGeofenceDialog = new SingleSelectListDialog( @@ -589,8 +601,8 @@ private void updateEditedMarker(boolean setMapCamera) { //mMap.invalidate(); } currentLocationOverlay = new LocationGeofenceEditorCurrentLocationOverlayOSM(new GeoPoint(mLastLocation), mLastLocation.getAccuracy(), - ContextCompat.getColor(this, R.color.map_last_location_marker_fill), - ContextCompat.getColor(this, R.color.map_last_location_marker_stroke)); + ContextCompat.getColor(this, R.color.mapLastLocationMarkerFillColor), + ContextCompat.getColor(this, R.color.mapLastLocationMarkerStrokeColor)); mMap.getOverlays().add(currentLocationOverlay); mMap.invalidate(); } @@ -601,8 +613,8 @@ private void updateEditedMarker(boolean setMapCamera) { //mMap.invalidate(); } geofenceOverlay = new LocationGeofenceEditorGeofenceOverlayOSM(new GeoPoint(mLocation), geofence._radius, - ContextCompat.getColor(this, R.color.map_edited_location_marker_fill), - ContextCompat.getColor(this, R.color.map_edited_location_marker_stroke)); + ContextCompat.getColor(this, R.color.mapEditedLocationMarkerFillColor), + ContextCompat.getColor(this, R.color.mapEditedLocationMarkerStrokeColor)); mMap.getOverlays().add(geofenceOverlay); if (editedMarker != null) { @@ -651,7 +663,7 @@ private void refreshActivity(boolean updateEditedMarker, boolean setMapCamera) { } //} if (addressButton.isEnabled()) - GlobalGUIRoutines.setImageButtonEnabled(enableAddressButton, addressButton, getApplicationContext()); + GlobalGUIRoutines.setImageButtonEnabled(enableAddressButton, addressButton, this); if (updateEditedMarker) { radiusValue.setText(String.valueOf(Math.round(geofence._radius))); @@ -704,6 +716,7 @@ private void showErrorLocationDialog() { true, true, false, false, true, + false, this ); @@ -720,6 +733,7 @@ private void showErrorLocationDialog() { true, true, false, false, false, + false, this ); @@ -902,7 +916,7 @@ private void startWorkerForFetchAddress(boolean updateName) { enableAddressButton = true; } - GlobalGUIRoutines.setImageButtonEnabled(enableAddressButton, addressButton, getApplicationContext()); + GlobalGUIRoutines.setImageButtonEnabled(enableAddressButton, addressButton, this); } }); } @@ -1261,11 +1275,11 @@ private double calcZoom(float visible_distance, int img_width, double atLat) private final LocationListener mLocationListener = new LocationListener() { - public void onLocationChanged(Location location) { + public void onLocationChanged(@NonNull Location location) { // PPApplicationStatic.logE("[IN_LISTENER] LocationGeofenceEditorActivityOSM.mLocationListener.onLocationChanged", "xxx"); - if (location == null) - return; + //if (location == null) + // return; final Location oldLastLocation = mLastLocation; @@ -1296,11 +1310,11 @@ public void onLocationChanged(Location location) { } } - public void onProviderDisabled(String provider) { + public void onProviderDisabled(@NonNull String provider) { // PPApplicationStatic.logE("[IN_LISTENER] LocationGeofenceEditorActivityOSM.mLocationListener.onProviderDisabled", "xxx"); } - public void onProviderEnabled(String provider) { + public void onProviderEnabled(@NonNull String provider) { // PPApplicationStatic.logE("[IN_LISTENER] LocationGeofenceEditorActivityOSM.mLocationListener.onProviderEnabled", "888888888888888"); } @@ -1327,6 +1341,7 @@ public void showDialogAndRefreshFromListener(Context context) { true, true, false, false, false, + false, this ); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationGeofencePreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationGeofencePreference.java index 43eb221a6e..8ee5ceed3b 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationGeofencePreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationGeofencePreference.java @@ -232,7 +232,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public LocationGeofencePreference.SavedState createFromParcel(Parcel in) { return new LocationGeofencePreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationGeofencePreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationGeofencePreferenceFragment.java index 8d9df30562..e5978e3939 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationGeofencePreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationGeofencePreferenceFragment.java @@ -26,6 +26,7 @@ public class LocationGeofencePreferenceFragment extends PreferenceDialogFragment LocationGeofencePreference preference; private RelativeLayout locationSystemSettingsRelLa; + private View divider2; private TextView locationEnabledStatusTextView; private AppCompatImageButton locationSystemSettingsButton; //private LinearLayout progressLinearLayout; @@ -62,9 +63,11 @@ protected void onBindDialogView(@NonNull View view) preference.setNegativeButtonText(null);*/ AppCompatImageButton addButton = view.findViewById(R.id.location_pref_dlg_add); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(addButton, getString(R.string.location_pref_dlg_add_button_tooltip)); geofencesListView = view.findViewById(R.id.location_pref_dlg_listview); + //noinspection DataFlowIssue geofencesListView.setEmptyView(view.findViewById(R.id.location_pref_dlg_empty)); //progressLinearLayout = view.findViewById(R.id.location_pref_dlg_linla_progress); @@ -131,6 +134,7 @@ public void onClick(View v) { final Button unselectAllButton = view.findViewById(R.id.location_pref_dlg_unselectAll); if (preference.onlyEdit == 0) { + //noinspection DataFlowIssue unselectAllButton.setOnClickListener(v -> { // clear all checks DatabaseHandler.getInstance(prefContext.getApplicationContext()).checkGeofence("", 0, true); @@ -138,12 +142,15 @@ public void onClick(View v) { }); } else { + //noinspection DataFlowIssue unselectAllButton.setVisibility(View.GONE); } locationSystemSettingsRelLa = view.findViewById(R.id.location_pref_dlg_locationSystemSettingsRelLa); locationEnabledStatusTextView = view.findViewById(R.id.location_pref_dlg_locationEnableStatus); locationSystemSettingsButton = view.findViewById(R.id.location_pref_dlg_locationSystemSettingsButton); + divider2 = view.findViewById(R.id.location_pref_dlg_buttonBarDivider2); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(locationSystemSettingsButton, getString(R.string.location_settings_button_tooltip)); setLocationEnableStatus(); @@ -175,8 +182,11 @@ public void onDialogClosed(boolean positiveResult) { } void setLocationEnableStatus() { + boolean locationEnabled; String statusText; if (!GlobalUtils.isLocationEnabled(prefContext)) { + locationEnabled = false; + statusText = getString(R.string.phone_profiles_pref_eventLocationSystemSettings) + StringConstants.STR_NEWLINE_WITH_COLON + "* " + getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary) + "! *"; @@ -211,6 +221,7 @@ void setLocationEnableStatus() { true, true, false, false, true, + false, getActivity() ); @@ -225,10 +236,15 @@ void setLocationEnableStatus() { //locationEnabledStatusTextView.setVisibility(View.VISIBLE); //locationSystemSettingsButton.setVisibility(View.VISIBLE); } else { + locationEnabled = true; locationSystemSettingsRelLa.setVisibility(View.GONE); //locationEnabledStatusTextView.setVisibility(View.GONE); //locationSystemSettingsButton.setVisibility(View.GONE); } + if (locationEnabled && (preference.onlyEdit == 1)) { + //noinspection DataFlowIssue + divider2.setVisibility(View.GONE); + } } /* @@ -320,6 +336,7 @@ void showEditMenu(View view) true, true, false, false, false, + false, getActivity() ); @@ -336,6 +353,7 @@ void showEditMenu(View view) true, true, false, false, true, + false, getActivity() ); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationModeChangedBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationModeChangedBroadcastReceiver.java index 5a3aa2cd61..5796087253 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationModeChangedBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationModeChangedBroadcastReceiver.java @@ -36,7 +36,7 @@ public void onReceive(Context context, Intent intent) { if ((action != null) && action.matches(LocationManager.PROVIDERS_CHANGED_ACTION)) { -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] LocationModeChangedBroadcastReceiver.onReceive", "sensorType=SENSOR_TYPE_RADIO_SWITCH"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] LocationModeChangedBroadcastReceiver.onReceive", "SENSOR_TYPE_RADIO_SWITCH"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_RADIO_SWITCH}); @@ -56,7 +56,7 @@ public void onReceive(Context context, Intent intent) { GlobalUtils.sleep(10000); -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] LocationScanner.LocationCallback", "sensorType=SENSOR_TYPE_LOCATION_MODE"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] LocationScanner.LocationCallback", "SENSOR_TYPE_LOCATION_MODE"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_LOCATION_MODE}); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationScanner.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationScanner.java index b58c6f666d..b97993a603 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationScanner.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationScanner.java @@ -514,7 +514,7 @@ private void showNotification() { PPApplicationStatic.createExclamationNotificationChannel(context.getApplicationContext(), false); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(context.getApplicationContext(), PPApplication.EXCLAMATION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.error_color)) + .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.errorColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_exclamation_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(context.getApplicationContext().getResources(), R.drawable.ic_exclamation_notification)) .setContentTitle(context.getString(R.string.location_scanner_location_not_working_notification_title)) // title for notification diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationScannerListener.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationScannerListener.java index bc9377ed49..63cd7a2a8b 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationScannerListener.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationScannerListener.java @@ -4,18 +4,20 @@ import android.location.LocationListener; import android.os.Bundle; +import androidx.annotation.NonNull; + class LocationScannerListener implements LocationListener { - public void onLocationChanged(Location location) { + public void onLocationChanged(@NonNull Location location) { // PPApplicationStatic.logE("[IN_LISTENER] LocationScanner.LocationScannerListener.onLocationChanged", "xxx"); LocationScanner.doLocationChanged(location, false); } - public void onProviderDisabled(String provider) { + public void onProviderDisabled(@NonNull String provider) { // PPApplicationStatic.logE("[IN_LISTENER] LocationScanner.LocationScannerListener.onProviderDisabled", "xxx"); } - public void onProviderEnabled(String provider) { + public void onProviderEnabled(@NonNull String provider) { // PPApplicationStatic.logE("[IN_LISTENER] LocationScanner.LocationScannerListener.onProviderEnabled", "xxx"); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationSensorWorker.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationSensorWorker.java index 99a66a3c6f..02db7b2801 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationSensorWorker.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LocationSensorWorker.java @@ -35,6 +35,7 @@ public Result doWork() { // PPApplicationStatic.logE("[IN_WORKER] LocationSensorWorker.doWork", "--------------- START"); if (EventStatic.getGlobalEventsRunning(context)) { +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] LocationSensorWorker.doWork", "SENSOR_TYPE_LOCATION_SCANNER"); EventsHandler eventsHandler = new EventsHandler(context); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_LOCATION_SCANNER}); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LockDeviceActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LockDeviceActivity.java index 160121f678..34a53a2c45 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LockDeviceActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LockDeviceActivity.java @@ -10,6 +10,8 @@ import android.view.Gravity; import android.view.View; import android.view.WindowManager; +import android.widget.TextClock; +import android.widget.TextView; import androidx.appcompat.app.AppCompatActivity; import androidx.localbroadcastmanager.content.LocalBroadcastManager; @@ -21,6 +23,8 @@ public class LockDeviceActivity extends AppCompatActivity private View view = null; private boolean displayed = false; + static final String EXTRA_ONLY_SCREEN_OFF = "only_screen_off"; + static final String ACTION_FINISH_LOCK_DEVICE_ACTIVITY_BROADCAST_RECEIVER = PPApplication.PACKAGE_NAME + ".FinishLockDeviceActivityBroadcastReceiver"; static private class FinishActivityBroadcastReceiver extends BroadcastReceiver { @@ -46,6 +50,9 @@ protected void onCreate(Bundle savedInstanceState) { // PPApplicationStatic.logE("[BACKGROUND_ACTIVITY] LockDeviceActivity.onCreate", "xxx"); + Intent intent = getIntent(); + PPApplication.lockDeviceActivityOnlyScreenOff = intent.getBooleanExtra(EXTRA_ONLY_SCREEN_OFF, false); + boolean canWriteSettings;// = true; canWriteSettings = Settings.System.canWrite(getApplicationContext()); @@ -74,7 +81,13 @@ protected void onCreate(Bundle savedInstanceState) { */ WindowManager.LayoutParams params = new WindowManager.LayoutParams(); - params.flags = 1808; + //params.flags = 1808; + params.flags = + WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE | + WindowManager.LayoutParams.FLAG_FULLSCREEN | + WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | + WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS; + //Log.e("LockDeviceActivity.onCreate", "params.flags="+params.flags); params.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY; params.gravity = Gravity.TOP; params.width = -1; @@ -85,8 +98,44 @@ protected void onCreate(Bundle savedInstanceState) { //LayoutInflater layoutInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); //if (layoutInflater != null) { view = getLayoutInflater().inflate(R.layout.activity_lock_device, null); - view.setSystemUiVisibility(5894); - view.setOnSystemUiVisibilityChangeListener(i -> view.setSystemUiVisibility(5894)); + //view.setSystemUiVisibility(5894); + view.setSystemUiVisibility( + View.SYSTEM_UI_FLAG_FULLSCREEN | + View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_LAYOUT_STABLE | + View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); + /*Log.e("LockDeviceActivity.onCreate", "uiVisibiloty="+ + ( + View.SYSTEM_UI_FLAG_FULLSCREEN | + View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_LAYOUT_STABLE | + View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY + ));*/ + //view.setOnSystemUiVisibilityChangeListener(i -> view.setSystemUiVisibility(5894)); + view.setOnSystemUiVisibilityChangeListener(i -> view.setSystemUiVisibility( + View.SYSTEM_UI_FLAG_FULLSCREEN | + View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | + View.SYSTEM_UI_FLAG_LAYOUT_STABLE | + View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY + )); + + if (PPApplication.lockDeviceActivityOnlyScreenOff) { + TextClock clock = view.findViewById(R.id.activity_lockDevice_clock); + //noinspection DataFlowIssue + clock.setVisibility(View.GONE); + TextView text = view.findViewById(R.id.activity_lockDevice_screenOff); + //noinspection DataFlowIssue + text.setVisibility(View.GONE); + text = view.findViewById(R.id.activity_lockDevice_textView1); + //noinspection DataFlowIssue + text.setVisibility(View.GONE); + } WindowManager windowManager = (WindowManager) getSystemService(Context.WINDOW_SERVICE); if (windowManager != null) @@ -101,7 +150,11 @@ protected void onCreate(Bundle savedInstanceState) { displayed = true; - PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayed = Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, 15000); + if (PPApplication.lockDeviceActivityOnlyScreenOff) + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForScreenOff = Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, 15000); + else + PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForDeviceLock = Settings.System.getInt(getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, 15000); + //ActivateProfileHelper.removeScreenTimeoutAlwaysOnView(getApplicationContext()); /*if (PPApplication.deviceIsOppo || PPApplication.deviceIsRealme) { @@ -124,6 +177,8 @@ protected void onCreate(Bundle savedInstanceState) { }); } } else*/ + + //if (!PPApplication.lockDeviceActivityOnlyScreenOff) Settings.System.putInt(getApplicationContext().getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, 1000); LockDeviceActivityFinishBroadcastReceiver.setAlarm(getApplicationContext()); @@ -141,6 +196,31 @@ protected void attachBaseContext(Context base) { super.attachBaseContext(LocaleHelper.onAttach(base)); } + /* + @Override + public boolean onKeyDown(int keyCode, KeyEvent event) + { + Log.e("LockDeviceActivity.onKeyDown", "(1)"); + if(keyCode==KeyEvent.KEYCODE_POWER) { + Log.e("LockDeviceActivity.onKeyDown", "(2)"); + finish(); + } + + return true; + } + + @Override + public boolean dispatchKeyEvent(KeyEvent event) { + Log.e("LockDeviceActivity.dispatchKeyEvent", "(1)"); + if (event.getKeyCode() == KeyEvent.KEYCODE_POWER) { + Log.e("LockDeviceActivity.dispatchKeyEvent", "(2)"); + if (event.getAction() == KeyEvent.ACTION_UP){ + return true; + }} + return super.dispatchKeyEvent(event); + }; + */ + @Override protected void onDestroy() { super.onDestroy(); @@ -184,10 +264,18 @@ protected void onDestroy() { }); } } else*/ - if (PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayed != 0) - Settings.System.putInt(appContext.getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayed); - else - Settings.System.putInt(appContext.getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, 30000); + + if (PPApplication.lockDeviceActivityOnlyScreenOff) { + if (PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForScreenOff != 0) + Settings.System.putInt(appContext.getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForScreenOff); + else + Settings.System.putInt(appContext.getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, 30000); + } else { + if (PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForDeviceLock != 0) + Settings.System.putInt(appContext.getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, PPApplication.screenTimeoutWhenLockDeviceActivityIsDisplayedForDeviceLock); + else + Settings.System.putInt(appContext.getContentResolver(), Settings.System.SCREEN_OFF_TIMEOUT, 30000); + } // set screen timeout from ApplicationPreferences.prefActivatedProfileScreenTimeoutWhenScreenOff // this replaces screen timeout set in this activity diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LockDeviceAfterScreenOffBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LockDeviceAfterScreenOffBroadcastReceiver.java index a2bcba9bc1..d489468611 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LockDeviceAfterScreenOffBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/LockDeviceAfterScreenOffBroadcastReceiver.java @@ -211,7 +211,7 @@ static void doWork(boolean useHandler, Context context) { EventsHandler.SENSOR_TYPE_BRIGHTNESS}, PPExecutors.SENSOR_NAME_SENSOR_TYPE_SCREEN_BRIGHTNESS, 0); } else { - // PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] LockDeviceAfterScreenOffBroadcastReceiver", "sensorType=SENSOR_TYPE_SCREEN (2)"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] LockDeviceAfterScreenOffBroadcastReceiver", "sensorType=SENSOR_TYPE_SCREEN,SENSOR_TYPE_BRIGHTNESS"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{ EventsHandler.SENSOR_TYPE_SCREEN, diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MainWorker.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MainWorker.java index be5c0ba35a..d352a789f7 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MainWorker.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MainWorker.java @@ -106,6 +106,7 @@ public Result doWork() { int sensorType = getInputData().getInt(PhoneProfilesService.EXTRA_SENSOR_TYPE, 0); if (EventStatic.getGlobalEventsRunning(appContext) && (sensorType != 0)) { // start events handler +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] MainWorker.doWork", "HANDLE_EVENTS_VOLUMES_WORK_TAG,HANDLE_EVENTS_BRIGHTNESS_WORK_TAG"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{sensorType}); } @@ -119,6 +120,7 @@ public Result doWork() { if (EventStatic.getGlobalEventsRunning(appContext)) { // Log.e("MainWorker.doWork", "HANDLE_EVENTS_BLUETOOTH_CONNECTION_WORK_TAG"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] MainWorker.doWork", "HANDLE_EVENTS_BLUETOOTH_CONNECTION_WORK_TAG"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{ EventsHandler.SENSOR_TYPE_RADIO_SWITCH, @@ -185,7 +187,7 @@ public Result doWork() { PPApplicationStatic.createExclamationNotificationChannel(getApplicationContext(), false); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(appContext, PPApplication.EXCLAMATION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(appContext, R.color.error_color)) + .setColor(ContextCompat.getColor(appContext, R.color.errorColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_exclamation_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(appContext.getResources(), R.drawable.ic_exclamation_notification)) .setContentTitle(nTitle) // title for notification @@ -419,6 +421,7 @@ private void doAfterFirstStart(Context context, final long _time = now.getTimeInMillis() + gmtOffset; eventsHandler.setEventDeviceBootParameters(_time); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] MainWorker.doAfterFirstStart", "SENSOR_TYPE_DEVICE_BOOT"); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_DEVICE_BOOT}); } @@ -477,11 +480,14 @@ private void doAfterFirstStart(Context context, // must be first // PPApplicationStatic.logE("MainWorker.doAfterFirstStart", "call of createContactsCache (1)"); +// PPApplicationStatic.logE("[CONTACTS_CACHE] MainWorker.doAfterFirstStart", "PPApplicationStatic.createContactsCache()"); PPApplicationStatic.createContactsCache(appContext, true, true/*, true*/); //must be seconds, this ads groups into contacts // PPApplicationStatic.logE("MainWorker.doAfterFirstStart", "call of createContactsCache (2)"); +// PPApplicationStatic.logE("[CONTACTS_CACHE] MainWorker.doAfterFirstStart", "PPApplicationStatic.createContactGroupsCache()"); PPApplicationStatic.createContactGroupsCache(appContext, true/*, true*//*, true*/); // PPApplicationStatic.logE("MainWorker.doAfterFirstStart", "call of createContactsCache (3)"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] MainWorker.doAfterFirstStart", "SENSOR_TYPE_CONTACTS_CACHE_CHANGED"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_CONTACTS_CACHE_CHANGED}); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellNamesDialog.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellNamesDialog.java index 6c4e31333a..2389afc485 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellNamesDialog.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellNamesDialog.java @@ -59,6 +59,7 @@ class MobileCellNamesDialog { dialogBuilder.setNegativeButton(android.R.string.cancel, null); if (!showFilterItems) { + //noinspection ReplaceNullCheck if (_positiveClick != null) dialogBuilder.setPositiveButton(android.R.string.ok, _positiveClick); else { @@ -71,8 +72,10 @@ public void onClick(DialogInterface dialog, int which) { //} //} else if (preference instanceof MobileCellsRegistrationDialogPreference) { + //noinspection DataFlowIssue ((MobileCellsRegistrationDialogPreference) preference).setCellNameText(cellName.getText().toString()); } else if (preference instanceof MobileCellsEditorPreference) { + //noinspection DataFlowIssue ((MobileCellsEditorPreference) preference).setCellNameText(cellName.getText().toString()); } } @@ -105,7 +108,8 @@ public void onClick(DialogInterface dialog, int which) { cellNamesListView = layout.findViewById(R.id.mobile_cell_names_dlg_listview); emptyList = layout.findViewById(R.id.mobile_cell_names_dlg_empty); cellName = layout.findViewById(R.id.mobile_cell_names_dlg_name); - cellName.setBackgroundTintList(ContextCompat.getColorStateList(activity, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + cellName.setBackgroundTintList(ContextCompat.getColorStateList(activity, R.color.edit_text_color)); if (!showFilterItems) { cellName.addTextChangedListener(new TextWatcher() { @Override @@ -133,6 +137,7 @@ public void afterTextChanged(Editable s) { rellaDialog = layout.findViewById(R.id.mobile_cell_names_dlg_rella_dialog); listAdapter = new MobileCellNamesDialogAdapter(activity, this); + //noinspection DataFlowIssue cellNamesListView.setAdapter(listAdapter); cellNamesListView.setOnItemClickListener((parent, v, position, id) -> { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellNamesPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellNamesPreference.java index 73dcb4fb01..3c5f02dd3f 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellNamesPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellNamesPreference.java @@ -234,7 +234,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public MobileCellNamesPreference.SavedState createFromParcel(Parcel in) { return new MobileCellNamesPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellNamesPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellNamesPreferenceFragment.java index d3d8dd7757..530ee0f47b 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellNamesPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellNamesPreferenceFragment.java @@ -98,6 +98,7 @@ protected void onBindDialogView(@NonNull View view) { locationSystemSettingsRelLa = view.findViewById(R.id.mobile_cell_names_pref_dlg_locationSystemSettingsRelLa); locationEnabledStatusTextView = view.findViewById(R.id.mobile_cell_names_pref_dlg_locationEnableStatus); locationSystemSettingsButton = view.findViewById(R.id.mobile_cell_names_pref_dlg_locationSystemSettingsButton); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(locationSystemSettingsButton, getString(R.string.location_settings_button_tooltip)); connectedCellSIM1 = view.findViewById(R.id.mobile_cell_names_pref_dlg_connectedCell_sim1); @@ -176,6 +177,7 @@ protected void onBindDialogView(@NonNull View view) { } else + //noinspection DataFlowIssue rescanButton.setEnabled(false); setLocationEnableStatus(); @@ -255,6 +257,7 @@ void setLocationEnableStatus() { true, true, false, false, true, + false, getActivity() ); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsEditorPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsEditorPreference.java index 022bc811bb..8aedfa7202 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsEditorPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsEditorPreference.java @@ -300,7 +300,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public MobileCellsEditorPreference.SavedState createFromParcel(Parcel in) { return new MobileCellsEditorPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsEditorPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsEditorPreferenceFragment.java index 3b73f10f2d..d7aae2dc01 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsEditorPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsEditorPreferenceFragment.java @@ -1,5 +1,7 @@ package sk.henrichg.phoneprofilesplus; +import static android.content.Context.LAYOUT_INFLATER_SERVICE; + import android.annotation.SuppressLint; import android.app.Activity; import android.content.BroadcastReceiver; @@ -21,8 +23,10 @@ import android.view.View; import android.widget.Button; import android.widget.EditText; +import android.widget.LinearLayout; import android.widget.ListView; import android.widget.PopupMenu; +import android.widget.PopupWindow; import android.widget.RelativeLayout; import android.widget.TextView; @@ -72,7 +76,8 @@ public class MobileCellsEditorPreferenceFragment extends PreferenceDialogFragmen private AppCompatImageButton locationSystemSettingsButton; private Button rescanButton; private RelativeLayout emptyList; - private AlertDialog progressDialog = null; + //private AlertDialog progressDialog = null; + private PopupWindow popupWindow = null; private RefreshListViewAsyncTask rescanAsyncTask = null; @@ -104,8 +109,10 @@ public void onDialogClosed(boolean positiveResult) { preference.resetSummary(); }*/ - if ((progressDialog != null) && progressDialog.isShowing()) - progressDialog.dismiss(); + if ((popupWindow != null) && popupWindow.isShowing()) + popupWindow.dismiss(); + //if ((progressDialog != null) && progressDialog.isShowing()) + // progressDialog.dismiss(); if ((mRenameDialog != null) && mRenameDialog.mDialog.isShowing()) mRenameDialog.mDialog.dismiss(); if ((mSelectorDialog != null) && mSelectorDialog.mDialog.isShowing()) @@ -185,9 +192,11 @@ protected void onBindDialogView(@NonNull View view) { //if (preference.value.isEmpty()) // cellFilter.setText(R.string.mobile_cell_names_dialog_item_show_all); //else + //noinspection DataFlowIssue cellFilter.setText(R.string.mobile_cell_names_dialog_item_show_new); } else + //noinspection DataFlowIssue cellFilter.setText(preference.cellFilter); cellFilter.addTextChangedListener(new TextWatcher() { @Override @@ -251,6 +260,7 @@ public void afterTextChanged(Editable s) { Button editButton = view.findViewById(R.id.mobile_cells_pref_dlg_rename); //TooltipCompat.setTooltipText(editButton, getString(R.string.mobile_cells_pref_dlg_rename_cell_button_tooltip)); + //noinspection DataFlowIssue editButton.setOnClickListener(v -> { if (getActivity() != null) if (!getActivity().isFinishing()) { @@ -307,6 +317,7 @@ public void afterTextChanged(Editable s) { } }); AppCompatImageButton changeSelectionIcon = view.findViewById(R.id.mobile_cells_pref_dlg_changeSelection); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(changeSelectionIcon, getString(R.string.mobile_cells_pref_dlg_select_button_tooltip)); changeSelectionIcon.setOnClickListener(view13 -> { if (getActivity() != null) @@ -357,6 +368,7 @@ public void afterTextChanged(Editable s) { } }); final AppCompatImageButton sortIcon = view.findViewById(R.id.mobile_cells_pref_dlg_sort); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(sortIcon, getString(R.string.mobile_cells_pref_dlg_button_tooltip)); sortIcon.setOnClickListener(v -> { if (getActivity() != null) @@ -379,60 +391,58 @@ public void afterTextChanged(Editable s) { }); final AppCompatImageButton helpIcon = view.findViewById(R.id.mobile_cells_pref_dlg_helpIcon); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(helpIcon, getString(R.string.help_button_tooltip)); helpIcon.setOnClickListener(v -> DialogHelpPopupWindow.showPopup(helpIcon, R.string.menu_help, (Activity)prefContext, /*getDialog(),*/ R.string.mobile_cells_pref_dlg_help, false)); rescanButton = view.findViewById(R.id.mobile_cells_pref_dlg_rescanButton); if (PPApplication.HAS_FEATURE_TELEPHONY) { - TelephonyManager telephonyManager = (TelephonyManager) prefContext.getSystemService(Context.TELEPHONY_SERVICE); - boolean simIsReady = false; - if (telephonyManager != null) { - if (Permissions.checkPhone(prefContext.getApplicationContext())) { - SubscriptionManager mSubscriptionManager = (SubscriptionManager) prefContext.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE); - //SubscriptionManager.from(context); - if (mSubscriptionManager != null) { - List subscriptionList = null; - try { - // Loop through the subscription list i.e. SIM list. - subscriptionList = mSubscriptionManager.getActiveSubscriptionInfoList(); - } catch (SecurityException e) { - PPApplicationStatic.recordException(e); - //Log.e("MobileCellsEditorPreferenceFragment.onBindDialogView", Log.getStackTraceString(e)); - } - if (subscriptionList != null) { - int size = subscriptionList.size();/*mSubscriptionManager.getActiveSubscriptionInfoCountMax();*/ - for (int i = 0; i < size; i++) { - // Get the active subscription ID for a given SIM card. - SubscriptionInfo subscriptionInfo = subscriptionList.get(i); - if (subscriptionInfo != null) { - int slotIndex = subscriptionInfo.getSimSlotIndex(); - if (telephonyManager.getSimState(slotIndex) == TelephonyManager.SIM_STATE_READY) { - // sim card is ready - simIsReady = true; - break; + //noinspection DataFlowIssue + rescanButton.setOnClickListener(v -> { + if (Permissions.grantMobileCellsDialogPermissions(prefContext, true)) { + boolean simIsReady = false; + TelephonyManager telephonyManager = (TelephonyManager) prefContext.getSystemService(Context.TELEPHONY_SERVICE); + if (telephonyManager != null) { + SubscriptionManager mSubscriptionManager = (SubscriptionManager) prefContext.getSystemService(Context.TELEPHONY_SUBSCRIPTION_SERVICE); + //SubscriptionManager.from(context); + if (mSubscriptionManager != null) { + List subscriptionList = null; + try { + // Loop through the subscription list i.e. SIM list. + subscriptionList = mSubscriptionManager.getActiveSubscriptionInfoList(); + } catch (SecurityException e) { + PPApplicationStatic.recordException(e); + //Log.e("MobileCellsEditorPreferenceFragment.onBindDialogView", Log.getStackTraceString(e)); + } + if (subscriptionList != null) { + int size = subscriptionList.size();/*mSubscriptionManager.getActiveSubscriptionInfoCountMax();*/ + for (int i = 0; i < size; i++) { + // Get the active subscription ID for a given SIM card. + SubscriptionInfo subscriptionInfo = subscriptionList.get(i); + if (subscriptionInfo != null) { + int slotIndex = subscriptionInfo.getSimSlotIndex(); + if (telephonyManager.getSimState(slotIndex) == TelephonyManager.SIM_STATE_READY) { + // sim card is ready + simIsReady = true; + break; + } } } } } } - } - } - if (simIsReady) { - rescanButton.setOnClickListener(v -> { - if (Permissions.grantMobileCellsDialogPermissions(prefContext, true)) { + if (simIsReady) refreshListView(true, true/*, Integer.MAX_VALUE*/); - } - }); - } - else - rescanButton.setEnabled(false); - + } + }); } else + //noinspection DataFlowIssue rescanButton.setEnabled(false); if ((phoneCount > 1)) { addCellButtonSIM1 = view.findViewById(R.id.mobile_cells_pref_dlg_addCellButton_sim1); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(addCellButtonSIM1, getString(R.string.mobile_cells_pref_dlg_add_button_tooltip)); addCellButtonSIM1.setOnClickListener(v -> { if (preference.registeredCellDataSIM1 != null) { @@ -455,6 +465,7 @@ public void afterTextChanged(Editable s) { } }); addCellButtonSIM2 = view.findViewById(R.id.mobile_cells_pref_dlg_addCellButton_sim2); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(addCellButtonSIM2, getString(R.string.mobile_cells_pref_dlg_add_button_tooltip)); addCellButtonSIM2.setOnClickListener(v -> { if (preference.registeredCellDataSIM2 != null) { @@ -478,6 +489,7 @@ public void afterTextChanged(Editable s) { }); } else { addCellButtonDefault = view.findViewById(R.id.mobile_cells_pref_dlg_addCellButton_simDefault); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(addCellButtonDefault, getString(R.string.mobile_cells_pref_dlg_add_button_tooltip)); addCellButtonDefault.setOnClickListener(v -> { if (preference.registeredCellDataDefault != null) { @@ -518,14 +530,17 @@ public void afterTextChanged(Editable s) { if ((phoneCount > 1)) { if (!sim1Exists) { connectedCellRelLa = view.findViewById(R.id.mobile_cells_pref_dlg_reLa1_sim1); + //noinspection DataFlowIssue connectedCellRelLa.setVisibility(View.GONE); } if (!sim2Exists) { connectedCellRelLa = view.findViewById(R.id.mobile_cells_pref_dlg_reLa1_sim2); + //noinspection DataFlowIssue connectedCellRelLa.setVisibility(View.GONE); } connectedCellRelLa = view.findViewById(R.id.mobile_cells_pref_dlg_reLa1_simDefault); + //noinspection DataFlowIssue connectedCellRelLa.setVisibility(View.GONE); } else { @@ -541,6 +556,7 @@ public void afterTextChanged(Editable s) { locationSystemSettingsRelLa = view.findViewById(R.id.mobile_cells_pref_dlg_locationSystemSettingsRelLa); locationEnabledStatusTextView = view.findViewById(R.id.mobile_cells_pref_dlg_locationEnableStatus); locationSystemSettingsButton = view.findViewById(R.id.mobile_cells_pref_dlg_locationSystemSettingsButton); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(locationSystemSettingsButton, getString(R.string.location_settings_button_tooltip)); setLocationEnableStatus(); @@ -599,6 +615,7 @@ void setLocationEnableStatus() { true, true, false, false, true, + false, getActivity() ); @@ -753,6 +770,7 @@ else if (cellIdLong != Long.MAX_VALUE) true, true, false, false, true, + false, getActivity() ); @@ -806,6 +824,7 @@ else if (vCellId != Long.MAX_VALUE) true, true, false, false, true, + false, getActivity() ); @@ -862,6 +881,7 @@ else if (vCellId != Long.MAX_VALUE) true, true, false, false, true, + false, getActivity() ); @@ -971,6 +991,19 @@ protected void onPreExecute() { Context prefContext = prefContextWeakRef.get(); if ((fragment != null) && (prefContext != null)) { if (showProgress) { + + LayoutInflater inflater = (LayoutInflater) + prefContext.getSystemService(LAYOUT_INFLATER_SERVICE); + //noinspection DataFlowIssue + @SuppressLint("InflateParams") + View popupView = inflater.inflate(R.layout.dialog_progress_bar, null); + int width = LinearLayout.LayoutParams.WRAP_CONTENT; + int height = LinearLayout.LayoutParams.WRAP_CONTENT; + boolean focusable = true; // lets taps outside the popup also dismiss it + fragment.popupWindow = new PopupWindow(popupView, width, height, focusable); + fragment.popupWindow.showAtLocation(fragment.cellsListView, Gravity.CENTER, 0, 0); + + /* AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(prefContext); dialogBuilder.setTitle(R.string.phone_profiles_pref_applicationEventMobileCellConfigureCells); @@ -980,6 +1013,7 @@ protected void onPreExecute() { fragment.progressDialog = dialogBuilder.create(); fragment.progressDialog.show(); + */ } } } @@ -1276,16 +1310,18 @@ protected Void doInBackground(Void... params) { // add only cell in _value = selected for edited event String[] splits = _value.split(StringConstants.STR_SPLIT_REGEX); for (String cell : splits) { - boolean cellIdEquals = false; - long vCellId = Long.parseLong(cell); - if (vCellId <= Integer.MAX_VALUE) - cellIdEquals = (vCellId != Integer.MAX_VALUE) && (vCellId == cellData.cellId); - else if (vCellId != Long.MAX_VALUE) - cellIdEquals = vCellId == cellData.cellIdLong; - - if (cellIdEquals) { - _filteredCellsList.add(cellData); - break; + if (!cell.isEmpty()) { + boolean cellIdEquals = false; + long vCellId = Long.parseLong(cell); + if (vCellId <= Integer.MAX_VALUE) + cellIdEquals = (vCellId != Integer.MAX_VALUE) && (vCellId == cellData.cellId); + else if (vCellId != Long.MAX_VALUE) + cellIdEquals = vCellId == cellData.cellIdLong; + + if (cellIdEquals) { + _filteredCellsList.add(cellData); + break; + } } } } else if (_cellFilterValue.equals(prefContext.getString(R.string.mobile_cell_names_dialog_item_show_without_name))) { @@ -1490,8 +1526,10 @@ else if (preference.registeredCellDataDefault.cellIdLong != Long.MAX_VALUE) final Handler handler = new Handler(prefContext.getMainLooper()); handler.post(() -> { - if ((fragment.progressDialog != null) && fragment.progressDialog.isShowing()) - fragment.progressDialog.dismiss(); + if ((fragment.popupWindow != null) && fragment.popupWindow.isShowing()) + fragment.popupWindow.dismiss(); + //if ((fragment.progressDialog != null) && fragment.progressDialog.isShowing()) + // fragment.progressDialog.dismiss(); }); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsListener.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsListener.java index 792f587c57..8d408ea46e 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsListener.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsListener.java @@ -758,7 +758,7 @@ private void doAutoRegistration(final int _registeredCell, final long _registere nText = nText + context.getString(R.string.notification_not_used_mobile_cell_text2); mBuilder = new NotificationCompat.Builder(context.getApplicationContext(), PPApplication.NOT_USED_MOBILE_CELL_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.information_color)) + .setColor(ContextCompat.getColor(context.getApplicationContext(), R.color.informationColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_information_notify*/) .setLargeIcon(BitmapFactory.decodeResource(context.getApplicationContext().getResources(), R.drawable.ic_information_notification)) .setContentTitle(context.getString(R.string.notification_not_used_mobile_cell_title)) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsRegistrationDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsRegistrationDialogPreference.java index 5c5c833418..c340b1f9b8 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsRegistrationDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsRegistrationDialogPreference.java @@ -168,7 +168,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public MobileCellsRegistrationDialogPreference.SavedState createFromParcel(Parcel in) { return new MobileCellsRegistrationDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsRegistrationDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsRegistrationDialogPreferenceFragment.java index ee0fb1ec7f..f1e635b12e 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsRegistrationDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsRegistrationDialogPreferenceFragment.java @@ -94,6 +94,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { TextView mTextViewRange = layout.findViewById(R.id.duration_pref_dlg_range); mValue = layout.findViewById(R.id.duration_pref_dlg_value); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(mValue, getString(R.string.duration_pref_dlg_edit_duration_tooltip)); mSeekBarHours = layout.findViewById(R.id.duration_pref_dlg_hours); mSeekBarMinutes = layout.findViewById(R.id.duration_pref_dlg_minutes); @@ -203,11 +204,13 @@ public void afterTextChanged(Editable s) { mSeekBarMinutes.setOnSeekBarChangeListener(this); mSeekBarSeconds.setOnSeekBarChangeListener(this); + //noinspection DataFlowIssue mTextViewRange.setText(sMin + " - " + sMax); startButton = mDialog.getButton(DialogInterface.BUTTON_POSITIVE); stopButton = layout.findViewById(R.id.mobile_cells_registration_stop_button); + //noinspection DataFlowIssue stopButton.setOnClickListener(v -> { updateInterface(0, true); //PPApplication.phoneProfilesService.mobileCellsScanner.durationForAutoRegistration = 0; @@ -293,12 +296,15 @@ void updateInterface(long millisUntilFinished, boolean forceStop) { mSeekBarMinutes.setEnabled(!started); mSeekBarSeconds.setEnabled(!started); mCellsName.setEnabled(!started); + /* if (started) { - ColorStateList colors = mCellsName.getHintTextColors(); - mCellsName.setTextColor(colors); + //ColorStateList colors = mCellsName.getHintTextColors(); + //mCellsName.setTextColor(colors); + mCellsName.setTextColor(ContextCompat.getColor(prefContext, R.color.buttonDisabledBorderColor)); } else //mCellsName.setTextColor(GlobalGUIRoutines.getThemeAccentColor(prefContext)); mCellsName.setTextColor(ContextCompat.getColor(prefContext, R.color.accent_color)); + */ String value = mCellsName.getText().toString(); boolean enable = !value.isEmpty(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsRegistrationService.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsRegistrationService.java index 03c69980cc..624f5899b6 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsRegistrationService.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileCellsRegistrationService.java @@ -186,7 +186,7 @@ private void showNotification(long millisUntilFinished) { //PPApplicationStatic.createMobileCellsRegistrationNotificationChannel(this); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext(), PPApplication.MOBILE_CELLS_REGISTRATION_NOTIFICATION_CHANNEL_SILENT) - .setColor(ContextCompat.getColor(getApplicationContext(), R.color.information_color)) + .setColor(ContextCompat.getColor(getApplicationContext(), R.color.informationColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_information_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(getApplicationContext().getResources(), R.drawable.ic_information_notification)) .setContentTitle(getString(R.string.phone_profiles_pref_applicationEventMobileCellsRegistration_notification)) // title for notification @@ -251,7 +251,7 @@ private void showResultNotification() { PPApplicationStatic.createInformationNotificationChannel(getApplicationContext(), false); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext(), PPApplication.INFORMATION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(getApplicationContext(), R.color.information_color)) + .setColor(ContextCompat.getColor(getApplicationContext(), R.color.informationColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_information_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(getApplicationContext().getResources(), R.drawable.ic_information_notification)) .setContentTitle(getString(R.string.phone_profiles_pref_applicationEventMobileCellsRegistration_notification)) // title for notification diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileDataNetworkCallback.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileDataNetworkCallback.java index ba84400179..e919a009fb 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileDataNetworkCallback.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileDataNetworkCallback.java @@ -171,7 +171,7 @@ static void _doConnection(Context appContext) { if (PhoneProfilesService.getInstance() != null) { // start events handler -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] MobileDataNetworkCallback._doConnection", "sensorType=SENSOR_TYPE_RADIO_SWITCH"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] MobileDataNetworkCallback._doConnection", "SENSOR_TYPE_RADIO_SWITCH"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_RADIO_SWITCH}); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileDataStateChangedContentObserver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileDataStateChangedContentObserver.java index 810d36d643..7afeb9b628 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileDataStateChangedContentObserver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MobileDataStateChangedContentObserver.java @@ -45,7 +45,7 @@ private void doOnChange(/*boolean selfChange, Uri uri*/) { wakeLock.acquire(10 * 60 * 1000); } -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] MobileDataStateChangedContentObserver.onChange", "sensorType=SENSOR_TYPE_RADIO_SWITCH"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] MobileDataStateChangedContentObserver.onChange", "SENSOR_TYPE_RADIO_SWITCH"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_RADIO_SWITCH}); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MultiSelectListDialog.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MultiSelectListDialog.java index 51866adc50..e460a9e720 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MultiSelectListDialog.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MultiSelectListDialog.java @@ -44,9 +44,11 @@ class MultiSelectListDialog listView = layout.findViewById(R.id.pp_list_pref_dlg_listview); + //noinspection DataFlowIssue listView.setOnItemClickListener((parent, item, position, id) -> { CheckBox chb = item.findViewById(R.id.pp_multiselect_list_pref_dlg_item_checkbox); itemValues[position] = !itemValues[position]; + //noinspection DataFlowIssue chb.setChecked(itemValues[position]); }); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagPreference.java index d856cf8d1a..5564807932 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagPreference.java @@ -155,6 +155,7 @@ void writeToNFCTag(long id, String tag) { true, true, false, false, false, + false, fragment.getActivity() ); @@ -269,7 +270,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public NFCTagPreference.SavedState createFromParcel(Parcel in) { return new NFCTagPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagPreferenceFragment.java index eb983ff1b9..5650422fbf 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagPreferenceFragment.java @@ -66,6 +66,7 @@ protected void onBindDialogView(@NonNull View view) { //dataLinearLayout = layout.findViewById(R.id.nfc_tag_pref_dlg_linla_data); addIcon = view.findViewById(R.id.nfc_tag_pref_dlg_addIcon); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(addIcon, getString(R.string.nfc_tag_pref_dlg_add_button_tooltip)); addIcon.setOnClickListener(v -> { String tagName = nfcTagName.getText().toString(); @@ -83,7 +84,8 @@ protected void onBindDialogView(@NonNull View view) { }); nfcTagName = view.findViewById(R.id.nfc_tag_pref_dlg_bt_name); - nfcTagName.setBackgroundTintList(ContextCompat.getColorStateList(prefContext, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + nfcTagName.setBackgroundTintList(ContextCompat.getColorStateList(prefContext, R.color.edit_text_color)); nfcTagName.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -101,7 +103,7 @@ public void afterTextChanged(Editable s) { }); GlobalGUIRoutines.setImageButtonEnabled(!nfcTagName.getText().toString().isEmpty(), - addIcon, prefContext.getApplicationContext()); + addIcon, prefContext); nfcTagListView = view.findViewById(R.id.nfc_tag_pref_dlg_listview); emptyList = view.findViewById(R.id.nfc_tag_pref_dlg_empty); @@ -163,11 +165,13 @@ public void onClick(View v) { }); */ final ImageView helpIcon = view.findViewById(R.id.nfc_tag_pref_dlg_helpIcon); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(helpIcon, getString(R.string.help_button_tooltip)); helpIcon.setOnClickListener(v -> DialogHelpPopupWindow.showPopup(helpIcon, R.string.menu_help, (Activity)prefContext, /*getDialog(),*/ R.string.nfc_tag_pref_dlg_help, false)); ImageView changeSelectionIcon = view.findViewById(R.id.nfc_tag_pref_dlg_changeSelection); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(changeSelectionIcon, getString(R.string.nfc_tag_pref_dlg_select_button_tooltip)); changeSelectionIcon.setOnClickListener(view1 -> { if (getActivity() != null) @@ -332,6 +336,7 @@ void showEditMenu(View view) true, true, false, false, true, + false, getActivity() ); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagReadActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagReadActivity.java index 6af09b9711..b7eead8205 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagReadActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagReadActivity.java @@ -79,7 +79,7 @@ public void run() { //Context appContext= appContextWeakRef.get(); //if (appContext != null) { -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] NFCTagReadActivity,onCreate", "sensorType=SENSOR_TYPE_NFC_TAG"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] NFCTagReadActivity.onCreate", "SENSOR_TYPE_NFC_TAG"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.setEventNFCParameters(_tagData, _time); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_NFC_TAG}); @@ -155,6 +155,7 @@ protected void onStop() { GlobalGUIRoutines.unlockScreenOrientation(this); } + /** @noinspection NullableProblems*/ @Override public void onNewIntent(Intent intent){ super.onNewIntent(intent); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagReadForegroundActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagReadForegroundActivity.java index 63f3c7905b..e15ad4e954 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagReadForegroundActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagReadForegroundActivity.java @@ -8,6 +8,7 @@ import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; import java.util.Calendar; @@ -20,7 +21,7 @@ public class NFCTagReadForegroundActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { - GlobalGUIRoutines.setTheme(this, false, false, false, false, false, false); // must by called before super.onCreate() + GlobalGUIRoutines.setTheme(this, false, true, false, false, false, false); // must by called before super.onCreate() //GlobalGUIRoutines.setLanguage(this); super.onCreate(savedInstanceState); @@ -32,6 +33,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_nfc_read_tag); setTaskDescription(new ActivityManager.TaskDescription(getString(R.string.ppp_app_name))); + Toolbar toolbar = findViewById(R.id.read_nfc_tag__toolbar); + setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setHomeButtonEnabled(false); getSupportActionBar().setDisplayHomeAsUpEnabled(false); @@ -94,7 +97,7 @@ public void run() { //Context appContext= appContextWeakRef.get(); //if (appContext != null) { -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] NFCTagReadActivity,onCreate", "sensorType=SENSOR_TYPE_NFC_TAG"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] NFCTagReadForegroundActivity.onCreate", "SENSOR_TYPE_NFC_TAG"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.setEventNFCParameters(_tagData, _time); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_NFC_TAG}); @@ -135,6 +138,7 @@ public void onTagWriteError(NFCTagWriteException exception) { */ Button button = findViewById(R.id.read_nfc_tag_button); + //noinspection DataFlowIssue button.setOnClickListener(view -> finish()); } @@ -173,6 +177,7 @@ protected void onStop() { GlobalGUIRoutines.unlockScreenOrientation(this); } + /** @noinspection NullableProblems*/ @Override public void onNewIntent(Intent intent){ super.onNewIntent(intent); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagWriteActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagWriteActivity.java index bfcd4d50d1..f9335367e5 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagWriteActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NFCTagWriteActivity.java @@ -12,6 +12,7 @@ import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; +import androidx.appcompat.widget.Toolbar; import androidx.core.content.ContextCompat; public class NFCTagWriteActivity extends AppCompatActivity { @@ -34,7 +35,7 @@ public class NFCTagWriteActivity extends AppCompatActivity { @SuppressLint("SetTextI18n") @Override protected void onCreate(Bundle savedInstanceState) { - GlobalGUIRoutines.setTheme(this, false, false, false, false, false, false); // must by called before super.onCreate() + GlobalGUIRoutines.setTheme(this, false, true, false, false, false, false); // must by called before super.onCreate() //GlobalGUIRoutines.setLanguage(this); super.onCreate(savedInstanceState); @@ -42,6 +43,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_nfc_write_tag); setTaskDescription(new ActivityManager.TaskDescription(getString(R.string.ppp_app_name))); + Toolbar toolbar = findViewById(R.id.write_nfc_tag_toolbar); + setSupportActionBar(toolbar); if (getSupportActionBar() != null) { getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -54,22 +57,27 @@ protected void onCreate(Bundle savedInstanceState) { tagDbId = intent.getLongExtra(EXTRA_TAG_DB_ID, 0); touchTextView = findViewById(R.id.write_nfc_tag_touch); + //noinspection DataFlowIssue touchTextView.setText(R.string.nfc_tag_pref_dlg_readNfcTag_touch); tagDataTextView = findViewById(R.id.write_nfc_tag_data); writableTextView = findViewById(R.id.write_nfc_tag_writable); addReadedNameButton = findViewById(R.id.write_nfc_tag_addReadedTagName); + //noinspection DataFlowIssue addReadedNameButton.setEnabled(false); writeNameToTagAndAddNameButton = findViewById(R.id.write_nfc_tag_writeNameToTagAndAddName); + //noinspection DataFlowIssue writeNameToTagAndAddNameButton.setEnabled(false); TextView tagNameTextView = findViewById(R.id.write_nfc_tag_name); + //noinspection DataFlowIssue tagNameTextView.setText(getString(R.string.nfc_tag_pref_dlg_writeToNfcTag_tagName) + " " + tagName); tagDataTextView.setText(getString(R.string.nfc_tag_pref_dlg_writeToNfcTag_tagData) + " " + getString(R.string.nfc_tag_pref_dlg_writeToNfcTag_tagData_noData)); if (tagDbId != 0) { TextView addUpdateTagTextView = findViewById(R.id.write_nfc_tag_addUpdateName); + //noinspection DataFlowIssue addUpdateTagTextView.setText(R.string.nfc_tag_pref_dlg_writeToNfcTag_changeNameButtons); } @@ -120,7 +128,7 @@ protected void onCreate(Bundle savedInstanceState) { writeNameToTagAndAddNameButton.setEnabled(nfcManager.intentForWrite != null); } else { - writableTextView.setTextColor(ContextCompat.getColor(this, R.color.error_color)); + writableTextView.setTextColor(ContextCompat.getColor(this, R.color.errorColor)); writableTextView.setText(R.string.nfc_tag_pref_dlg_writeToNfcTag_not_writable); touchTextView.setText(R.string.nfc_tag_pref_dlg_readNfcTag_touch); writeNameToTagAndAddNameButton.setEnabled(false); @@ -170,6 +178,7 @@ protected void onCreate(Bundle savedInstanceState) { Button button = findViewById(R.id.write_nfc_tag_button); + //noinspection DataFlowIssue button.setOnClickListener(view -> { setResult(Activity.RESULT_CANCELED); finish(); @@ -187,7 +196,7 @@ private void displayError(NFCTagWriteException exception) { text = text + " (" + getString(R.string.nfc_tag_pref_dlg_writeToNfcTag_not_writable) + ")"; } } - writableTextView.setTextColor(ContextCompat.getColor(this, R.color.error_color)); + writableTextView.setTextColor(ContextCompat.getColor(this, R.color.errorColor)); writableTextView.setText(text); //ToastCompat.makeText(getApplicationContext(), exception.getType().toString(), Toast.LENGTH_LONG).show(); //ToastCompat.makeText(getApplicationContext().this, R.string.write_nfc_tag_error, Toast.LENGTH_LONG).show(); @@ -232,6 +241,7 @@ protected void onStop() { GlobalGUIRoutines.unlockScreenOrientation(this); } + /** @noinspection NullableProblems*/ @Override public void onNewIntent(Intent intent){ super.onNewIntent(intent); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NotUsedMobileCellsDetectedActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NotUsedMobileCellsDetectedActivity.java index 9ded0b1742..ffec4c70de 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NotUsedMobileCellsDetectedActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NotUsedMobileCellsDetectedActivity.java @@ -234,6 +234,7 @@ protected void onStart() ListView cellNamesListView = layout.findViewById(R.id.not_used_mobile_cells_dlg_cell_names); listAdapter = new NotUsedMobileCellsDialogAdapter(this); + //noinspection DataFlowIssue cellNamesListView.setAdapter(listAdapter); cellNamesListView.setOnItemClickListener((parent, v, position, id) -> { @@ -275,6 +276,7 @@ protected void onStart() */ TextView cellNamesLabel = layout.findViewById(R.id.not_used_mobile_cells_dlg_cell_names_label); + //noinspection DataFlowIssue cellNamesLabel.setText(getString(R.string.mobile_cell_names_dialog_title)+":"); cellName.addTextChangedListener(new TextWatcher() { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NotificationVolume0DialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NotificationVolume0DialogPreferenceFragment.java index c2162fb0a6..46686d8cd2 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NotificationVolume0DialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/NotificationVolume0DialogPreferenceFragment.java @@ -91,6 +91,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { // }); TextView text = layout.findViewById(R.id.notification_0_pref_dialog_text); + //noinspection DataFlowIssue text.setText(message); //phoneProfilesSilentRB = layout.findViewById(R.id.notification_0_pref_dialog_PhoneProfilesSilent_rb); @@ -98,6 +99,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { //if (uriId.isEmpty()) { // phoneProfilesSilentRB.setVisibility(View.GONE); + //noinspection DataFlowIssue noneRB.setChecked(true); //} //else { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/OneRowWidgetProvider.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/OneRowWidgetProvider.java index c052e7906b..e5d82c01f5 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/OneRowWidgetProvider.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/OneRowWidgetProvider.java @@ -785,7 +785,8 @@ private static void _onUpdate(Context context, AppWidgetManager appWidgetManager intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK); intent.putExtra(PPApplication.EXTRA_STARTUP_SOURCE, PPApplication.STARTUP_SOURCE_WIDGET); PendingIntent pendingIntent = PendingIntent.getActivity(context, 200, intent, PendingIntent.FLAG_UPDATE_CURRENT); - remoteViews.setOnClickPendingIntent(R.id.widget_one_row_header_profile_root, pendingIntent); +// remoteViews.setOnClickPendingIntent(R.id.widget_one_row_header_profile_root, pendingIntent); + remoteViews.setOnClickPendingIntent(R.id.widget_one_row_header, pendingIntent); // widget update try { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/OpaquenessLightingPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/OpaquenessLightingPreference.java index 4c005cb7e3..70fd765e07 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/OpaquenessLightingPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/OpaquenessLightingPreference.java @@ -330,8 +330,8 @@ public void writeToParcel(Parcel dest, int flags) super(superState); } - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator<>() { public OpaquenessLightingPreference.SavedState createFromParcel(Parcel in) { return new OpaquenessLightingPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/OpaquenessLightingPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/OpaquenessLightingPreferenceFragment.java index ab55a0b5af..f24d1c0e82 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/OpaquenessLightingPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/OpaquenessLightingPreferenceFragment.java @@ -33,6 +33,7 @@ protected void onBindDialogView(@NonNull View view) ListView listView = view.findViewById(R.id.opaqueness_lighting_pref_dlg_listview); + //noinspection DataFlowIssue listView.setOnItemClickListener((parent, item, position, id) -> doOnItemSelected(position)); OpaquenessLightingPreferenceAdapter opaquenessLightingPreferenceAdapter = new OpaquenessLightingPreferenceAdapter(preference.fragment, prefContext, preference.value); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPAlertDialog.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPAlertDialog.java index eeca216626..f6e265e7b3 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPAlertDialog.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPAlertDialog.java @@ -10,9 +10,14 @@ import androidx.appcompat.app.AlertDialog; -class PPAlertDialog { +// added support for click to message links +// supported is all from InfoDialogPreferencesFragment.onLinkClickedListener() +class PPAlertDialog implements PPLinkMovementMethod.OnPPLinkMovementMethodListener { final AlertDialog mDialog; final Activity activity; + final TextView messageText; + final CharSequence title; + final boolean cancelDialogAtLinkClick; /* final DialogInterface.OnClickListener positiveClick; @@ -34,14 +39,18 @@ class PPAlertDialog { boolean _checBoxChecked, boolean _checkBoxEnabled, boolean _hideButtonBarDivider, + boolean _cancelDialogAtLinkClick, Activity _activity) { this.activity = _activity; + this.cancelDialogAtLinkClick = _cancelDialogAtLinkClick; /* this.positiveClick = _positiveClick; this.negativeClick = _negativeClick; this.neutralClick = _neutralClick; */ + this.title = _title; + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(activity); dialogBuilder.setTitle(_title); dialogBuilder.setCancelable(true); @@ -66,19 +75,23 @@ class PPAlertDialog { //mDialog.setOnShowListener(dialog -> doShow()); - TextView messageText = layout.findViewById(R.id.info_pref_dialog_info_text); + messageText = layout.findViewById(R.id.info_pref_dialog_info_text); + //noinspection DataFlowIssue messageText.setText(_message); View buttonsDivider = layout.findViewById(R.id.info_pref_dialog_buttonBarDivider); if (_hideButtonBarDivider) + //noinspection DataFlowIssue buttonsDivider.setVisibility(View.GONE); else + //noinspection DataFlowIssue buttonsDivider.setVisibility(View.VISIBLE); mDialog.setCanceledOnTouchOutside(_canceledOnTouchOutside); if (_checkBoxListener != null) { CheckBox checkBox = layout.findViewById(R.id.info_pref_dialog_checkBox); + //noinspection DataFlowIssue checkBox.setText(_checkBoxText); checkBox.setEnabled(_checkBoxEnabled); checkBox.setChecked(_checBoxChecked); @@ -98,6 +111,23 @@ private void doShow() { void show() { if (!activity.isFinishing()) mDialog.show(); + + messageText.setMovementMethod(new PPLinkMovementMethod(this, activity)); + } + + @Override + public void onLinkClicked(final String linkUrl, PPLinkMovementMethod.LinkType linkTypeUrl, + final String linkText, PPLinkMovementMethod.LinkType linkTypeText) { + if (cancelDialogAtLinkClick) + mDialog.cancel(); + + InfoDialogPreferenceFragment.onLinkClickedListener(linkUrl, linkTypeUrl, linkText, linkTypeText, + title, activity, activity); + } + + @Override + public void onLongClick(String text) { + } } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java index b1b2c915f4..ad6d887b48 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java @@ -17,6 +17,7 @@ import android.os.HandlerThread; import android.os.PowerManager; import android.os.Process; +import android.os.SystemProperties; import android.provider.Settings; import android.service.notification.StatusBarNotification; import android.service.quicksettings.TileService; @@ -56,18 +57,20 @@ public class PPApplication extends Application //implements Configuration.Provider //implements Application.ActivityLifecycleCallbacks { - // this version code must by <= version code in dependencies.gradle + // this version code must by <= then version code in dependencies.gradle static final int PPP_VERSION_CODE_FOR_IMPORTANT_INFO_NEWS = 7090; - static final boolean SHOW_IMPORTANT_INFO_NEWS = false; - static final boolean SHOW_IMPORTANT_INFO_NOTIFICATION_NEWS = false; + // TODO set it to false if you do not want to show News + static final boolean SHOW_IMPORTANT_INFO_NEWS = true; + // TODO set it to false if you do not want to show notification + static final boolean SHOW_IMPORTANT_INFO_NOTIFICATION_NEWS = true; //// Extender versions // for this version will be displayed upgrade notification // required must by <= latest - static final int VERSION_CODE_EXTENDER_REQUIRED = 900; - static final String VERSION_NAME_EXTENDER_REQUIRED = "8.1.6"; + static final int VERSION_CODE_EXTENDER_REQUIRED = 910; + static final String VERSION_NAME_EXTENDER_REQUIRED = "9.0"; // Used for check required version. This version must be in IzzyOnDroid - static final int VERSION_CODE_EXTENDER_LATEST = 905; + static final int VERSION_CODE_EXTENDER_LATEST = 910; //static final String VERSION_NAME_EXTENDER_LATEST = "8.1.7"; /////// @@ -77,9 +80,10 @@ public class PPApplication extends Application static final int VERSION_CODE_PPPPS_REQUIRED = 65; static final String VERSION_NAME_PPPPS_REQUIRED = "1.0.8"; // Used for check required version. This version must be in IzzyOnDroid - static final int VERSION_CODE_PPPPS_LATEST = 70; + static final int VERSION_CODE_PPPPS_LATEST = 80; //static final String VERSION_NAME_PPPPS_LATEST = "1.0.9"; /////// + static final int VERSION_CODE_PPPPS_LATEST_WITHOUT_SERVICE = 71; static final int pid = Process.myPid(); static final int uid = Process.myUid(); @@ -193,7 +197,7 @@ public class PPApplication extends Application static final String SHIUKU_HOW_TO_START_URL = "https://github.com/henrichg/PhoneProfilesPlus/blob/master/docs/shizuku.md"; // TODO change to latest version - static final String INSTALL_WITH_OPTIONS_DOWNLOAD_URL = "https://github.com/zacharee/InstallWithOptions/releases/download/0.6.1/InstallWithOptions_0.6.1-release.apk"; + static final String INSTALL_WITH_OPTIONS_DOWNLOAD_URL = "https://github.com/zacharee/InstallWithOptions/releases/download/0.6.4/InstallWithOptions_0.6.4-release.apk"; //static final String GALAXY_STORE_PACKAGE_NAME = "com.sec.android.app.samsungapps"; //static final String GALAXY_STORE_PPP_RELEASES_URL = "https://galaxystore.samsung.com/detail/sk.henrichg.phoneprofilesplus"; @@ -294,7 +298,6 @@ public class PPApplication extends Application //+"|[APPLICATION_FULLY_STARTED]" //+"|[MAIN_WORKER_CALL]" //+"|[CONTACTS_DIALOG]" - //+"|[CONTACTS_CACHE]" //+"|[SYNCHRONIZED]" //+"|[DEFAULT_SIM]" //+"|[RESTART_WIFI_SCANNER]" @@ -303,8 +306,14 @@ public class PPApplication extends Application //+"|BluetoothConnectionBroadcastReceiver" //+"|EventPreferencesBluetooth" //+"|CheckCriticalPPPReleasesBroadcastReceiver" - //+"|[LOCATION_SCAN_TEST]" + //+"|PreferenceAllowed" + + //+"|[CONTACTS_CACHE]" + //+"|[CONTACTS_OBSERVER]" + //+"|[BLUETOOTH_CONNECT]" + //+"|EventPreferencesBluetooth.doHandleEvent" + //+"|BluetoothStateChangedBroadcastReceiver.onReceive" ; static final int ACTIVATED_PROFILES_FIFO_SIZE = 20; @@ -313,32 +322,39 @@ public class PPApplication extends Application static final int ALTYPE_UNDEFINED = 0; static final int ALTYPE_LOG_TOP = 999; - static final int ALTYPE_PROFILE_ACTIVATION = 1; - static final int ALTYPE_APPLICATION_EXIT = 10; - static final int ALTYPE_DATA_IMPORT = 11; static final int ALTYPE_PAUSED_LOGGING = 12; static final int ALTYPE_STARTED_LOGGING = 13; - static final int ALTYPE_EVENT_END_DELAY = 14; - static final int ALTYPE_EVENT_STOP = 15; + + static final int ALTYPE_APPLICATION_START = 9; static final int ALTYPE_APPLICATION_START_ON_BOOT = 16; + static final int ALTYPE_APPLICATION_EXIT = 10; + static final int ALTYPE_APPLICATION_INSTALLATION = 115; + static final int ALTYPE_APPLICATION_UPGRADE = 34; + static final int ALTYPE_APPLICATION_SYSTEM_RESTART = 107; + static final int ALTYPE_DATA_IMPORT = 11; + static final int ALTYPE_DATA_EXPORT = 101; + + static final int ALTYPE_PROFILE_PREFERENCES_CHANGED = 30; + static final int ALTYPE_SHARED_PROFILE_PREFERENCES_CHANGED = 31; static final int ALTYPE_EVENT_PREFERENCES_CHANGED = 17; + + static final int ALTYPE_PROFILE_ADDED = 108; + static final int ALTYPE_EVENT_ADDED = 109; static final int ALTYPE_EVENT_DELETED = 18; static final int ALTYPE_PROFILE_DELETED = 19; + static final int ALTYPE_PROFILE_ACTIVATION = 1; static final int ALTYPE_MERGED_PROFILE_ACTIVATION = 2; + static final int ALTYPE_AFTER_DURATION_SPECIFIC_PROFILE = 35; + + static final int ALTYPE_RESTART_EVENTS = 6; static final int ALTYPE_MANUAL_RESTART_EVENTS = 20; + static final int ALTYPE_AFTER_DURATION_UNDO_PROFILE = 21; static final int ALTYPE_AFTER_DURATION_DEFAULT_PROFILE = 22; static final int ALTYPE_AFTER_DURATION_RESTART_EVENTS = 23; static final int ALTYPE_EVENT_START = 3; - static final int ALTYPE_PROFILE_PREFERENCES_CHANGED = 30; - static final int ALTYPE_SHARED_PROFILE_PREFERENCES_CHANGED = 31; - static final int ALTYPE_ALL_EVENTS_DELETED = 32; - static final int ALTYPE_ALL_PROFILES_DELETED = 33; - static final int ALTYPE_APPLICATION_UPGRADE = 34; - static final int ALTYPE_AFTER_DURATION_SPECIFIC_PROFILE = 35; - static final int ALTYPE_EVENT_START_DELAY = 4; static final int ALTYPE_EVENT_END_NONE = 51; @@ -351,11 +367,15 @@ public class PPApplication extends Application static final int ALTYPE_AFTER_END_OF_ACTIVATION_DEFAULT_PROFILE = 58; static final int ALTYPE_AFTER_END_OF_ACTIVATION_RESTART_EVENTS = 59; static final int ALTYPE_AFTER_END_OF_ACTIVATION_SPECIFIC_PROFILE = 60; + static final int ALTYPE_EVENT_END_DELAY = 14; + + static final int ALTYPE_EVENT_STOP = 15; + + static final int ALTYPE_ALL_EVENTS_DELETED = 32; + static final int ALTYPE_ALL_PROFILES_DELETED = 33; - static final int ALTYPE_RESTART_EVENTS = 6; static final int ALTYPE_RUN_EVENTS_DISABLE = 7; static final int ALTYPE_RUN_EVENTS_ENABLE = 8; - static final int ALTYPE_APPLICATION_START = 9; static final int ALTYPE_PROFILE_ERROR_RUN_APPLICATION_APPLICATION = 1000; static final int ALTYPE_PROFILE_ERROR_RUN_APPLICATION_SHORTCUT = 1001; @@ -369,21 +389,78 @@ public class PPApplication extends Application static final int ALTYPE_PROFILE_ERROR_WIFI = 1009; static final int ALTYPE_PROFILE_ERROR_WIFIAP = 1010; static final int ALTYPE_PROFILE_ERROR_CLOSE_ALL_APPLICATIONS = 1011; + static final int ALTYPE_PROFILE_ERROR_SEND_SMS = 1012; - static final int ALTYPE_DATA_EXPORT = 101; static final int ALTYPE_ACTION_FROM_EXTERNAL_APP_PROFILE_ACTIVATION = 102; static final int ALTYPE_ACTION_FROM_EXTERNAL_APP_RESTART_EVENTS = 103; static final int ALTYPE_ACTION_FROM_EXTERNAL_APP_ENABLE_RUN_FOR_EVENT = 104; static final int ALTYPE_ACTION_FROM_EXTERNAL_APP_PAUSE_EVENT = 105; static final int ALTYPE_ACTION_FROM_EXTERNAL_APP_STOP_EVENT = 106; - static final int ALTYPE_APPLICATION_SYSTEM_RESTART = 107; - static final int ALTYPE_PROFILE_ADDED = 108; - static final int ALTYPE_EVENT_ADDED = 109; + static final int ALTYPE_TIMEZONE_CHANGED = 110; static final int ALTYPE_EXTENDER_ACCESSIBILITY_SERVICE_ENABLED = 111; static final int ALTYPE_EXTENDER_ACCESSIBILITY_SERVICE_NOT_ENABLED = 112; static final int ALTYPE_EXTENDER_ACCESSIBILITY_SERVICE_UNBIND = 113; + static final int ALTYPE_CALL_SCREENING_BLOCKED_CALL = 114; + // TODO actual max. value = 115; + + static final int ALFILTER_ALL = 0; + static final int ALFILTER_CALL_SCREENING_BLOCKED_CALL = 1; + // ALTYPE_CALL_SCREENING_BLOCKED_CALL + static final int ALFITER_ERRORS = 2; + // ALTYPE_PROFILE_ERROR_RUN_APPLICATION_APPLICATION + // ALTYPE_PROFILE_ERROR_RUN_APPLICATION_SHORTCUT + // ALTYPE_PROFILE_ERROR_RUN_APPLICATION_INTENT + // ALTYPE_PROFILE_ERROR_SET_TONE_RINGTONE + // ALTYPE_PROFILE_ERROR_SET_TONE_NOTIFICATION + // ALTYPE_PROFILE_ERROR_SET_TONE_ALARM + // ALTYPE_PROFILE_ERROR_SET_WALLPAPER + // ALTYPE_PROFILE_ERROR_SET_VPN + // ALTYPE_PROFILE_ERROR_CAMERA_FLASH + // ALTYPE_PROFILE_ERROR_WIFI + // ALTYPE_PROFILE_ERROR_WIFIAP + // ALTYPE_PROFILE_ERROR_CLOSE_ALL_APPLICATIONS + // ALTYPE_PROFILE_ERROR_SEND_SMS + // ALTYPE_EXTENDER_ACCESSIBILITY_SERVICE_NOT_ENABLED + // ALTYPE_EXTENDER_ACCESSIBILITY_SERVICE_UNBIND + static final int ALFILTER_EVENT_START = 3; + // ALTYPE_EVENT_START + // ALTYPE_EVENT_START_DELAY + static final int ALFILTER_EVENT_END = 4; + // ALTYPE_EVENT_END_NONE + // ALTYPE_EVENT_END_ACTIVATE_PROFILE + // ALTYPE_EVENT_END_UNDO_PROFILE + // ALTYPE_EVENT_END_ACTIVATE_PROFILE_UNDO_PROFILE + // ALTYPE_EVENT_END_RESTART_EVENTS + // ALTYPE_EVENT_END_ACTIVATE_PROFILE_RESTART_EVENTS + // ALTYPE_AFTER_END_OF_ACTIVATION_UNDO_PROFILE + // ALTYPE_AFTER_END_OF_ACTIVATION_DEFAULT_PROFILE + // ALTYPE_AFTER_END_OF_ACTIVATION_RESTART_EVENTS + // ALTYPE_AFTER_END_OF_ACTIVATION_SPECIFIC_PROFILE + // ALTYPE_EVENT_END_DELAY + // ALTYPE_ACTION_FROM_EXTERNAL_APP_PAUSE_EVENT + static final int ALFILTER_EVENT_STOP = 5; + // ALTYPE_EVENT_STOP + // ALTYPE_ACTION_FROM_EXTERNAL_APP_STOP_EVENT + static final int ALFILTER_RESTART_EVENTS = 6; + // ALTYPE_RESTART_EVENTS + // ALTYPE_MANUAL_RESTART_EVENTS + // ALTYPE_AFTER_DURATION_RESTART_EVENTS + // ALTYPE_EVENT_END_ACTIVATE_PROFILE_RESTART_EVENTS + // ALTYPE_AFTER_END_OF_ACTIVATION_RESTART_EVENTS + // ALTYPE_ACTION_FROM_EXTERNAL_APP_RESTART_EVENTS + static final int ALFITER_PROFILE_ACTIVATION = 7; + // ALTYPE_PROFILE_ACTIVATION + // ALTYPE_MERGED_PROFILE_ACTIVATION + // ALTYPE_AFTER_DURATION_UNDO_PROFILE + // ALTYPE_AFTER_DURATION_DEFAULT_PROFILE + // ALTYPE_AFTER_DURATION_SPECIFIC_PROFILE + // ALTYPE_AFTER_END_OF_ACTIVATION_UNDO_PROFILE + // ALTYPE_AFTER_END_OF_ACTIVATION_DEFAULT_PROFILE + // ALTYPE_AFTER_END_OF_ACTIVATION_SPECIFIC_PROFILE + // ALTYPE_ACTION_FROM_EXTERNAL_APP_PROFILE_ACTIVATION + static final String MODEL_NEXUS = "Nexus"; static final String MANUFACTURER_HMD_GLOBAL = "HMD Global"; @@ -402,7 +479,8 @@ public class PPApplication extends Application static final boolean deviceIsMotorola = isMotorola(); static final boolean romIsMIUI = isMIUIROM(); static final boolean romIsEMUI = isEMUIROM(); - static final boolean romIsGalaxy = isGalaxyROM(); + static boolean romIsGalaxy = false; + static boolean romIsGalaxy611 = false; static volatile boolean HAS_FEATURE_BLUETOOTH_LE = false; static volatile boolean HAS_FEATURE_WIFI = false; @@ -412,6 +490,8 @@ public class PPApplication extends Application static volatile boolean HAS_FEATURE_LOCATION = false; static volatile boolean HAS_FEATURE_LOCATION_GPS = false; static volatile boolean HAS_FEATURE_CAMERA_FLASH = false; + // this is required for target 33 + //static volatile boolean HAS_FEATURE_TELEPHONY_MESSAGING = false; static final String PACKAGE_NAME = "sk.henrichg.phoneprofilesplus"; static final String PACKAGE_NAME_EXTENDER = "sk.henrichg.phoneprofilesplusextender"; @@ -441,7 +521,7 @@ public class PPApplication extends Application static final int STARTUP_SOURCE_EDITOR = 8; //static final int STARTUP_SOURCE_ACTIVATOR_START = 9; //static final int STARTUP_SOURCE_LAUNCHER_START = 10; - static final int STARTUP_SOURCE_LAUNCHER = 11; + //static final int STARTUP_SOURCE_LAUNCHER = 11; // STARTUP_SOURCE_EVENT_MANUAL is for activation of profile from evet, when is set: // - "Start of event"/"Other parameters"/"[M] Manual profile activation at start" // - "End of event"/"Other parameters"/"[M] Manual profile activation at end" @@ -571,6 +651,10 @@ public class PPApplication extends Application static final int PROFILE_ACTIVATION_CAMERA_FLASH_ERROR_NOTIFICATION_ID = 168; static final String PROFILE_ACTIVATION_CAMERA_FLASH_ERROR_NOTIFICATION_TAG = PACKAGE_NAME+"_PROFILE_ACTIVATION_CAMERA_FLASH_ERROR_NOTIFICATION"; static final String PROFILE_ACTIVATION_ERRORS_NOTIFICATION_GROUP = PACKAGE_NAME+"_PROFILE_ACTIVATION_ERRORS_NOTIFICATION_GROUP"; + static final int PROFILE_ACTIVATION_SEND_SMS_ERROR_NOTIFICATION_ID = 169; + static final String PROFILE_ACTIVATION_SEND_SMS_ERROR_NOTIFICATION_TAG = PACKAGE_NAME+"_PROFILE_SEND_SMS_ERROR_NOTIFICATION"; + static final int PROFILE_ACTIVATION_SCREEN_NIGHT_LIGHT_PREFS_NOTIFICATION_ID = 170; + static final String PROFILE_ACTIVATION_SCREEN_NIGHT_LIGHT_PREFS_NOTIFICATION_TAG = PACKAGE_NAME+"PROFILE_ACTIVATION_SCREEN_NIGHT_LIGHT_PREFS_NOTIFICATION"; static final int KEEP_SCREEN_ON_NOTIFICATION_ID = 142; static final String KEEP_SCREEN_ON_NOTIFICATION_TAG = PACKAGE_NAME+"_KEEP_SCREEN_ON_NOTIFICATION"; @@ -793,6 +877,10 @@ public class PPApplication extends Application //static volatile boolean applicationPackageReplaced = false; static volatile boolean deviceBoot = false; + static final int titleTapTargetSize = 22; + static final float descriptionTapTargetAlpha = 0.95f; + + //static final boolean restoreFinished = true; static volatile Collator collator = null; @@ -872,8 +960,10 @@ public class PPApplication extends Application // LockDeviceActivity //static volatile LockDeviceActivity lockDeviceActivity = null; static volatile boolean lockDeviceActivityDisplayed = false; + static volatile boolean lockDeviceActivityOnlyScreenOff = false; - static volatile int screenTimeoutWhenLockDeviceActivityIsDisplayed = 0; + static volatile int screenTimeoutWhenLockDeviceActivityIsDisplayedForDeviceLock = 0; + static volatile int screenTimeoutWhenLockDeviceActivityIsDisplayedForScreenOff = 0; // static int brightnessBeforeScreenOff; // static float adaptiveBrightnessBeforeScreenOff; @@ -980,6 +1070,7 @@ public class PPApplication extends Application static volatile ApplicationEventEndBroadcastReceiver applicationEventEndBroadcastReceiver = null; //static volatile MusicBroadcastReceiver musicBroadcastReceiver = null; static volatile PPAudioPlaybackCallback audioPlaybackCallback = null; + static volatile CallScreeningEventEndBroadcastReceiver callScreeningEventEndBroadcastReceiver = null; static volatile SettingsContentObserver settingsContentObserver = null; @@ -1075,6 +1166,7 @@ public class PPApplication extends Application static boolean prefActivityLogEnabled; static long prefLastActivatedProfile; + static long prefProfileBeforeActivation; static long wallpaperChangeTime; static volatile String connectToSSID = StringConstants.CONNECTTOSSID_JUSTANY; @@ -1112,7 +1204,7 @@ public class PPApplication extends Application static volatile int mobileCellsScannerDurationForAutoRegistration = 0; static volatile String mobileCellsScannerCellsNameForAutoRegistration = ""; - static volatile boolean blockContactContentObserver = false; + //static volatile boolean blockContactContentObserver = false; @Override public void onCreate() @@ -1140,6 +1232,7 @@ public void onCreate() } }*/ + super.onCreate(); // This is required : https://www.acra.ch/docs/Troubleshooting-Guide#applicationoncreate @@ -1148,6 +1241,17 @@ public void onCreate() return; } + romIsGalaxy = isGalaxyROM(getApplicationContext()); + romIsGalaxy611 = isGalaxyROM611(getApplicationContext()); + + // do not used because some dynamic notification, widgets has its own laypouts and in it + // are colors configured = keep material componets lib to 1.10.0 + /*if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) { + DynamicTonalPaletteSamsung dynamicTonalPaletteSamsung = new DynamicTonalPaletteSamsung(); + GlobalGUIRoutines.lightColorScheme = dynamicTonalPaletteSamsung.dynamicLightColorSchemeSamsung(getApplicationContext()); + GlobalGUIRoutines.darkColorScheme = dynamicTonalPaletteSamsung.dynamicDarkColorSchemeSamsung(getApplicationContext()); + }*/ + RootUtils.initRoot(); // PPApplicationStatic.logE("[SYNCHRONIZED] PPApplication.onCreate", "PPApplication.applicationStartedMutex"); @@ -1211,6 +1315,7 @@ public void onCreate() HAS_FEATURE_LOCATION = hasSystemFeature(packageManager, PackageManager.FEATURE_LOCATION); HAS_FEATURE_LOCATION_GPS = hasSystemFeature(packageManager, PackageManager.FEATURE_LOCATION_GPS); HAS_FEATURE_CAMERA_FLASH = hasSystemFeature(packageManager, PackageManager.FEATURE_CAMERA_FLASH); + //HAS_FEATURE_TELEPHONY_MESSAGING = hasSystemFeature(packageManager, PackageManager.FEATURE_TELEPHONY_MESSAGING); PPApplicationStatic.logE("##### PPApplication.onCreate", "end of get features"); @@ -1544,7 +1649,7 @@ protected void attachBaseContext(Context base) { .withResSendButtonIcon(0) .withResDiscardButtonIcon(0) .withSendOnClick(true) - .withColor(ContextCompat.getColor(base, R.color.error_color)) + .withColor(ContextCompat.getColor(base, R.color.errorColor)) .withEnabled(true) .build(), new MailSenderConfigurationBuilder() @@ -2036,28 +2141,61 @@ private static String getOneUiVersion() throws Exception { } */ - /* private static boolean isSemAvailable(Context context) { return context != null && (context.getPackageManager().hasSystemFeature("com.samsung.feature.samsung_experience_mobile") || - context.getPackageManager().hasSystemFeature("com.samsung.feature.samsung_experience_mobile_lite")); + context.getPackageManager().hasSystemFeature("com.samsung.feature.samsung_experience_mobile_lite")); } - */ + private static boolean isGalaxyROM(Context appContext) { + try { + if (isSemAvailable(appContext)) { + String systemProperty = SystemProperties.get("ro.build.version.oneui"); + int oneUIVersion = Integer.parseInt(systemProperty); + if (oneUIVersion != 0) + return true; + else { + return deviceIsSamsung; + } + } + } catch (Exception e) { + return deviceIsSamsung; + } + return deviceIsSamsung; + } + + /* private static boolean isGalaxyROM() { try { //String romName = getOneUiVersion(); - /* - if (romName.isEmpty()) - return true; // old, non-OneUI ROM - else - return true; // OneUI ROM - */ + //if (romName.isEmpty()) + // return true; // old, non-OneUI ROM + //else + // return true; // OneUI ROM return isSamsung(); } catch (Exception e) { return false; } } + */ + + private static boolean isGalaxyROM611(Context appContext) { + try { + if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) && isSemAvailable(appContext)) { + // OneUi is since Android SDK 28 + String systemProperty = SystemProperties.get("ro.build.version.oneui"); + //Log.e("PPApplication.isGalaxyROM611", "systemProperty="+systemProperty); + boolean isOneUI611 = false; + try { + isOneUI611 = (Integer.parseInt(systemProperty) >= 60101); + } catch (Exception ignored) {} + return isOneUI611; + } + } catch (Exception e) { + return false; + } + return false; + } private static boolean isLG() { final String LGE = "lge"; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplicationStatic.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplicationStatic.java index 40e8f3b468..1b1d076544 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplicationStatic.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplicationStatic.java @@ -263,7 +263,8 @@ static void addActivityLog(Context context, final int logType, final String even (logType == PPApplication.ALTYPE_PROFILE_ERROR_CAMERA_FLASH) || (logType == PPApplication.ALTYPE_PROFILE_ERROR_WIFI) || (logType == PPApplication.ALTYPE_PROFILE_ERROR_WIFIAP) || - (logType == PPApplication.ALTYPE_PROFILE_ERROR_CLOSE_ALL_APPLICATIONS)) { + (logType == PPApplication.ALTYPE_PROFILE_ERROR_CLOSE_ALL_APPLICATIONS) || + (logType == PPApplication.ALTYPE_PROFILE_ERROR_SEND_SMS)) { boolean manualProfileActivation = false; if (EventStatic.getGlobalEventsRunning(appContext)) { @@ -339,13 +340,18 @@ static void addActivityLog(Context context, final int logType, final String even notificationId = PPApplication.PROFILE_ACTIVATION_CLOSE_ALL_APPLICATIONS_ERROR_NOTIFICATION_ID; notificationTag = PPApplication.PROFILE_ACTIVATION_CLOSE_ALL_APPLICATIONS_ERROR_NOTIFICATION_TAG; break; + case PPApplication.ALTYPE_PROFILE_ERROR_SEND_SMS: + text = appContext.getString(R.string.altype_profileError_sendSMS); + notificationId = PPApplication.PROFILE_ACTIVATION_SEND_SMS_ERROR_NOTIFICATION_ID; + notificationTag = PPApplication.PROFILE_ACTIVATION_SEND_SMS_ERROR_NOTIFICATION_TAG; + break; } if (!text.isEmpty()) { text = appContext.getString(R.string.profile_activation_activation_error) + StringConstants.STR_COLON_WITH_SPACE + text + "."; PPApplicationStatic.createExclamationNotificationChannel(appContext, false); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(appContext, PPApplication.EXCLAMATION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(appContext, R.color.error_color)) + .setColor(ContextCompat.getColor(appContext, R.color.errorColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_exclamation_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(appContext.getResources(), R.drawable.ic_exclamation_notification)) .setContentTitle(title) // title for notification @@ -532,7 +538,7 @@ static void logException(String tag, String text) { Context appContext = PPApplication.getInstance().getApplicationContext(); createExclamationNotificationChannel(appContext, false); NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(appContext, PPApplication.EXCLAMATION_NOTIFICATION_CHANNEL) - .setColor(ContextCompat.getColor(appContext, R.color.error_color)) + .setColor(ContextCompat.getColor(appContext, R.color.errorColor)) .setSmallIcon(R.drawable.ic_ppp_notification/*ic_exclamation_notify*/) // notification icon .setLargeIcon(BitmapFactory.decodeResource(appContext.getResources(), R.drawable.ic_exclamation_notification)) .setContentTitle("App exception occured!!") // title for notification @@ -714,6 +720,10 @@ static void loadGlobalApplicationData(Context context) { EventPreferencesRoaming.getEventRoamingInSIMSlot(context, 0); EventPreferencesRoaming.getEventRoamingInSIMSlot(context, 1); EventPreferencesRoaming.getEventRoamingInSIMSlot(context, 2); + //EventPreferencesCallScreening.getEventCallScreeningActive(context); + EventPreferencesCallScreening.getEventCallScreeningTime(context); + EventPreferencesCallScreening.getEventCallScreeningPhoneNumber(context); + EventPreferencesCallScreening.getEventCallScreeningCallDirection(context); ApplicationPreferences.loadStartTargetHelps(context); } @@ -1177,7 +1187,7 @@ static void setActivityProfileName(Context context, int activityType, String act } */ - private static void getLastActivatedProfile(Context context) + static void getLastActivatedProfile(Context context) { // PPApplicationStatic.logE("[SYNCHRONIZED] PPApplicationStatic.getLastActivatedProfile", "PPApplication.applicationGlobalPreferencesMutex"); synchronized (PPApplication.applicationGlobalPreferencesMutex) { @@ -1193,7 +1203,14 @@ static void setLastActivatedProfile(Context context, long profileId) Editor editor = ApplicationPreferences.getEditor(context); editor.putLong(PPApplication.PREF_LAST_ACTIVATED_PROFILE, profileId); editor.apply(); - PPApplication.prefLastActivatedProfile = profileId; +// PPApplication.prefLastActivatedProfile = profileId; + } + } + static void getProfileBeforeActivation(Context context) + { +// PPApplicationStatic.logE("[SYNCHRONIZED] PPApplicationStatic.geProfileBeforeActivation", "PPApplication.applicationGlobalPreferencesMutex"); + synchronized (PPApplication.applicationGlobalPreferencesMutex) { + PPApplication.prefProfileBeforeActivation = DatabaseHandler.getInstance(context).getActivatedProfileId(); } } @@ -2059,6 +2076,23 @@ static void registerReceiversForSMSSensor(boolean register, Context context) { } } + /* + static void registerReceiversForCallScreeningSensor(boolean register, Context context) { + try { + Intent commandIntent = new Intent(PhoneProfilesService.ACTION_COMMAND); + //commandIntent.putExtra(PhoneProfilesService.EXTRA_ONLY_START, false); + if (register) + commandIntent.putExtra(PhoneProfilesService.EXTRA_REGISTER_RECEIVERS_FOR_CALL_SCREENING_SENSOR, true); + else + commandIntent.putExtra(PhoneProfilesService.EXTRA_UNREGISTER_RECEIVERS_FOR_CALL_SCREENING_SENSOR, true); + runCommand(context, commandIntent); +// Log.e("PPApplication.registerReceiversForSMSSensor", "xxx"); + } catch (Exception e) { + recordException(e); + } + } + */ + /* public static void restartEvents(Context context, boolean unblockEventsRun, boolean reactivateProfile) { try { @@ -2160,6 +2194,7 @@ private static void _exitApp(final Context context, final DataWrapper dataWrappe } PPApplication.contactGroupsCache = null; if (PPApplication.contactsCache != null) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] PPApplicationStatic._exitApp", "(in contactsCacheMutex) contactsCache.clearCache()"); PPApplication.contactsCache.clearCache(); } PPApplication.contactsCache = null; @@ -2615,11 +2650,14 @@ static ApplicationsCache getApplicationsCache() static void createContactsCache(Context context, boolean clear, boolean fixEvents/*, boolean forceCache*/) { if (clear) { - if (PPApplication.contactsCache != null) + if (PPApplication.contactsCache != null) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] PPApplicationStatic.createContactsCache", "contactsCache.clearCache()"); PPApplication.contactsCache.clearCache(); + } } if (PPApplication.contactsCache == null) PPApplication.contactsCache = new ContactsCache(); +// PPApplicationStatic.logE("[CONTACTS_CACHE] PPApplicationStatic.createContactsCache", "contactsCache.getContactList()"); PPApplication.contactsCache.getContactList(context, fixEvents/*, forceCache*/); } @@ -2631,11 +2669,14 @@ static ContactsCache getContactsCache() static void createContactGroupsCache(Context context, boolean clear/*, boolean fixEvents*//*, boolean forceCache*/) { if (clear) { - if (PPApplication.contactGroupsCache != null) + if (PPApplication.contactGroupsCache != null) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] PPApplicationStatic.createContactGroupsCache", "contactGroupsCache.clearCache()"); PPApplication.contactGroupsCache.clearCache(); + } } if (PPApplication.contactGroupsCache == null) PPApplication.contactGroupsCache = new ContactGroupsCache(); +// PPApplicationStatic.logE("[CONTACTS_CACHE] PPApplicationStatic.createContactGroupsCache", "contactGroupsCache.getContactGroupList()"); PPApplication.contactGroupsCache.getContactGroupList(context/*, fixEvents*//*, forceCache*/); } @@ -2658,8 +2699,9 @@ static boolean isPixelLauncherDefault(Context context) { defaultLauncher = context.getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY); //else // defaultLauncher = context.getPackageManager().resolveActivity(intent, PackageManager.ResolveInfoFlags.of(PackageManager.MATCH_DEFAULT_ONLY)); - return defaultLauncher.activityInfo.packageName.toLowerCase().contains( - "com.google.android.apps.nexuslauncher"); + return (defaultLauncher == null) || + defaultLauncher.activityInfo.packageName.toLowerCase().contains( + "com.google.android.apps.nexuslauncher"); } catch (Exception e) { return false; } @@ -2689,7 +2731,8 @@ static boolean isOneUILauncherDefault(Context context) { //else // defaultLauncher = context.getPackageManager().resolveActivity(intent, PackageManager.ResolveInfoFlags.of(PackageManager.MATCH_DEFAULT_ONLY)); - return defaultLauncher.activityInfo.packageName.toLowerCase().contains( + return (defaultLauncher == null) || + defaultLauncher.activityInfo.packageName.toLowerCase().contains( "com.sec.android.app.launcher"); } catch (Exception e) { return false; @@ -2721,7 +2764,8 @@ static boolean isMIUILauncherDefault(Context context) { // defaultLauncher = context.getPackageManager().resolveActivity(intent, PackageManager.ResolveInfoFlags.of(PackageManager.MATCH_DEFAULT_ONLY)); //Log.e("PPApplication.isMIUILauncherDefault", "defaultLauncher="+defaultLauncher); - return defaultLauncher.activityInfo.packageName.toLowerCase().contains( + return (defaultLauncher == null) || + defaultLauncher.activityInfo.packageName.toLowerCase().contains( "com.miui.home"); } catch (Exception e) { return false; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPAudioPlaybackCallback.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPAudioPlaybackCallback.java index 7c57f30e9e..cd85ee15a7 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPAudioPlaybackCallback.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPAudioPlaybackCallback.java @@ -32,7 +32,7 @@ public void onPlaybackConfigChanged(List configs) { //Log.e("PPAudioPlaybackCallback.onPlaybackConfigChanged", "played"); // start events handler -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] MusicBroadcastReceiver.onReceive", "sensorType=SENSOR_TYPE_DEVICE_IDLE_MODE"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] PPAudioPlaybackCallback.onPlaybackConfigChanged", "SENSOR_TYPE_MUSIC"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_MUSIC}); @@ -41,6 +41,7 @@ public void onPlaybackConfigChanged(List configs) { } // Set is media playing to false since no active playback found //Log.e("PPAudioPlaybackCallback.onPlaybackConfigChanged", "not played"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] PPAudioPlaybackCallback.onPlaybackConfigChanged", "SENSOR_TYPE_MUSIC"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_MUSIC}); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPCallScreeningService.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPCallScreeningService.java index 99e3c135c1..45eacc1c71 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPCallScreeningService.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPCallScreeningService.java @@ -1,7 +1,6 @@ package sk.henrichg.phoneprofilesplus; import android.content.Context; -import android.content.SharedPreferences; import android.net.Uri; import android.os.Build; import android.telecom.Call; @@ -9,95 +8,159 @@ import android.telephony.PhoneNumberUtils; import android.telephony.SmsManager; +import androidx.annotation.NonNull; + +import java.util.Calendar; import java.util.List; public class PPCallScreeningService extends CallScreeningService { @Override - public void onScreenCall(Call.Details callDetails) { + public void onScreenCall(@NonNull Call.Details callDetails) { if (Build.VERSION.SDK_INT >= 29) { - CallResponse.Builder response = new CallResponse.Builder(); - if (callDetails.getCallDirection() == Call.Details.DIRECTION_INCOMING) { - //Log.e("PPCallScreeningService.onScreenCall", "Call screening service triggered"); - - //DataWrapper dataWrapper = new DataWrapper(getApplicationContext(), false, 0, false, 0, 0, 0f); - //Profile activatedProfile = dataWrapper.getActivatedProfile(false, false); - - // get profile from shared preferences, saved in Profile.execute() - SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences(PPApplication.TMP_SHARED_PREFS_ACTIVATE_PROFILE_HELPER_EXECUTE, Context.MODE_PRIVATE); - - String contacts = sharedPreferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACTS, Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_CONTACTS)); - String contactGroups = sharedPreferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS, Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS)); - int contactListType = Integer.parseInt(sharedPreferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE, Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE))); - boolean blockCalls = sharedPreferences.getBoolean(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS, Boolean.TRUE.equals(Profile.defaultValuesBoolean.get(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS))); - boolean sendSMS = sharedPreferences.getBoolean(Profile.PREF_PROFILE_PHONE_CALLS_SEND_SMS, Boolean.TRUE.equals(Profile.defaultValuesBoolean.get(Profile.PREF_PROFILE_PHONE_CALLS_SEND_SMS))); - String smsText = sharedPreferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_SMS_TEXT, Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_SMS_TEXT)); - - boolean profileFound = false; - boolean phoneNumberFound = false; - String calledPhoneNumber = ""; - Uri callHandle = callDetails.getHandle(); - if (callHandle != null) { - calledPhoneNumber = callHandle.getSchemeSpecificPart(); - if ( - ( - (contactListType == EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) || +// Log.e("PPCallScreeningService.onScreenCall", "Call screening service triggered"); + + final Context appContext = getApplicationContext(); + + Uri callHandle = callDetails.getHandle(); + if (callHandle != null) { + + //Runnable runnable = () -> { // NOT WORKING BLOCK CALL WTH THIS !!! + final String callingPhoneNumber = callHandle.getSchemeSpecificPart(); +// Log.e("PPCallScreeningService.onScreenCall", "callingPhoneNumber="+callingPhoneNumber); + final int callDirection = callDetails.getCallDirection(); + + Runnable runnable = () -> { + EventsHandler eventsHandler = new EventsHandler(appContext); + + //Log.e("PPCallScreeningService.onScreenCall", "call of EventsHandler"); + Calendar now = Calendar.getInstance(); + long time = now.getTimeInMillis(); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] PPCallScreeningService.onScreenCall", "SENSOR_TYPE_CALL_SCREENING"); + eventsHandler.setEventCallScreeningParameters(callingPhoneNumber, time, callDirection); + eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_CALL_SCREENING}); + }; + PPApplicationStatic.createBasicExecutorPool(); + PPApplication.basicExecutorPool.submit(runnable); + + CallResponse.Builder response = new CallResponse.Builder(); + + if (callDirection == Call.Details.DIRECTION_INCOMING) //noinspection ExtractMethodRecommender + { + // blok call only for incoming call + +// Log.e("PPCallScreeningService.onScreenCall", "***** (1) *****"); + + //noinspection ExtractMethodRecommender +// PPApplicationStatic.logE("[CONTACTS_CACHE] PPCallScreeningService.onScreenCall", "PPApplicationStatic.getContactsCache()"); + ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); + List contactList = null; + if (contactsCache != null) { +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCallScreening.doHandleEvent", "PPApplication.contactsCacheMutex"); +// PPApplicationStatic.logE("[CONTACTS_CACHE] PPCallScreeningService.onScreenCall", "contactsCache.getList()"); + contactList = contactsCache.getList(/*false*/); + } + + boolean blockCallingPhoneNumber = false; + boolean sendSMS = false; + String smsText = ""; + + if (contactList != null) { + List eventList = DatabaseHandler.getInstance(appContext).getAllEvents(); + for (Event event : eventList) { + if (event._eventPreferencesCallScreening._enabled && + event._eventPreferencesCallScreening.isRunnable(appContext)) { + + String contacts = event._eventPreferencesCallScreening._contacts; + String contactGroups = event._eventPreferencesCallScreening._contactGroups; + //int contactListType = event._eventPreferencesCallScreening._contactListType; + boolean notInContacts = event._eventPreferencesCallScreening._notInContacts; + int direction = event._eventPreferencesCallScreening._callDirection; + boolean blockCalls = event._eventPreferencesCallScreening._blockCalls; + sendSMS = event._eventPreferencesCallScreening._sendSMS; + smsText = event._eventPreferencesCallScreening._smsText; + + if (notInContacts) { + blockCallingPhoneNumber = !isPhoneNumberInContacts(contactList, callingPhoneNumber); + } else { + if (( + /*(contactListType == EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) ||*/ ((contacts != null) && (!contacts.isEmpty())) || - ((contactGroups != null) && (!contactGroups.isEmpty())) - ) && blockCalls - ) { - - profileFound = true; - - ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); - if (contactsCache != null) { - List contactList; -// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCall.doHandleEvent", "PPApplication.contactsCacheMutex"); - synchronized (PPApplication.contactsCacheMutex) { - contactList = contactsCache.getList(/*false*/); + ((contactGroups != null) && (!contactGroups.isEmpty())) + ) && (direction != EventPreferencesCallScreening.CALL_DIRECTION_OUTGOING) + && blockCalls) { + blockCallingPhoneNumber = isPhoneNumberConfigured(contacts, contactGroups, /*contactListType,*/ contactList, callingPhoneNumber); + } + } } - phoneNumberFound = isPhoneNumberConfigured(contacts, contactGroups, contactListType, contactList, calledPhoneNumber); - if (contactList != null) - contactList.clear(); + if (blockCallingPhoneNumber) + break; } + + contactList.clear(); } - } - if (profileFound && phoneNumberFound) { - response.setDisallowCall(true); - response.setRejectCall(true); - if (Permissions.checkSendSMS(getApplicationContext())) { - if (sendSMS && (!calledPhoneNumber.isEmpty()) && - (smsText != null) && (!smsText.isEmpty())) { - try { - SmsManager smsManager = SmsManager.getDefault(); - smsManager.sendTextMessage(calledPhoneNumber, null, smsText, null, null); - } catch (Exception e) { - PPApplicationStatic.recordException(e); +// Log.e("PPCallScreeningService.onScreenCall", "blockCallingPhoneNumber="+blockCallingPhoneNumber); + + if (blockCallingPhoneNumber) { + //block call + + // blocked call to Activity log + PPApplicationStatic.addActivityLog(appContext, PPApplication.ALTYPE_CALL_SCREENING_BLOCKED_CALL, null, callingPhoneNumber, ""); + + response.setDisallowCall(true); + response.setRejectCall(true); + + if (Permissions.checkSendSMS(appContext)) { + // send sms + if (sendSMS && (!callingPhoneNumber.isEmpty()) && + (smsText != null) && (!smsText.isEmpty())) { + try { + SmsManager smsManager = SmsManager.getDefault(); + smsManager.sendTextMessage(callingPhoneNumber, null, smsText, null, null); + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } } } + } else { +// Log.e("PPCallScreeningService.onScreenCall", "***** (2) *****"); + response.setDisallowCall(false); + response.setRejectCall(false); } } else { +// Log.e("PPCallScreeningService.onScreenCall", "***** (3) *****"); response.setDisallowCall(false); response.setRejectCall(false); } - } else { - response.setDisallowCall(false); - response.setRejectCall(false); + + response.setSilenceCall(false); + response.setSkipCallLog(false); + response.setSkipNotification(false); + respondToCall(callDetails, response.build()); + return; + //}; + //PPApplicationStatic.createEventsHandlerExecutor(); + //PPApplication.eventsHandlerExecutor.submit(runnable); } + +// Log.e("PPCallScreeningService.onScreenCall", "***** (4) *****"); + + CallResponse.Builder response = new CallResponse.Builder(); + response.setDisallowCall(false); + response.setRejectCall(false); + response.setSilenceCall(false); response.setSkipCallLog(false); response.setSkipNotification(false); respondToCall(callDetails, response.build()); - - //dataWrapper.invalidateDataWrapper(); } } - private boolean isPhoneNumberConfigured(String contacts, String contactGroups, int contactListType, List contactList, String phoneNumber) { + private boolean isPhoneNumberConfigured(String contacts, String contactGroups, /*int contactListType,*/ List contactList, String phoneNumber) { boolean phoneNumberFound = false; - if (contactListType != EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) { + //if (contactListType != EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) { // find phone number in groups String[] splits = contactGroups.split(StringConstants.STR_SPLIT_REGEX); @@ -151,12 +214,35 @@ private boolean isPhoneNumberConfigured(String contacts, String contactGroups, i } } - if (contactListType == EventPreferencesCall.CONTACT_LIST_TYPE_BLACK_LIST) - phoneNumberFound = !phoneNumberFound; - } else - phoneNumberFound = true; + //if (contactListType == EventPreferencesCall.CONTACT_LIST_TYPE_BLACK_LIST) + // phoneNumberFound = !phoneNumberFound; + //} else + // phoneNumberFound = true; return phoneNumberFound; } + private boolean isPhoneNumberInContacts(List contactList, String phoneNumber) { +// Log.e("PPCallScreeningService.isPhoneNumberInContacts", "phoneNumber="+phoneNumber); + + boolean phoneNumberInContacts = false; + + synchronized (PPApplication.contactsCacheMutex) { + if (contactList != null) { + for (Contact contact : contactList) { + if (contact.phoneId != 0) { + String _phoneNumber = contact.phoneNumber; +// Log.e("PPCallScreeningService.isPhoneNumberInContacts", "_phoneNumber="+_phoneNumber); + if (PhoneNumberUtils.compare(_phoneNumber, phoneNumber)) { + phoneNumberInContacts = true; + break; + } + } + } + } + } + + return phoneNumberInContacts; + } + } \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPEditTextAlertDialog.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPEditTextAlertDialog.java index ee1c6459d3..dc473d0abc 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPEditTextAlertDialog.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPEditTextAlertDialog.java @@ -55,16 +55,20 @@ class PPEditTextAlertDialog { //mDialog.setOnShowListener(dialog -> doShow()); TextView messageText = layout.findViewById(R.id.dialog_with_edittext_label); + //noinspection DataFlowIssue messageText.setText(_label); editText = layout.findViewById(R.id.dialog_with_edittext_edit); + //noinspection DataFlowIssue editText.setText(_initialEditValue); editText.requestFocus(); View buttonsDivider = layout.findViewById(R.id.dialog_with_edittext_buttonBarDivider); if (_hideButtonBarDivider) + //noinspection DataFlowIssue buttonsDivider.setVisibility(View.GONE); else + //noinspection DataFlowIssue buttonsDivider.setVisibility(View.VISIBLE); mDialog.setCanceledOnTouchOutside(_canceledOnTouchOutside); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPEditTextDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPEditTextDialogPreference.java new file mode 100644 index 0000000000..02025bf9c1 --- /dev/null +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPEditTextDialogPreference.java @@ -0,0 +1,145 @@ +package sk.henrichg.phoneprofilesplus; + +import android.content.Context; +import android.os.Parcel; +import android.os.Parcelable; +import android.util.AttributeSet; + +import androidx.preference.DialogPreference; + +public class PPEditTextDialogPreference extends DialogPreference { + + PPEditTextDialogPreferenceFragment fragment; + + //private final Context _context; + + // Custom xml attributes. + String editTextValue; + private String defaultValue; + private boolean savedInstanceState; + + public PPEditTextDialogPreference(Context context, AttributeSet attrs) { + super(context, attrs); + +// _context = context; + + //noinspection resource +// TypedArray typedArray = context.obtainStyledAttributes(attrs, +// R.styleable.PPPhoneCallSendSMSDialogPreference); +// +// sendSMS = typedArray.getBoolean( +// R.styleable.PPPhoneCallSendSMSDialogPreference_sendSMS, false); +// +// typedArray.recycle(); + } + + @Override + protected void onSetInitialValue(Object defaultValue) + { + // Get the persistent value and correct it for the minimum value. + this.defaultValue = ""; + if (defaultValue != null) + this.defaultValue = (String) defaultValue; + editTextValue = getPersistedString(this.defaultValue); + setSummaryVDP(); + } + + private void setSummaryVDP() + { + setSummary(editTextValue); + } + + void persistValue() { + if (shouldPersist()) { + persistString(editTextValue); + setSummaryVDP(); + } + } + + void resetSummary() { + if (!savedInstanceState) { + editTextValue = getPersistedString(defaultValue); + setSummaryVDP(); + } + savedInstanceState = false; + } + + @Override + protected Parcelable onSaveInstanceState() + { + savedInstanceState = true; + + final Parcelable superState = super.onSaveInstanceState(); + /*if (isPersistent()) { + return superState; + }*/ + + final PPEditTextDialogPreference.SavedState myState = new PPEditTextDialogPreference.SavedState(superState); + myState.editTextValue = editTextValue; + myState.defaultValue = defaultValue; + return myState; + } + + @Override + protected void onRestoreInstanceState(Parcelable state) + { + if ((state == null) || (!state.getClass().equals(PPEditTextDialogPreference.SavedState.class))) { + // Didn't save state for us in onSaveInstanceState + super.onRestoreInstanceState(state); + editTextValue = ""; + setSummaryVDP(); + return; + } + + // restore instance state + PPEditTextDialogPreference.SavedState myState = (PPEditTextDialogPreference.SavedState)state; + super.onRestoreInstanceState(myState.getSuperState()); + editTextValue = myState.editTextValue; + defaultValue = myState.defaultValue; + setSummaryVDP(); + } + + // SavedState class + private static class SavedState extends BaseSavedState + { + String editTextValue; + String defaultValue; + + SavedState(Parcel source) + { + super(source); + + editTextValue = source.readString(); + defaultValue = source.readString(); + } + + @Override + public void writeToParcel(Parcel dest, int flags) + { + super.writeToParcel(dest, flags); + + dest.writeString(editTextValue); + dest.writeString(defaultValue); + } + + SavedState(Parcelable superState) + { + super(superState); + } + + public static final Creator CREATOR = + new Creator<>() { + public PPEditTextDialogPreference.SavedState createFromParcel(Parcel in) + { + return new PPEditTextDialogPreference.SavedState(in); + } + public PPEditTextDialogPreference.SavedState[] newArray(int size) + { + return new PPEditTextDialogPreference.SavedState[size]; + } + + }; + + } + +} diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPEditTextDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPEditTextDialogPreferenceFragment.java new file mode 100644 index 0000000000..b643385b5d --- /dev/null +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPEditTextDialogPreferenceFragment.java @@ -0,0 +1,57 @@ +package sk.henrichg.phoneprofilesplus; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.EditText; +import android.widget.TextView; + +import androidx.annotation.NonNull; +import androidx.preference.PreferenceDialogFragmentCompat; + +public class PPEditTextDialogPreferenceFragment extends PreferenceDialogFragmentCompat +{ + + private PPEditTextDialogPreference preference; + + EditText editText; + TextView textView; + + @SuppressLint("InflateParams") + @Override + protected View onCreateDialogView(@NonNull Context context) + { + preference = (PPEditTextDialogPreference) getPreference(); + preference.fragment = this; + + LayoutInflater inflater = LayoutInflater.from(context); + return inflater.inflate(R.layout.dialog_edittext_preference, null, false); + } + + @Override + protected void onBindDialogView(@NonNull View view) { + super.onBindDialogView(view); + + editText = view.findViewById(R.id.dialog_edittext_preference_edit); + //noinspection DataFlowIssue + editText.setText(preference.editTextValue); + + textView = view.findViewById(R.id.dialog_edittext_preference_label); + //noinspection DataFlowIssue + textView.setVisibility(View.GONE); + } + + @Override + public void onDialogClosed(boolean positiveResult) { + if (positiveResult) { + preference.editTextValue = editText.getText().toString(); + preference.persistValue(); + } + else { + preference.resetSummary(); + } + preference.fragment = null; + } + +} diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPExecutors.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPExecutors.java index 19159d9714..d309fbb977 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPExecutors.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPExecutors.java @@ -43,6 +43,7 @@ class PPExecutors { static final String SENSOR_NAME_SENSOR_TYPE_SMS_EVENT_END = "SENSOR_TYPE_SMS_EVENT_END"; static final String SENSOR_NAME_SENSOR_TYPE_WIFI_SCANNER = "SENSOR_TYPE_WIFI_SCANNER"; static final String SENSOR_NAME_SENSOR_TYPE_APPLICATION_EVENT_END = "SENSOR_TYPE_APPLICATION_EVENT_END"; + static final String SENSOR_NAME_SENSOR_TYPE_CALL_SCREENING_EVENT_END = "SENSOR_TYPE_CALL_SCREENING_EVENT_END"; private PPExecutors() { // private constructor to prevent instantiation @@ -211,6 +212,8 @@ static void handleEvents(Context context, int[] _sensorType, String _sensorName, if (EventStatic.getGlobalEventsRunning(appContext) && (sensorType.length != 0)) { // start events handler +// for (int st : sensorType) +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] PPExecutors.handleEvents", ""+st); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(sensorType); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPExtenderBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPExtenderBroadcastReceiver.java index 0cdec6c16c..180910098e 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPExtenderBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPExtenderBroadcastReceiver.java @@ -11,8 +11,11 @@ import android.content.pm.PackageManager; import android.os.PowerManager; import android.provider.Settings; +import android.telephony.PhoneNumberUtils; +import android.telephony.SmsManager; import android.telephony.SubscriptionInfo; import android.telephony.SubscriptionManager; +import android.telephony.TelephonyManager; import android.text.TextUtils; import androidx.core.app.NotificationManagerCompat; @@ -52,14 +55,19 @@ public class PPExtenderBroadcastReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { // PPApplicationStatic.logE("[IN_BROADCAST] PPExtenderBroadcastReceiver.onReceive", "xxx"); +// Log.e("PPExtenderBroadcastReceiver.onReceive", "**********"); + if (!PPApplicationStatic.getApplicationStarted(true, true)) // application is not started return; +// Log.e("PPExtenderBroadcastReceiver.onReceive", "xxxxxxxxxxxxxxx"); + if ((intent == null) || (intent.getAction() == null)) return; // PPApplicationStatic.logE("[IN_BROADCAST] PPExtenderBroadcastReceiver.onReceive", intent.getAction()); +// Log.e("PPExtenderBroadcastReceiver.onReceive", intent.getAction()); final Context appContext = context.getApplicationContext(); @@ -147,6 +155,7 @@ public void onReceive(Context context, Intent intent) { setApplicationInForeground(appContext, ""); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] PPExtenderBroadcastReceiver.onReceive", "ACTION_ACCESSIBILITY_SERVICE_UNBIND -> SENSOR_TYPE_APPLICATION,SENSOR_TYPE_DEVICE_ORIENTATION"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.setEventApplicationParameters("", 0); eventsHandler.handleEvents(new int[]{ @@ -206,29 +215,30 @@ public void onReceive(Context context, Intent intent) { break; case PPApplication.ACTION_FOREGROUND_APPLICATION_CHANGED: - final String packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME); - final String className = intent.getStringExtra(EXTRA_CLASS_NAME); - //Log.e("PPExtenderBroadcastReceiver.onReceive", "(1) ACTION_FOREGROUND_APPLICATION_CHANGED packageName="+packageName); - //Log.e("PPExtenderBroadcastReceiver.onReceive", "(1) ACTION_FOREGROUND_APPLICATION_CHANGED className="+className); - try { - ComponentName componentName = new ComponentName(packageName, className); + final String packageName = intent.getStringExtra(EXTRA_PACKAGE_NAME); + final String className = intent.getStringExtra(EXTRA_CLASS_NAME); + //Log.e("PPExtenderBroadcastReceiver.onReceive", "(1) ACTION_FOREGROUND_APPLICATION_CHANGED packageName="+packageName); + //Log.e("PPExtenderBroadcastReceiver.onReceive", "(1) ACTION_FOREGROUND_APPLICATION_CHANGED className="+className); - ActivityInfo activityInfo = tryGetActivity(appContext, componentName); - boolean isActivity = activityInfo != null; - if (isActivity) { - setApplicationInForeground(appContext, packageName); + if ((packageName != null) && (className != null)) { + ComponentName componentName = new ComponentName(packageName, className); - Calendar now = Calendar.getInstance(); - int gmtOffset = 0; //TimeZone.getDefault().getRawOffset(); - final long _time = now.getTimeInMillis() + gmtOffset; + ActivityInfo activityInfo = tryGetActivity(appContext, componentName); + boolean isActivity = activityInfo != null; + if (isActivity) { + setApplicationInForeground(appContext, packageName); - if (EventStatic.getGlobalEventsRunning(appContext)) { - Runnable runnable3 = () -> { + Calendar now = Calendar.getInstance(); + int gmtOffset = 0; //TimeZone.getDefault().getRawOffset(); + final long _time = now.getTimeInMillis() + gmtOffset; + + if (EventStatic.getGlobalEventsRunning(appContext)) { + Runnable runnable3 = () -> { // PPApplicationStatic.logE("[IN_EXECUTOR] PPApplication.startHandlerThread", "START run - from=PPExtenderBroadcastReceiver.onReceive.ACTION_FOREGROUND_APPLICATION_CHANGED"); - //Context appContext= appContextWeakRef.get(); - //if (appContext != null) { + //Context appContext= appContextWeakRef.get(); + //if (appContext != null) { PowerManager powerManager = (PowerManager) appContext.getSystemService(Context.POWER_SERVICE); PowerManager.WakeLock wakeLock = null; try { @@ -238,6 +248,8 @@ public void onReceive(Context context, Intent intent) { } //Log.e("PPExtenderBroadcastReceiver.onReceive", "(2) ACTION_FOREGROUND_APPLICATION_CHANGED"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] PPExtenderBroadcastReceiver.onReceive", "ACTION_FOREGROUND_APPLICATION_CHANGED -> SENSOR_TYPE_APPLICATION,SENSOR_TYPE_DEVICE_ORIENTATION"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] PPExtenderBroadcastReceiver.onReceive", "ACTION_FOREGROUND_APPLICATION_CHANGED -> packageName="+packageName); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.setEventApplicationParameters(packageName, _time); eventsHandler.handleEvents(new int[]{ @@ -271,10 +283,11 @@ public void onReceive(Context context, Intent intent) { } } } - //} - }; - PPApplicationStatic.createEventsHandlerExecutor(); - PPApplication.eventsHandlerExecutor.submit(runnable3); + //} + }; + PPApplicationStatic.createEventsHandlerExecutor(); + PPApplication.eventsHandlerExecutor.submit(runnable3); + } } } } catch (Exception e) { @@ -383,7 +396,7 @@ public void onReceive(Context context, Intent intent) { } //if (DatabaseHandler.getInstance(appContext).getTypeEventsCount(DatabaseHandler.ETYPE_SMS, false) > 0) { -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] PPExtenderBroadcastReceiver.onReceive", "sensorType=SENSOR_TYPE_SMS"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] PPExtenderBroadcastReceiver.onReceive", "ACTION_SMS_MMS_RECEIVED -> SENSOR_TYPE_SMS"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.setEventSMSParameters(origin, time, simSlot); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_SMS}); @@ -406,11 +419,22 @@ public void onReceive(Context context, Intent intent) { } break; case PPApplication.ACTION_CALL_RECEIVED: +// Log.e("PPExtenderBroadcastReceiver.onReceive", "***** (0) *****"); + //final int servicePhoneEvent = intent.getIntExtra(EXTRA_SERVICE_PHONE_EVENT, 0); final int callEventType = intent.getIntExtra(EXTRA_CALL_EVENT_TYPE, EventPreferencesCall.PHONE_CALL_EVENT_UNDEFINED); final String phoneNumber = intent.getStringExtra(EXTRA_PHONE_NUMBER); final long eventTime = intent.getLongExtra(EXTRA_EVENT_TIME, 0); final int slotIndex = intent.getIntExtra(EXTRA_SIM_SLOT, 0); +// PPApplicationStatic.logE("[CONTACTS_CACHE] PPExtenderBroadcastReceiver.onReceive", "callEventType="+callEventType); +// PPApplicationStatic.logE("[CONTACTS_CACHE] PPExtenderBroadcastReceiver.onReceive", "phoneNumber="+phoneNumber); +// @SuppressLint("SimpleDateFormat") +// SimpleDateFormat sdf = new SimpleDateFormat("d.MM.yy HH:mm:ss:S"); +// String _time = sdf.format(Calendar.getInstance().getTimeInMillis()); +// PPApplicationStatic.logE("[CONTACTS_CACHE] PPExtenderBroadcastReceiver.onReceive", "eventTime="+_time); +// PPApplicationStatic.logE("[CONTACTS_CACHE] PPExtenderBroadcastReceiver.onReceive", "slotIndex="+slotIndex); + +// Log.e("PPExtenderBroadcastReceiver.onReceive", "callEventType="+callEventType); if (EventStatic.getGlobalEventsRunning(appContext)) { Runnable runnable3 = () -> { @@ -425,7 +449,7 @@ public void onReceive(Context context, Intent intent) { } //if (DatabaseHandler.getInstance(appContext).getTypeEventsCount(DatabaseHandler.ETYPE_CALL, false) > 0) { -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] PPExtenderBroadcastReceiver.onReceive", "sensorType=SENSOR_TYPE_PHONE_CALL"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] PPExtenderBroadcastReceiver.onReceive", "ACTION_CALL_RECEIVED -> SENSOR_TYPE_PHONE_CALL"); EventsHandler eventsHandler = new EventsHandler(appContext); // Log.e("PPExtenderBroadcastReceiver.onReceive", "callEventType="+callEventType); // Log.e("PPExtenderBroadcastReceiver.onReceive", "phoneNumber="+phoneNumber); @@ -435,6 +459,104 @@ public void onReceive(Context context, Intent intent) { eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_PHONE_CALL}); //} + if (callEventType == EventPreferencesCall.PHONE_CALL_EVENT_MISSED_CALL) { +// PPApplicationStatic.logE("[CONTACTS_CACHE] PPExtenderBroadcastReceiver.onReceive", "PHONE_CALL_EVENT_MISSED_CALL"); + +// Log.e("PPExtenderBroadcastReceiver.onReceive", "***** (1) *****"); + + //noinspection ExtractMethodRecommender +// PPApplicationStatic.logE("[CONTACTS_CACHE] PPExtenderBroadcastReceiver.onReceive", "PPApplicationStatic.getContactsCache()"); + ContactsCache contactsCache = PPApplicationStatic.getContactsCache(); + List contactList = null; + if (contactsCache != null) { +// PPApplicationStatic.logE("[SYNCHRONIZED] PPExtenderBroadcastReceiver.doHandleEvent", "PPApplication.contactsCacheMutex"); +// PPApplicationStatic.logE("[CONTACTS_CACHE] PPExtenderBroadcastReceiver.onReceive", "contactsCache.getList()"); + contactList = contactsCache.getList(/*false*/); + } + + boolean callingPhoneNumber = false; + boolean sendSMSFromEvent = false; + String smsTextFromEvent = ""; + + if (contactList != null) { + List eventList = DatabaseHandler.getInstance(appContext).getAllEvents(); + for (Event event : eventList) { + if (event._eventPreferencesCall._enabled && + event._eventPreferencesCall.isRunnable(appContext)) { + +// Log.e("PPExtenderBroadcastReceiver.onReceive", "***** (2) *****"); + + String contactsFromEvent = event._eventPreferencesCall._contacts; + String contactGroupsFromEvent = event._eventPreferencesCall._contactGroups; + int contactListTypeFromEvent = event._eventPreferencesCall._contactListType; + int callEventFromEvent = event._eventPreferencesCall._callEvent; + int forSIMCardFromEvent = event._eventPreferencesCall._forSIMCard; + sendSMSFromEvent = event._eventPreferencesCall._sendSMS; + smsTextFromEvent = event._eventPreferencesCall._smsText; + + if (( + /*(contactListTypeFromEvent == EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) ||*/ + ((contactsFromEvent != null) && (!contactsFromEvent.isEmpty())) || + ((contactGroupsFromEvent != null) && (!contactGroupsFromEvent.isEmpty())) + ) && (callEventFromEvent == EventPreferencesCall.CALL_EVENT_MISSED_CALL) && + (contactListTypeFromEvent == EventPreferencesCall.CONTACT_LIST_TYPE_WHITE_LIST) // only white list is allowed for send sms + ) + { +// Log.e("PPExtenderBroadcastReceiver.onReceive", "***** (3) *****"); + + boolean simSlotOK = true; + if (forSIMCardFromEvent != 0) { + boolean hasFeature = false; + boolean hasSIMCard = false; + final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); + if (telephonyManager != null) { + int phoneCount = telephonyManager.getPhoneCount(); + if (phoneCount > 1) { + hasFeature = true; + HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); + hasSIMCard = hasSIMCardData.simCount >= 1; + } + } + if (hasFeature && hasSIMCard) + simSlotOK = ((slotIndex == 1) && (forSIMCardFromEvent == 1)) || + ((slotIndex == 2) && (forSIMCardFromEvent == 2)); + } + +// Log.e("PPExtenderBroadcastReceiver.onReceive", "***** (4) *****"); + + if (simSlotOK) + callingPhoneNumber = isPhoneNumberConfigured(contactsFromEvent, contactGroupsFromEvent, /*contactListType,*/ contactList, phoneNumber); + } + } + if (callingPhoneNumber) + break; + } + + contactList.clear(); + } + + //Log.e("PPCallScreeningService.onScreenCall", "phoneNumberToBlock="+phoneNumberToBlock); + + if (callingPhoneNumber) { +// Log.e("PPExtenderBroadcastReceiver.onReceive", "***** (5) *****"); + if (Permissions.checkSendSMS(appContext)) { + // send sms + if (sendSMSFromEvent && ((phoneNumber != null) && (!phoneNumber.isEmpty())) && + (smsTextFromEvent != null) && (!smsTextFromEvent.isEmpty())) { + try { +// Log.e("PPExtenderBroadcastReceiver.onReceive", "***** (6) *****"); + + SmsManager smsManager = SmsManager.getDefault(); + smsManager.sendTextMessage(phoneNumber, null, smsTextFromEvent, null, null); + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } + } + } + } + + } + } catch (Exception e) { // PPApplicationStatic.logE("[IN_EXECUTOR] PPApplication.startHandlerThread", Log.getStackTraceString(e)); PPApplicationStatic.recordException(e); @@ -454,6 +576,71 @@ public void onReceive(Context context, Intent intent) { } } + private boolean isPhoneNumberConfigured(String contacts, String contactGroups, /*int contactListType,*/ List contactList, String phoneNumber) { + boolean phoneNumberFound = false; + + //if (contactListType != EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) { + + // find phone number in groups + String[] splits = contactGroups.split(StringConstants.STR_SPLIT_REGEX); + for (String split : splits) { + if (!split.isEmpty()) { +// PPApplicationStatic.logE("[SYNCHRONIZED] EventPreferencesCall.isPhoneNumberConfigured", "(2) PPApplication.contactsCacheMutex"); + synchronized (PPApplication.contactsCacheMutex) { + if (contactList != null) { + for (Contact contact : contactList) { + if (contact.groups != null) { + long groupId = contact.groups.indexOf(Long.valueOf(split)); + if (groupId != -1) { + // group found in contact + if (contact.phoneId != 0) { + String _phoneNumber = contact.phoneNumber; + if (PhoneNumberUtils.compare(_phoneNumber, phoneNumber)) { + phoneNumberFound = true; + break; + } + } + } + } + } + } + } + } + + if (phoneNumberFound) + break; + } + + if (!phoneNumberFound) { + // find phone number in contacts + // contactId#phoneId|... + splits = contacts.split(StringConstants.STR_SPLIT_REGEX); + for (String split : splits) { + String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX); + + if ((!split.isEmpty()) && + (splits2.length == 3) && + (!splits2[0].isEmpty()) && + (!splits2[1].isEmpty()) && + (!splits2[2].isEmpty())) { + String contactPhoneNumber = splits2[1]; + if (PhoneNumberUtils.compare(contactPhoneNumber, phoneNumber)) { + // phone number is in sensor configured + phoneNumberFound = true; + break; + } + } + } + } + + //if (contactListType == EventPreferencesCall.CONTACT_LIST_TYPE_BLACK_LIST) + // phoneNumberFound = !phoneNumberFound; + //} else + // phoneNumberFound = true; + + return phoneNumberFound; + } + private ActivityInfo tryGetActivity(Context context, ComponentName componentName) { try { return context.getPackageManager().getActivityInfo(componentName, 0); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPIntent.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPIntent.java index ecee793bcb..e206d9817b 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPIntent.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPIntent.java @@ -286,7 +286,7 @@ PPIntent duplicate(/*boolean doNotDelete*/) { } - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public static final Parcelable.Creator CREATOR = new Parcelable.Creator<>() { public PPIntent createFromParcel(Parcel source) { return new PPIntent(source); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPLinkMovementMethod.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPLinkMovementMethod.java index bf4c00e3c1..767b9b8d89 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPLinkMovementMethod.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPLinkMovementMethod.java @@ -13,6 +13,8 @@ import android.view.MotionEvent; import android.widget.TextView; +import androidx.annotation.NonNull; + // Source: https://stackoverflow.com/a/37205216/2863059 public class PPLinkMovementMethod extends LinkMovementMethod { @@ -98,13 +100,13 @@ public boolean onTouchEvent(final TextView widget, final Spannable buffer, final */ class SimpleOnGestureListener extends GestureDetector.SimpleOnGestureListener { @Override - public boolean onDown(MotionEvent event) { + public boolean onDown(@NonNull MotionEvent event) { // Notified when a tap occurs. return true; } @Override - public void onLongPress(MotionEvent e) { + public void onLongPress(@NonNull MotionEvent e) { // Notified when a long press occurs. String text = mBuffer.toString().replace(StringConstants.STR_HARD_SPACE_DOUBLE_ARROW, ""); text = text.replace(" "+StringConstants.STR_DOUBLE_ARROW, ""); @@ -153,7 +155,7 @@ private void doLinkType(LinkType linkType, String link, String emailText) { } @Override - public boolean onSingleTapConfirmed(MotionEvent event) { + public boolean onSingleTapConfirmed(@NonNull MotionEvent event) { // Notified when tap occurs. String linkText = getLinkText(mWidget, mBuffer, event).replace(StringConstants.STR_HARD_SPACE_DOUBLE_ARROW, ""); linkText = linkText.replace(" "+StringConstants.STR_DOUBLE_ARROW, ""); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPListPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPListPreference.java index f977bef66a..bf246e1085 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPListPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPListPreference.java @@ -200,7 +200,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public PPListPreference.SavedState createFromParcel(Parcel in) { return new PPListPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPListPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPListPreferenceFragment.java index 9bdb2cc69d..854a1af600 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPListPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPListPreferenceFragment.java @@ -36,6 +36,7 @@ protected void onBindDialogView(@NonNull View view) { PPListPreferenceAdapter listAdapter = new PPListPreferenceAdapter(prefContext, preference); + //noinspection DataFlowIssue listView.setOnItemClickListener((parent, v, position, id) -> { preference.value = preference.entryValues[position].toString(); //listAdapter.notifyDataSetChanged(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPMultiSelectListPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPMultiSelectListPreference.java index 9ee330020c..9e78227137 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPMultiSelectListPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPMultiSelectListPreference.java @@ -249,7 +249,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public PPMultiSelectListPreference.SavedState createFromParcel(Parcel in) { return new PPMultiSelectListPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPMultiSelectListPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPMultiSelectListPreferenceFragment.java index 75287f58d6..3346793d0e 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPMultiSelectListPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPMultiSelectListPreferenceFragment.java @@ -35,6 +35,7 @@ protected void onBindDialogView(@NonNull View view) { PPMultiSelectListPreferenceAdapter listAdapter = new PPMultiSelectListPreferenceAdapter(prefContext, preference); + //noinspection DataFlowIssue listView.setOnItemClickListener((parent, item, position, id) -> { CheckBox chb = item.findViewById(R.id.pp_multiselect_list_pref_dlg_item_checkbox); @@ -57,6 +58,7 @@ protected void onBindDialogView(@NonNull View view) { preference.value.add(_valueFromPos); _found = true; } + //noinspection DataFlowIssue chb.setChecked(_found); //preference.persistValue(); }); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPPPSDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPPPSDialogPreference.java index 8aa2bea410..f44a2c2022 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPPPSDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPPPSDialogPreference.java @@ -155,8 +155,8 @@ public void writeToParcel(Parcel dest, int flags) super(superState); } - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator<>() { public PPPPSDialogPreference.SavedState createFromParcel(Parcel in) { return new PPPPSDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPPPSDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPPPSDialogPreferenceFragment.java index e7bb2d7ffc..9d1f685cec 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPPPSDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPPPSDialogPreferenceFragment.java @@ -59,9 +59,11 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { ppppsLaunchText = layout.findViewById(R.id.ppppsPrefDialog_pppps_launch); Button ppppsInstallButton = layout.findViewById(R.id.ppppsPrefDialog_pppps_install_button); + //noinspection DataFlowIssue ppppsInstallButton.setOnClickListener(v -> installPPPPutSettings(getActivity(), preference, false)); Button ppppsLaunchButton = layout.findViewById(R.id.ppppsPrefDialog_pppps_launch_button); + //noinspection DataFlowIssue ppppsLaunchButton.setOnClickListener(v -> launchPPPPutSettings()); mDialog = dialogBuilder.create(); @@ -81,8 +83,8 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { " "+StringConstants.TAG_BOLD_START_HTML + PPApplication.VERSION_NAME_PPPPS_REQUIRED + " (" + PPApplication.VERSION_CODE_PPPPS_REQUIRED + ")"+StringConstants.TAG_BOLD_END_HTML; if (ppppsVersion < PPApplication.VERSION_CODE_PPPPS_REQUIRED) prefVolumeDataSummary = prefVolumeDataSummary + StringConstants.TAG_DOUBLE_BREAK_HTML + prefContext.getString(R.string.pppps_pref_dialog_PPPPutSettings_new_version_summary); - else - prefVolumeDataSummary = prefVolumeDataSummary + StringConstants.TAG_BREAK_HTML+StringConstants.CHAR_HARD_SPACE_HTML; //"

" + prefContext.getString(R.string.pppps_pref_dialog_PPPPutSettings_upgrade_summary); + //else + // prefVolumeDataSummary = prefVolumeDataSummary + StringConstants.TAG_BREAK_HTML+StringConstants.CHAR_HARD_SPACE_HTML; //"

" + prefContext.getString(R.string.pppps_pref_dialog_PPPPutSettings_upgrade_summary); } ppppsVersionText.setText(StringFormatUtils.fromHtml(prefVolumeDataSummary, false, false, 0, 0, true)); @@ -155,6 +157,7 @@ private static void installPPPPutSettingsFromGitHub(final Activity activity, dialogText = dialogText + activity.getString(R.string.install_pppps_text4); dialogText = dialogText.replace(StringConstants.CHAR_NEW_LINE, StringConstants.TAG_BREAK_HTML); + //noinspection DataFlowIssue text.setText(StringFormatUtils.fromHtml(dialogText, false, false, 0, 0, true)); text.setMovementMethod(LinkMovementMethod.getInstance()); @@ -260,6 +263,7 @@ public void onClick(@NonNull View textView) { }; sbt.setSpan(clickableSpan, str1.length()+1, str2.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); //sbt.setSpan(new UnderlineSpan(), str1.length()+1, str2.length(), 0); + //noinspection DataFlowIssue text.setText(sbt); text.setMovementMethod(LinkMovementMethod.getInstance()); @@ -308,12 +312,14 @@ private static void installPPPPutSettingsFromGitHub34(final Activity activity, dialogText = dialogText + activity.getString(R.string.install_pppps_text10) + StringConstants.TAG_BREAK_HTML; dialogText = dialogText + activity.getString(R.string.install_pppps_text11) + StringConstants.TAG_DOUBLE_BREAK_HTML; dialogText = dialogText + activity.getString(R.string.install_pppps_text12) + StringConstants.TAG_BREAK_HTML; + //noinspection DataFlowIssue text0.setText(StringFormatUtils.fromHtml(dialogText, false, false, 0, 0, true)); TextView text1 = layout.findViewById(R.id.install_pppps_from_github_dialog_info_text1); String url = PPApplication.SHIUKU_HOW_TO_START_URL; dialogText = activity.getString(R.string.install_pppps_text13) + " " + StringConstants.TAG_URL_LINK_START_HTML + url + StringConstants.TAG_URL_LINK_START_URL_END_HTML + url+ StringConstants.STR_HARD_SPACE_DOUBLE_ARROW_HTML+StringConstants.TAG_URL_LINK_END_HTML; + //noinspection DataFlowIssue text1.setText(StringFormatUtils.fromHtml(dialogText, false, false, 0, 0, true)); text1.setMovementMethod(LinkMovementMethod.getInstance()); @@ -357,7 +363,8 @@ public void onClick(@NonNull View textView) { request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //Enqueue a new download and same the referenceId DownloadManager downloadManager = (DownloadManager) activity.getSystemService(Context.DOWNLOAD_SERVICE); - /*DownloadCompletedBroadcastReceiver.downloadReferenceInstallWithOptions =*/ downloadManager.enqueue(request); + if (downloadManager != null) + /*DownloadCompletedBroadcastReceiver.downloadReferenceInstallWithOptions =*/ downloadManager.enqueue(request); } catch (Exception e) { PPApplicationStatic.recordException(e); } @@ -374,6 +381,7 @@ public void onClick(@NonNull View textView) { } }; sbt.setSpan(clickableSpanText2, str1Text2.length()+1, str2Text2.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + //noinspection DataFlowIssue text2.setText(sbt); text2.setMovementMethod(LinkMovementMethod.getInstance()); @@ -421,7 +429,8 @@ public void onClick(@NonNull View textView) { request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED); //Enqueue a new download and same the referenceId DownloadManager downloadManager = (DownloadManager) activity.getSystemService(Context.DOWNLOAD_SERVICE); - /*DownloadCompletedBroadcastReceiver.downloadReferencePPPPS =*/ downloadManager.enqueue(request); + if (downloadManager != null) + /*DownloadCompletedBroadcastReceiver.downloadReferencePPPPS =*/ downloadManager.enqueue(request); } catch (Exception e) { PPApplicationStatic.recordException(e); } @@ -438,25 +447,30 @@ public void onClick(@NonNull View textView) { } }; sbt.setSpan(clickableSpanText3, str1Text3.length()+1, str2Text3.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + //noinspection DataFlowIssue text3.setText(sbt); text3.setMovementMethod(LinkMovementMethod.getInstance()); TextView text4 = layout.findViewById(R.id.install_pppps_from_github_dialog_info_text4); dialogText = activity.getString(R.string.install_pppps_text16); + //noinspection DataFlowIssue text4.setText(StringFormatUtils.fromHtml(dialogText, false, false, 0, 0, true)); TextView text5 = layout.findViewById(R.id.install_pppps_from_github_dialog_info_text5); dialogText = activity.getString(R.string.install_pppps_text17); + //noinspection DataFlowIssue text5.setText(StringFormatUtils.fromHtml(dialogText, false, false, 0, 0, true)); TextView text6 = layout.findViewById(R.id.install_pppps_from_github_dialog_info_text6); dialogText = activity.getString(R.string.install_pppps_text18); + //noinspection DataFlowIssue text6.setText(StringFormatUtils.fromHtml(dialogText, false, false, 0, 0, true)); TextView text7 = layout.findViewById(R.id.install_pppps_from_github_dialog_info_text7); dialogText = StringConstants.TAG_BREAK_HTML + StringConstants.TAG_BOLD_START_HTML + activity.getString(R.string.install_pppps_text5) + StringConstants.TAG_BOLD_END_HTML+StringConstants.TAG_DOUBLE_BREAK_HTML; dialogText = dialogText + activity.getString(R.string.install_pppps_text4); dialogText = dialogText.replace(StringConstants.CHAR_NEW_LINE, StringConstants.TAG_BREAK_HTML); + //noinspection DataFlowIssue text7.setText(StringFormatUtils.fromHtml(dialogText, false, false, 0, 0, true)); //dialogBuilder.setCancelable(false); @@ -511,6 +525,7 @@ public void onClick(@NonNull View textView) { } }; sbtGitHub.setSpan(clickableSpanGitHub, str1GitHub.length()+1, str2GitHub.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + //noinspection DataFlowIssue textGitHub.setText(sbtGitHub); textGitHub.setMovementMethod(LinkMovementMethod.getInstance()); @@ -561,6 +576,7 @@ private static void installDroidIfy(final Activity activity, dialogText = dialogText + activity.getString(R.string.install_extender_required_version) + " "+StringConstants.TAG_BOLD_START_HTML + PPApplication.VERSION_NAME_PPPPS_REQUIRED + " (" + PPApplication.VERSION_CODE_PPPPS_REQUIRED + ")"+StringConstants.TAG_BOLD_END_HTML+StringConstants.TAG_DOUBLE_BREAK_HTML; dialogText = dialogText + activity.getString(R.string.install_pppps_install_droidify_text); + //noinspection DataFlowIssue text.setText(StringFormatUtils.fromHtml(dialogText, false, false, 0, 0, true)); //dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert); @@ -645,6 +661,7 @@ static void installPPPPutSettings(final Activity activity, " "+StringConstants.TAG_BOLD_START_HTML + PPApplication.VERSION_NAME_PPPPS_REQUIRED + " (" + PPApplication.VERSION_CODE_PPPPS_REQUIRED + ")"+StringConstants.TAG_BOLD_END_HTML+StringConstants.TAG_DOUBLE_BREAK_HTML; dialogText = dialogText + activity.getString(R.string.install_pppps_text1) + " \"" + activity.getString(R.string.alert_button_install) + "\"."+StringConstants.TAG_DOUBLE_BREAK_HTML; dialogText = dialogText + StringConstants.TAG_BOLD_START_HTML + activity.getString(R.string.install_pppps_text5) + StringConstants.TAG_BOLD_END_HTML+StringConstants.TAG_DOUBLE_BREAK_HTML; + //noinspection DataFlowIssue text.setText(StringFormatUtils.fromHtml(dialogText, false, false, 0, 0, true)); dialogBuilder.setPositiveButton(activity.getString(R.string.alert_button_install), (dialog, which) -> { @@ -777,6 +794,7 @@ private void launchPPPPutSettings() { true, true, false, false, true, + false, getActivity() ); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/HighlightedSpinnerAdapter.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPSpinnerAdapter.java similarity index 89% rename from phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/HighlightedSpinnerAdapter.java rename to phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPSpinnerAdapter.java index 51e9cf8413..4532631cc8 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/HighlightedSpinnerAdapter.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPSpinnerAdapter.java @@ -9,12 +9,12 @@ import androidx.annotation.NonNull; import androidx.core.content.ContextCompat; -class HighlightedSpinnerAdapter extends ArrayAdapter { +class PPSpinnerAdapter extends ArrayAdapter { private int mSelectedIndex = -1; private final Activity activity; - HighlightedSpinnerAdapter(Activity activity, int textViewResourceId, String[] objects) { + PPSpinnerAdapter(Activity activity, int textViewResourceId, String[] objects) { super(activity, textViewResourceId, objects); this.activity = activity; } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPVoiceServiceBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPVoiceServiceBroadcastReceiver.java index 7ac1d3553e..4d65f2b338 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPVoiceServiceBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPVoiceServiceBroadcastReceiver.java @@ -20,8 +20,7 @@ public final class PPVoiceServiceBroadcastReceiver extends BroadcastReceiver { public void onReceive(Context context, Intent intent) { //C0330j.m960e(intent, "intent"); String action = intent.getAction(); - if (action.equals(PPVoiceService.ACTION_ASSISTANT)) { - + if ((action != null) && action.equals(PPVoiceService.ACTION_ASSISTANT)) { voiceService.showSession(intent.getExtras(), 0); } } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PeriodicEventsHandlerWorker.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PeriodicEventsHandlerWorker.java index e3fc915ef6..14d2f70887 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PeriodicEventsHandlerWorker.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PeriodicEventsHandlerWorker.java @@ -88,7 +88,7 @@ public Result doWork() { } if (callEventsHandler) { -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] PeriodicEventsHandlerWorker.doWork", "sensorType=SENSOR_TYPE_PERIODIC_EVENTS_HANDLER"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] PeriodicEventsHandlerWorker.doWork", "SENSOR_TYPE_PERIODIC_EVENTS_HANDLER"); EventsHandler eventsHandler = new EventsHandler(getApplicationContext()); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_PERIODIC_EVENTS_HANDLER}); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PermissionType.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PermissionType.java index daa0181bd9..a19ce97bf8 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PermissionType.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PermissionType.java @@ -28,7 +28,7 @@ public void writeToParcel(Parcel dest, int flags) { this.permission = in.readString(); } - public static final Parcelable.Creator CREATOR = new Parcelable.Creator() { + public static final Parcelable.Creator CREATOR = new Parcelable.Creator<>() { public PermissionType createFromParcel(Parcel source) { return new PermissionType(source); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Permissions.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Permissions.java index 2f127ce72d..f2a1237d9a 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Permissions.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Permissions.java @@ -85,7 +85,12 @@ class Permissions { static final int PERMISSION_TYPE_PROFILE_CLOSE_ALL_APPLICATIONS = 55; static final int PERMISSION_TYPE_PROFILE_PPP_PUT_SETTINGS = 56; static final int PERMISSION_TYPE_PROFILE_RINGTONES_DUAL_SIM = 57; - static final int PERMISSION_TYPE_PROFILE_PHONE_CALLS = 58; + static final int PERMISSION_TYPE_PROFILE_SEND_SMS = 58; + static final int PERMISSION_TYPE_EVENT_CALL_SCREENING_PREFERENCES = 59; + static final int PERMISSION_TYPE_PROFILE_CLEAR_NOTIFICATIONS = 60; + static final int PERMISSION_TYPE_PROFILE_SCREEN_NIGHT_LIGHT = 61; + static final int PERMISSION_TYPE_PROFILE_VPN = 62; + static final int PERMISSION_TYPE_PROFILE_SCREEN_ON_OFF = 63; static final int GRANT_TYPE_PROFILE = 1; //static final int GRANT_TYPE_INSTALL_TONE = 2; @@ -196,8 +201,10 @@ static ArrayList recheckPermissions(Context context, ArrayList

recheckPermissions(Context context, ArrayList

checkProfilePermissions(Context context, Profil checkProfileRunApplications(context, profile, permissions); checkProfileInteractivePreferences(context, profile, permissions); checkProfileCloseAllApplications(context, profile, permissions); - checkProfilePhoneCalls(context, profile, permissions); + checkProfileSendSMS(context, profile, permissions); checkProfilePPPPutSettings(context, profile, permissions); + checkProfileClearNotifications(context, profile, permissions); + checkProfileScreenNightLight(context, profile, permissions); + checkProfileVPN(context, profile, permissions); + checkProfileScreenOnOff(context, profile, permissions); return permissions; } @@ -284,12 +296,13 @@ static boolean checkInstallTone(Context context, ArrayList perm } */ + // SYSTEM_ALERT_WINDOW is not needed static boolean checkPlayRingtoneNotification(Context context, boolean alsoContacts, ArrayList permissions) { try { boolean grantedReadExternalStorage = ContextCompat.checkSelfPermission(context, permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED; - boolean grantedDrawOverApps = true; - if (Build.VERSION.SDK_INT >= 29) - grantedDrawOverApps = Settings.canDrawOverlays(context); + //boolean grantedDrawOverApps = true; + //if ((Build.VERSION.SDK_INT >= 29) && alsoContacts) + // grantedDrawOverApps = Settings.canDrawOverlays(context); boolean grantedContacts = true; if (alsoContacts) grantedContacts = ContextCompat.checkSelfPermission(context, permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED; @@ -298,8 +311,8 @@ static boolean checkPlayRingtoneNotification(Context context, boolean alsoContac permissions.add(new PermissionType(Permissions.PERMISSION_TYPE_PLAY_RINGTONE_NOTIFICATION, Manifest.permission.READ_EXTERNAL_STORAGE)); if (!grantedContacts) permissions.add(new PermissionType(Permissions.PERMISSION_TYPE_PLAY_RINGTONE_NOTIFICATION, Manifest.permission.READ_CONTACTS)); - if (!grantedDrawOverApps) - permissions.add(new PermissionType(Permissions.PERMISSION_TYPE_PLAY_RINGTONE_NOTIFICATION, permission.SYSTEM_ALERT_WINDOW)); + //if (!grantedDrawOverApps) + // permissions.add(new PermissionType(Permissions.PERMISSION_TYPE_PLAY_RINGTONE_NOTIFICATION, permission.SYSTEM_ALERT_WINDOW)); } return grantedReadExternalStorage && grantedContacts; } catch (Exception e) { @@ -658,6 +671,27 @@ static boolean checkProfileWireGuard(Context context, Profile profile, ArrayList } } + static boolean checkProfileVPN(Context context, Profile profile, ArrayList permissions) { + if (profile == null) return true; + + try { + boolean grantedDrawOverlays = true; + String[] splits = profile._deviceVPN.split(StringConstants.STR_SPLIT_REGEX); + int vpnApplication = Integer.parseInt(splits[0]); + if ((vpnApplication > 0) && (vpnApplication < 4)) + grantedDrawOverlays = Settings.canDrawOverlays(context); + if (grantedDrawOverlays) + setShowRequestDrawOverlaysPermission(context, true); + if (permissions != null) { + if (!grantedDrawOverlays) + permissions.add(new PermissionType(PERMISSION_TYPE_PROFILE_VPN, permission.SYSTEM_ALERT_WINDOW)); + } + return grantedDrawOverlays; + } catch (Exception e) { + return false; + } + } + static boolean checkGallery(Context context) { try { return (ContextCompat.checkSelfPermission(context, permission.READ_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED); @@ -1033,6 +1067,46 @@ static boolean checkProfileScreenOnPermanent(Context context, Profile profile, A } } + static boolean checkScreenOnOff(Context context) { + try { + boolean grantedWriteSettings = Settings.System.canWrite(context); + if (grantedWriteSettings) + setShowRequestWriteSettingsPermission(context, true); + boolean grantedDrawOverlays = Settings.canDrawOverlays(context); + if (grantedDrawOverlays) + setShowRequestDrawOverlaysPermission(context, true); + return grantedWriteSettings && grantedDrawOverlays; + } catch (Exception e) { + return false; + } + } + + static boolean checkProfileScreenOnOff(Context context, Profile profile, ArrayList permissions) { + if (profile == null) return true; + + try { + if (profile._screenOnOff == 2) { + // only for Screen off + boolean grantedWriteSettings = Settings.System.canWrite(context); + if (grantedWriteSettings) + setShowRequestWriteSettingsPermission(context, true); + boolean grantedDrawOverlays = Settings.canDrawOverlays(context); + if (grantedDrawOverlays) + setShowRequestDrawOverlaysPermission(context, true); + if (permissions != null) { + if (!grantedWriteSettings) + permissions.add(new PermissionType(PERMISSION_TYPE_PROFILE_SCREEN_ON_OFF, permission.WRITE_SETTINGS)); + if (!grantedDrawOverlays) + permissions.add(new PermissionType(PERMISSION_TYPE_PROFILE_SCREEN_ON_OFF, permission.SYSTEM_ALERT_WINDOW)); + } + return grantedWriteSettings && grantedDrawOverlays; + } else + return true; + } catch (Exception e) { + return false; + } + } + static boolean checkProfileCameraFlash(Context context, Profile profile, ArrayList permissions) { if (profile == null) return true; @@ -1099,7 +1173,8 @@ static void checkProfileInteractivePreferences(Context context, Profile profile, (profile._deviceNetworkTypePrefs == 1) || (profile._deviceLocationServicePrefs == 1) || (profile._deviceWiFiAPPrefs == 1) || - (profile._deviceVPNSettingsPrefs == 1)){ + (profile._deviceVPNSettingsPrefs == 1) || + (profile._screenNightLightPrefs == 1)) { boolean grantedDrawOverlays = Settings.canDrawOverlays(context); if (grantedDrawOverlays) setShowRequestDrawOverlaysPermission(context, true); @@ -1113,8 +1188,7 @@ static void checkProfileInteractivePreferences(Context context, Profile profile, } catch (Exception e) { //return false; } - } //else - //return /*true*/; + } } static void checkProfileCloseAllApplications(Context context, Profile profile, ArrayList permissions) { @@ -1141,56 +1215,153 @@ static void checkProfileCloseAllApplications(Context context, Profile profile, A } static void checkProfilePPPPutSettings(Context context, Profile profile, ArrayList permissions) { + if (profile == null) return; + + if (Build.VERSION.SDK_INT >= 29) { + int ppppsVersion = ActivateProfileHelper.isPPPPutSettingsInstalled(context); + if ((ppppsVersion >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) && + (ppppsVersion <= PPApplication.VERSION_CODE_PPPPS_LATEST_WITHOUT_SERVICE)) { + // in version <= 70 service not exists in PPPPS + // and for this reason reguired is "Draw over apps" + try { + if ((profile._vibrateWhenRinging != 0) || + (profile._vibrateNotifications != 0) || + ProfileStatic.getVibrationIntensityChange(profile._vibrationIntensityRinging) || + ProfileStatic.getVibrationIntensityChange(profile._vibrationIntensityNotifications) || + ProfileStatic.getVibrationIntensityChange(profile._vibrationIntensityTouchInteraction) || + (profile._soundNotificationChangeSIM1 != 0) || + (profile._soundNotificationChangeSIM2 != 0) || + (profile._soundSameRingtoneForBothSIMCards != 0) || + (profile._notificationLed != 0) || + (profile._screenNightLight != 0) + ) { + boolean grantedDrawOverlays = Settings.canDrawOverlays(context); + if (grantedDrawOverlays) + setShowRequestDrawOverlaysPermission(context, true); + if (permissions != null) { + if (!grantedDrawOverlays) + permissions.add(new PermissionType(PERMISSION_TYPE_PROFILE_PPP_PUT_SETTINGS, permission.SYSTEM_ALERT_WINDOW)); + } + //return grantedDrawOverlays; + } //else + // return true; + } catch (Exception e) { + //return false; + } + } + } + } + + static void checkProfileSendSMS(Context context, Profile profile, ArrayList permissions) { if (profile == null) return /*true*/; + boolean grantedContacts = true; + boolean grantedSendSMS = true; + if (profile._sendSMSSendSMS) { + if (((profile._sendSMSContacts != null) && (!profile._sendSMSContacts.isEmpty())) || + ((profile._sendSMSContactGroups != null) && (!profile._sendSMSContactGroups.isEmpty()))) + grantedContacts = ContextCompat.checkSelfPermission(context, permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED; + if (profile._sendSMSSendSMS) + grantedSendSMS = ContextCompat.checkSelfPermission(context, permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED; + } + if (permissions != null) { + if (!grantedContacts) + permissions.add(new PermissionType(PERMISSION_TYPE_PROFILE_SEND_SMS, permission.READ_CONTACTS)); + if (!grantedSendSMS) + permissions.add(new PermissionType(PERMISSION_TYPE_PROFILE_SEND_SMS, permission.SEND_SMS)); + } + } + + static void checkEventCallScreening(Context context, Event event, SharedPreferences preferences, + ArrayList permissions, int sensorType) { if (Build.VERSION.SDK_INT >= 29) { - try { - //if ((profile._deviceCloseAllApplications == 1)){ - boolean grantedDrawOverlays = Settings.canDrawOverlays(context); - if (grantedDrawOverlays) - setShowRequestDrawOverlaysPermission(context, true); - if (permissions != null) { - if (!grantedDrawOverlays) - permissions.add(new PermissionType(PERMISSION_TYPE_PROFILE_PPP_PUT_SETTINGS, permission.SYSTEM_ALERT_WINDOW)); + if ((event == null) && (preferences == null)) return; // true; + + RoleManager roleManager = (RoleManager) context.getSystemService(ROLE_SERVICE); + boolean isHeld = (roleManager != null) && roleManager.isRoleHeld(ROLE_CALL_SCREENING); + + if (isHeld) { + boolean grantedContacts; + boolean grantedSendSMS; + if (event != null) { + try { + if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_CALL_SCREENING)) { + if (event._eventPreferencesCallScreening._enabled) { + grantedContacts = ContextCompat.checkSelfPermission(context, permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED; +// Log.e("Permissions.checkEventCallScreening", "grantedContacts="+grantedContacts); + if ((permissions != null) && (!grantedContacts)) + permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_CALL_SCREENING_PREFERENCES, permission.READ_CONTACTS)); + if (event._eventPreferencesCallScreening._sendSMS) { + grantedSendSMS = ContextCompat.checkSelfPermission(context, permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED; +// Log.e("Permissions.checkEventCallScreening", "grantedSendSMS="+grantedSendSMS); + if ((permissions != null) && (!grantedSendSMS)) + permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_CALL_SCREENING_PREFERENCES, permission.SEND_SMS)); + } + } + } + } catch (Exception ignored) { } - //return grantedDrawOverlays; - //} //else - // return true; - } catch (Exception e) { - //return false; + } else { + if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_CALL_SCREENING)) { + if (preferences.getBoolean(EventPreferencesCallScreening.PREF_EVENT_CALL_SCREENING_ENABLED, false)) { + grantedContacts = ContextCompat.checkSelfPermission(context, permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED; + if ((permissions != null) && (!grantedContacts)) + permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_CALL_SCREENING_PREFERENCES, permission.READ_CONTACTS)); + if (preferences.getBoolean(EventPreferencesCallScreening.PREF_EVENT_CALL_SCREENING_SEND_SMS, false)) { + grantedSendSMS = ContextCompat.checkSelfPermission(context, permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED; + if ((permissions != null) && (!grantedSendSMS)) + permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_CALL_SCREENING_PREFERENCES, permission.SEND_SMS)); + } + } + } + } } - } //else - //return /*true*/; + } } - static void checkProfilePhoneCalls(Context context, Profile profile, ArrayList permissions) { + static void checkProfileClearNotifications(Context context, Profile profile, ArrayList permissions) { if (profile == null) return /*true*/; - if (Build.VERSION.SDK_INT >= 29) { + boolean grantedContacts = true; + //boolean grantedClearNotificaiton = true; + if (profile._clearNotificationEnabled) { + if ((profile._clearNotificationCheckContacts) && + ((profile._clearNotificationContacts != null) && (!profile._clearNotificationContacts.isEmpty())) || + ((profile._clearNotificationContactGroups != null) && (!profile._clearNotificationContactGroups.isEmpty()))) + grantedContacts = ContextCompat.checkSelfPermission(context, permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED; + //if (profile._sendSMSSendSMS) + // grantedSendSMS = ContextCompat.checkSelfPermission(context, permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED; + } + if (permissions != null) { + if (!grantedContacts) + permissions.add(new PermissionType(PERMISSION_TYPE_PROFILE_CLEAR_NOTIFICATIONS, permission.READ_CONTACTS)); + //if (!grantedSendSMS) + // permissions.add(new PermissionType(PERMISSION_TYPE_PROFILE_SEND_SMS, permission.SEND_SMS)); + } + } + + static boolean checkProfileScreenNightLight(Context context, Profile profile, ArrayList permissions) { + if (profile == null) return true; + + if ((PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) || + (PPApplication.deviceIsHuawei && PPApplication.romIsEMUI)) { try { - RoleManager roleManager = (RoleManager) context.getSystemService(ROLE_SERVICE); - boolean isHeld = roleManager.isRoleHeld(ROLE_CALL_SCREENING); - - boolean grantedContacts = true; - boolean grantedSendSMS = true; - if (isHeld) { - if (((profile._phoneCallsContacts != null) && (!profile._phoneCallsContacts.isEmpty())) || - ((profile._phoneCallsContactGroups != null) && (!profile._phoneCallsContactGroups.isEmpty()))) { - grantedContacts = ContextCompat.checkSelfPermission(context, permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED; - if (profile._phoneCallsBlockCalls && profile._phoneCallsSendSMS) - grantedSendSMS = ContextCompat.checkSelfPermission(context, permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED; + if (profile._screenNightLight != 0) { + boolean granted = Settings.System.canWrite(context); + if (granted) + setShowRequestWriteSettingsPermission(context, true); + if (!granted) { + if (permissions != null) + permissions.add(new PermissionType(PERMISSION_TYPE_PROFILE_SCREEN_NIGHT_LIGHT, permission.WRITE_SETTINGS)); } - } - if (permissions != null) { - if (!grantedContacts) - permissions.add(new PermissionType(PERMISSION_TYPE_PROFILE_PHONE_CALLS, permission.READ_CONTACTS)); - if (!grantedSendSMS) - permissions.add(new PermissionType(PERMISSION_TYPE_PROFILE_PHONE_CALLS, permission.SEND_SMS)); - } + return granted; + } else + return true; } catch (Exception e) { - //return; + return false; } - } + } else + return true; } static ArrayList checkEventPermissions(Context context, Event event, SharedPreferences preferences, @@ -1200,11 +1371,12 @@ static ArrayList checkEventPermissions(Context context, Event ev checkEventCalendar(context, event, preferences, permissions, sensorType); checkEventPhoneState(context, event, preferences, permissions, sensorType); - checkEventCallContacts(context, event, preferences, permissions, sensorType); + checkEventCall(context, event, preferences, permissions, sensorType); checkEventSMSContacts(context, event, preferences, permissions, sensorType); checkEventLocation(context, event, preferences, permissions, sensorType); checkEventBluetoothForEMUI(context, event, preferences, permissions, sensorType); //checkEventBackgroundLocation(context, event, preferences, permissions, sensorType); + checkEventCallScreening(context, event, preferences, permissions, sensorType); return permissions; } @@ -1217,17 +1389,26 @@ static boolean checkContacts(Context context) { } } - static private void checkEventCallContacts(Context context, Event event, SharedPreferences preferences, - ArrayList permissions, int sensorType) { + static private void checkEventCall(Context context, Event event, SharedPreferences preferences, + ArrayList permissions, int sensorType) { if ((event == null) && (preferences == null)) return; // true; + boolean grantedContacts; + boolean grantedSendSMS; if (event != null) { try { if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_PHONE_CALL)) { if (event._eventPreferencesCall._enabled) { - boolean granted = ContextCompat.checkSelfPermission(context, permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED; - if ((permissions != null) && (!granted)) + grantedContacts = ContextCompat.checkSelfPermission(context, permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED; +// Log.e("Permissions.checkEventCall", "grantedContacts="+grantedContacts); + if ((permissions != null) && (!grantedContacts)) permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_CALL_PREFERENCES, permission.READ_CONTACTS)); + if (event._eventPreferencesCall._sendSMS) { + grantedSendSMS = ContextCompat.checkSelfPermission(context, permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED; +// Log.e("Permissions.checkEventCallScreening", "grantedSendSMS="+grantedSendSMS); + if ((permissions != null) && (!grantedSendSMS)) + permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_CALL_PREFERENCES, permission.SEND_SMS)); + } } } } catch (Exception ignored) { @@ -1236,9 +1417,14 @@ static private void checkEventCallContacts(Context context, Event event, SharedP else { if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_PHONE_CALL)) { if (preferences.getBoolean(EventPreferencesCall.PREF_EVENT_CALL_ENABLED, false)) { - boolean granted = ContextCompat.checkSelfPermission(context, permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED; - if ((permissions != null) && (!granted)) + grantedContacts = ContextCompat.checkSelfPermission(context, permission.READ_CONTACTS) == PackageManager.PERMISSION_GRANTED; + if ((permissions != null) && (!grantedContacts)) permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_CALL_PREFERENCES, permission.READ_CONTACTS)); + if (preferences.getBoolean(EventPreferencesCall.PREF_EVENT_CALL_SEND_SMS, false)) { + grantedSendSMS = ContextCompat.checkSelfPermission(context, permission.SEND_SMS) == PackageManager.PERMISSION_GRANTED; + if ((permissions != null) && (!grantedSendSMS)) + permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_CALL_PREFERENCES, permission.SEND_SMS)); + } } } } @@ -1372,10 +1558,13 @@ static private void checkEventLocation(Context context, Event event, SharedPrefe if (event != null) { try { + // location must be enabled for Wifi sensor, for get proper connected SSID + // locaiton is required also for connected/not connected + //noinspection DuplicateExpressions if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_WIFI_SCANNER) || -// (sensorType == EventsHandler.SENSOR_TYPE_WIFI_CONNECTION) || + (sensorType == EventsHandler.SENSOR_TYPE_WIFI_CONNECTION) || (sensorType == EventsHandler.SENSOR_TYPE_BLUETOOTH_SCANNER) || (sensorType == EventsHandler.SENSOR_TYPE_MOBILE_CELLS) || (sensorType == EventsHandler.SENSOR_TYPE_TIME) || @@ -1388,20 +1577,33 @@ static private void checkEventLocation(Context context, Event event, SharedPrefe grantedAccessBackgroundLocation = ContextCompat.checkSelfPermission(context, permission.ACCESS_BACKGROUND_LOCATION) == PackageManager.PERMISSION_GRANTED; if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || - (sensorType == EventsHandler.SENSOR_TYPE_WIFI_SCANNER) /*|| - (sensorType == EventsHandler.SENSOR_TYPE_WIFI_CONNECTION)*/) { - if ((event._eventPreferencesWifi._enabled && - (/*(event._eventPreferencesWifi._connectionType == EventPreferencesWifi.CTYPE_CONNECTED) || - (event._eventPreferencesWifi._connectionType == EventPreferencesWifi.CTYPE_NOT_CONNECTED) ||*/ - (event._eventPreferencesWifi._connectionType == EventPreferencesWifi.CTYPE_NEARBY) || - (event._eventPreferencesWifi._connectionType == EventPreferencesWifi.CTYPE_NOT_NEARBY)))) { - if (permissions != null) { - if (!grantedAccessFineLocation) - permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_WIFI_PREFERENCES, permission.ACCESS_FINE_LOCATION)); - if (!grantedAccessCoarseLocation) - permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_WIFI_PREFERENCES, permission.ACCESS_COARSE_LOCATION)); - // only for API 29 add also background location For 30+ must be granted separatelly - if (Build.VERSION.SDK_INT >= 29) { + (sensorType == EventsHandler.SENSOR_TYPE_WIFI_SCANNER) || + (sensorType == EventsHandler.SENSOR_TYPE_WIFI_CONNECTION)) { + if (Build.VERSION.SDK_INT < 29) { + if (ApplicationPreferences.applicationEventWifiEnableScanning && + (!ApplicationPreferences.applicationEventWifiDisabledScannigByProfile) && + (event._eventPreferencesWifi._enabled && + ((event._eventPreferencesWifi._connectionType == EventPreferencesWifi.CTYPE_NEARBY) || + (event._eventPreferencesWifi._connectionType == EventPreferencesWifi.CTYPE_NOT_NEARBY)))) { + if (permissions != null) { + if (!grantedAccessFineLocation) + permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_WIFI_PREFERENCES, permission.ACCESS_FINE_LOCATION)); + if (!grantedAccessCoarseLocation) + permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_WIFI_PREFERENCES, permission.ACCESS_COARSE_LOCATION)); + } + } + } else { + if ((event._eventPreferencesWifi._enabled && + ((event._eventPreferencesWifi._connectionType == EventPreferencesWifi.CTYPE_CONNECTED) || + (event._eventPreferencesWifi._connectionType == EventPreferencesWifi.CTYPE_NOT_CONNECTED) || + (event._eventPreferencesWifi._connectionType == EventPreferencesWifi.CTYPE_NEARBY) || + (event._eventPreferencesWifi._connectionType == EventPreferencesWifi.CTYPE_NOT_NEARBY)))) { + if (permissions != null) { + if (!grantedAccessFineLocation) + permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_WIFI_PREFERENCES, permission.ACCESS_FINE_LOCATION)); + if (!grantedAccessCoarseLocation) + permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_WIFI_PREFERENCES, permission.ACCESS_COARSE_LOCATION)); + // only for API 29 add also background location For 30+ must be granted separatelly if (grantedAccessFineLocation && grantedAccessCoarseLocation && (!grantedAccessBackgroundLocation)) permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_WIFI_PREFERENCES, permission.ACCESS_BACKGROUND_LOCATION)); } @@ -1410,7 +1612,9 @@ static private void checkEventLocation(Context context, Event event, SharedPrefe } if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_BLUETOOTH_SCANNER)) { - if (event._eventPreferencesBluetooth._enabled && + if (ApplicationPreferences.applicationEventBluetoothEnableScanning && + (!ApplicationPreferences.applicationEventBluetoothDisabledScannigByProfile) && + event._eventPreferencesBluetooth._enabled && ((event._eventPreferencesBluetooth._connectionType == EventPreferencesBluetooth.CTYPE_NEARBY) || (event._eventPreferencesBluetooth._connectionType == EventPreferencesBluetooth.CTYPE_NOT_NEARBY))) { if (permissions != null) { @@ -1428,7 +1632,9 @@ static private void checkEventLocation(Context context, Event event, SharedPrefe } if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_MOBILE_CELLS)) { - if (event._eventPreferencesMobileCells._enabled) { + if (ApplicationPreferences.applicationEventMobileCellEnableScanning && + (!ApplicationPreferences.applicationEventMobileCellDisabledScannigByProfile) && + event._eventPreferencesMobileCells._enabled) { if (permissions != null) { if (!grantedAccessFineLocation) permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_MOBILE_CELLS_PREFERENCES, permission.ACCESS_FINE_LOCATION)); @@ -1461,7 +1667,9 @@ static private void checkEventLocation(Context context, Event event, SharedPrefe } if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_LOCATION_SCANNER)) { - if (event._eventPreferencesLocation._enabled) { + if (ApplicationPreferences.applicationEventLocationEnableScanning && + (!ApplicationPreferences.applicationEventLocationDisabledScannigByProfile) && + event._eventPreferencesLocation._enabled) { if (permissions != null) { if (!grantedAccessFineLocation) permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_LOCATION_PREFERENCES, permission.ACCESS_FINE_LOCATION)); @@ -1484,6 +1692,7 @@ static private void checkEventLocation(Context context, Event event, SharedPrefe //noinspection DuplicateExpressions if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_WIFI_SCANNER) || + (sensorType == EventsHandler.SENSOR_TYPE_WIFI_CONNECTION) || (sensorType == EventsHandler.SENSOR_TYPE_BLUETOOTH_SCANNER) || (sensorType == EventsHandler.SENSOR_TYPE_MOBILE_CELLS) || (sensorType == EventsHandler.SENSOR_TYPE_TIME) || @@ -1495,17 +1704,34 @@ static private void checkEventLocation(Context context, Event event, SharedPrefe if (Build.VERSION.SDK_INT >= 29) grantedAccessBackgroundLocation = ContextCompat.checkSelfPermission(context, permission.ACCESS_BACKGROUND_LOCATION) == PackageManager.PERMISSION_GRANTED; - if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_WIFI_SCANNER)) { - if ((preferences.getBoolean(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false) && - ((Integer.parseInt(preferences.getString(EventPreferencesWifi.PREF_EVENT_WIFI_CONNECTION_TYPE, "1")) == EventPreferencesWifi.CTYPE_NEARBY) || - (Integer.parseInt(preferences.getString(EventPreferencesWifi.PREF_EVENT_WIFI_CONNECTION_TYPE, "1")) == EventPreferencesWifi.CTYPE_NOT_NEARBY)))) { - if (permissions != null) { - if (!grantedAccessFineLocation) - permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_WIFI_PREFERENCES, permission.ACCESS_FINE_LOCATION)); - if (!grantedAccessCoarseLocation) - permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_WIFI_PREFERENCES, permission.ACCESS_COARSE_LOCATION)); - // only for API 29 add also background location For 30+ must be granted separatelly - if (Build.VERSION.SDK_INT >= 29) { + if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || + (sensorType == EventsHandler.SENSOR_TYPE_WIFI_SCANNER) || + (sensorType == EventsHandler.SENSOR_TYPE_WIFI_CONNECTION)) { + if (Build.VERSION.SDK_INT < 29) { + if (ApplicationPreferences.applicationEventWifiEnableScanning && + (!ApplicationPreferences.applicationEventWifiDisabledScannigByProfile) && + (preferences.getBoolean(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false) && + ((Integer.parseInt(preferences.getString(EventPreferencesWifi.PREF_EVENT_WIFI_CONNECTION_TYPE, "1")) == EventPreferencesWifi.CTYPE_NEARBY) || + (Integer.parseInt(preferences.getString(EventPreferencesWifi.PREF_EVENT_WIFI_CONNECTION_TYPE, "1")) == EventPreferencesWifi.CTYPE_NOT_NEARBY)))) { + if (permissions != null) { + if (!grantedAccessFineLocation) + permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_WIFI_PREFERENCES, permission.ACCESS_FINE_LOCATION)); + if (!grantedAccessCoarseLocation) + permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_WIFI_PREFERENCES, permission.ACCESS_COARSE_LOCATION)); + } + } + } else { + if ((preferences.getBoolean(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false) && + ((Integer.parseInt(preferences.getString(EventPreferencesWifi.PREF_EVENT_WIFI_CONNECTION_TYPE, "1")) == EventPreferencesWifi.CTYPE_CONNECTED) || + (Integer.parseInt(preferences.getString(EventPreferencesWifi.PREF_EVENT_WIFI_CONNECTION_TYPE, "1")) == EventPreferencesWifi.CTYPE_NOT_CONNECTED) || + (Integer.parseInt(preferences.getString(EventPreferencesWifi.PREF_EVENT_WIFI_CONNECTION_TYPE, "1")) == EventPreferencesWifi.CTYPE_NEARBY) || + (Integer.parseInt(preferences.getString(EventPreferencesWifi.PREF_EVENT_WIFI_CONNECTION_TYPE, "1")) == EventPreferencesWifi.CTYPE_NOT_NEARBY)))) { + if (permissions != null) { + if (!grantedAccessFineLocation) + permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_WIFI_PREFERENCES, permission.ACCESS_FINE_LOCATION)); + if (!grantedAccessCoarseLocation) + permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_WIFI_PREFERENCES, permission.ACCESS_COARSE_LOCATION)); + // only for API 29 add also background location For 30+ must be granted separatelly if (grantedAccessFineLocation && grantedAccessCoarseLocation && (!grantedAccessBackgroundLocation)) permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_WIFI_PREFERENCES, permission.ACCESS_BACKGROUND_LOCATION)); } @@ -1514,7 +1740,9 @@ static private void checkEventLocation(Context context, Event event, SharedPrefe } if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_BLUETOOTH_SCANNER)) { - if (preferences.getBoolean(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, false) && + if (ApplicationPreferences.applicationEventBluetoothEnableScanning && + (!ApplicationPreferences.applicationEventBluetoothDisabledScannigByProfile) && + preferences.getBoolean(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, false) && ((Integer.parseInt(preferences.getString(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_CONNECTION_TYPE, "1")) == EventPreferencesBluetooth.CTYPE_NEARBY) || (Integer.parseInt(preferences.getString(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_CONNECTION_TYPE, "1")) == EventPreferencesBluetooth.CTYPE_NOT_NEARBY))) { if (permissions != null) { @@ -1532,7 +1760,9 @@ static private void checkEventLocation(Context context, Event event, SharedPrefe } if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_MOBILE_CELLS)) { - if (preferences.getBoolean(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED, false)) { + if (ApplicationPreferences.applicationEventMobileCellEnableScanning && + (!ApplicationPreferences.applicationEventMobileCellDisabledScannigByProfile) && + preferences.getBoolean(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED, false)) { if (permissions != null) { if (!grantedAccessFineLocation) permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_MOBILE_CELLS_PREFERENCES, permission.ACCESS_FINE_LOCATION)); @@ -1565,7 +1795,9 @@ static private void checkEventLocation(Context context, Event event, SharedPrefe } if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_LOCATION_SCANNER)) { - if (preferences.getBoolean(EventPreferencesLocation.PREF_EVENT_LOCATION_ENABLED, false)) { + if (ApplicationPreferences.applicationEventLocationEnableScanning && + (!ApplicationPreferences.applicationEventLocationDisabledScannigByProfile) && + preferences.getBoolean(EventPreferencesLocation.PREF_EVENT_LOCATION_ENABLED, false)) { if (permissions != null) { if (!grantedAccessFineLocation) permissions.add(new PermissionType(PERMISSION_TYPE_EVENT_LOCATION_PREFERENCES, permission.ACCESS_FINE_LOCATION)); @@ -1592,9 +1824,11 @@ static private void checkEventBluetoothForEMUI(Context context, Event event, Sha if (event != null) { try { if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_BLUETOOTH_SCANNER)) { - if (event._eventPreferencesBluetooth._enabled && - ((event._eventPreferencesBluetooth._connectionType == EventPreferencesBluetooth.CTYPE_NEARBY) || - (event._eventPreferencesBluetooth._connectionType == EventPreferencesBluetooth.CTYPE_NOT_NEARBY))) { + if (ApplicationPreferences.applicationEventBluetoothEnableScanning && + (!ApplicationPreferences.applicationEventBluetoothDisabledScannigByProfile) && + event._eventPreferencesBluetooth._enabled && + ((event._eventPreferencesBluetooth._connectionType == EventPreferencesBluetooth.CTYPE_NEARBY) || + (event._eventPreferencesBluetooth._connectionType == EventPreferencesBluetooth.CTYPE_NOT_NEARBY))) { boolean granted = checkBluetoothForEMUI(context); if (permissions != null) { if (!granted) @@ -1606,9 +1840,11 @@ static private void checkEventBluetoothForEMUI(Context context, Event event, Sha } } else { if ((sensorType == EventsHandler.SENSOR_TYPE_ALL) || (sensorType == EventsHandler.SENSOR_TYPE_BLUETOOTH_SCANNER)) { - if (preferences.getBoolean(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, false) && - ((Integer.parseInt(preferences.getString(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_CONNECTION_TYPE, "1")) == EventPreferencesBluetooth.CTYPE_NEARBY) || - (Integer.parseInt(preferences.getString(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_CONNECTION_TYPE, "1")) == EventPreferencesBluetooth.CTYPE_NOT_NEARBY))) { + if (ApplicationPreferences.applicationEventBluetoothEnableScanning && + (!ApplicationPreferences.applicationEventBluetoothDisabledScannigByProfile) && + preferences.getBoolean(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, false) && + ((Integer.parseInt(preferences.getString(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_CONNECTION_TYPE, "1")) == EventPreferencesBluetooth.CTYPE_NEARBY) || + (Integer.parseInt(preferences.getString(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_CONNECTION_TYPE, "1")) == EventPreferencesBluetooth.CTYPE_NOT_NEARBY))) { boolean granted = checkBluetoothForEMUI(context); if (permissions != null) { if (!granted) @@ -2954,6 +3190,7 @@ static void grantRootX(final ProfilesPrefsFragment profilesFragment, true, true, false, false, false, + false, activity ); @@ -2981,6 +3218,7 @@ static void grantRootX(final ProfilesPrefsFragment profilesFragment, true, true, checkBoxChecked, checkBoxEnabled, false, + false, activity ); @@ -3030,6 +3268,7 @@ static void grantG1Permission(final ProfilesPrefsFragment fragment, final Activi true, true, ApplicationPreferences.applicationNeverAskForGrantG1Permission, true, false, + false, activity ); @@ -3079,6 +3318,7 @@ static boolean grantNotificationsPermission(final Activity activity) { true, true, false, false, true, + false, activity ); @@ -3093,6 +3333,7 @@ static boolean grantNotificationsPermission(final Activity activity) { false, false, false, false, false, + false, activity ); @@ -3137,6 +3378,7 @@ static void grantShizukuPermission(final ProfilesPrefsFragment fragment, true, true, false, false, false, + false, activity ); @@ -3144,11 +3386,51 @@ static void grantShizukuPermission(final ProfilesPrefsFragment fragment, dialog.show(); } else { - Intent intentLaunch = new Intent(activity, ImportantInfoActivityForceScroll.class); - intentLaunch.putExtra(ImportantInfoActivity.EXTRA_SHOW_QUICK_GUIDE, false); - intentLaunch.putExtra(ImportantInfoActivityForceScroll.EXTRA_SHOW_FRAGMENT, 1); - intentLaunch.putExtra(ImportantInfoActivityForceScroll.EXTRA_SCROLL_TO, R.id.activity_info_notification_profile_shizuku_howTo_1); - activity.startActivity(intentLaunch); + if (ShizukuUtils.isShizukuInstalled(activity.getApplicationContext()) > 0) { + PPAlertDialog dialog = new PPAlertDialog( + activity.getString(R.string.profile_preferences_types_shizuku_permission), + activity.getString(R.string.profile_preferences_types_shizuku_permission_is_installed), + activity.getString(R.string.profile_preferences_types_shizuku_permission_launch_shizuku), + activity.getString(android.R.string.cancel), + activity.getString(R.string.profile_preferences_types_shizuku_permission_show_help), + null, + (dialog1, which) -> { + Intent launchIntent = activity.getPackageManager().getLaunchIntentForPackage(ShizukuUtils.SHIZUKU_PACKAGE_NAME); + if (launchIntent != null) { + activity.startActivity(launchIntent); + } else { + Intent intentLaunch = new Intent(activity, ImportantInfoActivityForceScroll.class); + intentLaunch.putExtra(ImportantInfoActivity.EXTRA_SHOW_QUICK_GUIDE, false); + intentLaunch.putExtra(ImportantInfoActivityForceScroll.EXTRA_SHOW_FRAGMENT, 1); + intentLaunch.putExtra(ImportantInfoActivityForceScroll.EXTRA_SCROLL_TO, R.id.activity_info_notification_profile_shizuku_howTo_1); + activity.startActivity(intentLaunch); + } + }, + null, + (dialog1, which) -> { + Intent intentLaunch = new Intent(activity, ImportantInfoActivityForceScroll.class); + intentLaunch.putExtra(ImportantInfoActivity.EXTRA_SHOW_QUICK_GUIDE, false); + intentLaunch.putExtra(ImportantInfoActivityForceScroll.EXTRA_SHOW_FRAGMENT, 1); + intentLaunch.putExtra(ImportantInfoActivityForceScroll.EXTRA_SCROLL_TO, R.id.activity_info_notification_profile_shizuku_howTo_1); + activity.startActivity(intentLaunch); + }, + null, + null, + true, true, + false, false, + true, + false, + activity + ); + if ((!activity.isFinishing())) + dialog.show(); + } else { + Intent intentLaunch = new Intent(activity, ImportantInfoActivityForceScroll.class); + intentLaunch.putExtra(ImportantInfoActivity.EXTRA_SHOW_QUICK_GUIDE, false); + intentLaunch.putExtra(ImportantInfoActivityForceScroll.EXTRA_SHOW_FRAGMENT, 1); + intentLaunch.putExtra(ImportantInfoActivityForceScroll.EXTRA_SCROLL_TO, R.id.activity_info_notification_profile_shizuku_howTo_1); + activity.startActivity(intentLaunch); + } } } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneCallsListener.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneCallsListener.java index 69d432960d..93c1eee36d 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneCallsListener.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneCallsListener.java @@ -405,7 +405,7 @@ private static void callAnswered(/*boolean incoming,*/ if ((!savedSpeakerphone) && (profile._volumeSpeakerPhone == 1)) // 1=speakerphone on changeSpeakerphone = true; if (changeSpeakerphone) { - /// activate SpeakerPhone + // activate SpeakerPhone // not working in EMUI :-/ // set it to MODE_IN_CALL, becaise simulatin ronging call sets it to MODE_NORMAL diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesDashClockExtension.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesDashClockExtension.java index c1e40200b3..e0e7cfdbaa 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesDashClockExtension.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesDashClockExtension.java @@ -11,6 +11,7 @@ public class PhoneProfilesDashClockExtension extends DashClockExtension { private DataWrapper dataWrapper; private static volatile PhoneProfilesDashClockExtension instance; + /** @noinspection unused*/ public PhoneProfilesDashClockExtension() { //instance = this; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesPrefsActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesPrefsActivity.java index e02b8a0158..5f0a0a2ffe 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesPrefsActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesPrefsActivity.java @@ -15,6 +15,7 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; +import androidx.core.view.WindowCompat; import androidx.fragment.app.Fragment; /** @noinspection ExtractMethodRecommender*/ @@ -63,6 +64,10 @@ protected void onCreate(Bundle savedInstanceState) { GlobalGUIRoutines.setTheme(this, false, false, false, false, false, true); // must by called before super.onCreate() //GlobalGUIRoutines.setLanguage(this); + //if (Build.VERSION.SDK_INT >= 34) + // EdgeToEdge.enable(this); + WindowCompat.setDecorFitsSystemWindows(this.getWindow(), false); + super.onCreate(savedInstanceState); setContentView(R.layout.activity_preferences); @@ -86,8 +91,10 @@ protected void onCreate(Bundle savedInstanceState) { boolean hideBackArrow = intent.getBooleanExtra(EXTRA_HIDE_BACK_ARROW, false); Toolbar toolbar = findViewById(R.id.activity_preferences_toolbar); + //noinspection DataFlowIssue toolbar.setVisibility(View.GONE); toolbar = findViewById(R.id.activity_preferences_toolbar_no_subtitle); + //noinspection DataFlowIssue toolbar.setVisibility(View.VISIBLE); if (hideBackArrow) toolbar.setContentInsetsAbsolute(GlobalGUIRoutines.dpToPx(15), 0); @@ -246,6 +253,9 @@ protected void onCreate(Bundle savedInstanceState) { case PhoneProfilesPrefsFragment.PREF_PROFILE_LIST_NOTIFICATIONLIST_CATEGORY_ROOT: preferenceFragment = new PhoneProfilesPrefsProfileListNotification(); break; + case PhoneProfilesPrefsFragment.PREF_CALL_SCREENING_CATEGORY_ROOT: + preferenceFragment = new PhoneProfilesPrefsCallScreening(); + break; } //preferenceFragment.scrollToSet = true; } @@ -407,7 +417,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) // PPApplicationStatic.logE("[PPP_NOTIFICATION] ActivatorActivity.onActivityResult", "call of PPAppNotification.drawNotification"); ImportantInfoNotification.showInfoNotification(appContext); ProfileListNotification.drawNotification(true, appContext); - DrawOverAppsPermissionNotification.showNotification(appContext, true); + //DrawOverAppsPermissionNotification.showNotification(appContext, true); IgnoreBatteryOptimizationNotification.showNotification(appContext, true); DNDPermissionNotification.showNotification(appContext, true); PPAppNotification.drawNotification(true, appContext); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesPrefsCallScreening.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesPrefsCallScreening.java new file mode 100644 index 0000000000..8ae184ac95 --- /dev/null +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesPrefsCallScreening.java @@ -0,0 +1,31 @@ +package sk.henrichg.phoneprofilesplus; + +import android.app.Activity; +import android.content.SharedPreferences; +import android.os.Bundle; + +import androidx.preference.PreferenceManager; + +public class PhoneProfilesPrefsCallScreening extends PhoneProfilesPrefsFragment { + + @Override + public void onCreatePreferences(Bundle bundle, String rootKey) { + PreferenceManager prefMng = getPreferenceManager(); + SharedPreferences preferences = prefMng.getSharedPreferences(); + if ((getContext() != null) && (preferences != null)) { + SharedPreferences applicationPreferences = getContext().getApplicationContext().getSharedPreferences(PPApplication.APPLICATION_PREFS_NAME, Activity.MODE_PRIVATE); + loadSharedPreferences(preferences, applicationPreferences); + } + + setPreferencesFromResource(R.xml.phone_profiles_prefs_call_screening, rootKey); + } + + /* + @Override + void updateSharedPreferences(SharedPreferences.Editor editor, SharedPreferences fromPreference) { + editor.putBoolean(ApplicationPreferences.PREF_APPLICATION_EVENT_USE_PRIORITY, fromPreference.getBoolean(ApplicationPreferences.PREF_APPLICATION_EVENT_USE_PRIORITY, ApplicationPreferences.PREF_APPLICATION_EVENT_USE_PRIORITY_DEFAULT_VALUE)); + editor.putBoolean(ApplicationPreferences.PREF_APPLICATION_RESTART_EVENTS_ALERT, fromPreference.getBoolean(ApplicationPreferences.PREF_APPLICATION_RESTART_EVENTS_ALERT, ApplicationPreferences.PREF_APPLICATION_RESTART_EVENTS_ALERT_DEFAULT_VALUE)); + } + */ + +} diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesPrefsFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesPrefsFragment.java index 073769dea0..cdb58ce872 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesPrefsFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesPrefsFragment.java @@ -1,11 +1,14 @@ package sk.henrichg.phoneprofilesplus; +import static android.app.role.RoleManager.ROLE_CALL_SCREENING; import static android.content.Context.RECEIVER_NOT_EXPORTED; +import static android.content.Context.ROLE_SERVICE; import android.Manifest; import android.app.Activity; import android.app.NotificationManager; import android.app.PendingIntent; +import android.app.role.RoleManager; import android.content.ComponentName; import android.content.Context; import android.content.Intent; @@ -114,6 +117,8 @@ class PhoneProfilesPrefsFragment extends PreferenceFragmentCompat private static final String PREF_NOTIFICATION_PROFILE_LIST_SYSTEM_SETTINGS = "notificationProfileListSystemSettingsProfileList"; private static final String PREF_NOTIFICATION_SCANNING_NOTIFICATION_ACCESS_RESTRICTED_SETTINGS = "applicationEventNotificationNotificationsAccessSettingsRestrictedSettings"; static final String PREF_EVENT_MOBILE_CELLS_REGISTRATION = "applicationEventMobileCellsRegistration"; + private final String PREF_SET_CALL_SCREENING_ROLE_SETTINGS = "setCallScreeningRoleSettings"; + private final int RESULT_SET_CALL_SCREENING_ROLE_SETTINGS = 1995; static final String PREF_APPLICATION_INTERFACE_CATEGORY_ROOT = "applicationInterfaceCategoryRoot"; static final String PREF_APPLICATION_START_CATEGORY_ROOT = "categoryApplicationStartRoot"; @@ -140,6 +145,7 @@ class PhoneProfilesPrefsFragment extends PreferenceFragmentCompat static final String PREF_SHORTCUT_CATEGORY_ROOT = "categoryShortcutRoot"; static final String PREF_SAMSUNG_EDGE_PANEL_CATEGORY_ROOT = "categorySamsungEdgePanelRoot"; static final String PREF_WIDGET_DASH_CLOCK_CATEGORY_ROOT = "categoryWidgetDashClockRoot"; + static final String PREF_CALL_SCREENING_CATEGORY_ROOT = "categoryCallScreeningRoot"; static final String PREF_UNLINK_RINGER_NOTIFICATION_VOLUMES_INFO = "applicationUnlinkRingerNotificationVolumesInfo"; static final String PREF_EVENT_PERIODIC_SCANNING_SCAN_INTERVAL_INFO = "applicationEventPeriodicScanningScanIntervalInfo"; @@ -398,11 +404,11 @@ public void onActivityCreated(Bundle savedInstanceState) { return; PhoneProfilesPrefsFragment fragment = this; - final TextView preferenceSubTitle = getActivity().findViewById(R.id.activity_preferences_subtitle); + final TextView preferenceSubTitle = activity.findViewById(R.id.activity_preferences_subtitle); // must be used handler for rewrite toolbar title/subtitle - final Handler handler = new Handler(getActivity().getMainLooper()); + final Handler handler = new Handler(activity.getMainLooper()); final WeakReference activityWeakRef = new WeakReference<>(activity); handler.postDelayed(() -> { // PPApplicationStatic.logE("[IN_THREAD_HANDLER] PPApplication.startHandlerThread", "START run - from=PhoneProfilesPrefsFragment.onActivityCreated"); @@ -411,21 +417,24 @@ public void onActivityCreated(Bundle savedInstanceState) { return; Toolbar toolbar = _activity.findViewById(R.id.activity_preferences_toolbar_no_subtitle); + //noinspection DataFlowIssue toolbar.setTitle(activity.getString(R.string.title_activity_phone_profiles_preferences)); }, 200); // subtitle if (nestedFragment) { + //noinspection DataFlowIssue preferenceSubTitle.setVisibility(View.VISIBLE); - Drawable triangle = ContextCompat.getDrawable(getActivity(), R.drawable.ic_submenu_triangle); + Drawable triangle = ContextCompat.getDrawable(activity, R.drawable.ic_submenu_triangle); if (triangle != null) { - triangle.setTint(ContextCompat.getColor(getActivity(), R.color.activityNormalTextColor)); + triangle.setTint(ContextCompat.getColor(activity, R.color.activityNormalTextColor)); SpannableString headerTitle = new SpannableString(" " + fragment.getPreferenceScreen().getTitle()); - triangle.setBounds(0, + triangle.setBounds( + GlobalGUIRoutines.sip(2), GlobalGUIRoutines.sip(1), - GlobalGUIRoutines.sip(11), + GlobalGUIRoutines.sip(13), GlobalGUIRoutines.sip(10)); headerTitle.setSpan(new ImageSpan(triangle, ImageSpan.ALIGN_BASELINE), 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); preferenceSubTitle.setText(headerTitle); @@ -433,6 +442,7 @@ public void onActivityCreated(Bundle savedInstanceState) { preferenceSubTitle.setText(fragment.getPreferenceScreen().getTitle()); } else { + //noinspection DataFlowIssue preferenceSubTitle.setVisibility(View.GONE); //toolbar.setSubtitle(null); } @@ -518,6 +528,9 @@ public void onActivityCreated(Bundle savedInstanceState) { if (preferenceCategoryScreen != null) setCategorySummary(preferenceCategoryScreen); } + + preferenceCategoryScreen = findPreference(PREF_CALL_SCREENING_CATEGORY_ROOT); + if (preferenceCategoryScreen != null) setCategorySummary(preferenceCategoryScreen); } Preference preference;/* = findPreference(PREF_UNLINK_RINGER_NOTIFICATION_VOLUMES_INFO); @@ -526,7 +539,7 @@ public void onActivityCreated(Bundle savedInstanceState) { preference.setEnabled(false); }*/ - //if (!ActivateProfileHelper.getMergedRingNotificationVolumes(getActivity().getApplicationContext())) { + //if (!ActivateProfileHelper.getMergedRingNotificationVolumes(activity.getApplicationContext())) { if (!ApplicationPreferences.prefMergedRingNotificationVolumes) { // detection of volumes merge = volumes are not merged preference = findPreference(PREF_UNLINK_RINGER_NOTIFICATION_VOLUMES_INFO); @@ -547,25 +560,25 @@ public void onActivityCreated(Bundle savedInstanceState) { systemCategory.removePreference(preference);*/ } - doOnActivityCreatedBatterySaver(PREF_PERIODIC_SCANNING_POWER_SAVE_MODE_SETTINGS); - doOnActivityCreatedBatterySaver(PREF_SYSTEM_POWER_SAVE_MODE_SETTINGS); - doOnActivityCreatedBatterySaver(PREF_LOCATION_POWER_SAVE_MODE_SETTINGS); - doOnActivityCreatedBatterySaver(PREF_WIFI_POWER_SAVE_MODE_SETTINGS); - doOnActivityCreatedBatterySaver(PREF_BLUETOOTH_POWER_SAVE_MODE_SETTINGS); - doOnActivityCreatedBatterySaver(PREF_MOBILE_CELL_POWER_SAVE_MODE_SETTINGS); - doOnActivityCreatedBatterySaver(PREF_ORIENTATION_POWER_SAVE_MODE_SETTINGS); - doOnActivityCreatedBatterySaver(PREF_NOTIFICATION_POWER_SAVE_MODE_SETTINGS); + doOnActivityCreatedBatterySaver(PREF_PERIODIC_SCANNING_POWER_SAVE_MODE_SETTINGS, activity); + doOnActivityCreatedBatterySaver(PREF_SYSTEM_POWER_SAVE_MODE_SETTINGS, activity); + doOnActivityCreatedBatterySaver(PREF_LOCATION_POWER_SAVE_MODE_SETTINGS, activity); + doOnActivityCreatedBatterySaver(PREF_WIFI_POWER_SAVE_MODE_SETTINGS, activity); + doOnActivityCreatedBatterySaver(PREF_BLUETOOTH_POWER_SAVE_MODE_SETTINGS, activity); + doOnActivityCreatedBatterySaver(PREF_MOBILE_CELL_POWER_SAVE_MODE_SETTINGS, activity); + doOnActivityCreatedBatterySaver(PREF_ORIENTATION_POWER_SAVE_MODE_SETTINGS, activity); + doOnActivityCreatedBatterySaver(PREF_NOTIFICATION_POWER_SAVE_MODE_SETTINGS, activity); preference = findPreference(PREF_APPLICATION_PERMISSIONS); if (preference != null) { //preference.setWidgetLayoutResource(R.layout.start_activity_preference); preference.setOnPreferenceClickListener(preference1 -> { - //Permissions.saveAllPermissions(getActivity().getApplicationContext(), false); + //Permissions.saveAllPermissions(activity.getApplicationContext(), false); boolean ok = false; Intent intent = new Intent(Settings.ACTION_APPLICATION_DETAILS_SETTINGS); //intent.addCategory(Intent.CATEGORY_DEFAULT); intent.setData(Uri.parse(PPApplication.INTENT_DATA_PACKAGE +PPApplication.PACKAGE_NAME)); - if (GlobalGUIRoutines.activityIntentExists(intent, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityIntentExists(intent, activity.getApplicationContext())) { try { startActivityForResult(intent, RESULT_APPLICATION_PERMISSIONS); ok = true; @@ -588,10 +601,11 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -606,7 +620,7 @@ public void onActivityCreated(Bundle savedInstanceState) { preference.setOnPreferenceClickListener(preference12 -> { boolean ok = false; //if (!PPApplication.romIsMIUI) { - if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_MANAGE_WRITE_SETTINGS, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_MANAGE_WRITE_SETTINGS, activity.getApplicationContext())) { try { Intent intent = new Intent(Settings.ACTION_MANAGE_WRITE_SETTINGS); intent.setData(Uri.parse(PPApplication.INTENT_DATA_PACKAGE + PPApplication.PACKAGE_NAME)); @@ -632,10 +646,11 @@ public void onActivityCreated(Bundle savedInstanceState) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } /*} @@ -644,17 +659,17 @@ public void onActivityCreated(Bundle savedInstanceState) { // MIUI 8 Intent localIntent = new Intent("miui.intent.action.APP_PERM_EDITOR"); localIntent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.PermissionsEditorActivity"); - localIntent.putExtra(PPApplication.EXTRA_PKG_NAME, getActivity().PPApplication.PACKAGE_NAME); + localIntent.putExtra(PPApplication.EXTRA_PKG_NAME, activity.PPApplication.PACKAGE_NAME); startActivityForResult(localIntent, RESULT_WRITE_SYSTEM_SETTINGS_PERMISSIONS); } catch (Exception e) { try { // MIUI 5/6/7 Intent localIntent = new Intent("miui.intent.action.APP_PERM_EDITOR"); localIntent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.AppPermissionsEditorActivity"); - localIntent.putExtra(PPApplication.EXTRA_PKG_NAME, getActivity().PPApplication.PACKAGE_NAME); + localIntent.putExtra(PPApplication.EXTRA_PKG_NAME, activity.PPApplication.PACKAGE_NAME); startActivityForResult(localIntent, RESULT_WRITE_SYSTEM_SETTINGS_PERMISSIONS); } catch (Exception e1) { - AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity()); + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(activity); dialogBuilder.setMessage(R.string.setting_screen_not_found_alert); //dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert); dialogBuilder.setPositiveButton(android.R.string.ok, null); @@ -677,7 +692,7 @@ public void onActivityCreated(Bundle savedInstanceState) { } /*preference = findPreference(PREF_ACCESS_NOTIFICATION_POLICY_PERMISSIONS); if (preference != null) { - if (GlobalGUIRoutines.activityActionExists(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityActionExists(android.provider.Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS, activity.getApplicationContext())) { //preference.setWidgetLayoutResource(R.layout.start_activity_preference); preference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override @@ -702,12 +717,12 @@ public boolean onPreferenceClick(Preference preference) { preference.setSummary(R.string.phone_profiles_pref_drawOverlaysPermissions_summary_miui); }*/ preference.setOnPreferenceClickListener(preference13 -> { - Intent intent = new Intent(getActivity(), GrantDrawOverAppsActivity.class); + Intent intent = new Intent(activity, GrantDrawOverAppsActivity.class); startActivityForResult(intent, RESULT_DRAW_OVERLAYS_POLICY_PERMISSIONS); /* boolean ok = false; //if (!PPApplication.romIsMIUI) { - if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_MANAGE_OVERLAY_PERMISSION, activity.getApplicationContext())) { try { Intent intent = new Intent(Settings.ACTION_MANAGE_OVERLAY_PERMISSION); intent.setData(Uri.parse(PPApplication.INTENT_DATA_PACKAGE +PPApplication.PACKAGE_NAME)); @@ -733,10 +748,10 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } */ @@ -746,17 +761,17 @@ public boolean onPreferenceClick(Preference preference) { // MIUI 8 Intent localIntent = new Intent("miui.intent.action.APP_PERM_EDITOR"); localIntent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.PermissionsEditorActivity"); - localIntent.putExtra(PPApplication.EXTRA_PKG_NAME, getActivity().PPApplication.PACKAGE_NAME); + localIntent.putExtra(PPApplication.EXTRA_PKG_NAME, activity.PPApplication.PACKAGE_NAME); startActivityForResult(localIntent, RESULT_DRAW_OVERLAYS_POLICY_PERMISSIONS); } catch (Exception e) { try { // MIUI 5/6/7 Intent localIntent = new Intent("miui.intent.action.APP_PERM_EDITOR"); localIntent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.AppPermissionsEditorActivity"); - localIntent.putExtra(PPApplication.EXTRA_PKG_NAME, getActivity().PPApplication.PACKAGE_NAME); + localIntent.putExtra(PPApplication.EXTRA_PKG_NAME, activity.PPApplication.PACKAGE_NAME); startActivityForResult(localIntent, RESULT_DRAW_OVERLAYS_POLICY_PERMISSIONS); } catch (Exception e1) { - AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity()); + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(activity); dialogBuilder.setMessage(R.string.setting_screen_not_found_alert); //dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert); dialogBuilder.setPositiveButton(android.R.string.ok, null); @@ -778,11 +793,11 @@ public boolean onPreferenceClick(Preference preference) { }); } - //int locationMode = Settings.Secure.getInt(getActivity().getApplicationContext().getContentResolver(), Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF); + //int locationMode = Settings.Secure.getInt(activity.getApplicationContext().getContentResolver(), Settings.Secure.LOCATION_MODE, Settings.Secure.LOCATION_MODE_OFF); /* if (WifiScanWorker.wifi == null) - WifiScanWorker.wifi = (WifiManager) getActivity().getApplicationContext().getSystemService(Context.WIFI_SERVICE); + WifiScanWorker.wifi = (WifiManager) activity.getApplicationContext().getSystemService(Context.WIFI_SERVICE); boolean isScanAlwaysAvailable = WifiScanWorker.wifi.isScanAlwaysAvailable(); @@ -793,7 +808,7 @@ public boolean onPreferenceClick(Preference preference) { preference.setOnPreferenceClickListener(preference14 -> { boolean ok = false; //Intent intent = new Intent(WifiManager.ACTION_REQUEST_SCAN_ALWAYS_AVAILABLE); - if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_LOCATION_SOURCE_SETTINGS, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_LOCATION_SOURCE_SETTINGS, activity.getApplicationContext())) { try { Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); //intent.addCategory(Intent.CATEGORY_DEFAULT); @@ -818,10 +833,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -834,7 +850,7 @@ public boolean onPreferenceClick(Preference preference) { preference.setOnPreferenceClickListener(preference15 -> { boolean ok = false; //Intent intent = new Intent(WifiManager.ACTION_REQUEST_SCAN_ALWAYS_AVAILABLE); - if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_WIFI_SETTINGS, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_WIFI_SETTINGS, activity.getApplicationContext())) { try { Intent intent = new Intent(Settings.ACTION_WIFI_SETTINGS); //intent.addCategory(Intent.CATEGORY_DEFAULT); @@ -859,10 +875,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -875,7 +892,7 @@ public boolean onPreferenceClick(Preference preference) { //preference.setWidgetLayoutResource(R.layout.start_activity_preference); preference.setOnPreferenceClickListener(preference16 -> { boolean ok = false; - if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_LOCATION_SOURCE_SETTINGS, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_LOCATION_SOURCE_SETTINGS, activity.getApplicationContext())) { try { Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); //intent.addCategory(Intent.CATEGORY_DEFAULT); @@ -900,10 +917,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -916,7 +934,7 @@ public boolean onPreferenceClick(Preference preference) { //preference.setWidgetLayoutResource(R.layout.start_activity_preference); preference.setOnPreferenceClickListener(preference17 -> { boolean ok = false; - if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_LOCATION_SOURCE_SETTINGS, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_LOCATION_SOURCE_SETTINGS, activity.getApplicationContext())) { try { Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); //intent.addCategory(Intent.CATEGORY_DEFAULT); @@ -941,10 +959,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -955,13 +974,13 @@ public boolean onPreferenceClick(Preference preference) { if (preference != null) { //preference.setWidgetLayoutResource(R.layout.start_activity_preference); preference.setOnPreferenceClickListener(preference18 -> { -// PowerManager pm = (PowerManager) getActivity().getApplicationContext().getSystemService(Context.POWER_SERVICE); +// PowerManager pm = (PowerManager) activity.getApplicationContext().getSystemService(Context.POWER_SERVICE); // String packageName = PPApplication.PACKAGE_NAME; // if (pm.isIgnoringBatteryOptimizations(packageName) //|| -// //(!GlobalGUIRoutines.activityActionExists(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS, getActivity().getApplicationContext())) +// //(!GlobalGUIRoutines.activityActionExists(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS, activity.getApplicationContext())) // ) { boolean ok = false; - if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS, activity.getApplicationContext())) { try { Intent intent = new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS); //intent.addCategory(Intent.CATEGORY_DEFAULT); @@ -986,10 +1005,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } // } else { @@ -997,14 +1017,14 @@ public boolean onPreferenceClick(Preference preference) { // boolean ok = false; // Intent intent = new Intent(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); // intent.setData(Uri.parse(PPApplication.DATA_PACKAGE + packageName)); -// if (GlobalGUIRoutines.activityIntentExists(intent, getActivity().getApplicationContext())) { +// if (GlobalGUIRoutines.activityIntentExists(intent, activity.getApplicationContext())) { // try { // startActivity(intent); // ok = true; // } catch (Exception ignored) { // } // } else { -// if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS, getActivity().getApplicationContext())) { +// if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS, activity.getApplicationContext())) { // try { // intent = new Intent(Settings.ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS); // //intent.addCategory(Intent.CATEGORY_DEFAULT); @@ -1016,7 +1036,7 @@ public boolean onPreferenceClick(Preference preference) { // } // } // if (!ok) { -// AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity()); +// AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(activity); // dialogBuilder.setMessage(R.string.setting_screen_not_found_alert); // //dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert); // dialogBuilder.setPositiveButton(android.R.string.ok, null); @@ -1030,7 +1050,7 @@ public boolean onPreferenceClick(Preference preference) { //// if (negative != null) negative.setAllCaps(false); //// } //// }); -// if (!getActivity().isFinishing()) +// if (!activity.isFinishing()) // dialog.show(); // } // } @@ -1044,7 +1064,7 @@ public boolean onPreferenceClick(Preference preference) { preference.setOnPreferenceClickListener(preference14 -> { boolean ok = false; //Intent intent = new Intent(WifiManager.ACTION_REQUEST_SCAN_ALWAYS_AVAILABLE); - if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS, activity.getApplicationContext())) { try { Intent intent = new Intent(Settings.ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS); //intent.addCategory(Intent.CATEGORY_DEFAULT); @@ -1069,10 +1089,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -1095,7 +1116,7 @@ public boolean onPreferenceClick(Preference preference) { preference = findPreference(PREF_GRANT_ROOT_PERMISSION); if (preference != null) { preference.setOnPreferenceClickListener(preference19 -> { - Permissions.grantRootX(null, getActivity()); + Permissions.grantRootX(null, activity); setSummary(PREF_GRANT_ROOT_PERMISSION); return false; }); @@ -1105,7 +1126,7 @@ public boolean onPreferenceClick(Preference preference) { preference = findPreference(PREF_GRANT_G1_PERMISSION); if (preference != null) { preference.setOnPreferenceClickListener(preference110 -> { - Permissions.grantG1Permission(null, getActivity()); + Permissions.grantG1Permission(null, activity); return false; }); } @@ -1113,13 +1134,13 @@ public boolean onPreferenceClick(Preference preference) { preference = findPreference(PREF_GRANT_SHIZUKU_PERMISSION); if (preference != null) { preference.setOnPreferenceClickListener(preference110 -> { - Permissions.grantShizukuPermission(null, getActivity()); + Permissions.grantShizukuPermission(null, activity); setSummary(PREF_GRANT_SHIZUKU_PERMISSION); return false; }); } - if (!BluetoothScanner.bluetoothLESupported(/*getActivity().getApplicationContext()*/)) { + if (!BluetoothScanner.bluetoothLESupported(/*activity.getApplicationContext()*/)) { PreferenceScreen preferenceCategory = findPreference(PREF_BLUETOOTH_SCANNING_CATEGORY); preference = findPreference(ApplicationPreferences.PREF_APPLICATION_EVENT_BLUETOOTH_LE_SCAN_DURATION); if ((preferenceCategory != null) && (preference != null)) @@ -1130,7 +1151,7 @@ public boolean onPreferenceClick(Preference preference) { //preference.setWidgetLayoutResource(R.layout.start_activity_preference); preference.setOnPreferenceClickListener(preference111 -> { boolean ok = false; - if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_LOCATION_SOURCE_SETTINGS, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityActionExists(Settings.ACTION_LOCATION_SOURCE_SETTINGS, activity.getApplicationContext())) { try { Intent intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS); //intent.addCategory(Intent.CATEGORY_DEFAULT); @@ -1155,10 +1176,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -1174,11 +1196,11 @@ public boolean onPreferenceClick(Preference preference) { preference = findPreference(PREF_AUTOSTART_MANAGER); if (preference != null) { final AutoStartPermissionHelper autoStartPermissionHelper = AutoStartPermissionHelper.getInstance(); - if (autoStartPermissionHelper.isAutoStartPermissionAvailable(getActivity().getApplicationContext())) { + if (autoStartPermissionHelper.isAutoStartPermissionAvailable(activity.getApplicationContext())) { preference.setOnPreferenceClickListener(preference119 -> { boolean success; try { - success = autoStartPermissionHelper.getAutoStartPermission(getActivity()); + success = autoStartPermissionHelper.getAutoStartPermission(activity); }catch (Exception e) { PPApplicationStatic.logException("****** PhoneProfilesPrefsFragment.onActivityCreated", Log.getStackTraceString(e)); success = false; @@ -1204,10 +1226,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, false, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -1271,11 +1294,11 @@ public boolean onPreferenceClick(Preference preference) { preference.setOnPreferenceClickListener(preference112 -> { boolean ok = false; // PPApplicationStatic.logE("[PPP_NOTIFICATION] PhoneProfilesPrefsFragment.onActivityCreated - activated porofile notification preference", "call of PPApplication.createPPPAppNotificationChannel()"); - PPApplicationStatic.createPPPAppNotificationChannel(getActivity().getApplicationContext(), false); + PPApplicationStatic.createPPPAppNotificationChannel(activity.getApplicationContext(), false); Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS); intent.putExtra(Settings.EXTRA_CHANNEL_ID, PPApplication.PROFILE_NOTIFICATION_CHANNEL); intent.putExtra(Settings.EXTRA_APP_PACKAGE, PPApplication.PACKAGE_NAME); - if (GlobalGUIRoutines.activityIntentExists(intent, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityIntentExists(intent, activity.getApplicationContext())) { try { startActivity(intent); ok = true; @@ -1298,10 +1321,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -1315,11 +1339,11 @@ public boolean onPreferenceClick(Preference preference) { preference.setOnPreferenceClickListener(preference112 -> { boolean ok = false; // PPApplicationStatic.logE("[PPP_NOTIFICATION] PhoneProfilesPrefsFragment.onActivityCreated - activated porofile notification preference", "call of PPApplication.createPPPAppNotificationChannel()"); - PPApplicationStatic.createPPPAppNotificationChannel(getActivity().getApplicationContext(), false); + PPApplicationStatic.createPPPAppNotificationChannel(activity.getApplicationContext(), false); Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS); intent.putExtra(Settings.EXTRA_CHANNEL_ID, PPApplication.PROFILE_LIST_NOTIFICATION_CHANNEL); intent.putExtra(Settings.EXTRA_APP_PACKAGE, PPApplication.PACKAGE_NAME); - if (GlobalGUIRoutines.activityIntentExists(intent, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityIntentExists(intent, activity.getApplicationContext())) { try { startActivity(intent); ok = true; @@ -1342,10 +1366,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -1358,7 +1383,7 @@ public boolean onPreferenceClick(Preference preference) { preference.setOnPreferenceClickListener(preference113 -> { boolean ok = false; // PPApplicationStatic.logE("[PPP_NOTIFICATION] PhoneProfilesPrefsFragment.onActivityCreated - all notifications preference", "call of PPApplication.createPPPAppNotificationChannel()"); - PPApplicationStatic.createPPPAppNotificationChannel(getActivity().getApplicationContext(), false); + PPApplicationStatic.createPPPAppNotificationChannel(activity.getApplicationContext(), false); Intent intent = new Intent(); if (Build.VERSION.SDK_INT > 26) { @@ -1370,10 +1395,10 @@ public boolean onPreferenceClick(Preference preference) { } else { intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS"); intent.putExtra(EXTRA_APP_PACKAGE, PPApplication.PACKAGE_NAME); - intent.putExtra(EXTRA_APP_UID, getActivity().getApplicationInfo().uid); + intent.putExtra(EXTRA_APP_UID, activity.getApplicationInfo().uid); } - if (GlobalGUIRoutines.activityIntentExists(intent, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityIntentExists(intent, activity.getApplicationContext())) { try { startActivity(intent); ok = true; @@ -1396,10 +1421,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -1411,7 +1437,7 @@ public boolean onPreferenceClick(Preference preference) { preference.setOnPreferenceClickListener(preference113 -> { boolean ok = false; // PPApplicationStatic.logE("[PPP_NOTIFICATION] PhoneProfilesPrefsFragment.onActivityCreated - all notifications preference", "call of PPApplication.createPPPAppNotificationChannel()"); - PPApplicationStatic.createPPPAppNotificationChannel(getActivity().getApplicationContext(), false); + PPApplicationStatic.createPPPAppNotificationChannel(activity.getApplicationContext(), false); Intent intent = new Intent(); if (Build.VERSION.SDK_INT > 26) { @@ -1423,10 +1449,10 @@ public boolean onPreferenceClick(Preference preference) { } else { intent.setAction("android.settings.APP_NOTIFICATION_SETTINGS"); intent.putExtra(EXTRA_APP_PACKAGE, PPApplication.PACKAGE_NAME); - intent.putExtra(EXTRA_APP_UID, getActivity().getApplicationInfo().uid); + intent.putExtra(EXTRA_APP_UID, activity.getApplicationInfo().uid); } - if (GlobalGUIRoutines.activityIntentExists(intent, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityIntentExists(intent, activity.getApplicationContext())) { try { startActivity(intent); ok = true; @@ -1449,10 +1475,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -1466,7 +1493,7 @@ public boolean onPreferenceClick(Preference preference) { boolean ok = false; String action; action = Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS; - if (GlobalGUIRoutines.activityActionExists(action, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityActionExists(action, activity.getApplicationContext())) { try { Intent intent = new Intent(action); startActivityForResult(intent, RESULT_NOTIFICATION_NOTIFICATION_ACCESS_SYSTEM_SETTINGS); @@ -1490,10 +1517,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -1503,25 +1531,25 @@ public boolean onPreferenceClick(Preference preference) { //preference = findPreference(PREF_APPLICATION_POWER_MANAGER); //if (preference != null) { /*boolean intentFound = false; - KillerManager.init(getActivity()); + KillerManager.init(activity); DeviceBase device = KillerManager.getDevice(); if (device != null) { - Intent intent = device.getActionPowerSaving(getActivity()); - if (intent != null && ActionsUtils.isIntentAvailable(getActivity(), intent)) + Intent intent = device.getActionPowerSaving(activity); + if (intent != null && ActionsUtils.isIntentAvailable(activity, intent)) intentFound = true; - //if (intent != null && GlobalGUIRoutines.activityIntentExists(intent, getActivity())) + //if (intent != null && GlobalGUIRoutines.activityIntentExists(intent, activity)) // intentFound = true; } /* - if (KillerManager.isActionAvailable(getActivity(), KillerManager.Actions.ACTION_POWERSAVING)) { + if (KillerManager.isActionAvailable(activity, KillerManager.Actions.ACTION_POWERSAVING)) { preference.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { try { - KillerManager.doActionPowerSaving(getActivity()); + KillerManager.doActionPowerSaving(activity); }catch (Exception e) { - if (getActivity() != null) { - AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity()); + if (activity != null) { + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(activity); dialogBuilder.setMessage(R.string.setting_screen_not_found_alert); //dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert); dialogBuilder.setPositiveButton(android.R.string.ok, null); @@ -1535,7 +1563,7 @@ public boolean onPreferenceClick(Preference preference) { // if (negative != null) negative.setAllCaps(false); // } // }); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } } @@ -1552,7 +1580,7 @@ public boolean onPreferenceClick(Preference preference) { preference = findPreference(PREF_UNLINK_RINGER_NOTIFICATION_VLUMES_IMPORTANT_INFO); if (preference != null) { preference.setOnPreferenceClickListener(preference115 -> { - Intent intentLaunch = new Intent(getActivity(), ImportantInfoActivityForceScroll.class); + Intent intentLaunch = new Intent(activity, ImportantInfoActivityForceScroll.class); intentLaunch.putExtra(ImportantInfoActivity.EXTRA_SHOW_QUICK_GUIDE, false); intentLaunch.putExtra(ImportantInfoActivityForceScroll.EXTRA_SHOW_FRAGMENT, 1); intentLaunch.putExtra(ImportantInfoActivityForceScroll.EXTRA_SCROLL_TO, R.id.activity_info_notification_how_does_volume_separation_work_title); @@ -1567,7 +1595,7 @@ public boolean onPreferenceClick(Preference preference) { getString(R.string.phone_profiles_pref_applicationDoNotKillMyApp_webSiteName) + " " + getString(R.string.phone_profiles_pref_applicationDoNotKillMyApp_summary2)); preference.setOnPreferenceClickListener(preference116 -> { - PPApplicationStatic.showDoNotKillMyAppDialog(getActivity()); + PPApplicationStatic.showDoNotKillMyAppDialog(activity); return false; }); } @@ -1584,15 +1612,15 @@ public boolean onPreferenceClick(Preference preference) { boolean ok = false; Intent intent = new Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS); intent.putExtra(Settings.EXTRA_CHANNEL_ID, PPApplication.NOT_USED_MOBILE_CELL_NOTIFICATION_CHANNEL); - intent.putExtra(Settings.EXTRA_APP_PACKAGE, getActivity().PPApplication.PACKAGE_NAME); - if (GlobalGUIRoutines.activityIntentExists(intent, getActivity().getApplicationContext())) { + intent.putExtra(Settings.EXTRA_APP_PACKAGE, activity.PPApplication.PACKAGE_NAME); + if (GlobalGUIRoutines.activityIntentExists(intent, activity.getApplicationContext())) { try { startActivity(intent); ok = true; } catch (Exception ignored) {} } if (!ok) { - AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(getActivity()); + AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(activity); dialogBuilder.setMessage(R.string.setting_screen_not_found_alert); //dialogBuilder.setIcon(android.R.drawable.ic_dialog_alert); dialogBuilder.setPositiveButton(android.R.string.ok, null); @@ -1606,7 +1634,7 @@ public boolean onPreferenceClick(Preference preference) { // if (negative != null) negative.setAllCaps(false); // } // }); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -1653,10 +1681,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, false, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); return false; }); @@ -1687,7 +1716,7 @@ public boolean onPreferenceClick(Preference preference) { intent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.PermissionsEditorActivity"); intent.putExtra(PPApplication.EXTRA_PKG_NAME, PPApplication.PACKAGE_NAME); - if (GlobalGUIRoutines.activityIntentExists(intent, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityIntentExists(intent, activity.getApplicationContext())) { try { startActivity(intent); ok = true; @@ -1710,10 +1739,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog2.show(); } }, @@ -1724,10 +1754,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, false, - getActivity() + false, + activity ); - if ((getActivity() != null) && (!getActivity().isFinishing())) + if (!activity.isFinishing()) dialog.show(); return false; }); @@ -1737,12 +1768,12 @@ public boolean onPreferenceClick(Preference preference) { if (preference != null) { boolean hyperOsWifiBluetoothDialogs = preferences.getBoolean(ApplicationPreferences.PREF_APPLICATION_HYPER_OS_WIFI_BLUETOOTH_DIALOGS, ApplicationPreferences.PREF_APPLICATION_HYPER_OS_WIFI_BLUETOOTH_DIALOGS_DEFAULT_VALUE); - SharedPreferences appSharedPreferences = ApplicationPreferences.getSharedPreferences(getActivity().getApplicationContext()); + SharedPreferences appSharedPreferences = ApplicationPreferences.getSharedPreferences(activity.getApplicationContext()); if (appSharedPreferences != null) { SharedPreferences.Editor editor = appSharedPreferences.edit(); editor.putBoolean(ApplicationPreferences.PREF_APPLICATION_HYPER_OS_WIFI_BLUETOOTH_DIALOGS, hyperOsWifiBluetoothDialogs); editor.apply(); - ApplicationPreferences.applicationHyperOsWifiBluetoothDialogs(getActivity().getApplicationContext()); + ApplicationPreferences.applicationHyperOsWifiBluetoothDialogs(activity.getApplicationContext()); } Permissions.setHyperOSWifiBluetoothDialogAppOp(); } @@ -1815,7 +1846,7 @@ public boolean onPreferenceClick(Preference preference) { (dialog1, which) -> { boolean ok = false; final Intent intent = new Intent(Settings.ACTION_SETTINGS); - if (GlobalGUIRoutines.activityIntentExists(intent, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityIntentExists(intent, activity.getApplicationContext())) { try { startActivity(intent); ok = true; @@ -1838,10 +1869,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog2.show(); } }, @@ -1852,10 +1884,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, false, - getActivity() + false, + activity ); - if ((getActivity() != null) && (!getActivity().isFinishing())) + if (!activity.isFinishing()) dialog.show(); return false; }); @@ -1873,9 +1906,9 @@ public boolean onPreferenceClick(Preference preference) { ///////////////// if (Build.VERSION.SDK_INT >= 31) { - if (PPApplicationStatic.isPixelLauncherDefault(getActivity()) || - PPApplicationStatic.isOneUILauncherDefault(getActivity()) || - PPApplicationStatic.isMIUILauncherDefault(getActivity())) { + if (PPApplicationStatic.isPixelLauncherDefault(activity) || + PPApplicationStatic.isOneUILauncherDefault(activity) || + PPApplicationStatic.isMIUILauncherDefault(activity)) { //preference = findPreference(ApplicationPreferences.PREF_APPLICATION_WIDGET_ICON_ROUNDED_CORNERS); //if (preference != null) // preference.setVisible(false); @@ -1925,8 +1958,8 @@ public boolean onPreferenceClick(Preference preference) { if (preferenceCategory != null) { preferenceCategory.removePreference(preference); if (preferenceCategory.getPreferenceCount() == 0) { - if (getActivity() != null) { - preference = new Preference(getActivity().getApplicationContext()); + //if (getActivity() != null) { + preference = new Preference(activity.getApplicationContext()); preference.setKey("specialProfileParameters_noParameters"); preference.setIconSpaceReserved(false); preference.setLayoutResource(R.layout.mp_preference_material_widget); @@ -1934,7 +1967,7 @@ public boolean onPreferenceClick(Preference preference) { preference.setTitle(R.string.phone_profiles_pref_applicationSpecialPreferencesNotAny); preference.setEnabled(false); preferenceCategory.addPreference(preference); - } + //} } } } @@ -1978,7 +2011,7 @@ public boolean onPreferenceClick(Preference preference) { preference = prefMng.findPreference(PREF_CREATE_EDITOR_SHORTCUT); if (preference != null) { - //Context appContext = getActivity().getApplicationContext(); + //Context appContext = activity.getApplicationContext(); if (ShortcutManagerCompat.isRequestPinShortcutSupported(appContext)) { List shortcuts = ShortcutManagerCompat.getShortcuts(appContext, ShortcutManagerCompat.FLAG_MATCH_PINNED); @@ -2033,7 +2066,7 @@ public boolean onPreferenceClick(Preference preference) { ShortcutInfoCompat shortcutInfo = shortcutBuilderCompat.build(); ShortcutManagerCompat.requestPinShortcut(appContext, shortcutInfo, successCallback.getIntentSender()); - //fragment.getActivity().setResult(Activity.RESULT_OK, intent); + //activity.setResult(Activity.RESULT_OK, intent); } catch (Exception e) { // show dialog about this crash // for Microsft laucher it is: @@ -2085,7 +2118,7 @@ public boolean onPreferenceClick(Preference preference) { preference = prefMng.findPreference(PREF_CREATE_MOBILE_CELL_SCANNING_SHORTCUT); if (preference != null) { - //Context appContext = getActivity().getApplicationContext(); + //Context appContext = activity.getApplicationContext(); if (ShortcutManagerCompat.isRequestPinShortcutSupported(appContext)) { List shortcuts = ShortcutManagerCompat.getShortcuts(appContext, ShortcutManagerCompat.FLAG_MATCH_PINNED); @@ -2140,7 +2173,7 @@ public boolean onPreferenceClick(Preference preference) { ShortcutInfoCompat shortcutInfo = shortcutBuilderCompat.build(); ShortcutManagerCompat.requestPinShortcut(appContext, shortcutInfo, successCallback.getIntentSender()); - //fragment.getActivity().setResult(Activity.RESULT_OK, intent); + //activity.setResult(Activity.RESULT_OK, intent); } catch (Exception e) { // show dialog about this crash // for Microsft laucher it is: @@ -2190,16 +2223,58 @@ public boolean onPreferenceClick(Preference preference) { infoDialogPreference.setIsHtml(true); } + if (Build.VERSION.SDK_INT >= 29) { + Preference callScreeningPreference = prefMng.findPreference(PREF_SET_CALL_SCREENING_ROLE_SETTINGS); + if (callScreeningPreference != null) { + //callScreeningPreference.setWidgetLayoutResource(R.layout.start_activity_preference); + callScreeningPreference.setOnPreferenceClickListener(preference13 -> { + RoleManager roleManager = (RoleManager) appContext.getSystemService(ROLE_SERVICE); + if (roleManager != null) { + if (roleManager.isRoleHeld(ROLE_CALL_SCREENING)) { + Intent intent = new Intent(Settings.ACTION_MANAGE_DEFAULT_APPS_SETTINGS); + //intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); + startActivityForResult(intent, RESULT_SET_CALL_SCREENING_ROLE_SETTINGS); + } else { + Intent intent = roleManager.createRequestRoleIntent(ROLE_CALL_SCREENING); + startActivityForResult(intent, RESULT_SET_CALL_SCREENING_ROLE_SETTINGS); + } + } else { + PPAlertDialog dialog2 = new PPAlertDialog( + callScreeningPreference.getTitle(), + getString(R.string.setting_screen_not_found_alert), + getString(android.R.string.ok), + null, + null, null, + null, + null, + null, + null, + null, + true, true, + false, false, + true, + false, + activity + ); + + if (!activity.isFinishing()) + dialog2.show(); + } + return false; + }); + } + } + } - private void doOnActivityCreatedBatterySaver(String key) { + private void doOnActivityCreatedBatterySaver(String key, PhoneProfilesPrefsActivity activity) { Preference preference = findPreference(key); if (preference != null) { //preference.setWidgetLayoutResource(R.layout.start_activity_preference); preference.setOnPreferenceClickListener(preference1 -> { boolean activityExists; Intent intent; - activityExists = (getActivity() != null) && GlobalGUIRoutines.activityActionExists(Settings.ACTION_BATTERY_SAVER_SETTINGS, getActivity().getApplicationContext()); + activityExists = GlobalGUIRoutines.activityActionExists(Settings.ACTION_BATTERY_SAVER_SETTINGS, activity.getApplicationContext()); intent = new Intent(Settings.ACTION_BATTERY_SAVER_SETTINGS); if (activityExists) { //intent.addCategory(Intent.CATEGORY_DEFAULT); @@ -2209,7 +2284,7 @@ private void doOnActivityCreatedBatterySaver(String key) { } catch (Exception e) { intent = new Intent(); intent.setComponent(new ComponentName(StringConstants.SETTINGS_PACKAGE_NAME, StringConstants.SETTINGS_BATTERY_SAVER_CLASS_NAME)); - activityExists = GlobalGUIRoutines.activityIntentExists(intent, getActivity().getApplicationContext()); + activityExists = GlobalGUIRoutines.activityIntentExists(intent, activity.getApplicationContext()); if (activityExists) { try { //noinspection deprecation @@ -2235,10 +2310,11 @@ private void doOnActivityCreatedBatterySaver(String key) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); } return false; @@ -2524,6 +2600,13 @@ void doOnActivityResult(int requestCode, int resultCode/*, Intent data*/) if (preference != null) preference.startRegistration(); } + + if (requestCode == RESULT_SET_CALL_SCREENING_ROLE_SETTINGS) { + if (Build.VERSION.SDK_INT >= 29) { + setSummary(PREF_SET_CALL_SCREENING_ROLE_SETTINGS); + } + } + } @SuppressWarnings("deprecation") @@ -2575,6 +2658,8 @@ private void updateAllSummary() if (getActivity() == null) return; + PhoneProfilesPrefsActivity activity = (PhoneProfilesPrefsActivity) getActivity(); + setSummary(ApplicationPreferences.PREF_APPLICATION_START_ON_BOOT); setSummary(ApplicationPreferences.PREF_APPLICATION_ACTIVATE); setSummary(ApplicationPreferences.PREF_APPLICATION_ALERT); @@ -2817,9 +2902,10 @@ private void updateAllSummary() //setSummary(PREF_NOTIFICATION_PROFILE_ICON_COLOR_INFO1); setSummary(PREF_NOTIFICATION_PROFILE_ICON_COLOR_INFO2); + setSummary(PREF_SET_CALL_SCREENING_ROLE_SETTINGS); - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, getActivity().getApplicationContext()); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, true, activity.getApplicationContext()); + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { /*prefMng.findPreference(PPApplication.PREF_APPLICATION_EVENT_WIFI_SCAN_INTERVAL).setEnabled(false); prefMng.findPreference(PPApplication.PREF_APPLICATION_EVENT_WIFI_ENABLE_WIFI).setEnabled(false); @@ -2828,13 +2914,14 @@ private void updateAllSummary() SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean(ApplicationPreferences.PREF_APPLICATION_EVENT_WIFI_ENABLE_WIFI, false); editor.apply(); + // this disables the entire preferences screen Preference preference = prefMng.findPreference(PREF_WIFI_SCANNING_CATEGORY); if (preference != null) preference.setEnabled(false); } - preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, getActivity().getApplicationContext()); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) + preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, true, activity.getApplicationContext()); + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { /*prefMng.findPreference(PPApplication.PREF_APPLICATION_EVENT_BLUETOOTH_SCAN_INTERVAL).setEnabled(false); prefMng.findPreference(PPApplication.PREF_APPLICATION_EVENT_BLUETOOTH_ENABLE_BLUETOOTH).setEnabled(false); @@ -2845,29 +2932,31 @@ private void updateAllSummary() SharedPreferences.Editor editor = preferences.edit(); editor.putBoolean(ApplicationPreferences.PREF_APPLICATION_EVENT_BLUETOOTH_ENABLE_BLUETOOTH, false); editor.apply(); + // this disables the entire preferences screen Preference preference = prefMng.findPreference(PREF_BLUETOOTH_SCANNING_CATEGORY); if (preference != null) preference.setEnabled(false); } - preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesOrientation.PREF_EVENT_ORIENTATION_ENABLED, getActivity().getApplicationContext()); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) + preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesOrientation.PREF_EVENT_ORIENTATION_ENABLED, true, activity.getApplicationContext()); + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + // this disables the entire preferences screen Preference preference = prefMng.findPreference(PREF_ORIENTATION_SCANNING_CATEGORY); if (preference != null) preference.setEnabled(false); } - preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED, getActivity().getApplicationContext()); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) + preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED, true, activity.getApplicationContext()); + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { - + // this disables the entire preferences screen Preference preference = prefMng.findPreference(PREF_MOBILE_CELLS_SCANNING_CATEGORY); if (preference != null) preference.setEnabled(false); } - if (!GlobalUtils.isLocationEnabled(getActivity().getApplicationContext())) { + if (!GlobalUtils.isLocationEnabled(activity.getApplicationContext())) { Preference preference = prefMng.findPreference(PREF_LOCATION_EDITOR); if (preference != null) preference.setEnabled(false); @@ -4073,6 +4162,24 @@ private void setSummary(String key) { } } } + if (key.equals(PREF_SET_CALL_SCREENING_ROLE_SETTINGS)) { + if (Build.VERSION.SDK_INT >= 29) { + String summary = getString(R.string.phone_profiles_pref_call_screening_setCallScreeningRole_summary); + Preference _preference = prefMng.findPreference(key); + if (_preference != null) { + RoleManager roleManager = (RoleManager) context.getSystemService(ROLE_SERVICE); + boolean isHeld = (roleManager != null) && roleManager.isRoleHeld(ROLE_CALL_SCREENING); + if (isHeld) { + summary = getString(R.string.phone_profiles_pref_call_screening_setCallScreeningRole_summary_ststus_1) + + StringConstants.STR_DOUBLE_NEWLINE + summary; + } else { + summary = getString(R.string.phone_profiles_pref_call_screening_setCallScreeningRole_summary_ststus_0) + + StringConstants.STR_DOUBLE_NEWLINE + summary; + } + _preference.setSummary(summary); + } + } + } // Do not bind toggles. if (preference instanceof CheckBoxPreference || preference instanceof SwitchPreferenceCompat) { @@ -4145,6 +4252,7 @@ private void setCategorySummary(Preference preferenceCategory) { Context context = getActivity().getApplicationContext(); + PhoneProfilesPrefsActivity activity = (PhoneProfilesPrefsActivity) getActivity(); String key = preferenceCategory.getKey(); @@ -4236,24 +4344,24 @@ private void setCategorySummary(Preference preferenceCategory) { _value.append(getString(R.string.phone_profiles_pref_applicationEventBackgroundScanningEnableScanning)).append(StringConstants.STR_COLON_WITH_SPACE); if (ApplicationPreferences.applicationEventPeriodicScanningEnableScanning) { _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_enabled), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_enabled), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); _value.append(StringConstants.TAG_DOUBLE_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_applicationEventBackgroundScanningScanInterval)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(String.valueOf(ApplicationPreferences.applicationEventPeriodicScanningScanInterval), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(String.valueOf(ApplicationPreferences.applicationEventPeriodicScanningScanInterval), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); _value.append(StringConstants.TAG_DOUBLE_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_applicationEventScanOnlyWhenScreenIsOn)); } else { if (!ApplicationPreferences.applicationEventPeriodicScanningDisabledScannigByProfile) _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_disabled), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_disabled), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); else _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } } @@ -4264,26 +4372,26 @@ private void setCategorySummary(Preference preferenceCategory) { _value.append(getString(R.string.phone_profiles_pref_applicationEventLocationEnableScanning)).append(StringConstants.STR_COLON_WITH_SPACE); if (ApplicationPreferences.applicationEventLocationEnableScanning) { _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_enabled), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_enabled), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); if (!GlobalUtils.isLocationEnabled(context)) { _value.append(StringConstants.TAG_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_eventLocationSystemSettings)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } else { _value.append(StringConstants.TAG_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_eventLocationSystemSettings)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsEnabled_summary), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsEnabled_summary), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } _value.append(StringConstants.TAG_DOUBLE_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_applicationEventLocationScanInterval)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(String.valueOf(ApplicationPreferences.applicationEventLocationUpdateInterval), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(String.valueOf(ApplicationPreferences.applicationEventLocationUpdateInterval), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); _value.append(StringConstants.TAG_DOUBLE_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_applicationEventLocationsEditor)); @@ -4295,20 +4403,20 @@ private void setCategorySummary(Preference preferenceCategory) { else { if (!ApplicationPreferences.applicationEventLocationDisabledScannigByProfile) _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_disabled), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_disabled), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); else _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } } if (key.equals(PREF_WIFI_SCANNING_CATEGORY_ROOT)) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, true, context); + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { _value.append(getString(R.string.profile_preferences_device_not_allowed)) .append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(preferenceAllowed.getNotAllowedPreferenceReasonString(context), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(preferenceAllowed.getNotAllowedPreferenceReasonString(context), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } else { @@ -4318,19 +4426,19 @@ private void setCategorySummary(Preference preferenceCategory) { _value.append(getString(R.string.phone_profiles_pref_applicationEventWifiEnableScanning)).append(StringConstants.STR_COLON_WITH_SPACE); if (ApplicationPreferences.applicationEventWifiEnableScanning) { _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_enabled), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_enabled), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); if (!GlobalUtils.isLocationEnabled(context)) { _value.append(StringConstants.TAG_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_eventLocationSystemSettings)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } else { _value.append(StringConstants.TAG_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_eventLocationSystemSettings)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsEnabled_summary), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsEnabled_summary), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } if (Build.VERSION.SDK_INT < 27) { @@ -4338,13 +4446,13 @@ private void setCategorySummary(Preference preferenceCategory) { _value.append(StringConstants.TAG_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_eventWiFiKeepOnSystemSettings)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_eventWiFiKeepOnSystemSettings_setToAlways_summary), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_eventWiFiKeepOnSystemSettings_setToAlways_summary), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } else { _value.append(StringConstants.TAG_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_eventWiFiKeepOnSystemSettings)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_eventWiFiKeepOnSystemSettings_notSetToAlways_summary), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_eventWiFiKeepOnSystemSettings_notSetToAlways_summary), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } } @@ -4352,7 +4460,7 @@ private void setCategorySummary(Preference preferenceCategory) { _value.append(StringConstants.TAG_DOUBLE_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_applicationEventWifiScanInterval)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(String.valueOf(ApplicationPreferences.applicationEventWifiScanInterval), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(String.valueOf(ApplicationPreferences.applicationEventWifiScanInterval), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); _value.append(StringConstants.TAG_DOUBLE_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_applicationEventWifiScanIfWifiOff)); @@ -4361,21 +4469,21 @@ private void setCategorySummary(Preference preferenceCategory) { } else { if (!ApplicationPreferences.applicationEventWifiDisabledScannigByProfile) _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_disabled), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_disabled), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); else _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } } } if (key.equals(PREF_BLUETOOTH_SCANNING_CATEGORY_ROOT)) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, true, context); + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { _value.append(getString(R.string.profile_preferences_device_not_allowed)) .append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(preferenceAllowed.getNotAllowedPreferenceReasonString(context), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(preferenceAllowed.getNotAllowedPreferenceReasonString(context), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } else { @@ -4385,26 +4493,26 @@ private void setCategorySummary(Preference preferenceCategory) { _value.append(getString(R.string.phone_profiles_pref_applicationEventBluetoothEnableScanning)).append(StringConstants.STR_COLON_WITH_SPACE); if (ApplicationPreferences.applicationEventBluetoothEnableScanning) { _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_enabled), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_enabled), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); if (!GlobalUtils.isLocationEnabled(context)) { _value.append(StringConstants.TAG_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_eventLocationSystemSettings)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } else { _value.append(StringConstants.TAG_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_eventLocationSystemSettings)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsEnabled_summary), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsEnabled_summary), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } _value.append(StringConstants.TAG_DOUBLE_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_applicationEventBluetoothScanInterval)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(String.valueOf(ApplicationPreferences.applicationEventBluetoothScanInterval), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(String.valueOf(ApplicationPreferences.applicationEventBluetoothScanInterval), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); _value.append(StringConstants.TAG_DOUBLE_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_applicationEventBluetoothScanIfBluetoothOff)); @@ -4415,21 +4523,21 @@ private void setCategorySummary(Preference preferenceCategory) { } else { if (!ApplicationPreferences.applicationEventBluetoothDisabledScannigByProfile) _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_disabled), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_disabled), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); else _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } } } if (key.equals(PREF_MOBILE_CELLS_SCANNING_CATEGORY_ROOT)) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED, true, context); + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { _value.append(getString(R.string.profile_preferences_device_not_allowed)) .append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(preferenceAllowed.getNotAllowedPreferenceReasonString(context), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(preferenceAllowed.getNotAllowedPreferenceReasonString(context), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); //addEnd = false; } @@ -4440,19 +4548,19 @@ private void setCategorySummary(Preference preferenceCategory) { if (ApplicationPreferences.applicationEventMobileCellEnableScanning) { // PPApplicationStatic.logE("[TEST BATTERY] PhoneProfilesPrefsFragment.setCategorySummary", "******** ### *******"); _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_enabled), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_enabled), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); if (!GlobalUtils.isLocationEnabled(context)) { _value.append(StringConstants.TAG_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_eventLocationSystemSettings)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsDisabled_summary), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } else { _value.append(StringConstants.TAG_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_eventLocationSystemSettings)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsEnabled_summary), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningLocationSettingsEnabled_summary), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } _value.append(StringConstants.TAG_DOUBLE_BREAK_HTML); @@ -4460,21 +4568,21 @@ private void setCategorySummary(Preference preferenceCategory) { } else { if (!ApplicationPreferences.applicationEventMobileCellDisabledScannigByProfile) _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_disabled), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_disabled), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); else _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } } } if (key.equals(PREF_ORIENTATION_SCANNING_CATEGORY_ROOT)) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesOrientation.PREF_EVENT_ORIENTATION_ENABLED, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesOrientation.PREF_EVENT_ORIENTATION_ENABLED, true, context); + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { _value.append(getString(R.string.profile_preferences_device_not_allowed)) .append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(preferenceAllowed.getNotAllowedPreferenceReasonString(context), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(preferenceAllowed.getNotAllowedPreferenceReasonString(context), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } else { @@ -4485,12 +4593,12 @@ private void setCategorySummary(Preference preferenceCategory) { if (ApplicationPreferences.applicationEventOrientationEnableScanning) { // PPApplicationStatic.logE("[TEST BATTERY] PhoneProfilesPrefsFragment.setCategorySummary", "******** ### *******"); _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_enabled), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_enabled), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); _value.append(StringConstants.TAG_DOUBLE_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_applicationEventOrientationScanInterval)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(String.valueOf(ApplicationPreferences.applicationEventOrientationScanInterval), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(String.valueOf(ApplicationPreferences.applicationEventOrientationScanInterval), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); _value.append(StringConstants.TAG_DOUBLE_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_applicationEventScanOnlyWhenScreenIsOn)); @@ -4498,21 +4606,21 @@ private void setCategorySummary(Preference preferenceCategory) { else { if (!ApplicationPreferences.applicationEventOrientationDisabledScannigByProfile) _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_disabled), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_disabled), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); else _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } } } if (key.equals(PREF_NOTIFICATION_SCANNING_CATEGORY_ROOT)) { - PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesNotification.PREF_EVENT_NOTIFICATION_ENABLED, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + PreferenceAllowed preferenceAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesNotification.PREF_EVENT_NOTIFICATION_ENABLED, true, context); + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { _value.append(getString(R.string.profile_preferences_device_not_allowed)) .append(StringConstants.STR_COLON_WITH_SPACE).append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(preferenceAllowed.getNotAllowedPreferenceReasonString(context), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(preferenceAllowed.getNotAllowedPreferenceReasonString(context), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } else { @@ -4521,19 +4629,19 @@ private void setCategorySummary(Preference preferenceCategory) { _value.append(getString(R.string.phone_profiles_pref_applicationEventNotificationEnableScanning)).append(StringConstants.STR_COLON_WITH_SPACE); if (ApplicationPreferences.applicationEventNotificationEnableScanning) { _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_enabled), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_enabled), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); if (!PPNotificationListenerService.isNotificationListenerServiceEnabled(context, true)) { _value.append(StringConstants.TAG_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_eventNotificationAccessSystemSettings)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue("* " + getString(R.string.phone_profiles_pref_applicationEventScanningNotificationAccessSettingsDisabled_summary) + "! *", prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue("* " + getString(R.string.phone_profiles_pref_applicationEventScanningNotificationAccessSettingsDisabled_summary) + "! *", prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } else { _value.append(StringConstants.TAG_BREAK_HTML); _value.append(getString(R.string.phone_profiles_pref_eventNotificationAccessSystemSettings)).append(StringConstants.STR_COLON_WITH_SPACE) .append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningNotificationAccessSettingsEnabled_summary), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningNotificationAccessSettingsEnabled_summary), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } _value.append(StringConstants.TAG_DOUBLE_BREAK_HTML); @@ -4541,11 +4649,11 @@ private void setCategorySummary(Preference preferenceCategory) { } else { if (!ApplicationPreferences.applicationEventNotificationDisabledScannigByProfile) _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_disabled), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.array_pref_applicationDisableScanning_disabled), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); else _value.append(StringConstants.TAG_BOLD_START_HTML) - .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile), prefMng, key, getActivity())) + .append(getColorForChangedPreferenceValue(getString(R.string.phone_profiles_pref_applicationEventScanningDisabledByProfile), prefMng, key, activity)) .append(StringConstants.TAG_BOLD_END_HTML); } } @@ -4700,6 +4808,21 @@ private void setCategorySummary(Preference preferenceCategory) { _value.append(StringConstants.STR_BULLET); _value.append(getString(R.string.phone_profiles_pref_applicationWidgetOneRowProfileLisArrowsMarkLightness)); } + if (key.equals(PREF_CALL_SCREENING_CATEGORY_ROOT)) { + if (Build.VERSION.SDK_INT >= 29) { + String summary; //= getString(R.string.phone_profiles_pref_call_screening_setCallScreeningRole_summary); + RoleManager roleManager = (RoleManager) context.getSystemService(ROLE_SERVICE); + boolean isHeld = (roleManager != null) && roleManager.isRoleHeld(ROLE_CALL_SCREENING); + if (isHeld) { + summary = getString(R.string.phone_profiles_pref_call_screening_setCallScreeningRole_summary_ststus_1);// + + //StringConstants.STR_DOUBLE_NEWLINE + summary; + } else { + summary = getString(R.string.phone_profiles_pref_call_screening_setCallScreeningRole_summary_ststus_0);//' + + //StringConstants.STR_DOUBLE_NEWLINE + summary; + } + _value.append(summary); + } + } /*if (addEnd) { if (!summary.isEmpty()) summary = summary + " • "; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesService.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesService.java index 61fff84e87..bfb1afb09d 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesService.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesService.java @@ -70,6 +70,7 @@ public class PhoneProfilesService extends Service static final String ACTION_DASH_CLOCK_BROADCAST_RECEIVER = PPApplication.PACKAGE_NAME + ".DashClockBroadcastReceiver"; static final String ACTION_BLUETOOTHLE_SCAN_BROADCAST_RECEIVER = PPApplication.PACKAGE_NAME + ".BluetoothLEScanBroadcastReceiver"; static final String ACTION_APPLICATION_EVENT_END_BROADCAST_RECEIVER = PPApplication.PACKAGE_NAME + ".ApplicationEventEndBroadcastReceiver"; + static final String ACTION_CALL_SCREENING_EVENT_END_BROADCAST_RECEIVER = PPApplication.PACKAGE_NAME + ".CallScreeningEventEndBroadcastReceiver"; //static final String EXTRA_SHOW_PROFILE_NOTIFICATION = "show_profile_notification"; static final String EXTRA_START_STOP_SCANNER = "start_stop_scanner"; @@ -139,6 +140,8 @@ public class PhoneProfilesService extends Service static final String EXTRA_REGISTER_RECEIVERS_FOR_SMS_SENSOR = "register_receivers_for_sms_sensor"; static final String EXTRA_UNREGISTER_RECEIVERS_FOR_SMS_SENSOR = "unregister_receivers_for_sms_sensor"; static final String EXTRA_DISABLE_NOT_USED_SCANNERS = "disable_not_used_scanners"; + //static final String EXTRA_REGISTER_RECEIVERS_FOR_CALL_SCREENING_SENSOR = "register_receivers_for_call_screening_sensor"; + //static final String EXTRA_UNREGISTER_RECEIVERS_FOR_CALL_SCREENING_SENSOR = "unregister_receivers_for_call_screening_sensor"; static final String EXTRA_START_FOR_SHIZUKU_START = "start_for_shizuku_start"; @@ -736,6 +739,7 @@ private void doForFirstStart(final Intent serviceIntent/*, int flags, int startI PPApplication.firstStartAfterInstallation = PPApplicationStatic.getSavedVersionCode(appContext) == 0; // this save actual version + boolean applicationJustInstalled = PPApplicationStatic.getSavedVersionCode(appContext) == 0; boolean newVersion = doForPackageReplaced(appContext); if (newVersion) { __activateProfiles = true; @@ -838,6 +842,11 @@ private void doForFirstStart(final Intent serviceIntent/*, int flags, int startI EventPreferencesRoaming.setEventRoamingInSIMSlot(appContext, 1, false, false); EventPreferencesRoaming.setEventRoamingInSIMSlot(appContext, 2, false, false); + //EventPreferencesCallScreening.setEventCallScreeningActive(appContext, false); + EventPreferencesCallScreening.setEventCallScreeningTime(appContext, 0); + EventPreferencesCallScreening.setEventCallScreeningPhoneNumber(appContext, ""); + EventPreferencesCallScreening.setEventCallScreeningCallDirection(appContext, 0); + // set alarm for Alarm clock sensor from last saved time in // NextAlarmClockBroadcastReceiver.onReceived() @@ -932,11 +941,12 @@ private void doForFirstStart(final Intent serviceIntent/*, int flags, int startI //else MobileCellsScanner.startAutoRegistration(appContext, true); - BluetoothConnectionBroadcastReceiver.clearConnectedDevices(/*appContext, true*/); + List connectedDevices = BluetoothConnectionBroadcastReceiver.getConnectedDevices(appContext); + BluetoothConnectionBroadcastReceiver.clearConnectedDevices(connectedDevices/*appContext, true*/); // this also clears shared preferences - BluetoothConnectionBroadcastReceiver.saveConnectedDevices(appContext); + BluetoothConnectionBroadcastReceiver.saveConnectedDevices(connectedDevices, appContext); // Log.e("PhoneProfilesService.doForFirstStart", "**** START of getConnectedDevices"); - BluetoothConnectedDevicesDetector.getConnectedDevices(appContext/*, false*/); + BluetoothConnectedDevicesDetector.getConnectedDevices(appContext, false); WifiScanWorker.setScanRequest(appContext, false); WifiScanWorker.setWaitForResults(appContext, false); @@ -968,7 +978,10 @@ private void doForFirstStart(final Intent serviceIntent/*, int flags, int startI try { PackageInfo pInfo = appContext.getPackageManager().getPackageInfo(PPApplication.PACKAGE_NAME, 0); String version = pInfo.versionName + " (" + PPApplicationStatic.getVersionCode(pInfo) + ")"; - PPApplicationStatic.addActivityLog(appContext, PPApplication.ALTYPE_APPLICATION_UPGRADE, version, null, ""); + if (applicationJustInstalled) + PPApplicationStatic.addActivityLog(appContext, PPApplication.ALTYPE_APPLICATION_INSTALLATION, version, null, ""); + else + PPApplicationStatic.addActivityLog(appContext, PPApplication.ALTYPE_APPLICATION_UPGRADE, version, null, ""); } catch (Exception e) { PPApplicationStatic.recordException(e); } @@ -1065,35 +1078,35 @@ private void doForFirstStart(final Intent serviceIntent/*, int flags, int startI PPApplicationStatic.recordException(e); } } - else*/ - { - PPApplicationStatic.logE("PhoneProfilesService.doForFirstStart - handler", "start work for first start"); - - //PPApplication.cancelWork(PPApplication.AFTER_FIRST_START_WORK_TAG); - - Data workData = new Data.Builder() - .putBoolean(PhoneProfilesService.EXTRA_ACTIVATE_PROFILES, __activateProfiles) - .putBoolean(PhoneProfilesService.EXTRA_START_FOR_EXTERNAL_APPLICATION, _startFromExternalApplication) - .putString(PhoneProfilesService.EXTRA_START_FOR_EXTERNAL_APP_ACTION, _startForExternalAppAction) - .putInt(PhoneProfilesService.EXTRA_START_FOR_EXTERNAL_APP_DATA_TYPE, _startForExternalAppDataType) - .putString(PhoneProfilesService.EXTRA_START_FOR_EXTERNAL_APP_DATA_VALUE, _startForExternalAppDataValue) - .putBoolean(PhoneProfilesService.EXTRA_START_FOR_SHIZUKU_START, false) - //.putBoolean(PhoneProfilesService.EXTRA_SHOW_TOAST, serviceIntent != null) - .build(); + else + {*/ + PPApplicationStatic.logE("PhoneProfilesService.doForFirstStart - handler", "start work for first start"); + + //PPApplication.cancelWork(PPApplication.AFTER_FIRST_START_WORK_TAG); + + Data workData = new Data.Builder() + .putBoolean(PhoneProfilesService.EXTRA_ACTIVATE_PROFILES, __activateProfiles) + .putBoolean(PhoneProfilesService.EXTRA_START_FOR_EXTERNAL_APPLICATION, _startFromExternalApplication) + .putString(PhoneProfilesService.EXTRA_START_FOR_EXTERNAL_APP_ACTION, _startForExternalAppAction) + .putInt(PhoneProfilesService.EXTRA_START_FOR_EXTERNAL_APP_DATA_TYPE, _startForExternalAppDataType) + .putString(PhoneProfilesService.EXTRA_START_FOR_EXTERNAL_APP_DATA_VALUE, _startForExternalAppDataValue) + .putBoolean(PhoneProfilesService.EXTRA_START_FOR_SHIZUKU_START, false) + //.putBoolean(PhoneProfilesService.EXTRA_SHOW_TOAST, serviceIntent != null) + .build(); // PPApplicationStatic.logE("[MAIN_WORKER_CALL] PhoneProfilesService.doForFirstStart", "xxxxxxxxxxxxxxxxxxxx"); - OneTimeWorkRequest worker = - new OneTimeWorkRequest.Builder(MainWorker.class) - .addTag(PPApplication.AFTER_FIRST_START_WORK_TAG) - .setInputData(workData) - //.setInitialDelay(5, TimeUnit.SECONDS) - .keepResultsForAtLeast(PPApplication.WORK_PRUNE_DELAY_MINUTES, TimeUnit.MINUTES) - .build(); - try { - if (PPApplicationStatic.getApplicationStarted(true, false)) { - WorkManager workManager = PPApplication.getWorkManagerInstance(); - if (workManager != null) { + OneTimeWorkRequest worker = + new OneTimeWorkRequest.Builder(MainWorker.class) + .addTag(PPApplication.AFTER_FIRST_START_WORK_TAG) + .setInputData(workData) + //.setInitialDelay(5, TimeUnit.SECONDS) + .keepResultsForAtLeast(PPApplication.WORK_PRUNE_DELAY_MINUTES, TimeUnit.MINUTES) + .build(); + try { + if (PPApplicationStatic.getApplicationStarted(true, false)) { + WorkManager workManager = PPApplication.getWorkManagerInstance(); + if (workManager != null) { // //if (PPApplicationStatic.logEnabled()) { // ListenableFuture> statuses; @@ -1105,16 +1118,16 @@ private void doForFirstStart(final Intent serviceIntent/*, int flags, int startI // //} // PPApplicationStatic.logE("[WORKER_CALL] PhoneProfilesService.doFirstStart", "keepResultsForAtLeast"); - //workManager.enqueue(worker); - // !!! MUST BE APPEND_OR_REPLACE FOR EXTRA_START_FOR_EXTERNAL_APPLICATION !!! - workManager.enqueueUniqueWork(PPApplication.AFTER_FIRST_START_WORK_TAG, ExistingWorkPolicy.REPLACE, worker); - } + //workManager.enqueue(worker); + // !!! MUST BE APPEND_OR_REPLACE FOR EXTRA_START_FOR_EXTERNAL_APPLICATION !!! + workManager.enqueueUniqueWork(PPApplication.AFTER_FIRST_START_WORK_TAG, ExistingWorkPolicy.REPLACE, worker); } - } catch (Exception e) { - PPApplicationStatic.recordException(e); } + } catch (Exception e) { + PPApplicationStatic.recordException(e); } //} + //} PPApplicationStatic.logE("PhoneProfilesService.doForFirstStart - handler", "END"); @@ -1485,7 +1498,7 @@ private boolean doForPackageReplaced(Context appContext) { if (Build.VERSION.SDK_INT >= 30) { SharedPreferences preferences = ApplicationPreferences.getSharedPreferences(appContext); - final String OLD_BROWN_COLOR = "#ff201a18"; + final String OLD_BROWN_COLOR = String.valueOf(appContext.getColor(R.color.pppColorOldBrownBackground)); String backgroundColorNightModeOn = preferences.getString(ApplicationPreferences.PREF_APPLICATION_WIDGET_ICON_BACKGROUND_COLOR_NIGHT_MODE_ON, ApplicationPreferences.PREF_APPLICATION_WIDGET_ICON_BACKGROUND_COLOR_NIGHT_MODE_ON_DEFAULT_VALUE); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesServiceStatic.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesServiceStatic.java index e131046c49..555c114253 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesServiceStatic.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesServiceStatic.java @@ -292,6 +292,7 @@ static void registerAllTheTimeRequiredPPPBroadcastReceivers(boolean register, Co } if (PPApplication.pppExtenderBroadcastReceiver == null) { +// Log.e("PhoneProfilesServiceStatic.registerAllTheTimeRequiredPPPBroadcastReceivers", "xxxx"); PPApplication.pppExtenderBroadcastReceiver = new PPExtenderBroadcastReceiver(); IntentFilter intentFilter14 = new IntentFilter(); intentFilter14.addAction(PPApplication.ACTION_PPPEXTENDER_STARTED); @@ -886,7 +887,7 @@ static void registerBatteryLevelChangedReceiver(boolean register, DataWrapper da } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesBattery.PREF_EVENT_BATTERY_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesBattery.PREF_EVENT_BATTERY_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -919,7 +920,7 @@ static void registerBatteryChargingChangedReceiver(boolean register, DataWrapper } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesBattery.PREF_EVENT_BATTERY_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesBattery.PREF_EVENT_BATTERY_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; boolean eventsExists = false; if (allowed) { @@ -932,26 +933,26 @@ static void registerBatteryChargingChangedReceiver(boolean register, DataWrapper eventsExists = dataWrapper.eventTypeExists(DatabaseHandler.ETYPE_ALL_SCANNER_SENSORS/*, false*/); if (eventsExists) { allowed = ApplicationPreferences.applicationEventWifiEnableScanning && - (EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, appContext).allowed == + (EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED); if (!allowed) allowed = ApplicationPreferences.applicationEventBluetoothEnableScanning && - (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, appContext).allowed == + (EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED); if (!allowed) allowed = ApplicationPreferences.applicationEventLocationEnableScanning && - (EventStatic.isEventPreferenceAllowed(EventPreferencesLocation.PREF_EVENT_LOCATION_ENABLED, appContext).allowed == + (EventStatic.isEventPreferenceAllowed(EventPreferencesLocation.PREF_EVENT_LOCATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED); if (!allowed) { // PPApplicationStatic.logE("[TEST BATTERY] PhoneProfilesService.registerBatteryChargingChangedReceiver", "******** ### *******"); allowed = ApplicationPreferences.applicationEventMobileCellEnableScanning && - (EventStatic.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED_NO_CHECK_SIM, appContext).allowed == + (EventStatic.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED_NO_CHECK_SIM, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED); } if (!allowed) { // PPApplicationStatic.logE("[TEST BATTERY] PhoneProfilesService.registerBatteryChargingChangedReceiver", "******** ### *******"); allowed = ApplicationPreferences.applicationEventOrientationEnableScanning && - (EventStatic.isEventPreferenceAllowed(EventPreferencesOrientation.PREF_EVENT_ORIENTATION_ENABLED, appContext).allowed == + (EventStatic.isEventPreferenceAllowed(EventPreferencesOrientation.PREF_EVENT_ORIENTATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED); } if (!allowed) @@ -994,7 +995,7 @@ static void registerReceiverForAccessoriesSensor(boolean register, DataWrapper d } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesAccessories.PREF_EVENT_ACCESSORIES_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesAccessories.PREF_EVENT_ACCESSORIES_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -1054,7 +1055,7 @@ static void registerReceiverForSMSSensor(boolean register, DataWrapper dataWrapp } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesSMS.PREF_EVENT_SMS_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesSMS.PREF_EVENT_SMS_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -1120,7 +1121,7 @@ static void registerReceiverForCalendarSensor(boolean register, DataWrapper data } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesCalendar.PREF_EVENT_CALENDAR_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesCalendar.PREF_EVENT_CALENDAR_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -1174,7 +1175,7 @@ static void registerReceiverForRadioSwitchAirplaneModeSensor(boolean register, D } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_AIRPLANE_MODE, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_AIRPLANE_MODE, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -1208,7 +1209,7 @@ static void registerReceiverForRadioSwitchNFCSensor(boolean register, DataWrappe } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_NFC, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_NFC, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -1248,7 +1249,7 @@ static void registerObserverForRadioSwitchMobileDataSensor(final boolean registe if (register) { DataWrapper _dataWrapper = dataWrapperWeakRef.get(); if (_dataWrapper != null) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_MOBILE_DATA, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_MOBILE_DATA, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { _dataWrapper.fillEventList(); @@ -1279,7 +1280,7 @@ static void registerReceiverForRadioSwitchDefaultSIMSensor(final boolean registe } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_DEFAULT_SIM, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -1321,7 +1322,7 @@ static void registerReceiverForAlarmClockSensor(boolean register, DataWrapper da } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesAlarmClock.PREF_EVENT_ALARM_CLOCK_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesAlarmClock.PREF_EVENT_ALARM_CLOCK_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -1363,7 +1364,7 @@ static void registerReceiverForNotificationSensor(boolean register, DataWrapper } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesNotification.PREF_EVENT_NOTIFICATION_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesNotification.PREF_EVENT_NOTIFICATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -1397,7 +1398,7 @@ static void registerReceiverForDeviceBootSensor(boolean register, DataWrapper da } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesDeviceBoot.PREF_EVENT_DEVICE_BOOT_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesDeviceBoot.PREF_EVENT_DEVICE_BOOT_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -1431,7 +1432,7 @@ static void registerReceiverForPeriodicSensor(boolean register, DataWrapper data } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesPeriodic.PREF_EVENT_PERIODIC_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesPeriodic.PREF_EVENT_PERIODIC_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -1465,7 +1466,7 @@ static void registerReceiverForActivatedProfileSensor(boolean register, DataWrap } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesActivatedProfile.PREF_EVENT_ACTIVATED_PROFILE_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesActivatedProfile.PREF_EVENT_ACTIVATED_PROFILE_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -1486,6 +1487,41 @@ static void registerReceiverForActivatedProfileSensor(boolean register, DataWrap } } + static void registerReceiverForCallScreeningSensor(boolean register, DataWrapper dataWrapper, Context context) { + Context appContext = context.getApplicationContext(); + if (!register) { + if (PPApplication.callScreeningEventEndBroadcastReceiver != null) { + try { + appContext.unregisterReceiver(PPApplication.callScreeningEventEndBroadcastReceiver); + PPApplication.callScreeningEventEndBroadcastReceiver = null; + } catch (Exception e) { + PPApplication.callScreeningEventEndBroadcastReceiver = null; + } + } + } + if (register) { + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesCallScreening.PREF_EVENT_CALL_SCREENING_ENABLED, false, appContext).preferenceAllowed == + PreferenceAllowed.PREFERENCE_ALLOWED; + if (allowed) { + dataWrapper.fillEventList(); + allowed = dataWrapper.eventTypeExists(DatabaseHandler.ETYPE_CALL_SCREENING/*, false*/); + } + if (allowed) { + if (PPApplication.callScreeningEventEndBroadcastReceiver == null) { + PPApplication.callScreeningEventEndBroadcastReceiver = new CallScreeningEventEndBroadcastReceiver(); + IntentFilter intentFilter22 = new IntentFilter(PhoneProfilesService.ACTION_CALL_SCREENING_EVENT_END_BROADCAST_RECEIVER); + int receiverFlags = 0; + if (Build.VERSION.SDK_INT >= 34) + receiverFlags = RECEIVER_NOT_EXPORTED; + appContext.registerReceiver(PPApplication.callScreeningEventEndBroadcastReceiver, intentFilter22, receiverFlags); + } + +// Log.e("PhoneProfilesService.registerReceiverForcallScreeningSensor", "xxx"); + } else + registerReceiverForCallScreeningSensor(false, dataWrapper, appContext); + } + } + static void unregisterPPPExtenderReceiver(int type, Context context) { Context appContext = context.getApplicationContext(); @@ -1570,9 +1606,9 @@ static void registerPPPExtenderReceiverForSMSCall(boolean register, DataWrapper unregisterPPPExtenderReceiver(PPApplication.REGISTRATION_TYPE_CALL_UNREGISTER, appContext); } if (register) { - boolean smsAllowed = (EventStatic.isEventPreferenceAllowed(EventPreferencesSMS.PREF_EVENT_SMS_ENABLED, appContext).allowed == + boolean smsAllowed = (EventStatic.isEventPreferenceAllowed(EventPreferencesSMS.PREF_EVENT_SMS_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED); - boolean callAllowed = (EventStatic.isEventPreferenceAllowed(EventPreferencesCall.PREF_EVENT_CALL_ENABLED, appContext).allowed == + boolean callAllowed = (EventStatic.isEventPreferenceAllowed(EventPreferencesCall.PREF_EVENT_CALL_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED); if (smsAllowed || callAllowed) { //dataWrapper.fillProfileList(false, false); @@ -1652,17 +1688,17 @@ static void registerPPPExtenderReceiver(boolean register, DataWrapper dataWrappe unregisterPPPExtenderReceiver(PPApplication.REGISTRATION_TYPE_LOCK_DEVICE_UNREGISTER, appContext); } if (register) { - boolean forceStopAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_FORCE_STOP_APPLICATION_CHANGE, null, null, false, appContext).allowed == + boolean forceStopAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_FORCE_STOP_APPLICATION_CHANGE, null, null, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; - boolean lockDeviceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_LOCK_DEVICE, null, null, false, appContext).allowed == + boolean lockDeviceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_LOCK_DEVICE, null, null, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; - boolean applicationsAllowed = (EventStatic.isEventPreferenceAllowed(EventPreferencesApplication.PREF_EVENT_APPLICATION_ENABLED, appContext).allowed == + boolean applicationsAllowed = (EventStatic.isEventPreferenceAllowed(EventPreferencesApplication.PREF_EVENT_APPLICATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED); - boolean orientationAllowed = (EventStatic.isEventPreferenceAllowed(EventPreferencesOrientation.PREF_EVENT_ORIENTATION_ENABLED, appContext).allowed == + boolean orientationAllowed = (EventStatic.isEventPreferenceAllowed(EventPreferencesOrientation.PREF_EVENT_ORIENTATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED); - boolean smsAllowed = (EventStatic.isEventPreferenceAllowed(EventPreferencesSMS.PREF_EVENT_SMS_ENABLED, appContext).allowed == + boolean smsAllowed = (EventStatic.isEventPreferenceAllowed(EventPreferencesSMS.PREF_EVENT_SMS_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED); - boolean callAllowed = (EventStatic.isEventPreferenceAllowed(EventPreferencesCall.PREF_EVENT_CALL_ENABLED, appContext).allowed == + boolean callAllowed = (EventStatic.isEventPreferenceAllowed(EventPreferencesCall.PREF_EVENT_CALL_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED); if (forceStopAllowed || applicationsAllowed || orientationAllowed || smsAllowed || callAllowed || lockDeviceAllowed) { @@ -1806,7 +1842,7 @@ static void registerLocationModeChangedBroadcastReceiver(boolean register, DataW } if (register) { if (ApplicationPreferences.applicationEventLocationEnableScanning) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_GPS, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesRadioSwitch.PREF_EVENT_RADIO_SWITCH_ENABLED_GPS, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; boolean eventsExists = false; if (allowed) { @@ -1819,7 +1855,7 @@ static void registerLocationModeChangedBroadcastReceiver(boolean register, DataW //PowerManager pm = (PowerManager) appContext.getSystemService(Context.POWER_SERVICE); if ((PPApplication.isScreenOn) || (!ApplicationPreferences.applicationEventLocationScanOnlyWhenScreenIsOn)) { // start only for screen On - allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesLocation.PREF_EVENT_LOCATION_ENABLED, appContext).allowed == + allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesLocation.PREF_EVENT_LOCATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -1937,7 +1973,7 @@ static void registerBluetoothScannerReceivers(boolean register, DataWrapper data else { if ((PPApplication.isScreenOn) || (!ApplicationPreferences.applicationEventBluetoothScanOnlyWhenScreenIsOn)) { // start only for screen On - allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, appContext).allowed == + allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -1990,7 +2026,7 @@ static void registerWifiAPStateChangeBroadcastReceiver(boolean register, DataWra allowed = true; else { if ((PPApplication.isScreenOn) || (!ApplicationPreferences.applicationEventWifiScanOnlyWhenScreenIsOn)) { - allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, appContext).allowed == + allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -2039,7 +2075,7 @@ static void registerWifiScannerReceiver(boolean register, DataWrapper dataWrappe else { if ((PPApplication.isScreenOn) || (!ApplicationPreferences.applicationEventWifiScanOnlyWhenScreenIsOn)) { // start only for screen On - allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, appContext).allowed == + allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -2077,7 +2113,7 @@ static void registerReceiverForTimeSensor(boolean register, DataWrapper dataWrap } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesTime.PREF_EVENT_TIME_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesTime.PREF_EVENT_TIME_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -2111,7 +2147,7 @@ static void registerReceiverForNFCSensor(boolean register, DataWrapper dataWrapp } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesNFC.PREF_EVENT_NFC_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesNFC.PREF_EVENT_NFC_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -2145,7 +2181,7 @@ static void registerReceiverForCallSensor(boolean register, DataWrapper dataWrap } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesCall.PREF_EVENT_CALL_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesCall.PREF_EVENT_CALL_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -2181,7 +2217,7 @@ static void registerReceiverForApplicationSensor(boolean register, DataWrapper d } } if (register) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesApplication.PREF_EVENT_APPLICATION_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesApplication.PREF_EVENT_APPLICATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -2227,7 +2263,7 @@ static void registerVPNCallback(final boolean register, final DataWrapper dataWr if (register) { DataWrapper _dataWrapper = dataWrapperWeakRef.get(); if (_dataWrapper != null) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesVPN.PREF_EVENT_VPN_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesVPN.PREF_EVENT_VPN_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { _dataWrapper.fillEventList(); @@ -2276,7 +2312,7 @@ static void registerLocationScannerReceiver(boolean register, DataWrapper dataWr boolean eventsExists = false; if ((PPApplication.isScreenOn) || (!ApplicationPreferences.applicationEventLocationScanOnlyWhenScreenIsOn)) { // start only for screen On - allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesLocation.PREF_EVENT_LOCATION_ENABLED, appContext).allowed == + allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesLocation.PREF_EVENT_LOCATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { dataWrapper.fillEventList(); @@ -2442,7 +2478,7 @@ static void registerAudioPlaybackCallback(final boolean register, final DataWrap //Log.e("PhoneProfilesServiceStatic.registerAudioPlaybackCallback", "register"); DataWrapper _dataWrapper = dataWrapperWeakRef.get(); if (_dataWrapper != null) { - boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesMusic.PREF_EVENT_MUSIC_ENABLED, appContext).allowed == + boolean allowed = EventStatic.isEventPreferenceAllowed(EventPreferencesMusic.PREF_EVENT_MUSIC_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (allowed) { _dataWrapper.fillEventList(); @@ -2550,7 +2586,7 @@ static void scheduleWifiWorker(final DataWrapper dataWrapper) { boolean eventsExists = false; if ((PPApplication.isScreenOn) || (!ApplicationPreferences.applicationEventWifiScanOnlyWhenScreenIsOn)) { // start only for screen On - eventAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, appContext).allowed == + eventAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (eventAllowed) { dataWrapper.fillEventList(); @@ -2604,7 +2640,7 @@ static void scheduleBluetoothWorker(final DataWrapper dataWrapper) { boolean eventsExists = false; if ((PPApplication.isScreenOn) || (!ApplicationPreferences.applicationEventBluetoothScanOnlyWhenScreenIsOn)) { // start only for screen On - eventAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, appContext).allowed == + eventAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesBluetooth.PREF_EVENT_BLUETOOTH_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (eventAllowed) { dataWrapper.fillEventList(); @@ -2639,7 +2675,7 @@ static void scheduleSearchCalendarEventsWorker(final DataWrapper dataWrapper) { final Context appContext = dataWrapper.context; //if (schedule) { - boolean eventAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesCalendar.PREF_EVENT_CALENDAR_ENABLED, appContext).allowed == + boolean eventAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesCalendar.PREF_EVENT_CALENDAR_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (eventAllowed) { dataWrapper.fillEventList(); @@ -2675,7 +2711,7 @@ static void startLocationScanner(boolean start, boolean applicationEventLocationScanOnlyWhenScreenIsOn = ApplicationPreferences.applicationEventLocationScanOnlyWhenScreenIsOn; if ((PPApplication.isScreenOn) || (!applicationEventLocationScanOnlyWhenScreenIsOn)) { // start only for screen On - eventAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesLocation.PREF_EVENT_LOCATION_ENABLED, appContext).allowed == + eventAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesLocation.PREF_EVENT_LOCATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (eventAllowed) { dataWrapper.fillEventList(); @@ -2735,7 +2771,7 @@ static void startMobileCellsScanner(final boolean start, final boolean stop, else { if ((PPApplication.isScreenOn) || (!ApplicationPreferences.applicationEventMobileCellScanOnlyWhenScreenIsOn)) { // start only for screen On - eventAllowed = (EventStatic.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED, appContext).allowed == + eventAllowed = (EventStatic.isEventPreferenceAllowed(EventPreferencesMobileCells.PREF_EVENT_MOBILE_CELLS_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED); if (eventAllowed) { _dataWrapper.fillEventList(); @@ -2791,7 +2827,7 @@ static void startOrientationScanner(boolean start, boolean stop, else*/ { if ((PPApplication.isScreenOn) || (!ApplicationPreferences.applicationEventOrientationScanOnlyWhenScreenIsOn)) { // start only for screen On - eventAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesOrientation.PREF_EVENT_ORIENTATION_ENABLED, appContext).allowed == + eventAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesOrientation.PREF_EVENT_ORIENTATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (eventAllowed) { dataWrapper.fillEventList(); @@ -2855,7 +2891,7 @@ static void startNotificationScanner(boolean start, boolean stop, boolean eventsExists = false; if ((PPApplication.isScreenOn) || (!ApplicationPreferences.applicationEventNotificationScanOnlyWhenScreenIsOn)) { // start only for screen On - eventAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesNotification.PREF_EVENT_NOTIFICATION_ENABLED, appContext).allowed == + eventAllowed = EventStatic.isEventPreferenceAllowed(EventPreferencesNotification.PREF_EVENT_NOTIFICATION_ENABLED, false, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (eventAllowed) { dataWrapper.fillEventList(); @@ -3007,6 +3043,10 @@ static void registerEventsReceiversAndWorkers(boolean fromCommand, Context conte // required for orientation event //registerReceiverForOrientationSensor(true, dataWrapper); + // required for Call screening sensor + registerReceiverForCallScreeningSensor(true, dataWrapper, appContext); + + // required for calendar event registerReceiverForActivatedProfileSensor(true, dataWrapper, appContext); @@ -3068,6 +3108,7 @@ static void unregisterEventsReceiversAndWorkers(boolean useHandler, Context cont registerLocationScannerReceiver(false, null, appContext); registerReceiverForNotificationSensor(false, null, appContext); //registerReceiverForOrientationSensor(false, null); + registerReceiverForCallScreeningSensor(false, null, appContext); //if (alarmClockBroadcastReceiver != null) // appContext.unregisterReceiver(alarmClockBroadcastReceiver); @@ -3136,6 +3177,7 @@ static void reregisterEventsReceiversAndWorkers(Context context) { registerReceiverForNotificationSensor(true,dataWrapper, appContext); registerReceiverForActivatedProfileSensor(true, dataWrapper, appContext); //registerReceiverForMusicSensor(true, dataWrapper, appContext); + registerReceiverForCallScreeningSensor(true, dataWrapper, appContext); registerVPNCallback(true, dataWrapper, appContext); registerAudioPlaybackCallback(true, dataWrapper, appContext); @@ -3328,6 +3370,16 @@ static void doCommand(Intent _intent, Context context) { DataWrapper dataWrapper = new DataWrapper(appContext, false, 0, false, 0, 0, 0f); registerReceiverForSMSSensor(false, dataWrapper, appContext); dataWrapper.invalidateDataWrapper(); + /*} else if (intent.getBooleanExtra(PhoneProfilesService.EXTRA_REGISTER_RECEIVERS_FOR_CALL_SCREENING_SENSOR, false)) { +// PPApplicationStatic.logE("[IN_EXECUTOR] PhoneProfilesService.doCommand", "EXTRA_REGISTER_RECEIVERS_FOR_CALL_SCREENING_SENSOR"); + DataWrapper dataWrapper = new DataWrapper(appContext, false, 0, false, 0, 0, 0f); + registerReceiverForCallScreeningSensor(true, dataWrapper, appContext); + dataWrapper.invalidateDataWrapper(); + } else if (intent.getBooleanExtra(PhoneProfilesService.EXTRA_UNREGISTER_RECEIVERS_FOR_CALL_SCREENING_SENSOR, false)) { +// PPApplicationStatic.logE("[IN_EXECUTOR] PhoneProfilesService.doCommand", "EXTRA_UNREGISTER_RECEIVERS_FOR_CALL_SCREENING_SENSOR"); + DataWrapper dataWrapper = new DataWrapper(appContext, false, 0, false, 0, 0, 0f); + registerReceiverForCallScreeningSensor(false, dataWrapper, appContext); + dataWrapper.invalidateDataWrapper();*/ } else if (intent.getBooleanExtra(PhoneProfilesService.EXTRA_RESCAN_SCANNERS, false)) { // PPApplicationStatic.logE("[IN_EXECUTOR] PhoneProfilesService.doCommand", "EXTRA_RESCAN_SCANNERS"); if (ApplicationPreferences.applicationEventLocationEnableScanning) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PlayRingingNotification.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PlayRingingNotification.java index 4c2b8d0131..7bd664a27d 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PlayRingingNotification.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PlayRingingNotification.java @@ -91,21 +91,24 @@ static void doSimulatingRingingCall(Intent intent, Context context) { //newRingerMode = ApplicationPreferences.prefRingerMode; //newZenMode = ApplicationPreferences.prefZenMode; AudioManager audioManager = (AudioManager)context.getSystemService(Context.AUDIO_SERVICE); - switch (audioManager.getRingerMode()) { - case AudioManager.RINGER_MODE_SILENT: - newRingerMode = Profile.RINGERMODE_SILENT; + if (audioManager != null) { + switch (audioManager.getRingerMode()) { + case AudioManager.RINGER_MODE_SILENT: + newRingerMode = Profile.RINGERMODE_SILENT; // PPApplicationStatic.logE("[RINGING_SIMULATION] PlayRingingNotification.doSimulatingRingingCall", "newRingerMode=SILENT"); - break; - case AudioManager.RINGER_MODE_VIBRATE: - newRingerMode = Profile.RINGERMODE_VIBRATE; + break; + case AudioManager.RINGER_MODE_VIBRATE: + newRingerMode = Profile.RINGERMODE_VIBRATE; // PPApplicationStatic.logE("[RINGING_SIMULATION] PlayRingingNotification.doSimulatingRingingCall", "newRingerMode=VIBRATE"); - break; - //case AudioManager.RINGER_MODE_NORMAL: - default: - newRingerMode = Profile.RINGERMODE_RING; + break; + //case AudioManager.RINGER_MODE_NORMAL: + default: + newRingerMode = Profile.RINGERMODE_RING; // PPApplicationStatic.logE("[RINGING_SIMULATION] PlayRingingNotification.doSimulatingRingingCall", "newRingerMode=RING"); - break; - } + break; + } + } else + newRingerMode = Profile.RINGERMODE_RING; switch (ActivateProfileHelper.getSystemZenMode(context)) { case ActivateProfileHelper.SYSTEM_ZENMODE_ALARMS: newZenMode = Profile.ZENMODE_ALARMS; @@ -162,9 +165,11 @@ static void doSimulatingRingingCall(Intent intent, Context context) { int ringtoneChangeFromProfile = intent.getIntExtra(PhoneProfilesService.EXTRA_NEW_RINTONE_CHANGE, 0); if (ringtoneChangeFromProfile != 0) { String __ringtoneFromProfile = intent.getStringExtra(PhoneProfilesService.EXTRA_NEW_RINGTONE); - String[] splits = __ringtoneFromProfile.split(StringConstants.STR_SPLIT_REGEX); - if (!splits[0].isEmpty()) { - _ringtoneFromProfile = splits[0]; + if (__ringtoneFromProfile != null) { + String[] splits = __ringtoneFromProfile.split(StringConstants.STR_SPLIT_REGEX); + if (!splits[0].isEmpty()) { + _ringtoneFromProfile = splits[0]; + } } } if (fromSIMSlot > 0) { @@ -175,9 +180,11 @@ static void doSimulatingRingingCall(Intent intent, Context context) { ringtoneChangeFromProfile = intent.getIntExtra(PhoneProfilesService.EXTRA_NEW_RINTONE_CHANGE_SIM1, 0); if (ringtoneChangeFromProfile != 0) { String __ringtoneFromProfile = intent.getStringExtra(PhoneProfilesService.EXTRA_NEW_RINGTONE_SIM1); - String[] splits = __ringtoneFromProfile.split(StringConstants.STR_SPLIT_REGEX); - if (!splits[0].isEmpty()) { - _ringtoneFromProfile = splits[0]; + if (__ringtoneFromProfile != null) { + String[] splits = __ringtoneFromProfile.split(StringConstants.STR_SPLIT_REGEX); + if (!splits[0].isEmpty()) { + _ringtoneFromProfile = splits[0]; + } } } } @@ -185,9 +192,11 @@ static void doSimulatingRingingCall(Intent intent, Context context) { ringtoneChangeFromProfile = intent.getIntExtra(PhoneProfilesService.EXTRA_NEW_RINTONE_CHANGE_SIM2, 0); if (ringtoneChangeFromProfile != 0) { String __ringtoneFromProfile = intent.getStringExtra(PhoneProfilesService.EXTRA_NEW_RINGTONE_SIM2); - String[] splits = __ringtoneFromProfile.split(StringConstants.STR_SPLIT_REGEX); - if (!splits[0].isEmpty()) { - _ringtoneFromProfile = splits[0]; + if (__ringtoneFromProfile != null) { + String[] splits = __ringtoneFromProfile.split(StringConstants.STR_SPLIT_REGEX); + if (!splits[0].isEmpty()) { + _ringtoneFromProfile = splits[0]; + } } } } @@ -405,21 +414,23 @@ static void stopSimulatingRingingCall(/*boolean abandonFocus*/boolean disableInt if (PlayRingingNotification.ringingCallIsSimulating) { // PPApplicationStatic.logE("[RINGING_SIMULATION] PlayRingingNotification.stopSimulatingRingingCall", "stop simulating"); - PPApplication.volumesInternalChange = true; - if (audioManager.getStreamVolume(AudioManager.STREAM_ALARM) != PlayRingingNotification.oldVolumeForRingingSimulation) - audioManager.setStreamVolume(AudioManager.STREAM_ALARM, PlayRingingNotification.oldVolumeForRingingSimulation, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE); - /*if (PlayRingingNotification.simulatingRingingCallRingingMuted == -1) { - // ringing was not mutted at start of simulation and was mutted by simuation - // result: must be unmutted - if (audioManager.isStreamMute(AudioManager.STREAM_RING)) { - Log.e("EventsHandler.stopSimulatingRingingCall", "unmute stream_ring"); - PPApplication.volumesInternalChange = true; - audioManager.adjustStreamVolume(AudioManager.STREAM_RING, AudioManager.ADJUST_UNMUTE, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE); - } else - Log.e("EventsHandler.stopSimulatingRingingCall", "NOT muted stream_ring"); - // 0 = not detected by simulation - PlayRingingNotification.simulatingRingingCallRingingMuted = 0; - }*/ + if (audioManager != null) { + PPApplication.volumesInternalChange = true; + if (audioManager.getStreamVolume(AudioManager.STREAM_ALARM) != PlayRingingNotification.oldVolumeForRingingSimulation) + audioManager.setStreamVolume(AudioManager.STREAM_ALARM, PlayRingingNotification.oldVolumeForRingingSimulation, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE); + /*if (PlayRingingNotification.simulatingRingingCallRingingMuted == -1) { + // ringing was not mutted at start of simulation and was mutted by simuation + // result: must be unmutted + if (audioManager.isStreamMute(AudioManager.STREAM_RING)) { + Log.e("EventsHandler.stopSimulatingRingingCall", "unmute stream_ring"); + PPApplication.volumesInternalChange = true; + audioManager.adjustStreamVolume(AudioManager.STREAM_RING, AudioManager.ADJUST_UNMUTE, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE); + } else + Log.e("EventsHandler.stopSimulatingRingingCall", "NOT muted stream_ring"); + // 0 = not detected by simulation + PlayRingingNotification.simulatingRingingCallRingingMuted = 0; + }*/ + } } } catch (Exception e) { PPApplicationStatic.recordException(e); @@ -632,7 +643,7 @@ static void playNotificationSound(final String notificationSound, //int zenMode = ApplicationPreferences.prefZenMode; //boolean isAudible = ActivateProfileHelper.isAudibleRinging(ringerMode, zenMode/*, false*/); int systemZenMode = ActivateProfileHelper.getSystemZenMode(appContext); - boolean isAudible = + boolean isAudible = (audioManager != null) && ActivateProfileHelper.isAudibleSystemRingerMode(audioManager, systemZenMode/*, getApplicationContext()*/); if (notificationVibrate || ((!isAudible) && (!notificationSound.isEmpty()))) { @@ -705,12 +716,14 @@ static void playNotificationSound(final String notificationSound, PPApplication.volumesMediaVolumeChangeed = false; if (!isAudible) { - PlayRingingNotification.oldVolumeForPlayNotificationSound = audioManager.getStreamVolume(AudioManager.STREAM_ALARM); - int maximumMediaValue = audioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM); - int mediaRingingVolume = Math.round(maximumMediaValue / 100.0f * 75.0f); - PPApplication.volumesInternalChange = true; - if (audioManager.getStreamVolume(AudioManager.STREAM_ALARM) != mediaRingingVolume) - audioManager.setStreamVolume(AudioManager.STREAM_ALARM, mediaRingingVolume, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE); + if (audioManager != null) { + PlayRingingNotification.oldVolumeForPlayNotificationSound = audioManager.getStreamVolume(AudioManager.STREAM_ALARM); + int maximumMediaValue = audioManager.getStreamMaxVolume(AudioManager.STREAM_ALARM); + int mediaRingingVolume = Math.round(maximumMediaValue / 100.0f * 75.0f); + PPApplication.volumesInternalChange = true; + if (audioManager.getStreamVolume(AudioManager.STREAM_ALARM) != mediaRingingVolume) + audioManager.setStreamVolume(AudioManager.STREAM_ALARM, mediaRingingVolume, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE); + } } else PlayRingingNotification.oldVolumeForPlayNotificationSound = -1; @@ -739,9 +752,11 @@ public void run() { if ((PlayRingingNotification.notificationIsPlayed) && (PlayRingingNotification.oldVolumeForPlayNotificationSound != -1) && (!PPApplication.volumesMediaVolumeChangeed)) { try { - PPApplication.volumesInternalChange = true; - if (audioManager.getStreamVolume(AudioManager.STREAM_ALARM) != PlayRingingNotification.oldVolumeForRingingSimulation) - audioManager.setStreamVolume(AudioManager.STREAM_ALARM, PlayRingingNotification.oldVolumeForPlayNotificationSound, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE); + if (audioManager != null) { + PPApplication.volumesInternalChange = true; + if (audioManager.getStreamVolume(AudioManager.STREAM_ALARM) != PlayRingingNotification.oldVolumeForRingingSimulation) + audioManager.setStreamVolume(AudioManager.STREAM_ALARM, PlayRingingNotification.oldVolumeForPlayNotificationSound, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE); + } } catch (Exception e) { //PPApplicationStatic.recordException(e); } @@ -800,9 +815,11 @@ static void stopPlayNotificationSound(boolean setBackMediaVolume, Context contex if ((PlayRingingNotification.oldVolumeForPlayNotificationSound != -1) && (!PPApplication.volumesMediaVolumeChangeed)) { try { - PPApplication.volumesInternalChange = true; - if (audioManager.getStreamVolume(AudioManager.STREAM_ALARM) != PlayRingingNotification.oldVolumeForRingingSimulation) - audioManager.setStreamVolume(AudioManager.STREAM_ALARM, PlayRingingNotification.oldVolumeForPlayNotificationSound, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE); + if (audioManager != null) { + PPApplication.volumesInternalChange = true; + if (audioManager.getStreamVolume(AudioManager.STREAM_ALARM) != PlayRingingNotification.oldVolumeForRingingSimulation) + audioManager.setStreamVolume(AudioManager.STREAM_ALARM, PlayRingingNotification.oldVolumeForPlayNotificationSound, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE); + } } catch (Exception e) { //PPApplicationStatic.recordException(e); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PreferenceAllowed.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PreferenceAllowed.java index c73adeb166..318af957c1 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PreferenceAllowed.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PreferenceAllowed.java @@ -13,7 +13,7 @@ import android.telephony.TelephonyManager; class PreferenceAllowed { - int allowed; + int preferenceAllowed; int notAllowedReason; String notAllowedReasonDetail; boolean notAllowedRoot; @@ -21,6 +21,15 @@ class PreferenceAllowed { boolean notAllowedPPPPS; boolean notAllowedShizuku; + private int _isRooted = -1; + private int _serviceBinaryExists = -1; + private int _settingsBinaryExists = -1; + private int _isPPPPSInstalled = -1; + private int _isShiuzkuAvailable = -1; + private int _isShiuzkuGranted = -1; + private int _canExploitWifiTethering = -1; + private int _canExploitWifiTethering30 = -1; + static final int PREFERENCE_NOT_ALLOWED = 0; static final int PREFERENCE_ALLOWED = 1; static final int PREFERENCE_NOT_ALLOWED_NO_HARDWARE = 1; @@ -42,7 +51,7 @@ class PreferenceAllowed { static final int PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED = 17; void copyFrom(PreferenceAllowed preferenceAllowed) { - allowed = preferenceAllowed.allowed; + this.preferenceAllowed = preferenceAllowed.preferenceAllowed; notAllowedReason = preferenceAllowed.notAllowedReason; notAllowedReasonDetail = preferenceAllowed.notAllowedReasonDetail; notAllowedRoot = preferenceAllowed.notAllowedRoot; @@ -77,7 +86,87 @@ String getNotAllowedPreferenceReasonString(Context context) { } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_AIRPLANE_MODE(PreferenceAllowed preferenceAllowed, + private int isRooted() { + if (_isRooted == -1) { + if (RootUtils.isRooted(/*fromUIThread*/)) + _isRooted = 1; + else + _isRooted = 0; + } + return _isRooted; + } + + private int serviceBinaryExists(boolean fromUIThread) { + if (_serviceBinaryExists == -1) { + if (RootUtils.serviceBinaryExists(fromUIThread)) + _serviceBinaryExists = 1; + else + _serviceBinaryExists = 0; + } + return _serviceBinaryExists; + } + + private int settingsBinaryExists(boolean fromUIThread) { + if (_settingsBinaryExists == -1) { + if (RootUtils.settingsBinaryExists(fromUIThread)) + _settingsBinaryExists = 1; + else + _settingsBinaryExists = 0; + } + return _settingsBinaryExists; + } + + private int isPPPPSInstalled(Context context) { + if (_isPPPPSInstalled == -1) { + if (ActivateProfileHelper.isPPPPutSettingsInstalled(context) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) + _isPPPPSInstalled = 1; + else + _isPPPPSInstalled = 0; + } + return _isPPPPSInstalled; + } + + private int isShiuzkuAvailable() { + if (_isShiuzkuAvailable == -1) { + if (ShizukuUtils.shizukuAvailable()) + _isShiuzkuAvailable = 1; + else + _isShiuzkuAvailable = 0; + } + return _isShiuzkuAvailable; + } + + private int isShiuzkuGranted() { + if (_isShiuzkuGranted == -1) { + if (ShizukuUtils.hasShizukuPermission()) + _isShiuzkuGranted = 1; + else + _isShiuzkuGranted = 0; + } + return _isShiuzkuGranted; + } + + private int canExploitWifiTethering(Context context) { + if (_canExploitWifiTethering == -1) { + if (WifiApManager.canExploitWifiTethering(context)) + _canExploitWifiTethering = 1; + else + _canExploitWifiTethering = 0; + } + return _canExploitWifiTethering; + } + + private int canExploitWifiTethering30(Context context) { + if (_canExploitWifiTethering30 == -1) { + if (WifiApManager.canExploitWifiTethering30(context)) + _canExploitWifiTethering30 = 1; + else + _canExploitWifiTethering30 = 0; + } + return _canExploitWifiTethering30; + } + + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_AIRPLANE_MODE( Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { boolean applicationNeverAskForGrantRoot = ApplicationPreferences.applicationNeverAskForGrantRoot; @@ -91,25 +180,25 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_AIRPLANE_MODE(Prefere assistantParameter = Integer.parseInt(sharedPreferences.getString(preferenceKey, "0")) >= 4; } - if ((!assistantParameter) && ShizukuUtils.hasShizukuPermission()) { - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if ((!assistantParameter) && (isShiuzkuGranted() == 1)) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._deviceAirplaneMode != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } } else - if ((!assistantParameter) && RootUtils.isRooted(/*fromUIThread*/)) { + if ((!assistantParameter) && (isRooted() == 1)) { // device is rooted if (profile != null) { // test if grant root is disabled if (profile._deviceAirplaneMode < 4) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } @@ -118,65 +207,67 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_AIRPLANE_MODE(Prefere if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._deviceAirplaneMode != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { if (assistantParameter) { // check if default Assistent is set to PPP if (ActivateProfileHelper.isPPPSetAsDefaultAssistant(context)) { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SET_AS_ASSISTANT; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SET_AS_ASSISTANT; //if ((profile != null) && (profile._deviceAirplaneMode != 0)) { - // preferenceAllowed.notAllowedRoot = true; + // notAllowedRoot = true; //} } } else { if (profile != null) { if (profile._deviceAirplaneMode != 0) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; - preferenceAllowed.notAllowedShizuku = true; +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_AIRPLANE_MODE", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { //noinspection ConstantConditions if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; - preferenceAllowed.notAllowedShizuku = true; +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_AIRPLANE_MODE", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } } } } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI( Profile profile, SharedPreferences sharedPreferences/*, boolean fromUIThread*/) { if (PPApplication.HAS_FEATURE_WIFI) { // device has Wifi - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; boolean applicationNeverAskForGrantRoot = ApplicationPreferences.applicationNeverAskForGrantRoot; @@ -191,11 +282,11 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI(PreferenceAllowe } if (requiresRoot) { - if (ShizukuUtils.hasShizukuPermission()) { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + if (isShiuzkuGranted() == 1) { + preferenceAllowed = PREFERENCE_ALLOWED; } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // shizuku is not granted but device is rooted if (profile != null) { @@ -204,8 +295,8 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI(PreferenceAllowe (profile._deviceWiFi == 7) || (profile._deviceWiFi == 8)) {*/ if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; } //} } else @@ -216,39 +307,54 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI(PreferenceAllowe preferenceValue.equals("7") || preferenceValue.equals("8")) {*/ if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters } //} } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; - if ((profile != null) && (profile._deviceWiFi != 0)) { - preferenceAllowed.notAllowedShizuku = true; + if (profile != null) { + if (profile._deviceWiFi != 0) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } } } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_BLUETOOTH(PreferenceAllowed preferenceAllowed) { + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_BLUETOOTH() { if (PPApplication.HAS_FEATURE_BLUETOOTH) // device has bluetooth - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA( String preferenceKey, Profile profile, SharedPreferences sharedPreferences, /*boolean fromUIThread,*/ Context context) { // PPApplicationStatic.logE("[DUAL_SIM] PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA", "*******************"); @@ -312,63 +418,64 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA(Preferenc if (ActivateProfileHelper.canSetMobileData(appContext)) { if (profile != null) { if (profile._deviceMobileData != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } } else - if (ShizukuUtils.hasShizukuPermission()) { + if (isShiuzkuGranted() == 1) { // not needed, used is "svc data enable/disable" /*if (ActivateProfileHelper.telephonyServiceExists(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA)) { - if (PPApplication.serviceBinaryExists(fromUIThread)) { + if (serviceBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._deviceMobileData != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + allowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + allowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); }*/ - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; final TelephonyManager telephonyManager = (TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null) { - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); + //HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); // PPApplicationStatic.logE("[DUAL_SIM] PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA", "hasSIM1="+hasSIMCardData.hasSIM1); // PPApplicationStatic.logE("[DUAL_SIM] PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA", "hasSIM2="+hasSIMCardData.hasSIM2); - boolean sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; +// boolean sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + boolean sim0Exists = telephonyManager.getPhoneCount() > 0; if (!sim0Exists) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted if (profile != null) { // test if grant root is disabled if ((profile._deviceMobileData != 0)) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } @@ -377,8 +484,8 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA(Preferenc if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } @@ -387,62 +494,78 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA(Preferenc // not needed, used is "svc data enable/disable" /*if (ActivateProfileHelper.telephonyServiceExists(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA)) { - if (PPApplication.serviceBinaryExists(fromUIThread)) { + if (serviceBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._deviceMobileData != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + allowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + allowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); }*/ - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; final TelephonyManager telephonyManager = (TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null) { - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); +// HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); // PPApplicationStatic.logE("[DUAL_SIM] PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA", "hasSIM1="+hasSIMCardData.hasSIM1); // PPApplicationStatic.logE("[DUAL_SIM] PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA", "hasSIM2="+hasSIMCardData.hasSIM2); - boolean sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; +// boolean sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + boolean sim0Exists = telephonyManager.getPhoneCount() > 0; if (!sim0Exists) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; - if ((profile != null) && (profile._deviceMobileData != 0)) { - preferenceAllowed.notAllowedShizuku = true; + if (profile != null) { + if (profile._deviceMobileData != 0) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } } } else { //Log.d("Profile.isProfilePreferenceAllowed", "mobile data not supported"); - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } /* - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_DUAL_SIM(PreferenceAllowed preferenceAllowed, - String preferenceKey, Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_DUAL_SIM( + String preferenceKey, Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { Context appContext = context.getApplicationContext(); @@ -502,10 +625,10 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_DUAL_SIM( if (profile != null) { if ((profile._deviceMobileDataSIM1 != 0) || (profile._deviceMobileDataSIM2 != 0)) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + allowed = PREFERENCE_ALLOWED; } else preferenceAllowed.allowed = PREFERENCE_ALLOWED; - } else if (RootUtils.isRooted(fromUIThread)) { + } else if (isRooted() == 1) { // device is rooted if (profile != null) { @@ -513,15 +636,15 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_DUAL_SIM( if ((profile._deviceMobileDataSIM1 != 0) || (profile._deviceMobileDataSIM2 != 0)) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; } } } else if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } @@ -529,74 +652,74 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_DUAL_SIM( } if (ActivateProfileHelper.telephonyServiceExists(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA)) { - if (RootUtils.serviceBinaryExists(fromUIThread)) { + if (serviceBinaryExists(fromUIThread) == 1) { if (profile != null) { if ((profile._deviceMobileDataSIM1 != 0) || (profile._deviceMobileDataSIM2 != 0)) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + allowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + allowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } final TelephonyManager telephonyManager = (TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null) { int phoneCount = telephonyManager.getPhoneCount(); if (phoneCount > 1) { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + allowed = PREFERENCE_ALLOWED; //if (!sim1Exists) { - // preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - // preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + // allowed = PREFERENCE_NOT_ALLOWED; + // notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; //} //if (!sim2Exists) { - // preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - // preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + // allowed = PREFERENCE_NOT_ALLOWED; + // notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; //} } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOTED; + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOTED; if ((profile != null) && ((profile._deviceMobileDataSIM1 != 0) || (profile._deviceMobileDataSIM2 != 0))) { - preferenceAllowed.notAllowedRoot = true; + notAllowedRoot = true; } } } else { //Log.d("Profile.isProfilePreferenceAllowed", "mobile data not supported"); - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } */ - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_PREFS(PreferenceAllowed preferenceAllowed) { + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_PREFS() { if (PPApplication.HAS_FEATURE_TELEPHONY) { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_GPS(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_GPS( Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { if (Build.VERSION.SDK_INT < 29) { @@ -612,69 +735,69 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_GPS(PreferenceAllowed if (Permissions.hasPermission(appContext, Manifest.permission.WRITE_SECURE_SETTINGS)) { if (profile != null) { if (profile._deviceGPS != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; - } else if (RootUtils.isRooted(/*fromUIThread*/)) { + preferenceAllowed = PREFERENCE_ALLOWED; + } else if (isRooted() == 1) { // device is rooted if (profile != null) { // test if grant root is disabled if (profile._deviceGPS != 0) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } } else if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._deviceGPS != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } /*else if (ActivateProfileHelper.canExploitGPS(appContext)) { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + allowed = PREFERENCE_ALLOWED; }*/ else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; if ((profile != null) && (profile._deviceGPS != 0)) { //return preferenceAllowed; - //preferenceAllowed.notAllowedRoot = true; - preferenceAllowed.notAllowedG1 = true; + //notAllowedRoot = true; + notAllowedG1 = true; } } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_ANDROID_VERSION; - preferenceAllowed.notAllowedReasonDetail = context.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_ANDROID_VERSION; + notAllowedReasonDetail = context.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_LOCATION_MODE(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_LOCATION_MODE( Profile profile, Context context) { Context appContext = context.getApplicationContext(); @@ -683,13 +806,13 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_LOCATION_MODE(Prefere if (Permissions.hasPermission(appContext, Manifest.permission.WRITE_SECURE_SETTINGS)) { if (profile != null) { if (profile._deviceLocationMode != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } /*else - if (PPApplication.isRooted(fromUIThread)) + if ((isRooted() == 1)) { // device is rooted - NOT WORKING @@ -697,8 +820,8 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_LOCATION_MODE(Prefere // test if grant root is disabled if (profile._deviceLocationMode != 0) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters //return preferenceAllowed; } @@ -708,8 +831,8 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_LOCATION_MODE(Prefere if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return preferenceAllowed; } @@ -717,24 +840,24 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_LOCATION_MODE(Prefere } if (PPApplication.settingsBinaryExists(fromUIThread)) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + allowed = PREFERENCE_ALLOWED; else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } }*/ else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; if ((profile != null) && (profile._deviceLocationMode != 0)) { //return preferenceAllowed; - //preferenceAllowed.notAllowedRoot = true; - preferenceAllowed.notAllowedG1 = true; + //notAllowedRoot = true; + notAllowedG1 = true; } } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NFC(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NFC( Profile profile, SharedPreferences sharedPreferences, /*boolean fromUIThread,*/ Context context) { Context appContext = context.getApplicationContext(); @@ -749,20 +872,20 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NFC(PreferenceAllowed if (Permissions.hasPermission(appContext, Manifest.permission.WRITE_SECURE_SETTINGS)) { if (profile != null) { if (profile._deviceNFC != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { if (profile != null) { // test if grant root is disabled if (profile._deviceNFC != 0) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } @@ -771,8 +894,8 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NFC(PreferenceAllowed if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } @@ -781,30 +904,30 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NFC(PreferenceAllowed if (profile != null) { if (profile._deviceNFC != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; if ((profile != null) && (profile._deviceNFC != 0)) { //return preferenceAllowed; - //preferenceAllowed.notAllowedRoot = true; - preferenceAllowed.notAllowedG1 = true; + //notAllowedRoot = true; + notAllowedG1 = true; } } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP( Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { Context appContext = context.getApplicationContext(); @@ -817,59 +940,62 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP(PreferenceAll if (PPApplication.HAS_FEATURE_WIFI) { // device has Wifi if (Build.VERSION.SDK_INT < 28) { - if (WifiApManager.canExploitWifiTethering(appContext)) { + if (canExploitWifiTethering(appContext) == 1) { if (profile != null) { if (profile._deviceWiFiAP != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else if (PPApplication.rootMutex.transactionCode_setWifiApEnabled != -1) { - if (ShizukuUtils.hasShizukuPermission()) { + if (isShiuzkuGranted() == 1) { if (ActivateProfileHelper.wifiServiceExists(Profile.PREF_PROFILE_DEVICE_WIFI_AP)) { - if (RootUtils.serviceBinaryExists(fromUIThread)) { + if (serviceBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._deviceWiFiAP != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; return; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); return; } - boolean sim0Exists; - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); - sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + boolean sim0Exists = false; +// HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); +// sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + TelephonyManager telephonyManager = (TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE); + if (telephonyManager != null) + sim0Exists = telephonyManager.getPhoneCount() > 0; if (!sim0Exists) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } - } else if (RootUtils.isRooted(/*fromUIThread*/)) { + } else if (isRooted() == 1) { // device is rooted if (profile != null) { // test if grant root is disabled if (profile._deviceWiFiAP != 0) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } } else if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } @@ -877,108 +1003,133 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP(PreferenceAll } if (ActivateProfileHelper.wifiServiceExists(Profile.PREF_PROFILE_DEVICE_WIFI_AP)) { - if (RootUtils.serviceBinaryExists(fromUIThread)) { + if (serviceBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._deviceWiFiAP != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; return; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); return; } - boolean sim0Exists; - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); - sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + boolean sim0Exists = false; +// HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); +// sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + TelephonyManager telephonyManager = (TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE); + if (telephonyManager != null) + sim0Exists = telephonyManager.getPhoneCount() > 0; if (!sim0Exists) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } } else { - if ((profile != null) && (profile._deviceWiFiAP != 0)) { - preferenceAllowed.notAllowedShizuku = true; + if (profile != null) { + if (profile._deviceWiFiAP != 0) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } else if (Build.VERSION.SDK_INT < 30) { - if (WifiApManager.canExploitWifiTethering(appContext)) { + if (canExploitWifiTethering(appContext) == 1) { if (profile != null) { if (profile._deviceWiFiAP != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; - - boolean sim0Exists; - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); - sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + preferenceAllowed = PREFERENCE_ALLOWED; + + boolean sim0Exists = false; +// HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); +// sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + TelephonyManager telephonyManager = (TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE); + if (telephonyManager != null) + sim0Exists = telephonyManager.getPhoneCount() > 0; if (!sim0Exists) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } } else { //if ((profile != null) && (profile._deviceWiFiAP != 0)) { - // preferenceAllowed.notAllowedRoot = true; + // notAllowedRoot = true; //} - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } else { // this must be called first, because WifiApManager.canExploitWifiTethering30(appContext) requires SIM inserted - boolean sim0Exists; - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); - sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + boolean sim0Exists = false; +// HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); +// sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + TelephonyManager telephonyManager = (TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE); + if (telephonyManager != null) + //noinspection deprecation + sim0Exists = telephonyManager.getPhoneCount() > 0; if (!sim0Exists) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } else { - if (WifiApManager.canExploitWifiTethering30(appContext)) { + if (canExploitWifiTethering30(appContext) == 1) { if (profile != null) { if (profile._deviceWiFiAP != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { //if ((profile != null) && (profile._deviceWiFiAP != 0)) { - // preferenceAllowed.notAllowedRoot = true; + // notAllowedRoot = true; //} - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } //} //else { - // preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - // preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - // preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_not_supported_android_version); + // allowed = PREFERENCE_NOT_ALLOWED; + // notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + // notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_not_supported_android_version); //} } - static void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_WHEN_RINGING(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_WHEN_RINGING( Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { boolean applicationNeverAskForGrantRoot = ApplicationPreferences.applicationNeverAskForGrantRoot; @@ -986,76 +1137,105 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_WHEN_RINGING(Prefere String preferenceKey = Profile.PREF_PROFILE_VIBRATE_WHEN_RINGING; if ((PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) || PPApplication.deviceIsOnePlus) { - if (ShizukuUtils.shizukuAvailable()) { - if (ShizukuUtils.hasShizukuPermission()) { - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (isShiuzkuAvailable() == 1) { + if (isShiuzkuGranted() == 1) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._vibrateWhenRinging != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { - if ((profile != null) && (profile._vibrateWhenRinging != 0)) { - boolean enabled = false; - if ((profile._volumeRingerMode == 1) || (profile._volumeRingerMode == 4)) - enabled = true; - if (profile._volumeRingerMode == 5) { - if ((profile._volumeZenMode == 1) || (profile._volumeZenMode == 2)) + if (profile != null) { + if (profile._vibrateWhenRinging != 0) { + boolean enabled = false; + if ((profile._volumeRingerMode == 1) || (profile._volumeRingerMode == 4)) enabled = true; - } - if (enabled) { - preferenceAllowed.notAllowedShizuku = true; + if (profile._volumeRingerMode == 5) { + if ((profile._volumeZenMode == 1) || (profile._volumeZenMode == 2)) + enabled = true; + } + if (enabled) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_WHEN_RINGING", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + String value = sharedPreferences.getString(preferenceKey, "0"); + if (!value.equals("0")) { + String ringerMode = sharedPreferences.getString(Profile.PREF_PROFILE_VOLUME_RINGER_MODE, "0"); + boolean enabled = false; + if (ringerMode.equals("1") || ringerMode.equals("4")) + enabled = true; + if (ringerMode.equals("5")) { + String zenMode = sharedPreferences.getString(Profile.PREF_PROFILE_VOLUME_ZEN_MODE, "0"); + if (zenMode.equals("1") || zenMode.equals("2")) + enabled = true; + } + if (enabled) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_WHEN_RINGING", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else + preferenceAllowed = PREFERENCE_ALLOWED; } } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; } } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted if (profile != null) { // test if grant root is disabled if (profile._vibrateWhenRinging != 0) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } } else if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._vibrateWhenRinging != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } - else if (ActivateProfileHelper.isPPPPutSettingsInstalled(context) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { + else if (isPPPPSInstalled(context) == 1) { if (profile != null) { if (profile._vibrateWhenRinging != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { if ((profile != null) && (profile._vibrateWhenRinging != 0)) { boolean enabled = false; @@ -1066,26 +1246,26 @@ else if (ActivateProfileHelper.isPPPPutSettingsInstalled(context) >= PPApplicati enabled = true; } if (enabled) { - preferenceAllowed.notAllowedPPPPS = true; + notAllowedPPPPS = true; } } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; } } else { if (profile != null) { if (profile._vibrateWhenRinging != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_NOTIFICATIONS(PreferenceAllowed preferenceAllowed, - Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { + void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_NOTIFICATIONS( + Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { Context appContext = context.getApplicationContext(); @@ -1095,9 +1275,9 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_NOTIFICATIONS(Prefer (PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) || (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) || PPApplication.deviceIsOnePlus) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } else { @@ -1105,137 +1285,174 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_NOTIFICATIONS(Prefer String preferenceKey = Profile.PREF_PROFILE_VIBRATE_NOTIFICATIONS; - if (ShizukuUtils.shizukuAvailable()) { - if (ShizukuUtils.hasShizukuPermission()) { - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (isShiuzkuAvailable() == 1) { + if (isShiuzkuGranted() == 1) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { - if (profile._vibrateWhenRinging != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + if (profile._vibrateNotifications != 0) + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { - if ((profile != null) && (profile._vibrateNotifications != 0)) { - preferenceAllowed.notAllowedShizuku = true; + if (profile != null) { + if (profile._vibrateNotifications != 0) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_NOTIFICATIONS", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_NOTIFICATIONS", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; } } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted if (profile != null) { // test if grant root is disabled if (profile._vibrateNotifications != 0) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } } else if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._vibrateNotifications != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else - if (ActivateProfileHelper.isPPPPutSettingsInstalled(context) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { + if (isPPPPSInstalled(context) == 1) { if (profile != null) { if (profile._vibrateNotifications != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { if ((profile != null) && (profile._vibrateNotifications != 0)) { - preferenceAllowed.notAllowedPPPPS = true; + notAllowedPPPPS = true; } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; } } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_ANDROID_VERSION; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_old_android); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_ANDROID_VERSION; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_old_android); } } @SuppressLint("ObsoleteSdkInt") - static void isProfileCategoryAllowed_PREF_PROFILE_VIBRATION_INTENSITY( - PreferenceAllowed preferenceAllowed, + void isProfileCategoryAllowed_PREF_PROFILE_VIBRATION_INTENSITY( Context context) { Context appContext = context.getApplicationContext(); if (Build.VERSION.SDK_INT < 29) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_ANDROID_VERSION; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_old_android); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_ANDROID_VERSION; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_old_android); } else if ((PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) || (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) || (PPApplication.deviceIsPixel && (Build.VERSION.SDK_INT < 33)) || (PPApplication.deviceIsOnePlus && (Build.VERSION.SDK_INT < 31))) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } else { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_RINGING( - PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_RINGING( Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { PreferenceAllowed _preferenceAllowed = new PreferenceAllowed(); - _preferenceAllowed.copyFrom(preferenceAllowed); - PreferenceAllowed.isProfileCategoryAllowed_PREF_PROFILE_VIBRATION_INTENSITY(_preferenceAllowed, context); - if (_preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { - if (ShizukuUtils.shizukuAvailable()) { - if (ShizukuUtils.hasShizukuPermission()) { - if (RootUtils.settingsBinaryExists(fromUIThread)) { + _preferenceAllowed.copyFrom(this); + _preferenceAllowed.isProfileCategoryAllowed_PREF_PROFILE_VIBRATION_INTENSITY( context); + if (_preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (isPPPPSInstalled(context) == 1) { + if (profile != null) { + if (profile.getVibrationIntensityRingingChange()) + preferenceAllowed = PREFERENCE_ALLOWED; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else + if (isShiuzkuAvailable() == 1) { + if (isShiuzkuGranted() == 1) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile.getVibrationIntensityRingingChange()) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { - if ((profile != null) && profile.getVibrationIntensityRingingChange()) { - preferenceAllowed.notAllowedShizuku = true; + if (profile != null) { + if (profile.getVibrationIntensityRingingChange()) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_RINGING", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + String preferenceKey = Profile.PREF_PROFILE_VIBRATION_INTENSITY_RINGING; + String value = sharedPreferences.getString(preferenceKey, "0"); + if (ProfileStatic.getVibrationIntensityChange(value)) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_RINGING", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; } } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted boolean applicationNeverAskForGrantRoot = ApplicationPreferences.applicationNeverAskForGrantRoot; @@ -1246,82 +1463,98 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_RINGING( // test if grant root is disabled if (profile.getVibrationIntensityRingingChange()) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } } else if (sharedPreferences != null) { if (ProfileStatic.getVolumeChange(sharedPreferences.getString(preferenceKey, "-1|1"))) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile.getVibrationIntensityRingingChange()) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } - } else - if (ActivateProfileHelper.isPPPPutSettingsInstalled(context) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { - if (profile != null) { - if (profile.getVibrationIntensityRingingChange()) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; - } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; } else { if ((profile != null) && profile.getVibrationIntensityRingingChange()) { - preferenceAllowed.notAllowedPPPPS = true; + notAllowedPPPPS = true; } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; } } else { - preferenceAllowed.copyFrom(_preferenceAllowed); + copyFrom(_preferenceAllowed); } } - static void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS( - PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS( Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { PreferenceAllowed _preferenceAllowed = new PreferenceAllowed(); - _preferenceAllowed.copyFrom(preferenceAllowed); - PreferenceAllowed.isProfileCategoryAllowed_PREF_PROFILE_VIBRATION_INTENSITY(_preferenceAllowed, context); + _preferenceAllowed.copyFrom(this); + _preferenceAllowed.isProfileCategoryAllowed_PREF_PROFILE_VIBRATION_INTENSITY( context); // Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS", "_preferenceAllowed.allowed="+_preferenceAllowed.allowed); - if (_preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { - if (ShizukuUtils.shizukuAvailable()) { - if (ShizukuUtils.hasShizukuPermission()) { - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (_preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (isPPPPSInstalled(context) == 1) { + if (profile != null) { + if (profile.getVibrationIntensityNotificationsChange()) + preferenceAllowed = PREFERENCE_ALLOWED; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else + if (isShiuzkuAvailable() == 1) { + if (isShiuzkuGranted() == 1) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile.getVibrationIntensityNotificationsChange()) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { - if ((profile != null) && profile.getVibrationIntensityNotificationsChange()) { - preferenceAllowed.notAllowedShizuku = true; + if (profile != null) { + if (profile.getVibrationIntensityNotificationsChange()) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + String preferenceKey = Profile.PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS; + String value = sharedPreferences.getString(preferenceKey, "0"); + if (ProfileStatic.getVibrationIntensityChange(value)) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; } } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted boolean applicationNeverAskForGrantRoot = ApplicationPreferences.applicationNeverAskForGrantRoot; @@ -1332,82 +1565,98 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICA // test if grant root is disabled if (profile.getVibrationIntensityNotificationsChange()) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } } else if (sharedPreferences != null) { if (ProfileStatic.getVolumeChange(sharedPreferences.getString(preferenceKey, "-1|1"))) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile.getVibrationIntensityNotificationsChange()) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } - } else - if (ActivateProfileHelper.isPPPPutSettingsInstalled(context) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { - if (profile != null) { - if (profile.getVibrationIntensityNotificationsChange()) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; - } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; } else { if ((profile != null) && profile.getVibrationIntensityNotificationsChange()) { - preferenceAllowed.notAllowedPPPPS = true; + notAllowedPPPPS = true; } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; } } else { - preferenceAllowed.copyFrom(_preferenceAllowed); + copyFrom(_preferenceAllowed); } } - static void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION( - PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION( Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { PreferenceAllowed _preferenceAllowed = new PreferenceAllowed(); - _preferenceAllowed.copyFrom(preferenceAllowed); - PreferenceAllowed.isProfileCategoryAllowed_PREF_PROFILE_VIBRATION_INTENSITY(_preferenceAllowed, context); - if (_preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { - if (ShizukuUtils.shizukuAvailable()) { - if (ShizukuUtils.hasShizukuPermission()) { - if (RootUtils.settingsBinaryExists(fromUIThread)) { + _preferenceAllowed.copyFrom(this); + _preferenceAllowed.isProfileCategoryAllowed_PREF_PROFILE_VIBRATION_INTENSITY( context); + if (_preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (isPPPPSInstalled(context) == 1) { + if (profile != null) { + if (profile.getVibrationIntensityTouchInteractionChange()) + preferenceAllowed = PREFERENCE_ALLOWED; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else + if (isShiuzkuAvailable() == 1) { + if (isShiuzkuGranted() == 1) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile.getVibrationIntensityTouchInteractionChange()) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { - if ((profile != null) && profile.getVibrationIntensityTouchInteractionChange()) { - preferenceAllowed.notAllowedShizuku = true; + if (profile != null) { + if (profile.getVibrationIntensityTouchInteractionChange()) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + String preferenceKey = Profile.PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION; + String value = sharedPreferences.getString(preferenceKey, "0"); + if (ProfileStatic.getVibrationIntensityChange(value)) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; } } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted boolean applicationNeverAskForGrantRoot = ApplicationPreferences.applicationNeverAskForGrantRoot; @@ -1418,88 +1667,81 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_IN // test if grant root is disabled if (profile.getVibrationIntensityTouchInteractionChange()) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } } else if (sharedPreferences != null) { if (ProfileStatic.getVolumeChange(sharedPreferences.getString(preferenceKey, "-1|1"))) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile.getVibrationIntensityTouchInteractionChange()) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } - } else - if (ActivateProfileHelper.isPPPPutSettingsInstalled(context) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { - if (profile != null) { - if (profile.getVibrationIntensityTouchInteractionChange()) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; - } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; } else { if ((profile != null) && profile.getVibrationIntensityTouchInteractionChange()) { - preferenceAllowed.notAllowedPPPPS = true; + notAllowedPPPPS = true; } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; } } else { - preferenceAllowed.copyFrom(_preferenceAllowed); + copyFrom(_preferenceAllowed); } } /* - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ADAPTIVE_BRIGHTNESS(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ADAPTIVE_BRIGHTNESS( SharedPreferences sharedPreferences, boolean fromUIThread) { boolean applicationNeverAskForGrantRoot = ApplicationPreferences.applicationNeverAskForGrantRoot; - if (RootUtils.isRooted(fromUIThread)) { + if (isRooted() == 1) { // device is rooted if (sharedPreferences != null) { String value = sharedPreferences.getString(Profile.PREF_PROFILE_DEVICE_BRIGHTNESS, Profile.defaultValuesString.get(Profile.PREF_PROFILE_DEVICE_BRIGHTNESS)); if (ProfileStatic.getDeviceBrightnessChange(value) && ProfileStatic.getDeviceBrightnessAutomatic(value)) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + if (settingsBinaryExists(fromUIThread) == 1) { + allowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOTED; + allowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOTED; } } */ - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_POWER_SAVE_MODE(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_POWER_SAVE_MODE( Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { Context appContext = context.getApplicationContext(); @@ -1511,21 +1753,21 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_POWER_SAVE_MODE(Prefe if (Permissions.hasPermission(appContext, Manifest.permission.WRITE_SECURE_SETTINGS)) { if (profile != null) { if (profile._devicePowerSaveMode != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted if (profile != null) { // test if grant root is disabled if (profile._devicePowerSaveMode != 0) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } @@ -1534,38 +1776,38 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_POWER_SAVE_MODE(Prefe if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._devicePowerSaveMode != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; if ((profile != null) && (profile._devicePowerSaveMode != 0)) { - //preferenceAllowed.notAllowedRoot = true; - preferenceAllowed.notAllowedG1 = true; + //notAllowedRoot = true; + notAllowedG1 = true; } } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE( String preferenceKey, Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { Context appContext = context.getApplicationContext(); @@ -1579,45 +1821,46 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE(Preferen final int phoneType = telephonyManager.getPhoneType(); if ((phoneType == TelephonyManager.PHONE_TYPE_GSM) || (phoneType == TelephonyManager.PHONE_TYPE_CDMA)) { - if (ShizukuUtils.hasShizukuPermission()) { + if (isShiuzkuGranted() == 1) { if (ActivateProfileHelper.telephonyServiceExists(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE)) { - if (RootUtils.serviceBinaryExists(fromUIThread)) { + if (serviceBinaryExists(fromUIThread) == 1) { if (profile == null) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; else { if (profile._deviceNetworkType != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; return; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); return; } boolean sim0Exists; // Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE", "called hasSIMCard"); - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); - sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; +// HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); +// sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + sim0Exists = telephonyManager.getPhoneCount() > 0; if (!sim0Exists) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted if (profile != null) { // test if grant root is disabled if ((profile._deviceNetworkType != 0)) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } @@ -1626,8 +1869,8 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE(Preferen if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } @@ -1635,60 +1878,76 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE(Preferen } if (ActivateProfileHelper.telephonyServiceExists(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE)) { - if (RootUtils.serviceBinaryExists(fromUIThread)) { + if (serviceBinaryExists(fromUIThread) == 1) { if (profile == null) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; else { if (profile._deviceNetworkType != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; return; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); return; } boolean sim0Exists; // Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE", "called hasSIMCard"); - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); - sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; +// HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); +// sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + sim0Exists = telephonyManager.getPhoneCount() > 0; if (!sim0Exists) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } } else { - if ((profile != null) && (profile._deviceNetworkType != 0)) { - preferenceAllowed.notAllowedShizuku = true; + if (profile != null) { + if (profile._deviceNetworkType != 0) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_network_type); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_network_type); } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_network_type); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_network_type); } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_DUAL_SIM(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_DUAL_SIM( String preferenceKey, Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { Context appContext = context.getApplicationContext(); @@ -1703,37 +1962,37 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_DUAL_SIM final int phoneType = telephonyManager.getPhoneType(); if ((phoneType == TelephonyManager.PHONE_TYPE_GSM) || (phoneType == TelephonyManager.PHONE_TYPE_CDMA)) { - if (ShizukuUtils.hasShizukuPermission()) { + if (isShiuzkuGranted() == 1) { if (ActivateProfileHelper.telephonyServiceExists(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE)) { - if (RootUtils.serviceBinaryExists(fromUIThread)) { + if (serviceBinaryExists(fromUIThread) == 1) { if (profile == null) //noinspection UnusedAssignment - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; else { if ((profile._deviceNetworkTypeSIM1 != 0) || (profile._deviceNetworkTypeSIM2 != 0)) //noinspection UnusedAssignment - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } if (phoneCount > 1) { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } else { //noinspection UnusedAssignment - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted if (profile != null) { @@ -1742,16 +2001,16 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_DUAL_SIM (profile._deviceNetworkTypeSIM2 != 0) ) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } } else if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } @@ -1759,59 +2018,73 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_DUAL_SIM } if (ActivateProfileHelper.telephonyServiceExists(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE)) { - if (RootUtils.serviceBinaryExists(fromUIThread)) { + if (serviceBinaryExists(fromUIThread) == 1) { if (profile == null) //noinspection UnusedAssignment - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; else { if ((profile._deviceNetworkTypeSIM1 != 0) || (profile._deviceNetworkTypeSIM2 != 0)) //noinspection UnusedAssignment - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } if (phoneCount > 1) { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } else { //noinspection UnusedAssignment - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } else { - if ((profile != null) && - ((profile._deviceNetworkTypeSIM1 != 0) || - (profile._deviceNetworkTypeSIM2 != 0))) { - preferenceAllowed.notAllowedShizuku = true; + if (profile != null) { + if ((profile._deviceNetworkTypeSIM1 != 0) || + (profile._deviceNetworkTypeSIM2 != 0)) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_DUAL_SIM", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_DUAL_SIM", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_network_type); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_network_type); } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_network_type); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_network_type); } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_NOTIFICATION_LED(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_NOTIFICATION_LED( Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { // Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_NOTIFICATION_LED", "xxx"); @@ -1824,85 +2097,100 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_NOTIFICATION_LED(PreferenceA int value = Settings.System.getInt(appContext.getContentResolver(), "notification_light_pulse"/*Settings.System.NOTIFICATION_LIGHT_PULSE*/, -10); if (value != -10) { - if (ShizukuUtils.shizukuAvailable()) { - if (ShizukuUtils.hasShizukuPermission()) { - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (isPPPPSInstalled(context) == 1) { +// Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_NOTIFICATION_LED", "installed"); + if (profile != null) { + if (profile._notificationLed != 0) + preferenceAllowed = PREFERENCE_ALLOWED; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else + if (isShiuzkuAvailable() == 1) { + if (isShiuzkuGranted() == 1) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._notificationLed != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { - if ((profile != null) && (profile._notificationLed != 0)) { - preferenceAllowed.notAllowedShizuku = true; + if (profile != null) { + if (profile._notificationLed != 0) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_NOTIFICATION_LED", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_NOTIFICATION_LED", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; } } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted if (profile != null) { // test if grant root is disabled if (profile._notificationLed != 0) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } } else if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._notificationLed != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } - } else - if (ActivateProfileHelper.isPPPPutSettingsInstalled(context) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { -// Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_NOTIFICATION_LED", "installed"); - if (profile != null) { - if (profile._notificationLed != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; - } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; } else { // Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_NOTIFICATION_LED", "(2)"); if ((profile != null) && (profile._notificationLed != 0)) { - preferenceAllowed.notAllowedPPPPS = true; + notAllowedPPPPS = true; } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; } } else { // Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_NOTIFICATION_LED", "(3)"); - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_old_android); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_old_android); } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_KEYGUARD(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_KEYGUARD( Context context) { Context appContext = context.getApplicationContext(); @@ -1912,68 +2200,68 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_KEYGUARD(PreferenceAl if (keyguardManager != null) { secureKeyguard = keyguardManager.isKeyguardSecure(); if (secureKeyguard) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_APPLICATION; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_secure_lock); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_APPLICATION; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_secure_lock); } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_CONNECT_TO_SSID(PreferenceAllowed preferenceAllowed) { + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_CONNECT_TO_SSID() { if (PPApplication.HAS_FEATURE_WIFI) // device has Wifi - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_WIFI_SCANNING(PreferenceAllowed preferenceAllowed) { + void isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_WIFI_SCANNING() { if (PPApplication.HAS_FEATURE_WIFI) // device has Wifi - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_BLUETOOTH_SCANNING(PreferenceAllowed preferenceAllowed) { + void isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_BLUETOOTH_SCANNING() { if (PPApplication.HAS_FEATURE_BLUETOOTH) // device has bluetooth - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP_PREFS(PreferenceAllowed preferenceAllowed) { + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP_PREFS() { if (PPApplication.HAS_FEATURE_WIFI) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_MOBILE_CELL_SCANNING(PreferenceAllowed preferenceAllowed) { + void isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_MOBILE_CELL_SCANNING() { if (PPApplication.HAS_FEATURE_TELEPHONY) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_ORIENTATION_SCANNING(PreferenceAllowed preferenceAllowed) { + void isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_ORIENTATION_SCANNING() { if (PPApplication.sensorManager != null) { boolean hasAccelerometer = PPApplication.accelerometerSensor != null; @@ -1982,19 +2270,19 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_ORIENTAT boolean hasLight = PPApplication.lightSensor != null; if (hasAccelerometer || hasProximity || hasLight) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_HEADS_UP_NOTIFICATIONS(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_HEADS_UP_NOTIFICATIONS( Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { Context appContext = context.getApplicationContext(); @@ -2008,21 +2296,21 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_HEADS_UP_NOTIFICATIONS(Prefe if (Permissions.hasPermission(appContext, Manifest.permission.WRITE_SECURE_SETTINGS)) { if (profile != null) { if (profile._headsUpNotifications != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted if (profile != null) { // test if grant root is disabled if (profile._headsUpNotifications != 0) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } @@ -2031,63 +2319,63 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_HEADS_UP_NOTIFICATIONS(Prefe if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._headsUpNotifications != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; if ((profile != null) && (profile._headsUpNotifications != 0)) { //return preferenceAllowed; - //preferenceAllowed.notAllowedRoot = true; - preferenceAllowed.notAllowedG1 = true; + //notAllowedRoot = true; + notAllowedG1 = true; } } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_PREFS(PreferenceAllowed preferenceAllowed) { + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_PREFS() { if (PPApplication.HAS_FEATURE_TELEPHONY) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_VOLUME_ACCESSIBILITY(PreferenceAllowed preferenceAllowed/*, + void isProfilePreferenceAllowed_PREF_PROFILE_VOLUME_ACCESSIBILITY(/*, Context context*/) { //Context appContext = context.getApplicationContext(); - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } - static void isProfilePreferenceAllowed_PREF_PROFILE_ALWAYS_ON_DISPLAY(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_ALWAYS_ON_DISPLAY( Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { Context appContext = context.getApplicationContext(); @@ -2099,55 +2387,55 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_ALWAYS_ON_DISPLAY(Preference if (Permissions.hasPermission(appContext, Manifest.permission.WRITE_SECURE_SETTINGS)) { if (profile != null) { if (profile._headsUpNotifications != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted if (profile != null) { // test if grant root is disabled if (profile._alwaysOnDisplay != 0) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; return; } } } else if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._alwaysOnDisplay != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; if ((profile != null) && (profile._alwaysOnDisplay != 0)) { //return preferenceAllowed; - //preferenceAllowed.notAllowedRoot = true; - preferenceAllowed.notAllowedG1 = true; + //notAllowedRoot = true; + notAllowedG1 = true; } } } - static void isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_DARK_MODE(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_DARK_MODE( Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { Context appContext = context.getApplicationContext(); @@ -2160,21 +2448,21 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_DARK_MODE(PreferenceA if (Permissions.hasPermission(appContext, Manifest.permission.WRITE_SECURE_SETTINGS)) { if (profile != null) { if (profile._screenDarkMode != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - if (RootUtils.isRooted(/*fromUIThread*/)) + if (isRooted() == 1) { // device is rooted if (profile != null) { // test if grant root is disabled if (profile._screenDarkMode != 0) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } @@ -2183,58 +2471,315 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_DARK_MODE(PreferenceA if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._screenDarkMode != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; if ((profile != null) && (profile._screenDarkMode != 0)) { //return preferenceAllowed; - preferenceAllowed.notAllowedG1 = true; + notAllowedG1 = true; } } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_old_android); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_old_android); + } + } + + void isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_NIGHT_LIGHT( + Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { + Context appContext = context.getApplicationContext(); + + boolean applicationNeverAskForGrantRoot = ApplicationPreferences.applicationNeverAskForGrantRoot; + + String preferenceKey = Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT; + + if (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) { + //allowed = PREFERENCE_NOT_ALLOWED; + //notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + + if (isPPPPSInstalled(context) == 1) { + if (profile != null) { + if (profile._screenNightLight != 0) + preferenceAllowed = PREFERENCE_ALLOWED; + } + else + preferenceAllowed = PREFERENCE_ALLOWED; + } else + if (isShiuzkuAvailable() == 1) { + if (isShiuzkuGranted() == 1) { + if (settingsBinaryExists(fromUIThread) == 1) { + if (profile != null) { + if (profile._screenNightLight != 0) + preferenceAllowed = PREFERENCE_ALLOWED; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + } + } else { + if (profile != null) { + if (profile._screenNightLight != 0) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_NIGHT_LIGHT", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_NIGHT_LIGHT", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } + } + } + } else + if (isRooted() == 1) { + // device is rooted + + if (profile != null) { + // test if grant root is disabled + if (profile._screenNightLight != 0) { + if (applicationNeverAskForGrantRoot) { + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + return; + } + } + } else if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { + if (applicationNeverAskForGrantRoot) { + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + // not needed to test all parameters + return; + } + } + } + + if (settingsBinaryExists(fromUIThread) == 1) { + if (profile != null) { + if (profile._screenNightLight != 0) + preferenceAllowed = PREFERENCE_ALLOWED; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + } + } else { + if ((profile != null) && (profile._screenNightLight != 0)) { + notAllowedPPPPS = true; + } + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; + } } + else + if (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) { + if (isShiuzkuAvailable() == 1) { + if (isShiuzkuGranted() == 1) { + if (settingsBinaryExists(fromUIThread) == 1) { + if (profile != null) { + if (profile._screenNightLight != 0) + preferenceAllowed = PREFERENCE_ALLOWED; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + } + } else { + if (profile != null) { + if (profile._screenNightLight != 0) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_NIGHT_LIGHT", "(3) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_NIGHT_LIGHT", "(4) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } + } + } + } + else if (isRooted() == 1) { + // shizuku is not granted but device is rooted + + if (profile != null) { + // test if grant root is disabled + if (profile._screenNightLight != 0) { + if (applicationNeverAskForGrantRoot) { + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + return; + } + } + } else if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { + if (applicationNeverAskForGrantRoot) { + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + // not needed to test all parameters + return; + } + } + } + + if (settingsBinaryExists(fromUIThread) == 1) { + if (profile != null) { + if (profile._screenNightLight != 0) + preferenceAllowed = PREFERENCE_ALLOWED; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + } + } else { + if (profile != null) { + if (profile._screenNightLight != 0) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_NIGHT_LIGHT", "(5) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_NIGHT_LIGHT", "(6) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } + } + } + } + else + if (!((PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) /*|| + (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy)*/)) { + if (Permissions.hasPermission(appContext, Manifest.permission.WRITE_SECURE_SETTINGS)) { + if (profile != null) { + if (profile._screenNightLight != 0) + preferenceAllowed = PREFERENCE_ALLOWED; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else if (isRooted() == 1) { + // device is rooted + if (profile != null) { + // test if grant root is disabled + if (profile._screenNightLight != 0) { + if (applicationNeverAskForGrantRoot) { + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + return; + } + } + } else if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { + if (applicationNeverAskForGrantRoot) { + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + // not needed to test all parameters + return; + } + } + } + + if (settingsBinaryExists(fromUIThread) == 1) { + if (profile != null) { + if (profile._screenNightLight != 0) + preferenceAllowed = PREFERENCE_ALLOWED; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + } + } else { + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION; + if ((profile != null) && (profile._screenNightLight != 0)) { + //return preferenceAllowed; + notAllowedG1 = true; + } + } + } else { + if (profile != null) { + if (profile._screenNightLight != 0) + preferenceAllowed = PREFERENCE_ALLOWED; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } + } + + void isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS() { + if ((PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) || + PPApplication.deviceIsOnePlus) { + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + } + else + preferenceAllowed = PREFERENCE_ALLOWED; } - static void isProfilePreferenceAllowed_PREF_PROFILE_VOLUME_SPEAKER_PHONE(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_VOLUME_SPEAKER_PHONE( Context context) { Context appContext = context.getApplicationContext(); if (Build.VERSION.SDK_INT < 29) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_not_supported_android_version); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_not_supported_android_version); } } - static void isProfilePreferenceAllowed_PREF_PROFILE_CAMERA_FLASH(PreferenceAllowed preferenceAllowed/*, Context context*/) { + void isProfilePreferenceAllowed_PREF_PROFILE_CAMERA_FLASH(/*, Context context*/) { boolean flashAvailable; if (PPApplication.HAS_FEATURE_CAMERA_FLASH) { @@ -2252,14 +2797,14 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_CAMERA_FLASH(PreferenceAllow flashAvailable = false; } if (flashAvailable) { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS( Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { Context appContext = context.getApplicationContext(); @@ -2274,56 +2819,57 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS(Pre int phoneCount = telephonyManager.getPhoneCount(); // PPApplicationStatic.logE("[DUAL_SIM] Profile.isProfilePreferenceAllowed", "phoneCount="+phoneCount); - if (ShizukuUtils.hasShizukuPermission()) { + if (isShiuzkuGranted() == 1) { if (ActivateProfileHelper.telephonyServiceExists(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS)) { if (phoneCount > 1) { - if (RootUtils.serviceBinaryExists(fromUIThread)) { + if (serviceBinaryExists(fromUIThread) == 1) { if (profile != null) { if (!profile._deviceDefaultSIMCards.equals("0|0|0")) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; return; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; return; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); return; } boolean sim0Exists; - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); - sim0Exists = hasSIMCardData.simCount > 1;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; +// HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); +// sim0Exists = hasSIMCardData.simCount > 1;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + sim0Exists = telephonyManager.getPhoneCount() > 0; if (!sim0Exists) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_TWO_SIM_CARDS; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_TWO_SIM_CARDS; } } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted if (profile != null) { // test if grant root is disabled if (!profile._deviceDefaultSIMCards.equals("0|0|0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } } else if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0|0|0").equals("0|0|0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } @@ -2332,56 +2878,72 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS(Pre if (ActivateProfileHelper.telephonyServiceExists(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS)) { if (phoneCount > 1) { - if (RootUtils.serviceBinaryExists(fromUIThread)) { + if (serviceBinaryExists(fromUIThread) == 1) { if (profile != null) { if (!profile._deviceDefaultSIMCards.equals("0|0|0")) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; return; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; return; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); return; } boolean sim0Exists; - HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); - sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; +// HasSIMCardData hasSIMCardData = GlobalUtils.hasSIMCard(context); +// sim0Exists = hasSIMCardData.simCount > 0;//hasSIMCardData.hasSIM1 || hasSIMCardData.hasSIM2; + sim0Exists = telephonyManager.getPhoneCount() > 0; if (!sim0Exists) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_SIM_CARD; } } else { - if ((profile != null) && (!profile._deviceDefaultSIMCards.equals("0|0|0"))) { - preferenceAllowed.notAllowedShizuku = true; + if (profile != null) { + if (!profile._deviceDefaultSIMCards.equals("0|0|0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0|0|0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } //} else { - // preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - // preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + // allowed = PREFERENCE_NOT_ALLOWED; + // notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; //} } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM( String preferenceKey, Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { Context appContext = context.getApplicationContext(); @@ -2389,19 +2951,19 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM(PreferenceA boolean applicationNeverAskForGrantRoot = ApplicationPreferences.applicationNeverAskForGrantRoot; if (Build.VERSION.SDK_INT >= 29) { - if (ShizukuUtils.hasShizukuPermission()) { + if (isShiuzkuGranted() == 1) { if (ActivateProfileHelper.telephonyServiceExists(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1)) { - if (RootUtils.serviceBinaryExists(fromUIThread)) { + if (serviceBinaryExists(fromUIThread) == 1) { //Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM", "(0) PREFERENCE_ALLOWED"); if (profile != null) { if ((profile._deviceOnOffSIM1 != 0) || (profile._deviceOnOffSIM2 != 0)) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; //Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM", "(1) PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND"); return; } @@ -2410,27 +2972,27 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM(PreferenceA if (telephonyManager != null) { int phoneCount = telephonyManager.getPhoneCount(); if (phoneCount > 1) { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; //Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM", "(2) PREFERENCE_ALLOWED"); } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; //Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM", "(3) PREFERENCE_NOT_ALLOWED_NO_HARDWARE"); } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); //Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM", "(4) PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM"); } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); //Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM", "(5) PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM"); } } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted if (profile != null) { @@ -2438,16 +3000,16 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM(PreferenceA if ((profile._deviceOnOffSIM1 != 0) || (profile._deviceOnOffSIM2 != 0)) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } } else if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } @@ -2455,18 +3017,18 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM(PreferenceA } if (ActivateProfileHelper.telephonyServiceExists(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1)) { - if (RootUtils.serviceBinaryExists(fromUIThread)) { + if (serviceBinaryExists(fromUIThread) == 1) { if (profile != null) { if ((profile._deviceOnOffSIM1 != 0) || (profile._deviceOnOffSIM2 != 0)) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SERVICE_NOT_FOUND; return; } @@ -2474,41 +3036,54 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM(PreferenceA if (telephonyManager != null) { int phoneCount = telephonyManager.getPhoneCount(); if (phoneCount > 1) { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; -// Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM", "(4) PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED"); - if ((profile != null) && - ((profile._deviceOnOffSIM1 != 0) || - (profile._deviceOnOffSIM2 != 0))) { - preferenceAllowed.notAllowedShizuku = true; + if (profile != null) { + if ((profile._deviceOnOffSIM1 != 0) || + (profile._deviceOnOffSIM2 != 0)) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); //Log.e("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM", "(6) PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM"); } } - static void isProfilePreferenceAllowed_PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM( Profile profile, Context context) { Context appContext = context.getApplicationContext(); @@ -2524,28 +3099,28 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM(Pr if (profile != null) { if ((profile._soundRingtoneChangeSIM1 != 0) || (profile._soundRingtoneChangeSIM2 != 0)) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_APPLICATION; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_not_supported_by_ppp); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_APPLICATION; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_not_supported_by_ppp); } } - static void isProfilePreferenceAllowed_PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM( String preferenceKey, Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context, boolean forSIM2) { @@ -2564,114 +3139,129 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SI rootRequired = true; boolean ppppsInstalled = false; if (!rootRequired) { - ppppsInstalled = ActivateProfileHelper.isPPPPutSettingsInstalled(context) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED; + ppppsInstalled = isPPPPSInstalled(context) == 1; } - if (ShizukuUtils.shizukuAvailable()) { - if (ShizukuUtils.hasShizukuPermission()) { - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (isShiuzkuAvailable() == 1) { + if (isShiuzkuGranted() == 1) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if ((profile._soundNotificationChangeSIM1 != 0) || (profile._soundNotificationChangeSIM2 != 0)) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { if (profile != null) { - preferenceAllowed.notAllowedShizuku = true; + if ((profile._soundNotificationChangeSIM1 != 0) || + (profile._soundNotificationChangeSIM2 != 0)) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; } } else - if (RootUtils.isRooted(/*fromUIThread*/)) { - // device is rooted - + if (isRooted() == 1) { if (profile != null) { // test if grant root is disabled if ((profile._soundNotificationChangeSIM1 != 0) || (profile._soundNotificationChangeSIM2 != 0)) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } } else if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { + // device is rooted + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if ((profile._soundNotificationChangeSIM1 != 0) || (profile._soundNotificationChangeSIM2 != 0)) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { if (rootRequired) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOTED; } else { if (ppppsInstalled) { if (profile != null) { if ((profile._soundNotificationChangeSIM1 != 0) || (profile._soundNotificationChangeSIM2 != 0)) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { if (profile != null) { if ((profile._soundNotificationChangeSIM1 != 0) || (profile._soundNotificationChangeSIM2 != 0)) { - preferenceAllowed.notAllowedPPPPS = true; + notAllowedPPPPS = true; } } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; } } } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } else if ((PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) || PPApplication.deviceIsOnePlus) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_not_supported); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_not_supported); } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_APPLICATION; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_not_supported_by_ppp); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_APPLICATION; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_not_supported_by_ppp); } } - static void isProfilePreferenceAllowed_PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS( Profile profile, SharedPreferences sharedPreferences, boolean fromUIThread, Context context) { Context appContext = context.getApplicationContext(); @@ -2686,93 +3276,108 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH if (telephonyManager != null) { int phoneCount = telephonyManager.getPhoneCount(); if (phoneCount > 1) { - if (ShizukuUtils.shizukuAvailable()) { - if (ShizukuUtils.hasShizukuPermission()) { - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (isPPPPSInstalled(context) == 1) { + if (profile != null) { + if (profile._soundSameRingtoneForBothSIMCards != 0) + preferenceAllowed = PREFERENCE_ALLOWED; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else + if (isShiuzkuAvailable() == 1) { + if (isShiuzkuGranted() == 1) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._soundSameRingtoneForBothSIMCards != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } } else { - if ((profile != null) && (profile._soundSameRingtoneForBothSIMCards != 0)) { - preferenceAllowed.notAllowedShizuku = true; + if (profile != null) { + if (profile._soundSameRingtoneForBothSIMCards != 0) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; } } else - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // device is rooted if (profile != null) { // test if grant root is disabled if ((profile._soundSameRingtoneForBothSIMCards != 0)) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; return; } } } else if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters return; } } } - if (RootUtils.settingsBinaryExists(fromUIThread)) { + if (settingsBinaryExists(fromUIThread) == 1) { if (profile != null) { if (profile._soundSameRingtoneForBothSIMCards != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SETTINGS_NOT_FOUND; } - } else - if (ActivateProfileHelper.isPPPPutSettingsInstalled(context) >= PPApplication.VERSION_CODE_PPPPS_REQUIRED) { - if (profile != null) { - if (profile._soundSameRingtoneForBothSIMCards != 0) - preferenceAllowed.allowed = PREFERENCE_ALLOWED; - } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; } else { if ((profile != null) && (profile._soundSameRingtoneForBothSIMCards != 0)) { - preferenceAllowed.notAllowedPPPPS = true; + notAllowedPPPPS = true; } - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_detail_cant_be_change); } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; - preferenceAllowed.notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_not_supported); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_SUPPORTED_BY_SYSTEM; + notAllowedReasonDetail = appContext.getString(R.string.preference_not_allowed_reason_not_supported); } } - static void isProfilePreferenceAllowed_PREF_PROFILE_LOCK_DEVICE(PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_LOCK_DEVICE( Profile profile, SharedPreferences sharedPreferences) { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; boolean applicationNeverAskForGrantRoot = ApplicationPreferences.applicationNeverAskForGrantRoot; @@ -2787,7 +3392,7 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_LOCK_DEVICE(PreferenceAllowe } if (requiresRoot) { - if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isRooted() == 1) { // shizuku is not granted but device is rooted if (profile != null) { @@ -2796,8 +3401,8 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_LOCK_DEVICE(PreferenceAllowe (profile._deviceWiFi == 7) || (profile._deviceWiFi == 8)) {*/ if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; } //} } else @@ -2808,33 +3413,36 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_LOCK_DEVICE(PreferenceAllowe preferenceValue.equals("7") || preferenceValue.equals("8")) {*/ if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; // not needed to test all parameters } //} } } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOTED; if ((profile != null) && (profile._deviceWiFi != 0)) { - preferenceAllowed.notAllowedRoot = true; + notAllowedRoot = true; } } } } - static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_SCREEN_TIMEOUT( - PreferenceAllowed preferenceAllowed, + void isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_ON_OFF() { + preferenceAllowed = PREFERENCE_ALLOWED; + } + + void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_SCREEN_TIMEOUT( String preferenceKey, Profile profile, SharedPreferences sharedPreferences/*, boolean fromUIThread, Context context*/) { // PPApplicationStatic.logE("[DUAL_SIM] PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_SCREEN_TIMEOUT", "*******************"); // Context appContext = context.getApplicationContext(); if (PPApplication.deviceIsOppo || PPApplication.deviceIsRealme || PPApplication.deviceIsOnePlus) { - if (ShizukuUtils.hasShizukuPermission()) { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; - } else if (RootUtils.isRooted(/*fromUIThread*/)) { + if (isShiuzkuGranted() == 1) { + preferenceAllowed = PREFERENCE_ALLOWED; + } else if (isRooted() == 1) { // device is rooted boolean applicationNeverAskForGrantRoot = ApplicationPreferences.applicationNeverAskForGrantRoot; @@ -2843,29 +3451,59 @@ static void isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_SCREEN_TIMEOUT( // test if grant root is disabled if ((profile._deviceScreenTimeout != 0)) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; } } } else if (sharedPreferences != null) { if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { if (applicationNeverAskForGrantRoot) { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED; } } } else - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } else { - preferenceAllowed.allowed = PREFERENCE_NOT_ALLOWED; - preferenceAllowed.notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; - if ((profile != null) && (profile._deviceScreenTimeout != 0)) { - preferenceAllowed.notAllowedShizuku = true; + if (profile != null) { + if (profile._deviceScreenTimeout != 0) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_SCREEN_TIMEOUT", "(1) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } else { + //noinspection ConstantConditions + if (sharedPreferences != null) { + if (!sharedPreferences.getString(preferenceKey, "0").equals("0")) { +// PPApplicationStatic.logE("PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_SCREEN_TIMEOUT", "(2) Shizuku not granted"); + preferenceAllowed = PREFERENCE_NOT_ALLOWED; + notAllowedReason = PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED; + notAllowedShizuku = true; + } else + preferenceAllowed = PREFERENCE_ALLOWED; + } } } } else { - preferenceAllowed.allowed = PREFERENCE_ALLOWED; + preferenceAllowed = PREFERENCE_ALLOWED; } } + void isProfilePreferenceAllowed_PREF_PROFILE_SEND_SMS() { + //if (PPApplication.HAS_FEATURE_TELEPHONY_MESSAGING) + //{ + preferenceAllowed = PREFERENCE_ALLOWED; + //} + //else { + // allowed = PREFERENCE_NOT_ALLOWED; + // notAllowedReason = PREFERENCE_NOT_ALLOWED_NO_HARDWARE; + //} + } + + void isProfilePreferenceAllowed_PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED() { + preferenceAllowed = PREFERENCE_ALLOWED; + } + } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Profile.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Profile.java index 5fb040c075..0a7fd89d04 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Profile.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/Profile.java @@ -131,14 +131,22 @@ class Profile { int _applicationLocationScanInterval; int _applicationOrientationScanInterval; int _applicationPeriodicScanInterval; - String _phoneCallsContacts; // contactId#phoneId|... - String _phoneCallsContactGroups; // groupId|... - int _phoneCallsContactListType; - boolean _phoneCallsBlockCalls; - boolean _phoneCallsSendSMS; - String _phoneCallsSMSText; + String _sendSMSContacts; // contactId#phoneId|... + String _sendSMSContactGroups; // groupId|... + //int _sendSMSContactListType; + boolean _sendSMSSendSMS; + String _sendSMSSMSText; String _deviceWallpaperLockScreen; - + boolean _clearNotificationEnabled; + String _clearNotificationApplications; + boolean _clearNotificationCheckContacts; + String _clearNotificationContacts; // contactId#phoneId|... + String _clearNotificationContactGroups; // groupId|... + boolean _clearNotificationCheckText; + String _clearNotificationText; + int _screenNightLight; + int _screenNightLightPrefs; + int _screenOnOff; Bitmap _iconBitmap; Bitmap _preferencesIndicator; @@ -267,13 +275,22 @@ class Profile { static final String PREF_PROFILE_APPLICATION_LOCATION_UPDATE_INTERVAL = "prf_pref_applicationLocationUpdateInterval"; static final String PREF_PROFILE_APPLICATION_ORIENTATION_SCAN_INTERVAL = "prf_pref_applicationOrientationScanInterval"; static final String PREF_PROFILE_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL = "prf_pref_applicationPeriodicScanningScanInterval"; - static final String PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS = "prf_pref_phoneCalls_blockCalls"; - static final String PREF_PROFILE_PHONE_CALLS_CONTACTS = "prf_pref_phoneCalls_contacts"; - static final String PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS = "prf_pref_phoneCalls_contactGroups"; - static final String PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE = "prf_pref_phoneCalls_contactListType"; - static final String PREF_PROFILE_PHONE_CALLS_SEND_SMS = "prf_pref_phoneCalls_sendSMS"; - static final String PREF_PROFILE_PHONE_CALLS_SMS_TEXT = "prf_pref_phoneCalls_SMSText"; + static final String PREF_PROFILE_SEND_SMS_CONTACTS = "prf_pref_sendSMS_contacts"; + static final String PREF_PROFILE_SEND_SMS_CONTACT_GROUPS = "prf_pref_semdSMS_contactGroups"; + //static final String PREF_PROFILE_SEND_SMS_CONTACT_LIST_TYPE = "prf_pref_sendSMS_contactListType"; + static final String PREF_PROFILE_SEND_SMS_SEND_SMS = "prf_pref_sendSMS_sendSMS"; + static final String PREF_PROFILE_SEND_SMS_SMS_TEXT = "prf_pref_sendSMS_SMSText"; static final String PREF_PROFILE_DEVICE_WALLPAPER_LOCKSCREEN = "prf_pref_deviceWallpaperLockScreen"; + static final String PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED = "prf_pref_clearNotificationEnbaled"; + static final String PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS = "prf_pref_clearNotificationApplications"; + static final String PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS = "prf_pref_clearNotificationCheckContacts"; + static final String PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT = "prf_pref_clearNotificationCheckText"; + static final String PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS = "prf_pref_clearNotificationContactGroups"; + static final String PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS = "prf_pref_clearNotificationContacts"; + static final String PREF_PROFILE_CLEAR_NOTIFICATION_TEXT = "prf_pref_clearNotificationText"; + static final String PREF_PROFILE_SCREEN_NIGHT_LIGHT = "prf_pref_screenNightLight"; + static final String PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS = "prf_pref_screenNightLightPrefs"; + static final String PREF_PROFILE_SCREEN_ON_OFF = "prf_pref_screenOnOff"; static final int RINGERMODE_RING = 1; static final int RINGERMODE_RING_AND_VIBRATE = 2; @@ -320,8 +337,10 @@ class Profile { defaultValuesBoolean.put(PREF_PROFILE_HIDE_STATUS_BAR_ICON, false); defaultValuesBoolean.put(PREF_PROFILE_VOLUME_MUTE_SOUND, false); defaultValuesBoolean.put(PREF_PROFILE_VOLUME_MEDIA_CHANGE_DURING_PLAY, false); - defaultValuesBoolean.put(PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS, false); - defaultValuesBoolean.put(PREF_PROFILE_PHONE_CALLS_SEND_SMS, false); + defaultValuesBoolean.put(PREF_PROFILE_SEND_SMS_SEND_SMS, false); + defaultValuesBoolean.put(PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED, false); + defaultValuesBoolean.put(PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS, false); + defaultValuesBoolean.put(PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT, false); } static final ArrayMap defaultValuesString; static { @@ -432,11 +451,18 @@ class Profile { defaultValuesString.put(PREF_PROFILE_APPLICATION_LOCATION_UPDATE_INTERVAL, "15"); defaultValuesString.put(PREF_PROFILE_APPLICATION_ORIENTATION_SCAN_INTERVAL, "10"); defaultValuesString.put(PREF_PROFILE_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL, "15"); - defaultValuesString.put(PREF_PROFILE_PHONE_CALLS_CONTACTS, ""); - defaultValuesString.put(PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS, ""); - defaultValuesString.put(PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE, "0"); - defaultValuesString.put(PREF_PROFILE_PHONE_CALLS_SMS_TEXT, ""); + defaultValuesString.put(PREF_PROFILE_SEND_SMS_CONTACTS, ""); + defaultValuesString.put(PREF_PROFILE_SEND_SMS_CONTACT_GROUPS, ""); + //defaultValuesString.put(PREF_PROFILE_SEND_SMS_CONTACT_LIST_TYPE, "0"); + defaultValuesString.put(PREF_PROFILE_SEND_SMS_SMS_TEXT, ""); defaultValuesString.put(PREF_PROFILE_DEVICE_WALLPAPER_LOCKSCREEN, "-"); + defaultValuesString.put(PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS, ""); + defaultValuesString.put(PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS, ""); + defaultValuesString.put(PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS, ""); + defaultValuesString.put(PREF_PROFILE_CLEAR_NOTIFICATION_TEXT, ""); + defaultValuesString.put(PREF_PROFILE_SCREEN_NIGHT_LIGHT, "0"); + defaultValuesString.put(PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS, "0"); + defaultValuesString.put(PREF_PROFILE_SCREEN_ON_OFF, "0"); } static final int[] profileIconId = { @@ -1097,13 +1123,22 @@ class Profile { int applicationLocationScanInterval, int applicationOrientationScanInterval, int applicationPeriodicScanInterval, - String phoneCallsContacts, - String phoneCallsContactGroups, - int phoneCallsContactListType, - boolean phoneCallsBlockCalls, - boolean phoneCallsSendSMS, - String phoneCallsSMSText, - String deviceWallpaperLockscreen + String sendSMSContacts, + String sendSMSContactGroups, + //int sendSMSContactListType, + boolean sendSMSSendSMS, + String sendSMSSMSText, + String deviceWallpaperLockscreen, + boolean clearNotificationEnabled, + String clearNotificationApplications, + boolean clearNotificationCheckContacts, + String clearNotificationContacts, + String clearNotificationContactGroups, + boolean clearNotificationCheckText, + String clearNotificationText, + int screenNightLight, + int screenNightLightPrefs, + int screenOnOff ) { this._id = id; @@ -1219,13 +1254,22 @@ class Profile { this._applicationLocationScanInterval = applicationLocationScanInterval; this._applicationOrientationScanInterval = applicationOrientationScanInterval; this._applicationPeriodicScanInterval = applicationPeriodicScanInterval; - this._phoneCallsContacts = phoneCallsContacts; - this._phoneCallsContactGroups = phoneCallsContactGroups; - this._phoneCallsContactListType = phoneCallsContactListType; - this._phoneCallsBlockCalls = phoneCallsBlockCalls; - this._phoneCallsSendSMS = phoneCallsSendSMS; - this._phoneCallsSMSText = phoneCallsSMSText; + this._sendSMSContacts = sendSMSContacts; + this._sendSMSContactGroups = sendSMSContactGroups; + //this._phoneCallsContactListType = sendSMSContactListType; + this._sendSMSSendSMS = sendSMSSendSMS; + this._sendSMSSMSText = sendSMSSMSText; this._deviceWallpaperLockScreen = deviceWallpaperLockscreen; + this._clearNotificationEnabled = clearNotificationEnabled; + this._clearNotificationApplications = clearNotificationApplications; + this._clearNotificationCheckContacts = clearNotificationCheckContacts; + this._clearNotificationContacts = clearNotificationContacts; + this._clearNotificationContactGroups = clearNotificationContactGroups; + this._clearNotificationCheckText = clearNotificationCheckText; + this._clearNotificationText = clearNotificationText; + this._screenNightLight = screenNightLight; + this._screenNightLightPrefs = screenNightLightPrefs; + this._screenOnOff = screenOnOff; this._iconBitmap = null; this._preferencesIndicator = null; @@ -1346,13 +1390,22 @@ class Profile { int applicationLocationScanInterval, int applicationOrientationScanInterval, int applicationPeriodicScanInterval, - String phoneCallsContacts, - String phoneCallsContactGroups, - int phoneCallsContactListType, - boolean phoneCallsBlockCalls, - boolean phoneCallsSendSMS, - String phoneCallsSMSText, - String deviceWallpaperLockscreen + String sendSMSContacts, + String sendSMSContactGroups, + //int sendSMSContactListType, + boolean sendSMSSendSMS, + String sendSMSSMSText, + String deviceWallpaperLockscreen, + boolean clearNotificationEnabled, + String clearNotificationApplications, + boolean clearNotificationCheckContacts, + String clearNotificationContacts, + String clearNotificationContactGroups, + boolean clearNotificationCheckText, + String clearNotificationText, + int screenNightLight, + int screenNightLightPrefs, + int screenOnOff ) { this._name = name; @@ -1467,13 +1520,22 @@ class Profile { this._applicationLocationScanInterval = applicationLocationScanInterval; this._applicationOrientationScanInterval = applicationOrientationScanInterval; this._applicationPeriodicScanInterval = applicationPeriodicScanInterval; - this._phoneCallsContacts = phoneCallsContacts; - this._phoneCallsContactGroups = phoneCallsContactGroups; - this._phoneCallsContactListType = phoneCallsContactListType; - this._phoneCallsBlockCalls = phoneCallsBlockCalls; - this._phoneCallsSendSMS = phoneCallsSendSMS; - this._phoneCallsSMSText = phoneCallsSMSText; + this._sendSMSContacts = sendSMSContacts; + this._sendSMSContactGroups = sendSMSContactGroups; + //this._sendSMSContactListType = sendSMSContactListType; + this._sendSMSSendSMS = sendSMSSendSMS; + this._sendSMSSMSText = sendSMSSMSText; this._deviceWallpaperLockScreen = deviceWallpaperLockscreen; + this._clearNotificationEnabled = clearNotificationEnabled; + this._clearNotificationApplications = clearNotificationApplications; + this._clearNotificationCheckContacts = clearNotificationCheckContacts; + this._clearNotificationContacts = clearNotificationContacts; + this._clearNotificationContactGroups = clearNotificationContactGroups; + this._clearNotificationCheckText = clearNotificationCheckText; + this._clearNotificationText = clearNotificationText; + this._screenNightLight = screenNightLight; + this._screenNightLightPrefs = screenNightLightPrefs; + this._screenOnOff = screenOnOff; this._iconBitmap = null; this._preferencesIndicator = null; @@ -1595,13 +1657,22 @@ void copyProfile(Profile profile) this._applicationLocationScanInterval = profile._applicationLocationScanInterval; this._applicationOrientationScanInterval = profile._applicationOrientationScanInterval; this._applicationPeriodicScanInterval = profile._applicationPeriodicScanInterval; - this._phoneCallsContacts = profile._phoneCallsContacts; - this._phoneCallsContactGroups = profile._phoneCallsContactGroups; - this._phoneCallsContactListType = profile._phoneCallsContactListType; - this._phoneCallsBlockCalls = profile._phoneCallsBlockCalls; - this._phoneCallsSendSMS = profile._phoneCallsSendSMS; - this._phoneCallsSMSText = profile._phoneCallsSMSText; + this._sendSMSContacts = profile._sendSMSContacts; + this._sendSMSContactGroups = profile._sendSMSContactGroups; + //this._sendSMSContactListType = profile._sendSMSContactListType; + this._sendSMSSendSMS = profile._sendSMSSendSMS; + this._sendSMSSMSText = profile._sendSMSSMSText; this._deviceWallpaperLockScreen = profile._deviceWallpaperLockScreen; + this._clearNotificationEnabled = profile._clearNotificationEnabled; + this._clearNotificationApplications = profile._clearNotificationApplications; + this._clearNotificationCheckContacts = profile._clearNotificationCheckContacts; + this._clearNotificationContacts = profile._clearNotificationContacts; + this._clearNotificationContactGroups = profile._clearNotificationContactGroups; + this._clearNotificationCheckText = profile._clearNotificationCheckText; + this._clearNotificationText = profile._clearNotificationText; + this._screenNightLight = profile._screenNightLight; + this._screenNightLightPrefs = profile._screenNightLightPrefs; + this._screenOnOff = profile._screenOnOff; this._iconBitmap = profile._iconBitmap; this._preferencesIndicator = profile._preferencesIndicator; @@ -1959,22 +2030,41 @@ else if (this._deviceOnOffSIM2 == 2) this._applicationOrientationScanInterval = withProfile._applicationOrientationScanInterval; if (withProfile._applicationPeriodicScanInterval != 0) this._applicationPeriodicScanInterval = withProfile._applicationPeriodicScanInterval; - if (!withProfile._phoneCallsContacts.isEmpty()) - this._phoneCallsContacts = withProfile._phoneCallsContacts; - if (!withProfile._phoneCallsContactGroups.isEmpty()) - this._phoneCallsContactGroups = withProfile._phoneCallsContactGroups; - if (withProfile._phoneCallsContactListType != 0) - this._phoneCallsContactListType = withProfile._phoneCallsContactListType; - if (withProfile._phoneCallsBlockCalls) - this._phoneCallsBlockCalls = true; - if (withProfile._phoneCallsSendSMS) - this._phoneCallsSendSMS = true; - if (!withProfile._phoneCallsSMSText.isEmpty()) - this._phoneCallsSMSText = withProfile._phoneCallsSMSText; + if (!withProfile._sendSMSContacts.isEmpty()) + this._sendSMSContacts = withProfile._sendSMSContacts; + if (!withProfile._sendSMSContactGroups.isEmpty()) + this._sendSMSContactGroups = withProfile._sendSMSContactGroups; + //if (withProfile._phoneCallsContactListType != 0) + // this._phoneCallsContactListType = withProfile._phoneCallsContactListType; + if (withProfile._sendSMSSendSMS) + this._sendSMSSendSMS = true; + if (!withProfile._sendSMSSMSText.isEmpty()) + this._sendSMSSMSText = withProfile._sendSMSSMSText; + if (withProfile._clearNotificationEnabled) + this._clearNotificationEnabled = true; + if (!withProfile._clearNotificationApplications.isEmpty()) + this._clearNotificationApplications = withProfile._clearNotificationApplications; + if (withProfile._clearNotificationCheckContacts) + this._clearNotificationCheckContacts = true; + if (!withProfile._clearNotificationContacts.isEmpty()) + this._clearNotificationContacts = withProfile._clearNotificationContacts; + if (!withProfile._clearNotificationContactGroups.isEmpty()) + this._clearNotificationContactGroups = withProfile._clearNotificationContactGroups; + if (withProfile._clearNotificationCheckText) + this._clearNotificationCheckText = true; + if (!withProfile._clearNotificationText.isEmpty()) + this._clearNotificationText = withProfile._clearNotificationText; + if (withProfile._screenNightLight != 0) + this._screenNightLight = withProfile._screenNightLight; + if (withProfile._screenNightLightPrefs != 0) + this._screenNightLightPrefs = withProfile._screenNightLightPrefs; + if (withProfile._screenOnOff != 0) + this._screenOnOff = withProfile._screenOnOff; } // set merged profile as activated DatabaseHandler.getInstance(dataWrapper.context).activateProfile(withProfile); +// Log.e("Pofile.mergeProfiles", "profile to db="+withProfile._id); dataWrapper.setProfileActive(withProfile); /* Do not log this, logged is merged profile in EventsHandler @@ -2353,22 +2443,43 @@ boolean compareProfile(Profile withProfile) if (this._volumeMediaChangeDuringPlay != withProfile._volumeMediaChangeDuringPlay) { return false; } - if (!this._phoneCallsContacts.equals(withProfile._phoneCallsContacts)) { + if (!this._sendSMSContacts.equals(withProfile._sendSMSContacts)) { + return false; + } + if (!this._sendSMSContactGroups.equals(withProfile._sendSMSContactGroups)) { + return false; + } + //if (this._phoneCallsContactListType != withProfile._phoneCallsContactListType) { + // return false; + //} + if (this._sendSMSSendSMS != withProfile._sendSMSSendSMS) { + return false; + } + if (!this._sendSMSSMSText.equals(withProfile._sendSMSSMSText)) { + return false; + } + if (this._clearNotificationEnabled != withProfile._clearNotificationEnabled) { + return false; + } + if (!this._clearNotificationApplications.equals(withProfile._clearNotificationApplications)) { + return false; + } + if (this._clearNotificationCheckContacts != withProfile._clearNotificationCheckContacts) { return false; } - if (!this._phoneCallsContactGroups.equals(withProfile._phoneCallsContactGroups)) { + if (!this._clearNotificationContacts.equals(withProfile._clearNotificationContacts)) { return false; } - if (this._phoneCallsContactListType != withProfile._phoneCallsContactListType) { + if (!this._clearNotificationContactGroups.equals(withProfile._clearNotificationContactGroups)) { return false; } - if (this._phoneCallsBlockCalls != withProfile._phoneCallsBlockCalls) { + if (this._clearNotificationCheckText != withProfile._clearNotificationCheckText) { return false; } - if (this._phoneCallsSendSMS != withProfile._phoneCallsSendSMS) { + if (!this._clearNotificationText.equals(withProfile._clearNotificationText)) { return false; } - if (!this._phoneCallsSMSText.equals(withProfile._phoneCallsSMSText)) { + if (this._screenNightLight != withProfile._screenNightLight) { return false; } @@ -3422,13 +3533,22 @@ void saveProfileToSharedPreferences(SharedPreferences preferences) { editor.putString(PREF_PROFILE_APPLICATION_LOCATION_UPDATE_INTERVAL, Integer.toString(this._applicationLocationScanInterval)); editor.putString(PREF_PROFILE_APPLICATION_ORIENTATION_SCAN_INTERVAL, Integer.toString(this._applicationOrientationScanInterval)); editor.putString(PREF_PROFILE_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL, Integer.toString(this._applicationPeriodicScanInterval)); - editor.putString(PREF_PROFILE_PHONE_CALLS_CONTACTS, this._phoneCallsContacts); - editor.putString(PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS, this._phoneCallsContactGroups); - editor.putString(PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE, Integer.toString(this._phoneCallsContactListType)); - editor.putBoolean(PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS, this._phoneCallsBlockCalls); - editor.putBoolean(PREF_PROFILE_PHONE_CALLS_SEND_SMS, this._phoneCallsSendSMS); - editor.putString(PREF_PROFILE_PHONE_CALLS_SMS_TEXT, this._phoneCallsSMSText); + editor.putString(PREF_PROFILE_SEND_SMS_CONTACTS, this._sendSMSContacts); + editor.putString(PREF_PROFILE_SEND_SMS_CONTACT_GROUPS, this._sendSMSContactGroups); + //editor.putString(PREF_PROFILE_SEND_SMS_CONTACT_LIST_TYPE, Integer.toString(this._phoneCallsContactListType)); + editor.putBoolean(PREF_PROFILE_SEND_SMS_SEND_SMS, this._sendSMSSendSMS); + editor.putString(PREF_PROFILE_SEND_SMS_SMS_TEXT, this._sendSMSSMSText); editor.putString(PREF_PROFILE_DEVICE_WALLPAPER_LOCKSCREEN, this._deviceWallpaperLockScreen); + editor.putBoolean(PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED, this._clearNotificationEnabled); + editor.putString(PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS, this._clearNotificationApplications); + editor.putBoolean(PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS, this._clearNotificationCheckContacts); + editor.putBoolean(PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT, this._clearNotificationCheckText); + editor.putString(PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS, this._clearNotificationContactGroups); + editor.putString(PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS, this._clearNotificationContacts); + editor.putString(PREF_PROFILE_CLEAR_NOTIFICATION_TEXT, this._clearNotificationText); + editor.putString(PREF_PROFILE_SCREEN_NIGHT_LIGHT, Integer.toString(this._screenNightLight)); + editor.putString(PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS, Integer.toString(this._screenNightLightPrefs)); + editor.putString(PREF_PROFILE_SCREEN_ON_OFF, Integer.toString(this._screenOnOff)); editor.apply(); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileDurationAlarmBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileDurationAlarmBroadcastReceiver.java index 47cc77a762..7c401b3ea1 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileDurationAlarmBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileDurationAlarmBroadcastReceiver.java @@ -495,7 +495,7 @@ private static void _doWork(Context appContext, final long profileId, (startupSource == PPApplication.STARTUP_SOURCE_SHORTCUT) || (startupSource == PPApplication.STARTUP_SOURCE_ACTIVATOR) || (startupSource == PPApplication.STARTUP_SOURCE_EDITOR) || - (startupSource == PPApplication.STARTUP_SOURCE_LAUNCHER) || + //(startupSource == PPApplication.STARTUP_SOURCE_LAUNCHER) || (startupSource == PPApplication.STARTUP_SOURCE_QUICK_TILE) || (startupSource == PPApplication.STARTUP_SOURCE_EVENT_MANUAL) || (startupSource == PPApplication.STARTUP_SOURCE_EXTERNAL_APP); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconColorChooserDialog.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconColorChooserDialog.java index 8265b20409..08189c3add 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconColorChooserDialog.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconColorChooserDialog.java @@ -74,6 +74,7 @@ class ProfileIconColorChooserDialog implements View.OnClickListener { final FrameLayout defaultColorLayout = layout.findViewById(R.id.dialog_color_chooser_default_color); + //noinspection DataFlowIssue defaultColorLayout.setTag(-1); defaultColorLayout.setOnClickListener(this); @@ -101,6 +102,7 @@ class ProfileIconColorChooserDialog implements View.OnClickListener { setBackgroundCompat(defaultColorLayout, new RippleDrawable(rippleColors, selector, null)); final TextView defaultColorLabel = layout.findViewById(R.id.dialog_color_chooser_default_color_label); + //noinspection DataFlowIssue defaultColorLabel.setTag(-1); defaultColorLabel.setOnClickListener(this); @@ -113,6 +115,7 @@ class ProfileIconColorChooserDialog implements View.OnClickListener { final FrameLayout customColorLayout = layout.findViewById(R.id.dialog_color_chooser_custom_color); + //noinspection DataFlowIssue customColorLayout.setTag(-2); customColorLayout.setOnClickListener(this); @@ -147,6 +150,7 @@ class ProfileIconColorChooserDialog implements View.OnClickListener { setBackgroundCompat(customColorLayout, new RippleDrawable(rippleColors, selector, null)); final TextView customColorLabel = layout.findViewById(R.id.dialog_color_chooser_custom_color_label); + //noinspection DataFlowIssue customColorLabel.setTag(-2); customColorLabel.setOnClickListener(this); @@ -154,6 +158,7 @@ class ProfileIconColorChooserDialog implements View.OnClickListener { final GridLayout list = layout.findViewById(R.id.dialog_color_chooser_grid); + //noinspection DataFlowIssue int count = list.getChildCount(); for (int i = 0; i < count; i++) { FrameLayout child = (FrameLayout) list.getChildAt(i); @@ -192,6 +197,7 @@ public void onClick(View v) { dialogBuilder.setView(layout); final ChromaColorView chromaColorView = layout.findViewById(R.id.custom_color_chroma_color_view); + //noinspection DataFlowIssue chromaColorView.setCurrentColor(profileIconPreference.customColor); chromaColorView.setColorMode(ColorMode.values()[0]); chromaColorView.setIndicatorMode(IndicatorMode.values()[1]); @@ -240,24 +246,9 @@ private Drawable createSelector(int color) { }*/ String applicationTheme = ApplicationPreferences.applicationTheme(activity, true); - /*if (GlobalGUIRoutines.isNightModeEnabled(activity.getApplicationContext())) - applicationTheme = "dark"; - else - applicationTheme = "white";*/ - /*int nightModeFlags = - context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; - switch (nightModeFlags) { - case Configuration.UI_MODE_NIGHT_YES: - applicationTheme = "dark"; - break; - case Configuration.UI_MODE_NIGHT_NO: - case Configuration.UI_MODE_NIGHT_UNDEFINED: - applicationTheme = "white"; - break; - }*/ - final String COLOR1 = "#6E6E6E"; - final String COLOR2 = "#AEAEAE"; +// final String COLOR1 = "#6E6E6E"; +// final String COLOR2 = "#AEAEAE"; GradientDrawable coloredCircle = new GradientDrawable(); coloredCircle.setColor(color); @@ -267,12 +258,14 @@ private Drawable createSelector(int color) { //if (position == 2) // dark gray color // coloredCircle.setStroke(2, Color.parseColor("#6E6E6E")); //else - coloredCircle.setStroke(1, Color.parseColor(COLOR1)); +// coloredCircle.setStroke(1, Color.parseColor(COLOR1)); + coloredCircle.setStroke(1, activity.getColor(R.color.pppColorChooserColor1)); } else { //if (position == 0) // white color // coloredCircle.setStroke(2, Color.parseColor("#AEAEAE")); //else - coloredCircle.setStroke(1, Color.parseColor(COLOR1)); +// coloredCircle.setStroke(1, Color.parseColor(COLOR1)); + coloredCircle.setStroke(1, activity.getColor(R.color.pppColorChooserColor1)); } GradientDrawable darkerCircle = new GradientDrawable(); darkerCircle.setColor(shiftColor(color)); @@ -281,12 +274,14 @@ private Drawable createSelector(int color) { //if (position == 2) // dark gray color // coloredCircle.setStroke(2, Color.parseColor("#6E6E6E")); //else - coloredCircle.setStroke(2, Color.parseColor(COLOR1)); +// coloredCircle.setStroke(2, Color.parseColor(COLOR1)); + coloredCircle.setStroke(2, activity.getColor(R.color.pppColorChooserColor1)); } else { //if (position == 0) // white color // darkerCircle.setStroke(2, Color.parseColor("#AEAEAE")); //else - darkerCircle.setStroke(2, Color.parseColor(COLOR2)); +// darkerCircle.setStroke(2, Color.parseColor(COLOR2)); + darkerCircle.setStroke(2, activity.getColor(R.color.pppColorChooserColor2)); } StateListDrawable stateListDrawable = new StateListDrawable(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconPreference.java index 0746175d34..37f5ae16dd 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconPreference.java @@ -361,7 +361,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public ProfileIconPreference.SavedState createFromParcel(Parcel in) { return new ProfileIconPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconPreferenceAdapter.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconPreferenceAdapter.java index 83d860b289..74ec88dbe7 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconPreferenceAdapter.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconPreferenceAdapter.java @@ -39,10 +39,10 @@ public long getItemId(int position) { } private static class ViewHolder { - ImageView icon; + ImageView icon; View mark; - //int position; - } + //int position; + } public View getView(int position, View convertView, ViewGroup parent) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconPreferenceFragment.java index 1e8517b3a0..bf324670a1 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileIconPreferenceFragment.java @@ -48,6 +48,7 @@ protected void onBindDialogView(@NonNull View view) { preference.isImageResourceID, preference.useCustomColor, preference.customColor*/); + //noinspection DataFlowIssue gridView.setAdapter(adapter); gridView.setSelection(ProfileStatic.getImageResourcePosition(preference.imageIdentifier/*, prefContext*/)); @@ -61,6 +62,7 @@ protected void onBindDialogView(@NonNull View view) { dialogIcon = view.findViewById(R.id.profileicon_pref_dlg_icon); colorChooserButton = view.findViewById(R.id.profileicon_pref_dlg_change_color); + //noinspection DataFlowIssue colorChooserButton.setOnClickListener(v -> showCustomColorChooser()); colorChooserButton.setEnabled(preference.isImageResourceID); @@ -73,6 +75,7 @@ public void onClick(View v) { });*/ final Button customIconButton = view.findViewById(R.id.profileicon_pref_dlg_custom_icon); + //noinspection DataFlowIssue customIconButton.setOnClickListener(v -> { if (Permissions.grantCustomProfileIconPermissions(prefContext)) { preference.startGallery(); @@ -81,6 +84,7 @@ public void onClick(View v) { }); final AppCompatImageButton helpButton = view.findViewById(R.id.profileicon_pref_dlg_custom_icon_helpIcon); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(helpButton, getString(R.string.menu_help)); helpButton.setOnClickListener(v -> { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileListWidgetProvider.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileListWidgetProvider.java index 50a21a2959..140e15e43e 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileListWidgetProvider.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileListWidgetProvider.java @@ -774,7 +774,8 @@ private static RemoteViews buildLayout(Context context, /*AppWidgetManager appWi intent.putExtra(PPApplication.EXTRA_STARTUP_SOURCE, PPApplication.STARTUP_SOURCE_WIDGET); PendingIntent pendingIntent = PendingIntent.getActivity(context, 1, intent, PendingIntent.FLAG_UPDATE_CURRENT); - widget.setOnClickPendingIntent(R.id.widget_profile_list_header_profile_root, pendingIntent); + //widget.setOnClickPendingIntent(R.id.widget_profile_list_header_profile_root, pendingIntent); + widget.setOnClickPendingIntent(R.id.widget_profile_list_header, pendingIntent); //if (Event.getGlobalEventsRunning() && PPApplicationStatic.getApplicationStarted(true)) { //widget.setViewVisibility(R.id.widget_profile_list_header_restart_events, View.VISIBLE); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileMultiSelectPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileMultiSelectPreference.java index da83abea45..e1e0b16cf4 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileMultiSelectPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileMultiSelectPreference.java @@ -322,7 +322,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public ProfileMultiSelectPreference.SavedState createFromParcel(Parcel in) { return new ProfileMultiSelectPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileMultiSelectPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileMultiSelectPreferenceFragment.java index 4a0933dfe1..047f709591 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileMultiSelectPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileMultiSelectPreferenceFragment.java @@ -60,6 +60,7 @@ protected void onBindDialogView(@NonNull View view) { }); final Button unselectAllButton = view.findViewById(R.id.profile_multiselect_pref_dlg_unselect_all); + //noinspection DataFlowIssue unselectAllButton.setOnClickListener(v -> { preference.value=""; refreshListView(false); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilePreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilePreference.java index b22fa57e98..4ae6e6e2de 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilePreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilePreference.java @@ -283,8 +283,8 @@ public void writeToParcel(Parcel dest, int flags) super(superState); } - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator<>() { public ProfilePreference.SavedState createFromParcel(Parcel in) { return new ProfilePreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilePreferencesIndicator.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilePreferencesIndicator.java index 1af558493f..bf391e4b7c 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilePreferencesIndicator.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilePreferencesIndicator.java @@ -83,9 +83,11 @@ private void addIndicator(int preferenceBitmapResourceID, int index, _canvas.drawBitmap(preferenceBitmap, 0, 0, paint); // add icon into profile preferences indicator + //noinspection ConstantValue if (bitmapResult != null) canvas.drawBitmap(bitmapResult, preferenceBitmap.getWidth() * index, 0, null); + //noinspection ConstantValue if (bitmapResult != null) { try { bitmapResult.recycle(); @@ -424,11 +426,11 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, profile.saveProfileToSharedPreferences(sharedPreferences); if (profile._volumeRingerMode != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_RINGER_MODE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { - boolean vibrateWhenRingingAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATE_WHEN_RINGING, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED; + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_RINGER_MODE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + boolean vibrateWhenRingingAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATE_WHEN_RINGING, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; boolean vibrateNotificationsAllowed = false; if ((Build.VERSION.SDK_INT >= 28) && (Build.VERSION.SDK_INT < 33)) { - vibrateNotificationsAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATE_NOTIFICATIONS, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED; + vibrateNotificationsAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATE_NOTIFICATIONS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; } boolean addVibrateIndicator = false; if (vibrateWhenRingingAllowed && ((profile._vibrateWhenRinging == 1) || (profile._vibrateWhenRinging == 3))) @@ -640,7 +642,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // volume level if (profile._volumeMuteSound && - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_MUTE_SOUND, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_MUTE_SOUND, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_volumeMuteSound) + StringConstants.STR_COLON_WITH_SPACE + appContext.getString(R.string.array_pref_hardwareModeArray_off); @@ -657,10 +659,10 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, profile.getVolumeVoiceChange() || profile.getVolumeAccessibilityChange() || profile.getVolumeBluetoothSCOChange()) { - if ((ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_ALARM, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_VOICE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_ACCESSIBILITY, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_BLUETOOTH_SCO, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + if ((ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_ALARM, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_VOICE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_ACCESSIBILITY, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_BLUETOOTH_SCO, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_volumePartial); if (fillStrings) @@ -684,15 +686,15 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, profile.getVolumeDTMFChange() || profile.getVolumeAccessibilityChange() || profile.getVolumeBluetoothSCOChange()) { - if ((ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_ALARM, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_MEDIA, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_NOTIFICATION, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_RINGTONE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_SYSTEM, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_VOICE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_DTMF, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_ACCESSIBILITY, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_BLUETOOTH_SCO, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + if ((ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_ALARM, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_MEDIA, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_NOTIFICATION, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_RINGTONE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_SYSTEM, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_VOICE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_DTMF, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_ACCESSIBILITY, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_BLUETOOTH_SCO, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_volumeAll); if (fillStrings) @@ -708,7 +710,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // speaker phone if (profile._volumeSpeakerPhone != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_SPEAKER_PHONE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VOLUME_SPEAKER_PHONE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (profile._volumeSpeakerPhone == 1) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_volumeSpeakerPhone) + StringConstants.STR_COLON_WITH_SPACE + @@ -742,9 +744,9 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, if (profile.getVibrationIntensityRingingChange() || profile.getVibrationIntensityNotificationsChange() || profile.getVibrationIntensityTouchInteractionChange()) { - if ((ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATION_INTENSITY_RINGING, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + if ((ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATION_INTENSITY_RINGING, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_vibrationIntensityAll); if (fillStrings) @@ -762,9 +764,9 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, if ((profile._soundRingtoneChange == 1) || (profile._soundNotificationChange == 1) || (profile._soundAlarmChange == 1)) { - if ((ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_ALARM_CHANGE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + if ((ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_ALARM_CHANGE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_soundsChange); if (fillStrings) @@ -789,8 +791,8 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, // sound for sim 1 if ((profile._soundRingtoneChangeSIM1 == 1) || (profile._soundNotificationChangeSIM1 == 1)) { - if ((ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + if ((ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_soundsChangeSIM1); if (fillStrings) @@ -806,8 +808,8 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, // sound for sim 2 if ((profile._soundRingtoneChangeSIM2 == 1) || (profile._soundNotificationChangeSIM2 == 1)) { - if ((ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { + if ((ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_soundsChangeSIM2); if (fillStrings) @@ -823,7 +825,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } } if (profile._soundSameRingtoneForBothSIMCards == 1) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_soundSameRingtoneForBothSIMCards); if (fillStrings) @@ -840,7 +842,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, // sound on touch if (profile._soundOnTouch != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_ON_TOUCH, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_ON_TOUCH, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._soundOnTouch == 1) || (profile._soundOnTouch == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_soundOnTouch) + StringConstants.STR_COLON_WITH_SPACE + @@ -871,7 +873,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // vibration on touch if (profile._vibrationOnTouch != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATION_ON_TOUCH, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATION_ON_TOUCH, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._vibrationOnTouch == 1) || (profile._vibrationOnTouch == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_vibrationOnTouch) + StringConstants.STR_COLON_WITH_SPACE + @@ -902,7 +904,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // dtmf tone when dialing if (profile._dtmfToneWhenDialing != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DTMF_TONE_WHEN_DIALING, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DTMF_TONE_WHEN_DIALING, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._dtmfToneWhenDialing == 1) || (profile._dtmfToneWhenDialing == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_dtmfToneWhenDialing) + StringConstants.STR_COLON_WITH_SPACE + @@ -933,7 +935,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // airplane mode if (profile._deviceAirplaneMode != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._deviceAirplaneMode == 1) || (profile._deviceAirplaneMode == 3) || (profile._deviceAirplaneMode == 4) || (profile._deviceAirplaneMode == 6)) { if (fillPreferences) @@ -965,7 +967,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // auto-sync if (profile._deviceAutoSync != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_AUTOSYNC, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_AUTOSYNC, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._deviceAutoSync == 1) || (profile._deviceAutoSync == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceAutosync) + StringConstants.STR_COLON_WITH_SPACE + @@ -1001,7 +1003,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, int phoneCount = telephonyManager.getPhoneCount(); if (phoneCount > 1) { if (profile._deviceOnOffSIM1 != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._deviceOnOffSIM1 == 1) || (profile._deviceOnOffSIM1 == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceOnOff_SIM1) + StringConstants.STR_COLON_WITH_SPACE + @@ -1031,7 +1033,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } } if (profile._deviceOnOffSIM2 != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._deviceOnOffSIM2 == 1) || (profile._deviceOnOffSIM2 == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceOnOff_SIM2) + StringConstants.STR_COLON_WITH_SPACE + @@ -1066,7 +1068,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, // default sim card if (!profile._deviceDefaultSIMCards.equals("0|0|0")) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { final TelephonyManager telephonyManager = (TelephonyManager) appContext.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager != null) { int phoneCount = telephonyManager.getPhoneCount(); @@ -1088,7 +1090,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, // mobile data if (profile._deviceMobileData != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._deviceMobileData == 1) || (profile._deviceMobileData == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceMobileData_21) + StringConstants.STR_COLON_WITH_SPACE + @@ -1188,7 +1190,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, // mobile data preferences if (profile._deviceMobileDataPrefs == 1) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_PREFS, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_PREFS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceMobileDataPrefs); if (fillStrings) @@ -1203,7 +1205,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // wifi if (profile._deviceWiFi != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WIFI, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WIFI, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._deviceWiFi == 1) || (profile._deviceWiFi == 3) || (profile._deviceWiFi == 4) || @@ -1241,7 +1243,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, //if (Build.VERSION.SDK_INT < 30) { // wifi AP if (profile._deviceWiFiAP != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WIFI_AP, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WIFI_AP, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._deviceWiFiAP == 1) || (profile._deviceWiFiAP == 3) || (profile._deviceWiFiAP == 4) || (profile._deviceWiFiAP == 5)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceWiFiAP) + StringConstants.STR_COLON_WITH_SPACE + @@ -1273,7 +1275,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, //} // wifi AP preferences if (profile._deviceWiFiAPPrefs == 1) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WIFI_AP_PREFS, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WIFI_AP_PREFS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceWiFiAPPrefs); if (fillStrings) @@ -1288,7 +1290,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // connect to ssid if (!profile._deviceConnectToSSID.equals(StringConstants.CONNECTTOSSID_JUSTANY)) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_CONNECT_TO_SSID, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_CONNECT_TO_SSID, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceConnectToSSID); if (fillStrings) @@ -1303,7 +1305,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // bluetooth if (profile._deviceBluetooth != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_BLUETOOTH, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_BLUETOOTH, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._deviceBluetooth == 1) || (profile._deviceBluetooth == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceBluetooth) + StringConstants.STR_COLON_WITH_SPACE + @@ -1334,7 +1336,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // location mode if (profile._deviceLocationMode != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_LOCATION_MODE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_LOCATION_MODE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (profile._deviceLocationMode > 1) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceLocationMode) + StringConstants.STR_COLON_WITH_SPACE + @@ -1365,7 +1367,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // gps if (profile._deviceGPS != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_GPS, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_GPS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._deviceGPS == 1) || (profile._deviceGPS == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceGPS) + StringConstants.STR_COLON_WITH_SPACE + @@ -1396,7 +1398,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // location settings preferences if (profile._deviceLocationServicePrefs == 1) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_LOCATION_SERVICE_PREFS, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_LOCATION_SERVICE_PREFS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceLocationServicePrefs); if (fillStrings) @@ -1411,7 +1413,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // nfc if (profile._deviceNFC != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NFC, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NFC, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._deviceNFC == 1) || (profile._deviceNFC == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceNFC) + StringConstants.STR_COLON_WITH_SPACE + @@ -1442,7 +1444,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // network type if (profile._deviceNetworkType != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceNetworkType); if (fillStrings) @@ -1460,7 +1462,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, int phoneCount = telephonyManager.getPhoneCount(); if (phoneCount > 1) { if (profile._deviceNetworkTypeSIM1 != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM1, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM1, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceNetworkTypeSIM1); if (fillStrings) @@ -1474,7 +1476,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } } if (profile._deviceNetworkTypeSIM2 != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM2, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM2, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceNetworkTypeSIM2); if (fillStrings) @@ -1491,7 +1493,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // network type prefs if (profile._deviceNetworkTypePrefs != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_PREFS, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_PREFS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceNetworkTypePrefs); if (fillStrings) @@ -1506,7 +1508,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // VPN if (!profile._deviceVPN.startsWith("0")) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_VPN, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_VPN, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { String[] splits = profile._deviceVPN.split(StringConstants.STR_SPLIT_REGEX); boolean enableVPN; try { @@ -1545,7 +1547,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // VPN Settings preferences if (profile._deviceVPNSettingsPrefs == 1) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_VPN_SETTINGS_PREFS, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_VPN_SETTINGS_PREFS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceVPNSettingsPrefs); if (fillStrings) @@ -1561,7 +1563,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, // screen timeout if (profile._deviceScreenTimeout != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_SCREEN_TIMEOUT, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_SCREEN_TIMEOUT, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceScreenTimeout); if (fillStrings) @@ -1576,7 +1578,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // brightness/auto-brightness if (profile.getDeviceBrightnessChange()) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_BRIGHTNESS, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_BRIGHTNESS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (profile.getDeviceBrightnessAutomatic()) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceBrightness) + StringConstants.STR_COLON_WITH_SPACE + @@ -1605,7 +1607,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // auto-rotate if (profile._deviceAutoRotate != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_AUTOROTATE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_AUTOROTATE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) if (profile._deviceAutoRotate == 6) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceAutoRotation) + StringConstants.STR_COLON_WITH_SPACE + @@ -1635,7 +1637,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // screen on permanent if (profile._screenOnPermanent != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_ON_PERMANENT, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_ON_PERMANENT, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._screenOnPermanent == 1) || (profile._screenOnPermanent == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceScreenOnPermanent) + StringConstants.STR_COLON_WITH_SPACE + @@ -1664,9 +1666,40 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } } } + // screen on permanent + if (profile._screenOnOff != 0) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_ON_OFF, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if ((profile._screenOnOff == 1) || (profile._screenOnOff == 3)) { + if (fillPreferences) + preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceScreenOnOff) + StringConstants.STR_COLON_WITH_SPACE + + appContext.getString(R.string.array_pref_hardwareModeArray_on); + if (fillStrings) + strings[countDrawables++] = "sof:1"; + else { + disabled[countDrawables] = false; + drawables[countDrawables++] = R.drawable.ic_profile_pref_screen_on_off; + } + if (fillPreferences) + countItems[countPreferences++] = 1; + } + if (profile._screenOnOff == 2) { + if (fillPreferences) + preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceScreenOnOff) + StringConstants.STR_COLON_WITH_SPACE + + appContext.getString(R.string.array_pref_hardwareModeArray_off); + if (fillStrings) + strings[countDrawables++] = "sof:0"; + else { + disabled[countDrawables] = true; + drawables[countDrawables++] = R.drawable.ic_profile_pref_screen_on_off; + } + if (fillPreferences) + countItems[countPreferences++] = 1; + } + } + } // wallpaper if (profile._deviceWallpaperChange != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WALLPAPER_CHANGE, profile,null, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WALLPAPER_CHANGE, profile,null, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceWallpaperChange); if (fillStrings) @@ -1681,7 +1714,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // lock screen if (profile._deviceKeyguard != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_KEYGUARD, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_KEYGUARD, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._deviceKeyguard == 1) || (profile._deviceKeyguard == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceKeyguard) + StringConstants.STR_COLON_WITH_SPACE + @@ -1712,7 +1745,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // lock device if (profile._lockDevice != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_LOCK_DEVICE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_LOCK_DEVICE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (profile._lockDevice == 3) { boolean enabled; enabled = PPExtenderBroadcastReceiver.isEnabled(appContext, PPApplication.VERSION_CODE_EXTENDER_REQUIRED, false, false @@ -1745,7 +1778,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // notification led if (profile._notificationLed != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_NOTIFICATION_LED, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_NOTIFICATION_LED, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._notificationLed == 1) || (profile._notificationLed == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_notificationLed) + StringConstants.STR_COLON_WITH_SPACE + @@ -1776,7 +1809,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // heads-up notifications if (profile._headsUpNotifications != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_HEADS_UP_NOTIFICATIONS, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_HEADS_UP_NOTIFICATIONS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._headsUpNotifications == 1) || (profile._headsUpNotifications == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_headsUpNotifications) + StringConstants.STR_COLON_WITH_SPACE + @@ -1807,7 +1840,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // always on display if (profile._alwaysOnDisplay != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_ALWAYS_ON_DISPLAY, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_ALWAYS_ON_DISPLAY, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._alwaysOnDisplay == 1) || (profile._alwaysOnDisplay == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_alwaysOnDisplay) + StringConstants.STR_COLON_WITH_SPACE + @@ -1838,7 +1871,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // screen dark mode if (profile._screenDarkMode != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_DARK_MODE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_DARK_MODE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (profile._screenDarkMode == 1) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_screenDarkMode) + StringConstants.STR_COLON_WITH_SPACE + @@ -1867,10 +1900,56 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } } } + // screen night light + if (profile._screenNightLight != 0) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (profile._screenNightLight == 1) { + if (fillPreferences) + preferences[countPreferences] = ProfileStatic.getNightLightStringString(appContext) + StringConstants.STR_COLON_WITH_SPACE + + appContext.getString(R.string.array_pref_hardwareModeArray_on); + if (fillStrings) + strings[countDrawables++] = "nli:1"; + else { + disabled[countDrawables] = false; + drawables[countDrawables++] = R.drawable.ic_profile_pref_screen_night_light; + } + if (fillPreferences) + countItems[countPreferences++] = 1; + } + if (profile._screenNightLight == 2) { + if (fillPreferences) + preferences[countPreferences] = ProfileStatic.getNightLightStringString(appContext) + StringConstants.STR_COLON_WITH_SPACE + + appContext.getString(R.string.array_pref_hardwareModeArray_off); + if (fillStrings) + strings[countDrawables++] = "nli:0"; + else { + disabled[countDrawables] = true; + drawables[countDrawables++] = R.drawable.ic_profile_pref_screen_night_light; + } + if (fillPreferences) + countItems[countPreferences++] = 1; + } + } + } + // screen night light prefereces + if (profile._screenNightLightPrefs == 1) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (fillPreferences) + preferences[countPreferences] = ProfileStatic.getNightLightPrefsStringString(appContext); + if (fillStrings) + strings[countDrawables++] = "nlis"; + else { + disabled[countDrawables] = false; + drawables[countDrawables++] = R.drawable.ic_profile_pref_screen_night_light_pref; + } + if (fillPreferences) + countItems[countPreferences++] = 1; + } + } // power save mode if (profile._devicePowerSaveMode != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_POWER_SAVE_MODE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_POWER_SAVE_MODE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._devicePowerSaveMode == 1) || (profile._devicePowerSaveMode == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_devicePowerSaveMode) + StringConstants.STR_COLON_WITH_SPACE + @@ -1901,7 +1980,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // run application if (profile._deviceRunApplicationChange == 1) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_RUN_APPLICATION_CHANGE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_RUN_APPLICATION_CHANGE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceRunApplicationsShortcutsChange); if (fillStrings) @@ -1916,7 +1995,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // close app applications if (profile._deviceCloseAllApplications != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_CLOSE_ALL_APPLICATIONS, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_CLOSE_ALL_APPLICATIONS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_deviceCloseAllApplications); if (fillStrings) @@ -1931,7 +2010,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // force stop application if (profile._deviceForceStopApplicationChange == 1) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_FORCE_STOP_APPLICATION_CHANGE, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_FORCE_STOP_APPLICATION_CHANGE, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { boolean enabled; enabled = PPExtenderBroadcastReceiver.isEnabled(appContext, PPApplication.VERSION_CODE_EXTENDER_REQUIRED, false, false /*, "ProfilePreferencesIndicator.fillArrays (profile._deviceForceStopApplicationChange)"*/); @@ -1951,7 +2030,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // generate notification if (profile.getGenerateNotificationGenerate()) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_GENERATE_NOTIFICATION, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_GENERATE_NOTIFICATION, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_generateNotification); if (fillStrings) @@ -1964,9 +2043,24 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, countItems[countPreferences++] = 1; } } + // clear notifications + if (profile._clearNotificationEnabled) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (fillPreferences) + preferences[countPreferences] = appContext.getString(R.string.profile_preferences_clearNotificationEnabled); + if (fillStrings) + strings[countDrawables++] = "clnt"; + else { + disabled[countDrawables] = false; + drawables[countDrawables++] = R.drawable.ic_profile_pref_clear_notifications; + } + if (fillPreferences) + countItems[countPreferences++] = 1; + } + } // camera flash if (profile._cameraFlash != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_CAMERA_FLASH, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_CAMERA_FLASH, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._cameraFlash == 1) || (profile._cameraFlash == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_cameraFlash) + StringConstants.STR_COLON_WITH_SPACE + @@ -1995,10 +2089,31 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } } } + // send sms + if ( + ( + /*(profile._phoneCallsContactListType == EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) ||*/ + ((profile._sendSMSContacts != null) && (!profile._sendSMSContacts.isEmpty())) || + ((profile._sendSMSContactGroups != null) && (!profile._sendSMSContactGroups.isEmpty())) + ) && + profile._sendSMSSendSMS) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (fillPreferences) + preferences[countPreferences] = appContext.getString(R.string.profile_preferences_category_send_sms); + if (fillStrings) + strings[countDrawables++] = "ssms"; + else { + disabled[countDrawables] = false; + drawables[countDrawables++] = R.drawable.ic_profile_pref_send_sms; + } + if (fillPreferences) + countItems[countPreferences++] = 1; + } + } // enable wifi scanning if (profile._applicationEnableWifiScanning != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_WIFI_SCANNING, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_WIFI_SCANNING, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (profile._applicationEnableWifiScanning == 1) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_applicationEnableWifiScanning) + StringConstants.STR_COLON_WITH_SPACE + @@ -2029,7 +2144,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // enable bluetooth scanning if (profile._applicationEnableBluetoothScanning != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_BLUETOOTH_SCANNING, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_BLUETOOTH_SCANNING, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (profile._applicationEnableBluetoothScanning == 1) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_applicationEnableBluetoothScanning) + StringConstants.STR_COLON_WITH_SPACE + @@ -2060,7 +2175,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // enable location scanning if (profile._applicationEnableLocationScanning != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_LOCATION_SCANNING, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_LOCATION_SCANNING, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (profile._applicationEnableLocationScanning == 1) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_applicationEnableLocationScanning) + StringConstants.STR_COLON_WITH_SPACE + @@ -2091,7 +2206,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // enable mobile cell scanning if (profile._applicationEnableMobileCellScanning != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_MOBILE_CELL_SCANNING, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_MOBILE_CELL_SCANNING, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (profile._applicationEnableMobileCellScanning == 1) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_applicationEnableMobileCellScanning) + StringConstants.STR_COLON_WITH_SPACE + @@ -2122,7 +2237,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // enable orientation scanning if (profile._applicationEnableOrientationScanning != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_ORIENTATION_SCANNING, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_ORIENTATION_SCANNING, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (profile._applicationEnableOrientationScanning == 1) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_applicationEnableOrientationScanning) + StringConstants.STR_COLON_WITH_SPACE + @@ -2153,7 +2268,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // enable notification scanning if (profile._applicationEnableNotificationScanning != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_NOTIFICATION_SCANNING, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_NOTIFICATION_SCANNING, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (profile._applicationEnableNotificationScanning == 1) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_applicationEnableNotificationScanning) + StringConstants.STR_COLON_WITH_SPACE + @@ -2184,7 +2299,7 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } // enable periodic scanning if (profile._applicationEnablePeriodicScanning != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_PERIODIC_SCANNING, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_ENABLE_PERIODIC_SCANNING, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (profile._applicationEnablePeriodicScanning == 1) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_applicationEnablePeriodicScanning) + StringConstants.STR_COLON_WITH_SPACE + @@ -2213,30 +2328,9 @@ void fillArrays(Profile profile, boolean fillStrings, //boolean monochrome, } } } - // phone calls - if ( - ( - (profile._phoneCallsContactListType == EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) || - ((profile._phoneCallsContacts != null) && (!profile._phoneCallsContacts.isEmpty())) || - ((profile._phoneCallsContactGroups != null) && (!profile._phoneCallsContactGroups.isEmpty())) - ) && - profile._phoneCallsBlockCalls) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { - if (fillPreferences) - preferences[countPreferences] = appContext.getString(R.string.profile_preferences_category_phone_calls); - if (fillStrings) - strings[countDrawables++] = "pcal"; - else { - disabled[countDrawables] = false; - drawables[countDrawables++] = R.drawable.ic_profile_pref_phonecalls; - } - if (fillPreferences) - countItems[countPreferences++] = 1; - } - } // disable global events run if (profile._applicationDisableGloabalEventsRun != 0) { - if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_DISABLE_GLOBAL_EVENTS_RUN, null, sharedPreferences, true, appContext).allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_APPLICATION_DISABLE_GLOBAL_EVENTS_RUN, null, sharedPreferences, true, appContext).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if ((profile._applicationDisableGloabalEventsRun == 1) || (profile._applicationDisableGloabalEventsRun == 3)) { if (fillPreferences) preferences[countPreferences] = appContext.getString(R.string.profile_preferences_applicationEnableGlobalEventsRun) + StringConstants.STR_COLON_WITH_SPACE + diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileStatic.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileStatic.java index 9e41387ca8..018219285d 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileStatic.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfileStatic.java @@ -713,13 +713,22 @@ static Profile removeSharedProfileParameters(Profile profile) profile._applicationLocationScanInterval, profile._applicationOrientationScanInterval, profile._applicationPeriodicScanInterval, - profile._phoneCallsContacts, - profile._phoneCallsContactGroups, - profile._phoneCallsContactListType, - profile._phoneCallsBlockCalls, - profile._phoneCallsSendSMS, - profile._phoneCallsSMSText, - profile._deviceWallpaperLockScreen + profile._sendSMSContacts, + profile._sendSMSContactGroups, + //profile._sendSMSContactListType, + profile._sendSMSSendSMS, + profile._sendSMSSMSText, + profile._deviceWallpaperLockScreen, + profile._clearNotificationEnabled, + profile._clearNotificationApplications, + profile._clearNotificationCheckContacts, + profile._clearNotificationContacts, + profile._clearNotificationContactGroups, + profile._clearNotificationCheckText, + profile._clearNotificationText, + profile._screenNightLight, + profile._screenNightLightPrefs, + profile._screenOnOff ); if (profile._volumeRingerMode == SHARED_PROFILE_VALUE) @@ -875,196 +884,212 @@ static PreferenceAllowed isProfilePreferenceAllowed(String preferenceKey, Profil //noinspection IfStatementWithIdenticalBranches if (profile == null) { - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; switch (preferenceKey) { case Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_AIRPLANE_MODE(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_AIRPLANE_MODE( null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_DEVICE_WIFI: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI(preferenceAllowed, null, sharedPreferences/*, fromUIThread*/); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI( null, sharedPreferences/*, fromUIThread*/); break; case Profile.PREF_PROFILE_DEVICE_BLUETOOTH: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_BLUETOOTH(preferenceAllowed); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_BLUETOOTH(); break; case Profile.PREF_PROFILE_DEVICE_MOBILE_DATA: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA(preferenceAllowed, preferenceKey, null, sharedPreferences, /*fromUIThread,*/ context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA( preferenceKey, null, sharedPreferences, /*fromUIThread,*/ context); break; //case Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM1: //case Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM2: - // PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_DUAL_SIM(preferenceAllowed, preferenceKey, null, sharedPreferences, fromUIThread, context); + // preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_DUAL_SIM(preferenceAllowed, preferenceKey, null, sharedPreferences, fromUIThread, context); // break; case Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_PREFS: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_PREFS(preferenceAllowed); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_PREFS(); break; case Profile.PREF_PROFILE_DEVICE_GPS: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_GPS(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_GPS( null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_DEVICE_LOCATION_MODE: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_LOCATION_MODE(preferenceAllowed, null, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_LOCATION_MODE( null, context); break; case Profile.PREF_PROFILE_DEVICE_NFC: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NFC(preferenceAllowed, null, sharedPreferences, /*fromUIThread,*/ context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NFC( null, sharedPreferences, /*fromUIThread,*/ context); break; case Profile.PREF_PROFILE_DEVICE_WIFI_AP: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP( null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_VIBRATE_WHEN_RINGING: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_WHEN_RINGING(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_WHEN_RINGING( null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_VIBRATE_NOTIFICATIONS: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_NOTIFICATIONS(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_NOTIFICATIONS( null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_VIBRATION_INTENSITY_RINGING: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_RINGING(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_RINGING( null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS( null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION( null, sharedPreferences, fromUIThread, context); break; //case Profile.PREF_PROFILE_DEVICE_ADAPTIVE_BRIGHTNESS: // !!! test this only for preference key !!! - // PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ADAPTIVE_BRIGHTNESS(preferenceAllowed, sharedPreferences, fromUIThread); + // preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ADAPTIVE_BRIGHTNESS( sharedPreferences, fromUIThread); // break; case Profile.PREF_PROFILE_DEVICE_POWER_SAVE_MODE: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_POWER_SAVE_MODE(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_POWER_SAVE_MODE( null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE(preferenceAllowed, preferenceKey, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE( preferenceKey, null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM1: case Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM2: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_DUAL_SIM(preferenceAllowed, preferenceKey, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_DUAL_SIM( preferenceKey, null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_NOTIFICATION_LED: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_NOTIFICATION_LED(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_NOTIFICATION_LED( null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_DEVICE_KEYGUARD: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_KEYGUARD(preferenceAllowed, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_KEYGUARD( context); break; case Profile.PREF_PROFILE_DEVICE_CONNECT_TO_SSID: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_CONNECT_TO_SSID(preferenceAllowed); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_CONNECT_TO_SSID(); break; case Profile.PREF_PROFILE_APPLICATION_ENABLE_WIFI_SCANNING: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_WIFI_SCANNING(preferenceAllowed); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_WIFI_SCANNING(); break; case Profile.PREF_PROFILE_APPLICATION_ENABLE_BLUETOOTH_SCANNING: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_BLUETOOTH_SCANNING(preferenceAllowed); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_BLUETOOTH_SCANNING(); break; case Profile.PREF_PROFILE_DEVICE_WIFI_AP_PREFS: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP_PREFS(preferenceAllowed); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP_PREFS(); break; case Profile.PREF_PROFILE_APPLICATION_ENABLE_MOBILE_CELL_SCANNING: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_MOBILE_CELL_SCANNING(preferenceAllowed); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_MOBILE_CELL_SCANNING(); break; case Profile.PREF_PROFILE_APPLICATION_ENABLE_ORIENTATION_SCANNING: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_ORIENTATION_SCANNING(preferenceAllowed); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_ORIENTATION_SCANNING(); break; case Profile.PREF_PROFILE_HEADS_UP_NOTIFICATIONS: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_HEADS_UP_NOTIFICATIONS(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_HEADS_UP_NOTIFICATIONS( null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_PREFS: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_PREFS(preferenceAllowed); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_PREFS(); break; case Profile.PREF_PROFILE_VOLUME_ACCESSIBILITY: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VOLUME_ACCESSIBILITY(preferenceAllowed/*, context*/); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VOLUME_ACCESSIBILITY(/*, context*/); break; case Profile.PREF_PROFILE_ALWAYS_ON_DISPLAY: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_ALWAYS_ON_DISPLAY(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_ALWAYS_ON_DISPLAY( null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_SCREEN_DARK_MODE: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_DARK_MODE(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_DARK_MODE( null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_VOLUME_SPEAKER_PHONE: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VOLUME_SPEAKER_PHONE(preferenceAllowed, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VOLUME_SPEAKER_PHONE( context); break; case Profile.PREF_PROFILE_CAMERA_FLASH: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_CAMERA_FLASH(preferenceAllowed/*, context*/); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_CAMERA_FLASH(/*, context*/); break; case Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS( null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1: case Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM(preferenceAllowed, preferenceKey, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM( preferenceKey, null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1: case Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM(preferenceAllowed, null, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM( null, context); break; case Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM(preferenceAllowed, preferenceKey, null, sharedPreferences, fromUIThread, context, false); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM( preferenceKey, null, sharedPreferences, fromUIThread, context, false); break; case Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM(preferenceAllowed, preferenceKey, null, sharedPreferences, fromUIThread, context, true); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM( preferenceKey, null, sharedPreferences, fromUIThread, context, true); break; case Profile.PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS(preferenceAllowed, null, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS( null, sharedPreferences, fromUIThread, context); break; case Profile.PREF_PROFILE_LOCK_DEVICE: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_LOCK_DEVICE(preferenceAllowed, null, sharedPreferences); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_LOCK_DEVICE( null, sharedPreferences); break; case Profile.PREF_PROFILE_DEVICE_SCREEN_TIMEOUT: - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_SCREEN_TIMEOUT(preferenceAllowed, preferenceKey, null, sharedPreferences/*, fromUIThread, context*/); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_SCREEN_TIMEOUT( preferenceKey, null, sharedPreferences/*, fromUIThread, context*/); + break; + case Profile.PREF_PROFILE_SEND_SMS_SEND_SMS: + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SEND_SMS(); + case Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED: + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED(); + case Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT: + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_NIGHT_LIGHT( null, sharedPreferences, fromUIThread, context); + break; + case Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS: + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS(); + break; + case Profile.PREF_PROFILE_SCREEN_ON_OFF: + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_ON_OFF(); break; default: - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; } return preferenceAllowed; } else { // !!! call only methods with profile parameter - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; - - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_AIRPLANE_MODE(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI(preferenceAllowed, profile, sharedPreferences/*, fromUIThread*/); - //PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_BLUETOOTH(preferenceAllowed); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA(preferenceAllowed, "-", profile, sharedPreferences, /*fromUIThread,*/ context); - //PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_DUAL_SIM(preferenceAllowed, "-", profile, sharedPreferences, fromUIThread, context); - //PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_PREFS(preferenceAllowed); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_GPS(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_LOCATION_MODE(preferenceAllowed, profile, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NFC(preferenceAllowed, profile, sharedPreferences, /*fromUIThread,*/ context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_WHEN_RINGING(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_NOTIFICATIONS(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_RINGING(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_POWER_SAVE_MODE(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE(preferenceAllowed, "-", profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_DUAL_SIM(preferenceAllowed, "-", profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_NOTIFICATION_LED(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - //PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_KEYGUARD(preferenceAllowed, context); - //PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_CONNECT_TO_SSID(preferenceAllowed); - //PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_WIFI_SCANNING(preferenceAllowed); - //PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_BLUETOOTH_SCANNING(preferenceAllowed); - //PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP_PREFS(preferenceAllowed); - //PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_MOBILE_CELL_SCANNING(preferenceAllowed); - //PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_ORIENTATION_SCANNING(preferenceAllowed); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_HEADS_UP_NOTIFICATIONS(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - //PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_PREFS(preferenceAllowed); - //PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VOLUME_ACCESSIBILITY(preferenceAllowed, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_ALWAYS_ON_DISPLAY(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_DARK_MODE(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - //PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VOLUME_SPEAKER_PHONE(preferenceAllowed, context); - //PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_CAMERA_FLASH(preferenceAllowed); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM(preferenceAllowed, "-", profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM(preferenceAllowed, profile, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM(preferenceAllowed, "-", profile, sharedPreferences, fromUIThread, context, false); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM(preferenceAllowed, "-", profile, sharedPreferences, fromUIThread, context, true); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS(preferenceAllowed, profile, sharedPreferences, fromUIThread, context); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_LOCK_DEVICE(preferenceAllowed, profile, sharedPreferences); - PreferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_SCREEN_TIMEOUT(preferenceAllowed, "-", profile, sharedPreferences/*, fromUIThread, context*/); + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_AIRPLANE_MODE( profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI( profile, sharedPreferences/*, fromUIThread*/); + //preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_BLUETOOTH(); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA( "-", profile, sharedPreferences, /*fromUIThread,*/ context); + //preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_DUAL_SIM( "-", profile, sharedPreferences, fromUIThread, context); + //preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_MOBILE_DATA_PREFS(); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_GPS( profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_LOCATION_MODE( profile, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NFC( profile, sharedPreferences, /*fromUIThread,*/ context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP( profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_WHEN_RINGING( profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATE_NOTIFICATIONS( profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_RINGING( profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS( profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION( profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_POWER_SAVE_MODE( profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE( "-", profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_DUAL_SIM( "-", profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_NOTIFICATION_LED( profile, sharedPreferences, fromUIThread, context); + //preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_KEYGUARD( context); + //preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_CONNECT_TO_SSID(); + //preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_WIFI_SCANNING(); + //preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_BLUETOOTH_SCANNING(); + //preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_WIFI_AP_PREFS(); + //preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_MOBILE_CELL_SCANNING(); + //preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_APPLICATION_DISABLE_ORIENTATION_SCANNING(); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_HEADS_UP_NOTIFICATIONS( profile, sharedPreferences, fromUIThread, context); + //preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_NETWORK_TYPE_PREFS(); + //preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VOLUME_ACCESSIBILITY( context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_ALWAYS_ON_DISPLAY( profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_DARK_MODE( profile, sharedPreferences, fromUIThread, context); + //preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_VOLUME_SPEAKER_PHONE( context); + //preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_CAMERA_FLASH(); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS( profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_ONOFF_SIM( "-", profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM( profile, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM( "-", profile, sharedPreferences, fromUIThread, context, false); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM( "-", profile, sharedPreferences, fromUIThread, context, true); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS( profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_LOCK_DEVICE( profile, sharedPreferences); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_DEVICE_SCREEN_TIMEOUT( "-", profile, sharedPreferences/*, fromUIThread, context*/); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_NIGHT_LIGHT( profile, sharedPreferences, fromUIThread, context); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS(); + preferenceAllowed.isProfilePreferenceAllowed_PREF_PROFILE_SCREEN_ON_OFF(); if (preferenceAllowed.notAllowedG1 || preferenceAllowed.notAllowedRoot || preferenceAllowed.notAllowedPPPPS || preferenceAllowed.notAllowedShizuku) - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; return preferenceAllowed; } @@ -1166,7 +1191,7 @@ static String getColorForChangedPreferenceValue(String preferenceValue, Context context) { Preference preference = prefMng.findPreference(preferenceKey); if ((preference != null) && preference.isEnabled()) { - int labelColor = ContextCompat.getColor(context, R.color.activityNormalTextColor); + int labelColor = ContextCompat.getColor(context, R.color.preferenceSummaryValueColor); String colorString = String.format(StringConstants.STR_FORMAT_INT, labelColor).substring(2); // !!strip alpha value!! return String.format(StringConstants.TAG_FONT_COLOR_HTML/*+":"*/, colorString, preferenceValue); } else @@ -1216,7 +1241,7 @@ static boolean isRedTextNotificationRequired(Profile profile, boolean againCheck defaultAssistantNotRequired = false; boolean defaultAssistantEnabled = defaultAssistantNotRequired || (ActivateProfileHelper.isPPPSetAsDefaultAssistant(context.getApplicationContext())); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) return (!grantedAllPermissions) || (!enabledNotificationAccess) || (!accessibilityEnabled) || @@ -1233,4 +1258,33 @@ static boolean isRedTextNotificationRequired(Profile profile, boolean againCheck (!grantedShizukuPermission); } + static int getNightLightStringId() { + if (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) + return R.string.profile_preferences_screenNightLight_Samsung; + if (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) + return R.string.profile_preferences_screenNightLight_Xiaomi; + if (PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) + return R.string.profile_preferences_screenNightLight_Huawei; + if (PPApplication.deviceIsOnePlus) + return R.string.profile_preferences_screenNightLight_OnePlus; + return R.string.profile_preferences_screenNightLight; + } + static String getNightLightStringString(Context context) { + return context.getString(getNightLightStringId()); + } + static int getNightLightStringPrefsId() { + if (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) + return R.string.profile_preferences_screenNightLightPrefs_Samsung; + if (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) + return R.string.profile_preferences_screenNightLightPrefs_Xiaomi; + //if (PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) + // return R.string.profile_preferences_screenNightLightPrefs_Huawei; + //if (PPApplication.deviceIsOnePlus) + // return R.string.profile_preferences_screenNightLightPrefs_OnePlus; + return R.string.profile_preferences_screenNightLightPrefs; + } + static String getNightLightPrefsStringString(Context context) { + return context.getString(getNightLightStringPrefsId()); + } + } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsActivity.java index 2e69e70f3b..4dc851c5dd 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsActivity.java @@ -18,6 +18,7 @@ import androidx.annotation.NonNull; import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.Toolbar; +import androidx.core.view.WindowCompat; import androidx.fragment.app.Fragment; import androidx.preference.PreferenceManager; @@ -41,7 +42,7 @@ public class ProfilesPrefsActivity extends AppCompatActivity { private Toolbar toolbar; LinearLayout settingsLinearLayout; - LinearLayout progressLinearLayout; + //LinearLayout progressLinearLayout; private StartPreferencesActivityAsyncTask startPreferencesActivityAsyncTask = null; private FinishPreferencesActivityAsyncTask finishPreferencesActivityAsyncTask = null; @@ -54,6 +55,10 @@ protected void onCreate(Bundle savedInstanceState) { GlobalGUIRoutines.setTheme(this, false, false, false, false, false, true); //GlobalGUIRoutines.setLanguage(this); + //if (Build.VERSION.SDK_INT >= 34) + // EdgeToEdge.enable(this); + WindowCompat.setDecorFitsSystemWindows(this.getWindow(), false); + super.onCreate(savedInstanceState); setContentView(R.layout.activity_profile_events_preferences); @@ -61,15 +66,17 @@ protected void onCreate(Bundle savedInstanceState) { toolbar = findViewById(R.id.activity_preferences_toolbar); setSupportActionBar(toolbar); - if (getSupportActionBar() != null) { getSupportActionBar().setHomeButtonEnabled(true); getSupportActionBar().setDisplayHomeAsUpEnabled(true); getSupportActionBar().setElevation(0/*GlobalGUIRoutines.dpToPx(1)*/); } + //noinspection DataFlowIssue + toolbar.setSubtitle(getString(R.string.title_activity_profile_preferences)); + toolbar.setTitle(getString(R.string.profile_string_0)); settingsLinearLayout = findViewById(R.id.activity_preferences_settings); - progressLinearLayout = findViewById(R.id.activity_preferences_settings_linla_progress); + //progressLinearLayout = findViewById(R.id.activity_preferences_settings_linla_progress); profile_id = getIntent().getLongExtra(PPApplication.EXTRA_PROFILE_ID, 0); newProfileMode = getIntent().getIntExtra(PPApplication.EXTRA_NEW_PROFILE_MODE, PPApplication.EDIT_MODE_UNDEFINED); @@ -84,15 +91,17 @@ protected void onCreate(Bundle savedInstanceState) { PPApplication.showToast(getApplicationContext(), getString(R.string.profile_preferences_profile_not_found), Toast.LENGTH_SHORT); - PPApplication.blockContactContentObserver = false; - ContactsContentObserver.enqueueContactsContentObserverWorker(); +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] ProfilesPrefsActivity.onCreate", "(1) PPApplication.blockContactContentObserver=false"); +// PPApplication.blockContactContentObserver = false; +// ContactsContentObserver.enqueueContactsContentObserverWorker(); super.finish(); return; } } if (savedInstanceState == null) { - PPApplication.blockContactContentObserver = true; +// PPApplication.blockContactContentObserver = true; +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] ProfilesPrefsActivity.onCreate", "(2) PPApplication.blockContactContentObserver=true"); startPreferencesActivityAsyncTask = new StartPreferencesActivityAsyncTask(this, newProfileMode, predefinedProfileIndex); @@ -118,16 +127,18 @@ protected void attachBaseContext(Context base) { super.attachBaseContext(LocaleHelper.onAttach(base)); } - @Override - protected void onPause() { - super.onPause(); - PPApplication.blockContactContentObserver = false; - } +// @Override +// protected void onPause() { +// super.onPause(); +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] ProfilesPrefsActivity.onPause", "PPApplication.blockContactContentObserver=false"); +// PPApplication.blockContactContentObserver = false; +// } @Override public void onResume() { super.onResume(); - PPApplication.blockContactContentObserver = true; +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] ProfilesPrefsActivity.onResume", "PPApplication.blockContactContentObserver=true"); +// PPApplication.blockContactContentObserver = true; List fragments = getSupportFragmentManager().getFragments(); //if (fragments == null) @@ -223,6 +234,7 @@ private void finishActivity() { true, true, false, false, true, + false, this ); @@ -305,8 +317,9 @@ protected void onDestroy() { @Override public void finish() { - PPApplication.blockContactContentObserver = false; - ContactsContentObserver.enqueueContactsContentObserverWorker(); +// PPApplicationStatic.logE("[CONTACTS_OBSERVER] ProfilesPrefsActivity.finish", "PPApplication.blockContactContentObserver=false"); +// PPApplication.blockContactContentObserver = false; +// ContactsContentObserver.enqueueContactsContentObserverWorker(); // for startActivityForResult Intent returnIntent = new Intent(); @@ -463,13 +476,22 @@ private Profile createProfile(long profile_id, int new_profile_mode, int predefi origProfile._applicationLocationScanInterval, origProfile._applicationOrientationScanInterval, origProfile._applicationPeriodicScanInterval, - origProfile._phoneCallsContacts, - origProfile._phoneCallsContactGroups, - origProfile._phoneCallsContactListType, - origProfile._phoneCallsBlockCalls, - origProfile._phoneCallsSendSMS, - origProfile._phoneCallsSMSText, - origProfile._deviceWallpaperLockScreen + origProfile._sendSMSContacts, + origProfile._sendSMSContactGroups, + //origProfile._sendSMSContactListType, + origProfile._sendSMSSendSMS, + origProfile._sendSMSSMSText, + origProfile._deviceWallpaperLockScreen, + origProfile._clearNotificationEnabled, + origProfile._clearNotificationApplications, + origProfile._clearNotificationCheckContacts, + origProfile._clearNotificationContacts, + origProfile._clearNotificationContactGroups, + origProfile._clearNotificationCheckText, + origProfile._clearNotificationText, + origProfile._screenNightLight, + origProfile._screenNightLightPrefs, + origProfile._screenOnOff ); showSaveMenu = true; } @@ -678,12 +700,21 @@ Profile getProfileFromPreferences(long profile_id, int new_profile_mode, int pre profile._applicationLocationScanInterval = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_APPLICATION_LOCATION_UPDATE_INTERVAL, "")); profile._applicationOrientationScanInterval = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_APPLICATION_ORIENTATION_SCAN_INTERVAL, "")); profile._applicationPeriodicScanInterval = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL, "")); - profile._phoneCallsContacts = preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACTS, ""); - profile._phoneCallsContactGroups = preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS, ""); - profile._phoneCallsContactListType = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE, "")); - profile._phoneCallsBlockCalls = preferences.getBoolean(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS, false); - profile._phoneCallsSendSMS = preferences.getBoolean(Profile.PREF_PROFILE_PHONE_CALLS_SEND_SMS, false); - profile._phoneCallsSMSText = preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_SMS_TEXT, ""); + profile._sendSMSContacts = preferences.getString(Profile.PREF_PROFILE_SEND_SMS_CONTACTS, ""); + profile._sendSMSContactGroups = preferences.getString(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS, ""); + //profile._phoneCallsContactListType = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE, "")); + profile._sendSMSSendSMS = preferences.getBoolean(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS, false); + profile._sendSMSSMSText = preferences.getString(Profile.PREF_PROFILE_SEND_SMS_SMS_TEXT, ""); + profile._clearNotificationEnabled = preferences.getBoolean(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED, false); + profile._clearNotificationApplications = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS, ""); + profile._clearNotificationCheckContacts = preferences.getBoolean(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS, false); + profile._clearNotificationContacts = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS, ""); + profile._clearNotificationContactGroups = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS, ""); + profile._clearNotificationCheckText = preferences.getBoolean(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT, false); + profile._clearNotificationText = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_TEXT, ""); + profile._screenNightLight = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT, "")); + profile._screenNightLightPrefs = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS, "")); + profile._screenOnOff = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_SCREEN_ON_OFF, "")); } return profile; @@ -739,8 +770,6 @@ private void savePreferences(int new_profile_mode, int predefinedProfileIndex) private void showTargetHelps() { - //String applicationTheme = ApplicationPreferences.applicationTheme(getApplicationContext(), true); - if (!showSaveMenu) return; @@ -752,96 +781,47 @@ private void showTargetHelps() { Toolbar toolbar = findViewById(R.id.activity_preferences_toolbar); - //TypedValue tv = new TypedValue(); - //getTheme().resolveAttribute(R.attr.colorAccent, tv, true); - - //final Display display = getWindowManager().getDefaultDisplay(); - int outerCircleColor = R.color.tabTargetHelpOuterCircleColor; -// if (appTheme.equals("dark")) -// outerCircleColor = R.color.tabTargetHelpOuterCircleColor_dark; int targetCircleColor = R.color.tabTargetHelpTargetCircleColor; -// if (appTheme.equals("dark")) -// targetCircleColor = R.color.tabTargetHelpTargetCircleColor_dark; int titleTextColor = R.color.tabTargetHelpTitleTextColor; int descriptionTextColor = R.color.tabTargetHelpDescriptionTextColor; -// if (appTheme.equals("dark")) -// textColor = R.color.tabTargetHelpTextColor_dark; - //boolean tintTarget = !applicationTheme.equals("white"); final TapTargetSequence sequence = new TapTargetSequence(this); - /*if (ApplicationPreferences.prefProfilePrefsActivityStartTargetHelps) { - - editor = ApplicationPreferences.getEditor(getApplicationContext()); - editor.putBoolean(PREF_START_TARGET_HELPS, false); - editor.apply(); - ApplicationPreferences.prefProfilePrefsActivityStartTargetHelps = false; - - List targets = new ArrayList<>(); - int id = 1; - //try { - // targets.add( - // TapTarget.forToolbarMenuItem(toolbar, R.id.profile_preferences_shared_profile, getString(R.string.title_activity_default_profile_preferences), getString(R.string.profile_preferences_sourceProfileInfo_summary)) - // .outerCircleColor(outerCircleColor) - // .targetCircleColor(targetCircleColor) - // .textColor(textColor) - // .tintTarget(true) - // .drawShadow(true) - // .id(id) - // ); - // ++id; - //} catch (Exception ignored) {} // not in action bar? - try { - targets.add( - TapTarget.forToolbarMenuItem(toolbar, R.id.profile_preferences_save, getString(R.string.profile_preference_activity_targetHelps_save_title), getString(R.string.profile_preference_activity_targetHelps_save_description)) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .textColor(textColor) - .tintTarget(true) - .drawShadow(true) - .id(id) - ); - ++id; - } catch (Exception e) { - //PPApplicationStatic.recordException(e); - } + List targets = new ArrayList<>(); + int id = 1; + try { + //noinspection DataFlowIssue + targets.add( + TapTarget.forToolbarMenuItem(toolbar, R.id.profile_preferences_save, getString(R.string.profile_preference_activity_targetHelps_save_title), getString(R.string.profile_preference_activity_targetHelps_save_description)) + .outerCircleColor(outerCircleColor) + .targetCircleColor(targetCircleColor) + .titleTextColor(titleTextColor) + .descriptionTextColor(descriptionTextColor) + .descriptionTextAlpha(PPApplication.descriptionTapTargetAlpha) + .dimColor(R.color.tabTargetHelpDimColor) + .titleTextSize(PPApplication.titleTapTargetSize) + .textTypeface(Typeface.DEFAULT_BOLD) + .tintTarget(true) + .drawShadow(true) + .id(id) + ); + ++id; + } catch (Exception e) { + //PPApplicationStatic.recordException(e); + } - sequence.targets(targets); + for (TapTarget target : targets) { + target.setDrawBehindStatusBar(true); + target.setDrawBehindNavigationBar(true); } - else {*/ - List targets = new ArrayList<>(); - int id = 1; - try { - targets.add( - TapTarget.forToolbarMenuItem(toolbar, R.id.profile_preferences_save, getString(R.string.profile_preference_activity_targetHelps_save_title), getString(R.string.profile_preference_activity_targetHelps_save_description)) - .outerCircleColor(outerCircleColor) - .targetCircleColor(targetCircleColor) - .titleTextColor(titleTextColor) - .descriptionTextColor(descriptionTextColor) - .textTypeface(Typeface.DEFAULT_BOLD) - .tintTarget(true) - .drawShadow(true) - .id(id) - ); - ++id; - } catch (Exception e) { - //PPApplicationStatic.recordException(e); - } - sequence.targets(targets); - //} + sequence.targets(targets); + sequence.listener(new TapTargetSequence.Listener() { // This listener will tell us when interesting(tm) events happen in regards // to the sequence @Override public void onSequenceFinish() { - //targetHelpsSequenceStarted = false; - - //SharedPreferences.Editor editor = ApplicationPreferences.getEditor(getApplicationContext()); - //editor.putBoolean(PREF_START_TARGET_HELPS_FINISHED, true); - //editor.apply(); - //ApplicationPreferences.prefProfilePrefsActivityStartTargetHelpsFinished = true; - } @Override @@ -851,17 +831,10 @@ public void onSequenceStep(TapTarget lastTarget, boolean targetClicked) { @Override public void onSequenceCanceled(TapTarget lastTarget) { - //targetHelpsSequenceStarted = false; } }); sequence.continueOnCancel(true) .considerOuterCircleCanceled(true); - //targetHelpsSequenceStarted = true; - - //editor = ApplicationPreferences.getEditor(getApplicationContext()); - //editor.putBoolean(PREF_START_TARGET_HELPS_FINISHED, false); - //editor.apply(); - //ApplicationPreferences.prefProfilePrefsActivityStartTargetHelpsFinished = false; sequence.start(); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsClearNotifications.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsClearNotifications.java new file mode 100644 index 0000000000..4f0097fc80 --- /dev/null +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsClearNotifications.java @@ -0,0 +1,12 @@ +package sk.henrichg.phoneprofilesplus; + +import android.os.Bundle; + +public class ProfilesPrefsClearNotifications extends ProfilesPrefsFragment { + + @Override + public void onCreatePreferences(Bundle bundle, String rootKey) { + setPreferencesFromResource(R.xml.profile_prefs_clear_notifications, rootKey); + } + +} diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsFragment.java index 2f8d73a572..a5a2c23740 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsFragment.java @@ -1,11 +1,7 @@ package sk.henrichg.phoneprofilesplus; -import static android.app.role.RoleManager.ROLE_CALL_SCREENING; -import static android.content.Context.ROLE_SERVICE; - import android.Manifest; import android.app.Activity; -import android.app.role.RoleManager; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; @@ -72,7 +68,7 @@ public class ProfilesPrefsFragment extends PreferenceFragmentCompat private static final int RESULT_ACCESSIBILITY_SETTINGS = 2983; private static final int RESULT_FORCE_SET_BRIGHTNESS_AT_SCREEN_ON_SETTINGS = 2984; private static final int RESULT_ASSISTANT_SETTINGS = 2985; - private static final int RESULT_SET_CALL_SCREENING_ROLE = 2986; + private static final int RESULT_NOTIFICATION_ACCESS_SYSTEM_SETTINGS = 2986; private static final String PREF_VOLUME_NOTIFICATION_VOLUME0 = "prf_pref_volumeNotificationVolume0"; @@ -113,6 +109,8 @@ public class ProfilesPrefsFragment extends PreferenceFragmentCompat private static final String PREF_PROFILE_APPLICATION_NOTIFICATION_SCAN_INTERVAL_INFO = "prf_pref_applicationNotificationScanIntervalInfo"; private static final String PREF_PROFILE_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL_INFO = "prf_pref_applicationPeriodicScanningScanIntervalInfo"; private static final String PREF_PROFILE_DEVICE_AIRPLANE_MODE_CATEGORY_ROOT = "prf_pref_deviceRadiosAirplaneModeCategoryRoot"; + private static final String PREF_NOTIFICATION_ACCESS_SYSTEM_SETTINGS = "prf_pref_clearNotificationNotificationsAccessSettings"; + private static final String PREF_NOTIFICATION_ACCESS_RESTRICTED_SETTINGS = "prf_pref_clearNotificationNotificationsAccessSettingsRestrictedSettings"; private static final String PREF_PROFILE_VOLUME_ZEN_MODE_INFO = "prf_pref_volumeZenModeInfo"; private static final String PREF_PROFILE_VOLUME_SOUND_MODE_INFO = "prf_pref_volumeSoundMode_info"; @@ -130,9 +128,9 @@ public class ProfilesPrefsFragment extends PreferenceFragmentCompat private static final String PREF_PROFILE_OTHERS_CATTEGORY = "prf_pref_othersCategory"; private static final String PREF_PROFILE_SCREEN_CATTEGORY = "prf_pref_screenCategory"; private static final String PREF_PROFILE_VOLUME_TYPE_CATTEGORY = "prf_pref_volumeTypeCategory"; - private static final String PREF_PROFILE_PHONE_CALLS_SET_CALL_SCREENING_ROLE = "prf_pref_phoneCalls_setCallScreeningRole"; private static final String PREF_PROFILE_DEVICE_WALLPAPER_CATTEGORY = "prf_pref_deviceWallpaperCategory"; private static final String PREF_PROFILE_DEVICE_WALLPAPER_HUAWEI_INFO = "prf_pref_deviceWallpaperHuaweiInfo"; + private static final String PREF_PROFILE_DEVICE_KEYGUARD_INFO = "prf_pref_deviceKeyguardInfo"; private static final String PREF_PROFILE_ACTIVATION_DURATION_CATTEGORY_ROOT = "prf_pref_activationDurationCategoryRoot"; private static final String PREF_PROFILE_SOUND_PROFILE_CATTEGORY_ROOT = "prf_pref_soundProfileCategoryRoot"; @@ -145,7 +143,9 @@ public class ProfilesPrefsFragment extends PreferenceFragmentCompat private static final String PREF_PROFILE_LED_ACCESSORIES_CATTEGORY_ROOT = "prf_pref_ledAccessoriesCategoryRoot"; private static final String PREF_PROFILE_OTHERS_CATTEGORY_ROOT = "prf_pref_othersCategoryRoot"; private static final String PREF_PROFILE_APPLICATION_CATTEGORY_ROOT = "prf_pref_applicationCategoryRoot"; - private static final String PREF_PROFILE_PHONE_CALLS_CATTEGORY_ROOT = "prf_pref_phoneCallsCategoryRoot"; + private static final String PREF_PROFILE_SEND_SMS_CATTEGORY_ROOT = "prf_pref_sendSMSCategoryRoot"; + private static final String PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT = "prf_pref_NotificationsCategoryRoot"; + private static final String PREF_PROFILE_CLEAR_NOTIFICATIONS_CATTEGORY_ROOT = "prf_pref_clearNotificationsCategoryRoot"; private static final String TAG_RINGTONE_NAME = ""; private static final String TAG_NOTIFICATION_NAME = ""; @@ -419,10 +419,27 @@ public void onDisplayPreferenceDialog(@NonNull Preference preference) dialogFragment.setArguments(bundle); } else - if ((Build.VERSION.SDK_INT >= 29) && (preference instanceof PhoneCallSendSMSDialogPreference)) + if ((Build.VERSION.SDK_INT >= 29) && preference instanceof SendSMSDialogPreference) + { + ((SendSMSDialogPreference) preference).fragment = new SendSMSDialogPreferenceFragment(); + dialogFragment = ((SendSMSDialogPreference) preference).fragment; + Bundle bundle = new Bundle(1); + bundle.putString(PPApplication.BUNDLE_KEY, preference.getKey()); + dialogFragment.setArguments(bundle); + } + else + if (preference instanceof SearchStringPreference) { + ((SearchStringPreference) preference).fragment = new SearchStringPreferenceFragment(); + dialogFragment = ((SearchStringPreference) preference).fragment; + Bundle bundle = new Bundle(1); + bundle.putString(PPApplication.BUNDLE_KEY, preference.getKey()); + dialogFragment.setArguments(bundle); + } + else + if (preference instanceof PPEditTextDialogPreference) { - ((PhoneCallSendSMSDialogPreference) preference).fragment = new PhoneCallSendSMSDialogPreferenceFragment(); - dialogFragment = ((PhoneCallSendSMSDialogPreference) preference).fragment; + ((PPEditTextDialogPreference)preference).fragment = new PPEditTextDialogPreferenceFragment(); + dialogFragment = ((PPEditTextDialogPreference)preference).fragment; Bundle bundle = new Bundle(1); bundle.putString(PPApplication.BUNDLE_KEY, preference.getKey()); dialogFragment.setArguments(bundle); @@ -454,50 +471,56 @@ public void onActivityCreated(Bundle savedInstanceState) { if (getActivity() == null) return; + ProfilesPrefsActivity activity = (ProfilesPrefsActivity) getActivity(); + // must be used handler for rewrite toolbar title/subtitle - final Handler handler = new Handler(getActivity().getMainLooper()); + final Handler handler = new Handler(activity.getMainLooper()); final WeakReference activityWeakRef - = new WeakReference<>((ProfilesPrefsActivity) getActivity()); + = new WeakReference<>(activity); handler.postDelayed(() -> { // PPApplicationStatic.logE("[IN_THREAD_HANDLER] PPApplication.startHandlerThread", "START run - from=ProfilesPrefsFragment.onActivityCreated"); - ProfilesPrefsActivity activity = activityWeakRef.get(); - if ((activity == null) || activity.isFinishing() || activity.isDestroyed()) + ProfilesPrefsActivity __activity = activityWeakRef.get(); + if ((__activity == null) || __activity.isFinishing() || __activity.isDestroyed()) return; - SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(activity.getApplicationContext()); + SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(__activity.getApplicationContext()); final String profileName = preferences.getString(Profile.PREF_PROFILE_NAME, ""); - Toolbar toolbar = activity.findViewById(R.id.activity_preferences_toolbar); - toolbar.setSubtitle(activity.getString(R.string.title_activity_profile_preferences)); - toolbar.setTitle(activity.getString(R.string.profile_string_0) + StringConstants.STR_COLON_WITH_SPACE + profileName); + Toolbar toolbar = __activity.findViewById(R.id.activity_preferences_toolbar); + //noinspection DataFlowIssue + toolbar.setSubtitle(__activity.getString(R.string.title_activity_profile_preferences)); + toolbar.setTitle(__activity.getString(R.string.profile_string_0) + StringConstants.STR_COLON_WITH_SPACE + profileName); }, 200); - final Context context = getActivity().getBaseContext(); + final Context context = activity.getBaseContext(); final ProfilesPrefsFragment fragment = this; - final TextView preferenceSubTitle = getActivity().findViewById(R.id.activity_preferences_subtitle); + final TextView preferenceSubTitle = activity.findViewById(R.id.activity_preferences_subtitle); // subtitle if (nestedFragment) { + //noinspection DataFlowIssue preferenceSubTitle.setVisibility(View.VISIBLE); - Drawable triangle = ContextCompat.getDrawable(getActivity(), R.drawable.ic_submenu_triangle); + Drawable triangle = ContextCompat.getDrawable(activity, R.drawable.ic_submenu_triangle); if (triangle != null) { - triangle.setTint(ContextCompat.getColor(getActivity(), R.color.activityNormalTextColor)); + triangle.setTint(ContextCompat.getColor(activity, R.color.activityNormalTextColor)); SpannableString headerTitle = new SpannableString(" " + fragment.getPreferenceScreen().getTitle()); - triangle.setBounds(0, + triangle.setBounds( + GlobalGUIRoutines.sip(2), GlobalGUIRoutines.sip(1), - GlobalGUIRoutines.sip(11), + GlobalGUIRoutines.sip(13), GlobalGUIRoutines.sip(10)); headerTitle.setSpan(new ImageSpan(triangle, ImageSpan.ALIGN_BASELINE), 0, 1, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); preferenceSubTitle.setText(headerTitle); } else preferenceSubTitle.setText(fragment.getPreferenceScreen().getTitle()); } else { + //noinspection DataFlowIssue preferenceSubTitle.setVisibility(View.GONE); } - ProfilesPrefsActivity activity = (ProfilesPrefsActivity) getActivity(); - activity.progressLinearLayout.setVisibility(View.GONE); + //ProfilesPrefsActivity activity = (ProfilesPrefsActivity) getActivity(); + //activity.progressLinearLayout.setVisibility(View.GONE); activity.settingsLinearLayout.setVisibility(View.VISIBLE); setDivider(null); // this remove dividers for categories @@ -656,7 +679,7 @@ public void onActivityCreated(Bundle savedInstanceState) { if ((Build.VERSION.SDK_INT >= 28) && (Build.VERSION.SDK_INT < 33)) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATE_NOTIFICATIONS, null, preferences, true, context); PPListPreference vibrateNotificationsPreference = prefMng.findPreference(Profile.PREF_PROFILE_VIBRATE_NOTIFICATIONS); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || ((preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED)|| @@ -680,8 +703,8 @@ public void onActivityCreated(Bundle savedInstanceState) { } PreferenceAllowed _preferenceAllowed = new PreferenceAllowed(); - PreferenceAllowed.isProfileCategoryAllowed_PREF_PROFILE_VIBRATION_INTENSITY(_preferenceAllowed, context); - if (_preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + _preferenceAllowed.isProfileCategoryAllowed_PREF_PROFILE_VIBRATION_INTENSITY( context); + if (_preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { VibrationIntensityPreference vibrationIntensityPreference = prefMng.findPreference(Profile.PREF_PROFILE_VIBRATION_INTENSITY_RINGING); if (vibrationIntensityPreference != null) { vibrationIntensityPreference.setTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT + getString(R.string.profile_preferences_vibrationIntensityRinging)); @@ -748,12 +771,12 @@ public void onActivityCreated(Bundle savedInstanceState) { if (preference != null) { preference.setOnPreferenceClickListener(preference1 -> { // start preferences activity for default profile - if (getActivity() != null) { - Intent intent = new Intent(getActivity().getBaseContext(), PhoneProfilesPrefsActivity.class); + //if (activity != null) { + Intent intent = new Intent(activity.getBaseContext(), PhoneProfilesPrefsActivity.class); intent.putExtra(PhoneProfilesPrefsActivity.EXTRA_SCROLL_TO, PhoneProfilesPrefsFragment.PREF_SYSTEM_CATEGORY_ROOT); //intent.putExtra(PhoneProfilesPrefsActivity.EXTRA_SCROLL_TO_TYPE, "screen"); - getActivity().startActivityForResult(intent, RESULT_UNLINK_VOLUMES_APP_PREFERENCES); - } + activity.startActivityForResult(intent, RESULT_UNLINK_VOLUMES_APP_PREFERENCES); + //} return false; }); } @@ -824,7 +847,7 @@ public void onActivityCreated(Bundle savedInstanceState) { if (extenderPreference != null) { //extenderPreference.setWidgetLayoutResource(R.layout.start_activity_preference); extenderPreference.setOnPreferenceClickListener(preference12 -> { - ExtenderDialogPreferenceFragment.installPPPExtender(getActivity(), null); + ExtenderDialogPreferenceFragment.installPPPExtender(activity, null); return false; }); } @@ -840,7 +863,7 @@ public void onActivityCreated(Bundle savedInstanceState) { } */ /* - boolean toneInstalled = TonesHandler.isToneInstalled(TonesHandler.TONE_ID, getActivity().getApplicationContext()); + boolean toneInstalled = TonesHandler.isToneInstalled(TonesHandler.TONE_ID, activity.getApplicationContext()); if (!toneInstalled) { Preference installTonePreference = prefMng.findPreference(PREF_INSTALL_SILENT_TONE); if (installTonePreference != null) { @@ -876,7 +899,7 @@ public boolean onPreferenceClick(Preference preference) { if (extenderPreference != null) { //extenderPreference.setWidgetLayoutResource(R.layout.start_activity_preference); extenderPreference.setOnPreferenceClickListener(preference14 -> { - ExtenderDialogPreferenceFragment.installPPPExtender(getActivity(), null); + ExtenderDialogPreferenceFragment.installPPPExtender(activity, null); return false; }); } @@ -910,7 +933,7 @@ public boolean onPreferenceClick(Preference preference) { } } else { - if (getActivity() != null) { + //if (getActivity() != null) { PPAlertDialog dialog = new PPAlertDialog( getString(R.string.event_preferences_applications_LaunchExtender_title), getString(R.string.event_preferences_extender_not_installed), @@ -925,12 +948,12 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); - } + //} } return false; }); @@ -953,7 +976,7 @@ public boolean onPreferenceClick(Preference preference) { } } else { - if (getActivity() != null) { + //if (getActivity() != null) { PPAlertDialog dialog = new PPAlertDialog( getString(R.string.event_preferences_applications_LaunchExtender_title), getString(R.string.event_preferences_extender_not_installed), @@ -968,12 +991,12 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog.show(); - } + //} } return false; }); @@ -1005,7 +1028,7 @@ public boolean onPreferenceClick(Preference preference) { preference = findPreference(Profile.PREF_PROFILE_DEVICE_WIFI_AP); if (preference != null) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_WIFI_AP, null, preferences, true, context); - preference.setEnabled((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + preference.setEnabled((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || ((preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || @@ -1027,7 +1050,7 @@ public boolean onPreferenceClick(Preference preference) { //String value = preferences.getString(Profile.PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION, "-1|1"); //setSummary(Profile.PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION, value); PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_NOTIFICATION_LED, null, preferences, true, context); - preference.setEnabled((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + preference.setEnabled((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || ((preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || @@ -1037,7 +1060,7 @@ public boolean onPreferenceClick(Preference preference) { preference = findPreference(PREF_ALWAYS_ON_DISPLAY_INFO); if (preference != null) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_ALWAYS_ON_DISPLAY, null, preferences, true, context); - preference.setEnabled((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + preference.setEnabled((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || ((preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || @@ -1047,7 +1070,7 @@ public boolean onPreferenceClick(Preference preference) { preference = findPreference(PREF_SCREEN_DARK_MODE_INFO); if (preference != null) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_DARK_MODE, null, preferences, true, context); - preference.setEnabled((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + preference.setEnabled((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || ((preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || @@ -1055,88 +1078,195 @@ public boolean onPreferenceClick(Preference preference) { (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); } - final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); - if (telephonyManager != null) { - if (telephonyManager.getPhoneCount() > 1) { + final TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); + if (telephonyManager != null) { + if (telephonyManager.getPhoneCount() > 1) { - preference = findPreference(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM1); - if (preference != null) { - PreferenceAllowed preferenceAllowedSIM1 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM1, null, preferences, true, context); - preference.setEnabled((preferenceAllowedSIM1.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + preference = findPreference(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM1); + if (preference != null) { + PreferenceAllowed preferenceAllowedSIM1 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM1, null, preferences, true, context); + preference.setEnabled((preferenceAllowedSIM1.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + ((preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); + } + preference = findPreference(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM2); + if (preference != null) { + PreferenceAllowed preferenceAllowedSIM2 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM2, null, preferences, true, context); + preference.setEnabled((preferenceAllowedSIM2.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + ((preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); + } + /* + preference = findPreference(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM1); + if (preference != null) { + PreferenceAllowed preferenceAllowedSIM1 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM1, null, preferences, true, context); + preference.setEnabled((preferenceAllowedSIM1.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + ((preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); + } + preference = findPreference(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM2); + if (preference != null) { + PreferenceAllowed preferenceAllowedSIM2 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM2, null, preferences, true, context); + preference.setEnabled((preferenceAllowedSIM2.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + ((preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); + } + */ + + preference = findPreference(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS); + if (preference != null) { + PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS, null, preferences, true, context); + preference.setEnabled((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + ((preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || + (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || + (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || + (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| + (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); + } + + PPListPreference listPreference = findPreference(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1); + if (listPreference != null) { + PreferenceAllowed preferenceAllowedSIM1 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1, null, preferences, true, context); + + listPreference.setTitle(StringConstants.STR_SHIZUKU_ROOT+ getString(R.string.profile_preferences_deviceOnOff_SIM1)); + listPreference.setDialogTitle(StringConstants.STR_SHIZUKU_ROOT+getString(R.string.profile_preferences_deviceOnOff_SIM1)); + String value = preferences.getString(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1, ""); + setSummary(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1, value); + + listPreference.setEnabled((preferenceAllowedSIM1.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || ((preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); - } - preference = findPreference(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM2); + } + listPreference = findPreference(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2); + if (listPreference != null) { + PreferenceAllowed preferenceAllowedSIM2 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2, null, preferences, true, context); + + listPreference.setTitle(StringConstants.STR_SHIZUKU_ROOT+ getString(R.string.profile_preferences_deviceOnOff_SIM2)); + listPreference.setDialogTitle(StringConstants.STR_SHIZUKU_ROOT+getString(R.string.profile_preferences_deviceOnOff_SIM2)); + String value = preferences.getString(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2, ""); + setSummary(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2, value); + + listPreference.setEnabled((preferenceAllowedSIM2.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + ((preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); + } + + if ((PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) || + (PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) || + (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) || + (PPApplication.deviceIsOnePlus)) { + preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1); if (preference != null) { - PreferenceAllowed preferenceAllowedSIM2 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM2, null, preferences, true, context); - preference.setEnabled((preferenceAllowedSIM2.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - ((preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); + PreferenceAllowed preferenceAllowedSIM1 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1, null, preferences, true, context); + preference.setEnabled((preferenceAllowedSIM1.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + ((preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); } - /* - preference = findPreference(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM1); + + preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_SIM1); if (preference != null) { - PreferenceAllowed preferenceAllowedSIM1 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM1, null, preferences, true, context); - preference.setEnabled((preferenceAllowedSIM1.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + PreferenceAllowed preferenceAllowedSIM1 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_SIM1, null, preferences, true, context); + preference.setEnabled((preferenceAllowedSIM1.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || ((preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); + disableDependedPref(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1); } - preference = findPreference(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM2); + + preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2); if (preference != null) { - PreferenceAllowed preferenceAllowedSIM2 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM2, null, preferences, true, context); - preference.setEnabled((preferenceAllowedSIM2.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + PreferenceAllowed preferenceAllowedSIM2 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2, null, preferences, true, context); + preference.setEnabled((preferenceAllowedSIM2.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || ((preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); } - */ - preference = findPreference(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS); + preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_SIM2); if (preference != null) { - PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS, null, preferences, true, context); - preference.setEnabled((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - ((preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || - (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || - (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || - (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| - (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); + PreferenceAllowed preferenceAllowedSIM2 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_SIM2, null, preferences, true, context); + preference.setEnabled((preferenceAllowedSIM2.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + ((preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); + disableDependedPref(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2); } - PPListPreference listPreference = findPreference(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1); + listPreference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1); if (listPreference != null) { - PreferenceAllowed preferenceAllowedSIM1 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1, null, preferences, true, context); + PreferenceAllowed preferenceAllowedSIM1 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1, null, preferences, true, context); + + listPreference.setTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT+getString(R.string.profile_preferences_soundNotificationChangeSIM1)); + listPreference.setDialogTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT+getString(R.string.profile_preferences_soundNotificationChangeSIM1)); + String value = preferences.getString(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1, ""); + setSummary(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1, value); + + listPreference.setEnabled((preferenceAllowedSIM1.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + ((preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| + (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); + } - listPreference.setTitle(StringConstants.STR_SHIZUKU_ROOT+ getString(R.string.profile_preferences_deviceOnOff_SIM1)); - listPreference.setDialogTitle(StringConstants.STR_SHIZUKU_ROOT+getString(R.string.profile_preferences_deviceOnOff_SIM1)); - String value = preferences.getString(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1, ""); - setSummary(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1, value); + RingtonePreference ringtonePreference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM1); + if (ringtonePreference != null) { + PreferenceAllowed preferenceAllowedSIM1 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM1, null, preferences, true, context); - listPreference.setEnabled((preferenceAllowedSIM1.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + ringtonePreference.setTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT+getString(R.string.profile_preferences_soundNotificationSIM1)); + ringtonePreference.setDialogTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT+getString(R.string.profile_preferences_soundNotificationSIM1)); + String value = preferences.getString(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM1, ""); + setSummary(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM1, value); + + ringtonePreference.setEnabled((preferenceAllowedSIM1.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || ((preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); + disableDependedPref(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1); } - listPreference = findPreference(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2); + + listPreference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2); if (listPreference != null) { - PreferenceAllowed preferenceAllowedSIM2 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2, null, preferences, true, context); + PreferenceAllowed preferenceAllowedSIM2 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2, null, preferences, true, context); - listPreference.setTitle(StringConstants.STR_SHIZUKU_ROOT+ getString(R.string.profile_preferences_deviceOnOff_SIM2)); - listPreference.setDialogTitle(StringConstants.STR_SHIZUKU_ROOT+getString(R.string.profile_preferences_deviceOnOff_SIM2)); - String value = preferences.getString(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2, ""); - setSummary(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2, value); + if (PPApplication.deviceIsHuawei && (PPApplication.romIsEMUI)) { + listPreference.setTitle(StringConstants.STR_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationChangeSIM2)); + listPreference.setDialogTitle(StringConstants.STR_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationChangeSIM2)); + } else { + listPreference.setTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationChangeSIM2)); + listPreference.setDialogTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationChangeSIM2)); + } + String value = preferences.getString(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2, ""); + setSummary(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2, value); - listPreference.setEnabled((preferenceAllowedSIM2.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + listPreference.setEnabled((preferenceAllowedSIM2.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || ((preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || @@ -1144,189 +1274,29 @@ public boolean onPreferenceClick(Preference preference) { (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); } - if ((PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) || - (PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) || - (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) || - (PPApplication.deviceIsOnePlus)) { - preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1); - if (preference != null) { - PreferenceAllowed preferenceAllowedSIM1 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1, null, preferences, true, context); - preference.setEnabled((preferenceAllowedSIM1.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - ((preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); - } - - preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_SIM1); - if (preference != null) { - PreferenceAllowed preferenceAllowedSIM1 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_SIM1, null, preferences, true, context); - preference.setEnabled((preferenceAllowedSIM1.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - ((preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); - disableDependedPref(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1); - } - - preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2); - if (preference != null) { - PreferenceAllowed preferenceAllowedSIM2 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2, null, preferences, true, context); - preference.setEnabled((preferenceAllowedSIM2.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - ((preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); - } - - preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_SIM2); - if (preference != null) { - PreferenceAllowed preferenceAllowedSIM2 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_RINGTONE_SIM2, null, preferences, true, context); - preference.setEnabled((preferenceAllowedSIM2.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - ((preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); - disableDependedPref(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2); - } - - listPreference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1); - if (listPreference != null) { - PreferenceAllowed preferenceAllowedSIM1 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1, null, preferences, true, context); - - listPreference.setTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT+getString(R.string.profile_preferences_soundNotificationChangeSIM1)); - listPreference.setDialogTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT+getString(R.string.profile_preferences_soundNotificationChangeSIM1)); - String value = preferences.getString(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1, ""); - setSummary(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1, value); - - listPreference.setEnabled((preferenceAllowedSIM1.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - ((preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); - } - - RingtonePreference ringtonePreference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM1); - if (ringtonePreference != null) { - PreferenceAllowed preferenceAllowedSIM1 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM1, null, preferences, true, context); - - ringtonePreference.setTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT+getString(R.string.profile_preferences_soundNotificationSIM1)); - ringtonePreference.setDialogTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT+getString(R.string.profile_preferences_soundNotificationSIM1)); - String value = preferences.getString(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM1, ""); - setSummary(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM1, value); - - ringtonePreference.setEnabled((preferenceAllowedSIM1.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - ((preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| - (preferenceAllowedSIM1.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); - disableDependedPref(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1); - } + ringtonePreference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM2); + if (ringtonePreference != null) { + PreferenceAllowed preferenceAllowedSIM2 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM2, null, preferences, true, context); - listPreference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2); - if (listPreference != null) { - PreferenceAllowed preferenceAllowedSIM2 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2, null, preferences, true, context); - - if (PPApplication.deviceIsHuawei && (PPApplication.romIsEMUI)) { - listPreference.setTitle(StringConstants.STR_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationChangeSIM2)); - listPreference.setDialogTitle(StringConstants.STR_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationChangeSIM2)); - } else { - listPreference.setTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationChangeSIM2)); - listPreference.setDialogTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationChangeSIM2)); - } - String value = preferences.getString(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2, ""); - setSummary(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2, value); - - listPreference.setEnabled((preferenceAllowedSIM2.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - ((preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); + if (PPApplication.deviceIsHuawei && (PPApplication.romIsEMUI)) { + ringtonePreference.setTitle(StringConstants.STR_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationSIM2)); + ringtonePreference.setDialogTitle(StringConstants.STR_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationSIM2)); + } else { + ringtonePreference.setTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationSIM2)); + ringtonePreference.setDialogTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationSIM2)); } + String value = preferences.getString(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM2, ""); + setSummary(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM2, value); - ringtonePreference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM2); - if (ringtonePreference != null) { - PreferenceAllowed preferenceAllowedSIM2 = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM2, null, preferences, true, context); - - if (PPApplication.deviceIsHuawei && (PPApplication.romIsEMUI)) { - ringtonePreference.setTitle(StringConstants.STR_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationSIM2)); - ringtonePreference.setDialogTitle(StringConstants.STR_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationSIM2)); - } else { - ringtonePreference.setTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationSIM2)); - ringtonePreference.setDialogTitle(StringConstants.STR_PPPPS_SHIZUKU_ROOT + getString(R.string.profile_preferences_soundNotificationSIM2)); - } - String value = preferences.getString(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM2, ""); - setSummary(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM2, value); - - ringtonePreference.setEnabled((preferenceAllowedSIM2.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || - ((preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| - (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); - disableDependedPref(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2); - } - } else { - preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1); - if (preference != null) - preference.setVisible(false); - preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_SIM1); - if (preference != null) - preference.setVisible(false); - preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2); - if (preference != null) - preference.setVisible(false); - preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_SIM2); - if (preference != null) - preference.setVisible(false); - preference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1); - if (preference != null) - preference.setVisible(false); - preference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM1); - if (preference != null) - preference.setVisible(false); - preference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2); - if (preference != null) - preference.setVisible(false); - preference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM2); - if (preference != null) - preference.setVisible(false); + ringtonePreference.setEnabled((preferenceAllowedSIM2.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + ((preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| + (preferenceAllowedSIM2.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))); + disableDependedPref(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2); } - } else { - - preference = findPreference(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM1); - if (preference != null) - preference.setVisible(false); - preference = findPreference(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM2); - if (preference != null) - preference.setVisible(false); - - //preference = findPreference(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM1); - //if (preference != null) - // preference.setVisible(false); - //preference = findPreference(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM2); - //if (preference != null) - // preference.setVisible(false); - - preference = findPreference(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS); - if (preference != null) - preference.setVisible(false); - - preference = findPreference(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1); - if (preference != null) - preference.setVisible(false); - preference = findPreference(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2); - if (preference != null) - preference.setVisible(false); - preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1); if (preference != null) preference.setVisible(false); @@ -1351,8 +1321,8 @@ public boolean onPreferenceClick(Preference preference) { preference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM2); if (preference != null) preference.setVisible(false); - } + } else { preference = findPreference(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM1); @@ -1362,14 +1332,12 @@ public boolean onPreferenceClick(Preference preference) { if (preference != null) preference.setVisible(false); - /* - preference = findPreference(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM1); - if (preference != null) - preference.setVisible(false); - preference = findPreference(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM2); - if (preference != null) - preference.setVisible(false); - */ + //preference = findPreference(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM1); + //if (preference != null) + // preference.setVisible(false); + //preference = findPreference(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM2); + //if (preference != null) + // preference.setVisible(false); preference = findPreference(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS); if (preference != null) @@ -1408,6 +1376,61 @@ public boolean onPreferenceClick(Preference preference) { preference.setVisible(false); } + } else { + + preference = findPreference(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM1); + if (preference != null) + preference.setVisible(false); + preference = findPreference(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM2); + if (preference != null) + preference.setVisible(false); + + /* + preference = findPreference(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM1); + if (preference != null) + preference.setVisible(false); + preference = findPreference(Profile.PREF_PROFILE_DEVICE_MOBILE_DATA_SIM2); + if (preference != null) + preference.setVisible(false); + */ + + preference = findPreference(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS); + if (preference != null) + preference.setVisible(false); + + preference = findPreference(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1); + if (preference != null) + preference.setVisible(false); + preference = findPreference(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2); + if (preference != null) + preference.setVisible(false); + + preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1); + if (preference != null) + preference.setVisible(false); + preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_SIM1); + if (preference != null) + preference.setVisible(false); + preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2); + if (preference != null) + preference.setVisible(false); + preference = findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_SIM2); + if (preference != null) + preference.setVisible(false); + preference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1); + if (preference != null) + preference.setVisible(false); + preference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM1); + if (preference != null) + preference.setVisible(false); + preference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2); + if (preference != null) + preference.setVisible(false); + preference = findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION_SIM2); + if (preference != null) + preference.setVisible(false); + + } if (!((PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) || PPApplication.deviceIsOnePlus)) { @@ -1442,7 +1465,7 @@ public boolean onPreferenceClick(Preference preference) { intent.setClassName("com.miui.securitycenter", "com.miui.permcenter.permissions.PermissionsEditorActivity"); intent.putExtra(PPApplication.EXTRA_PKG_NAME, PPApplication.PACKAGE_NAME); - if (GlobalGUIRoutines.activityIntentExists(intent, getActivity().getApplicationContext())) { + if (GlobalGUIRoutines.activityIntentExists(intent, activity.getApplicationContext())) { try { startActivity(intent); ok = true; @@ -1465,10 +1488,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, true, - getActivity() + false, + activity ); - if (!getActivity().isFinishing()) + if (!activity.isFinishing()) dialog2.show(); } }, @@ -1479,10 +1503,11 @@ public boolean onPreferenceClick(Preference preference) { true, true, false, false, false, - getActivity() + false, + activity ); - if ((getActivity() != null) && (!getActivity().isFinishing())) + if (!activity.isFinishing()) dialog.show(); return false; }); @@ -1534,14 +1559,7 @@ public boolean onPreferenceClick(Preference preference) { else summary = summary + getString(R.string.profile_preferences_deviceScreenTimeoutAndKeepScreenOnInfo_summary_0_Off); summary = summary + StringConstants.STR_DOUBLE_NEWLINE; - summary = summary + "\"" + getString(R.string.profile_preferences_deviceScreenTimeout) + "\" " + - getString(R.string.profile_preferences_deviceScreenTimeoutAndKeepScreenOnInfo_summary_1) + - " \"" + getString(R.string.profile_preferences_deviceScreenTimeoutAndKeepScreenOnInfo_summary_0_Off) + "\" " + - getString(R.string.profile_preferences_deviceScreenTimeoutAndKeepScreenOnInfo_summary_2) + - " \"" + getString(R.string.profile_preferences_deviceScreenOnPermanent) + "\". " + - getString(R.string.profile_preferences_deviceScreenTimeoutAndKeepScreenOnInfo_summary_3) + - " \"" + getString(R.string.profile_preferences_deviceScreenOnPermanent) + "\"=" + - "\"" + getString(R.string.array_pref_hardwareModeArray_off) + "\"."; + summary = summary + getString(R.string.profile_preferences_deviceScreenTimeoutAndKeepScreenOnInfo_summary); preference.setSummary(summary); } @@ -1651,7 +1669,7 @@ public boolean onPreferenceClick(Preference preference) { String value = preferences.getString(Profile.PREF_PROFILE_DEVICE_SCREEN_TIMEOUT, ""); setSummary(Profile.PREF_PROFILE_DEVICE_SCREEN_TIMEOUT, value); - listPreference.setEnabled((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + listPreference.setEnabled((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || ((preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || @@ -1661,19 +1679,6 @@ public boolean onPreferenceClick(Preference preference) { } } - if (Build.VERSION.SDK_INT >= 29) { - Preference callScreeningPreference = prefMng.findPreference(PREF_PROFILE_PHONE_CALLS_SET_CALL_SCREENING_ROLE); - if (callScreeningPreference != null) { - //callScreeningPreference.setWidgetLayoutResource(R.layout.start_activity_preference); - callScreeningPreference.setOnPreferenceClickListener(preference13 -> { - RoleManager roleManager = (RoleManager) context.getSystemService(ROLE_SERVICE); - Intent intent = roleManager.createRequestRoleIntent(ROLE_CALL_SCREENING); - startActivityForResult(intent, RESULT_SET_CALL_SCREENING_ROLE); - return false; - }); - } - } - if (!(PPApplication.deviceIsHuawei && PPApplication.romIsEMUI)) { preference = findPreference(PREF_PROFILE_DEVICE_WALLPAPER_HUAWEI_INFO); if (preference != null) { @@ -1682,25 +1687,139 @@ public boolean onPreferenceClick(Preference preference) { preferenceCategory.removePreference(preference); } } - } - @Override - public void onResume() { - super.onResume(); + preference = findPreference(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS); + if (preference != null) { + disableDependedPref(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS); + } - if (getActivity() == null) - return; + preference = findPreference(PREF_NOTIFICATION_ACCESS_SYSTEM_SETTINGS); + if (preference != null) { + //preference.setWidgetLayoutResource(R.layout.start_activity_preference); + preference.setOnPreferenceClickListener(preference114 -> { + boolean ok = false; + String action; + action = Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS; + if (GlobalGUIRoutines.activityActionExists(action, activity.getApplicationContext())) { + try { + Intent intent = new Intent(action); + startActivityForResult(intent, RESULT_NOTIFICATION_ACCESS_SYSTEM_SETTINGS); + ok = true; + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } + } + if (!ok) { + PPAlertDialog dialog = new PPAlertDialog( + preference114.getTitle(), + getString(R.string.setting_screen_not_found_alert), + getString(android.R.string.ok), + null, + null, null, + null, + null, + null, + null, + null, + true, true, + false, false, + true, + false, + activity + ); - //Log.e("ProfilesPrefsFragment.onResume", "xxxxxx"); + if (!activity.isFinishing()) + dialog.show(); + } + return false; + }); + } + if (Build.VERSION.SDK_INT >= 33) { + InfoDialogPreference infoDialogPreference2 = prefMng.findPreference(PREF_NOTIFICATION_ACCESS_RESTRICTED_SETTINGS); + if (infoDialogPreference2 != null) { + infoDialogPreference2.setOnPreferenceClickListener(preference120 -> { +// Log.e("PhoneProfilesPrefsFragment.onActivityCreated", "preference clicked"); + + infoDialogPreference2.setInfoText( + StringConstants.TAG_URL_LINK_START_HTML + InfoDialogPreference.PPP_APP_INFO_SCREEN + StringConstants.TAG_URL_LINK_START_URL_END_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_2) + StringConstants.STR_HARD_SPACE_DOUBLE_ARROW_HTML+StringConstants.TAG_URL_LINK_END_HTML+StringConstants.TAG_DOUBLE_BREAK_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_3) + StringConstants.TAG_DOUBLE_BREAK_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_4) + StringConstants.TAG_DOUBLE_BREAK_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_5) + StringConstants.TAG_BREAK_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_6) + StringConstants.TAG_DOUBLE_BREAK_HTML + + StringConstants.TAG_URL_LINK_START_HTML + InfoDialogPreference.DROIDIFY_INSTALLATION_SITE + StringConstants.TAG_URL_LINK_START_URL_END_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_10) + StringConstants.STR_HARD_SPACE_DOUBLE_ARROW_HTML+StringConstants.TAG_URL_LINK_END_HTML+StringConstants.TAG_DOUBLE_BREAK_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_7) + " " + + "\"" + getString(R.string.menu_import_export) + "\"/\"" + getString(R.string.menu_export) + "\"."+StringConstants.TAG_DOUBLE_BREAK_HTML + + getString(R.string.phone_profiles_pref_eventNotificationNotificationAccessSystemSettings_summary_restrictedSettings_8) + " " + + "\"" + getString(R.string.menu_import_export) + "\"/\"" + getString(R.string.menu_import) + "\"." + ); + infoDialogPreference2.setIsHtml(true); - // this is important for update preferences after PPPPS and Extender installation - //Log.e("ProfilesPrefsFragment.onResume", "called updateAllSummary"); - updateAllSummary(); + return false; + }); + } + } - if (!nestedFragment) { - //final Context context = getActivity().getBaseContext(); + preference = findPreference(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED); + if (preference != null) { + disableDependedPref(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED); + } - //disableDependedPref(Profile.PREF_PROFILE_DEVICE_FORCE_STOP_APPLICATION_CHANGE); + /*if (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) { + preference = findPreference(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT); + if (preference != null) { + preference.setVisible(false); + } + } else {*/ + PPListPreference listPreference = findPreference(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT); + if (listPreference != null) { + listPreference.setTitle(ProfileStatic.getNightLightStringId()); + listPreference.setDialogTitle(ProfileStatic.getNightLightStringId()); + } + //} + if ((PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) || + PPApplication.deviceIsOnePlus) { + preference = findPreference(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS); + if (preference != null) { + preference.setVisible(false); + } + } else { + listPreference = findPreference(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS); + if (listPreference != null) { + listPreference.setTitle(ProfileStatic.getNightLightStringPrefsId()); + listPreference.setDialogTitle(ProfileStatic.getNightLightStringPrefsId()); + } + } + + preference = findPreference(Profile.PREF_PROFILE_DEVICE_KEYGUARD); + if (preference != null) { + disableDependedPref(Profile.PREF_PROFILE_DEVICE_KEYGUARD); + } + preference = findPreference(Profile.PREF_PROFILE_SCREEN_ON_OFF); + if (preference != null) { + disableDependedPref(Profile.PREF_PROFILE_SCREEN_ON_OFF); + } + + } + + @Override + public void onResume() { + super.onResume(); + + if (getActivity() == null) + return; + + //Log.e("ProfilesPrefsFragment.onResume", "xxxxxx"); + + // this is important for update preferences after PPPPS and Extender installation + //Log.e("ProfilesPrefsFragment.onResume", "called updateAllSummary"); + updateAllSummary(); + + if (!nestedFragment) { + //final Context context = getActivity().getBaseContext(); + + //disableDependedPref(Profile.PREF_PROFILE_DEVICE_FORCE_STOP_APPLICATION_CHANGE); //disableDependedPref(Profile.PREF_PROFILE_LOCK_DEVICE); setRedTextToPreferences(); // PPApplicationStatic.logE("[PPP_NOTIFICATION] ProfilesPrefsFragment.onResume", "call of updateGUI"); @@ -1746,51 +1865,57 @@ public void onDestroy() @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { + if (getActivity() == null) + return; + + ProfilesPrefsActivity activity = (ProfilesPrefsActivity) getActivity(); - if (key.equals(Profile.PREF_PROFILE_NAME)) { + if ((key != null) && key.equals(Profile.PREF_PROFILE_NAME)) { + //noinspection UnnecessaryLocalVariable String value = sharedPreferences.getString(key, ""); - if (getActivity() != null) { + //if (getActivity() != null) { // must be used handler for rewrite toolbar title/subtitle final String _value = value; - final Handler handler = new Handler(getActivity().getMainLooper()); + final Handler handler = new Handler(activity.getMainLooper()); final WeakReference activityWeakRef - = new WeakReference<>((ProfilesPrefsActivity) getActivity()); + = new WeakReference<>(activity); handler.postDelayed(() -> { // PPApplicationStatic.logE("[IN_THREAD_HANDLER] PPApplication.startHandlerThread", "START run - from=ProfilesPrefsFragment.onSharedPreferenceChanged"); - ProfilesPrefsActivity activity = activityWeakRef.get(); - if ((activity == null) || activity.isFinishing() || activity.isDestroyed()) + ProfilesPrefsActivity __activity = activityWeakRef.get(); + if ((__activity == null) || __activity.isFinishing() || __activity.isDestroyed()) return; - Toolbar toolbar = activity.findViewById(R.id.activity_preferences_toolbar); + Toolbar toolbar = __activity.findViewById(R.id.activity_preferences_toolbar); //toolbar.setSubtitle(getString(R.string.profile_string_0) + ": " + _value); - toolbar.setTitle(activity.getString(R.string.profile_string_0) + StringConstants.STR_COLON_WITH_SPACE + _value); + //noinspection DataFlowIssue + toolbar.setTitle(__activity.getString(R.string.profile_string_0) + StringConstants.STR_COLON_WITH_SPACE + _value); }, 200); - } + //} } - if (getActivity() == null) - return; - String value; - if (key.equals(Profile.PREF_PROFILE_SHOW_IN_ACTIVATOR) || + if ((key != null) && + (key.equals(Profile.PREF_PROFILE_SHOW_IN_ACTIVATOR) || key.equals(Profile.PREF_PROFILE_ASK_FOR_DURATION) || key.equals(Profile.PREF_PROFILE_DURATION_NOTIFICATION_VIBRATE) || key.equals(Profile.PREF_PROFILE_HIDE_STATUS_BAR_ICON) || - key.endsWith(Profile.PREF_PROFILE_VOLUME_MUTE_SOUND) || - key.endsWith(Profile.PREF_PROFILE_VOLUME_MEDIA_CHANGE_DURING_PLAY) || - key.endsWith(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS) || - key.endsWith(Profile.PREF_PROFILE_PHONE_CALLS_SEND_SMS)) { + key.equals(Profile.PREF_PROFILE_VOLUME_MUTE_SOUND) || + key.equals(Profile.PREF_PROFILE_VOLUME_MEDIA_CHANGE_DURING_PLAY) || + key.equals(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT))) { boolean bValue = sharedPreferences.getBoolean(key, false); value = Boolean.toString(bValue); } else - if (key.equals(Profile.PREF_PROFILE_END_OF_ACTIVATION_TIME)) { + if ((key != null) && key.equals(Profile.PREF_PROFILE_END_OF_ACTIVATION_TIME)) { value = String.valueOf(sharedPreferences.getInt(key, 0)); } else { - if (prefMng.findPreference(key) != null) + if ((key != null) && prefMng.findPreference(key) != null) value = sharedPreferences.getString(key, ""); else value = ""; @@ -1802,11 +1927,11 @@ public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, Strin setRedTextToPreferences(); - ProfilesPrefsActivity activity = (ProfilesPrefsActivity)getActivity(); - if (activity != null) { + //ProfilesPrefsActivity activity = (ProfilesPrefsActivity)getActivity(); + //if (activity != null) { activity.showSaveMenu = true; activity.invalidateOptionsMenu(); - } + //} } @@ -1816,6 +1941,8 @@ void doOnActivityResult(int requestCode, int resultCode, Intent data) { final Context context = getActivity().getBaseContext(); + ProfilesPrefsActivity activity = (ProfilesPrefsActivity) getActivity(); + if (requestCode == (Permissions.REQUEST_CODE + Permissions.GRANT_TYPE_PROFILE)) { setRedTextToPreferences(); } @@ -1834,7 +1961,7 @@ void doOnActivityResult(int requestCode, int resultCode, Intent data) { /*//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { try { final int takeFlags = Intent.FLAG_GRANT_READ_URI_PERMISSION; - ContentResolver resolver = getActivity().getContentResolver(); + ContentResolver resolver = activity.getContentResolver(); resolver.takePersistableUriPermission(selectedImage, takeFlags); } catch (Exception e) { Log.e("ProfilesPrefsFragment.doOnActivityResult", Log.getStackTraceString(e)); @@ -1878,7 +2005,7 @@ void doOnActivityResult(int requestCode, int resultCode, Intent data) { /*//if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { try { final int takeFlags = Intent.FLAG_GRANT_READ_URI_PERMISSION; - ContentResolver resolver = getActivity().getContentResolver(); + ContentResolver resolver = activity.getContentResolver(); resolver.takePersistableUriPermission(selectedImage, takeFlags); } catch (Exception e) { Log.e("ProfilesPrefsFragment.doOnActivityResult", Log.getStackTraceString(e)); @@ -1902,12 +2029,12 @@ void doOnActivityResult(int requestCode, int resultCode, Intent data) { }*/ } else { - if (getActivity() != null) { + //if (getActivity() != null) { String text = getString(R.string.profileicon_pref_dialog_custom_icon_image_too_large); text = text + " " + (width * BitmapManipulator.ICON_BITMAP_SIZE_MULTIPLIER); text = text + "x" + (height * BitmapManipulator.ICON_BITMAP_SIZE_MULTIPLIER); - PPApplication.showToast(getActivity().getApplicationContext(), text, Toast.LENGTH_LONG); - } + PPApplication.showToast(activity.getApplicationContext(), text, Toast.LENGTH_LONG); + //} } } } @@ -1971,11 +2098,11 @@ void doOnActivityResult(int requestCode, int resultCode, Intent data) { PPApplication.updateGUI(true, false, context); // show save menu - ProfilesPrefsActivity activity = (ProfilesPrefsActivity)getActivity(); - if (activity != null) { + //ProfilesPrefsActivity activity = (ProfilesPrefsActivity)getActivity(); + //if (activity != null) { activity.showSaveMenu = true; activity.invalidateOptionsMenu(); - } + //} } if ((requestCode == (Permissions.REQUEST_CODE + Permissions.GRANT_TYPE_IMAGE_WALLPAPER)) || (requestCode == (Permissions.REQUEST_CODE + Permissions.GRANT_TYPE_IMAGE_WALLPAPER_LOCKSCREEN))) { @@ -2026,35 +2153,16 @@ void doOnActivityResult(int requestCode, int resultCode, Intent data) { setSummary(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE); setSummary(PREF_PROFILE_DEVICE_AIRPLANE_MODE_ASSISTANT_SETTINGS); // show save menu - ProfilesPrefsActivity activity = (ProfilesPrefsActivity)getActivity(); - if (activity != null) { + //ProfilesPrefsActivity activity = (ProfilesPrefsActivity)getActivity(); + //if (activity != null) { activity.showSaveMenu = true; activity.invalidateOptionsMenu(); - } + //} } - - if (requestCode == RESULT_SET_CALL_SCREENING_ROLE) { - if (Build.VERSION.SDK_INT >= 29) { - disableDependedPref(PREF_PROFILE_PHONE_CALLS_SET_CALL_SCREENING_ROLE); - setSummary(PREF_PROFILE_PHONE_CALLS_SET_CALL_SCREENING_ROLE); - - ProfilesPrefsActivity activity = (ProfilesPrefsActivity)getActivity(); - if (activity != null) { - activity.showSaveMenu = true; - activity.invalidateOptionsMenu(); - } - } - /* - //disableDependedPref(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE); - setSummary(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE); - setSummary(PREF_PROFILE_DEVICE_AIRPLANE_MODE_ASSISTANT_SETTINGS); - // show save menu - ProfilesPrefsActivity activity = (ProfilesPrefsActivity)getActivity(); - if (activity != null) { - activity.showSaveMenu = true; - activity.invalidateOptionsMenu(); - } - */ + if (requestCode == RESULT_NOTIFICATION_ACCESS_SYSTEM_SETTINGS) { + setSummary(PREF_NOTIFICATION_ACCESS_SYSTEM_SETTINGS); + setSummary(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS); + //disableDependedPref(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED); } } @@ -2111,22 +2219,22 @@ private String getCategoryTitleWhenPreferenceChanged(String key, int preferenceT String title = ""; PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); boolean _notGrantedG1Permission = - (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION); boolean _notRootedOrGrantedRoot = - (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && ((preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED)); boolean _notDefaultAssistant = - (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_SET_AS_ASSISTANT); boolean _notInstalledPPPS = - (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS); boolean _notGrantedShizuku = - (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && + (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) && (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || _notGrantedG1Permission || _notRootedOrGrantedRoot || _notGrantedShizuku || @@ -2137,9 +2245,11 @@ private String getCategoryTitleWhenPreferenceChanged(String key, int preferenceT case Profile.PREF_PROFILE_ASK_FOR_DURATION: case Profile.PREF_PROFILE_DURATION_NOTIFICATION_VIBRATE: case Profile.PREF_PROFILE_VOLUME_MUTE_SOUND: - case Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS: - case Profile.PREF_PROFILE_PHONE_CALLS_SEND_SMS: //case Profile.PREF_PROFILE_SHOW_IN_ACTIVATOR: + case Profile.PREF_PROFILE_SEND_SMS_SEND_SMS: + case Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED: + case Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS: + case Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT: /*boolean defaultValue = getResources().getBoolean( GlobalGUIRoutines.getResourceId(key, "bool", context));*/ @@ -2165,7 +2275,8 @@ private String getCategoryTitleWhenPreferenceChanged(String key, int preferenceT break; case Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE: defaultValueS = Profile.defaultValuesString.get(key); - if (!preferences.getString(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE, defaultValueS).equals(defaultValueS)) { + String airplanemode = preferences.getString(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE, defaultValueS); + if ((airplanemode != null) && (!airplanemode.equals(defaultValueS))) { title = getString(preferenceTitleId); notGrantedG1Permission = notGrantedG1Permission || _notGrantedG1Permission; notRootedOrGrantetRoot = notRootedOrGrantetRoot || _notRootedOrGrantedRoot; @@ -2298,7 +2409,7 @@ private boolean setCategorySummaryActivationDuration(Context context, String askForDurationTitle = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_ASK_FOR_DURATION, R.string.profile_preferences_askForDuration, context); if (askForDurationTitle.isEmpty()) { String value = preferences.getString(Profile.PREF_PROFILE_END_OF_ACTIVATION_TYPE, Profile.defaultValuesString.get(Profile.PREF_PROFILE_END_OF_ACTIVATION_TYPE)); - if (value.equals(String.valueOf(Profile.AFTER_DURATION_DURATION_TYPE_DURATION))) { + if ((value != null) && value.equals(String.valueOf(Profile.AFTER_DURATION_DURATION_TYPE_DURATION))) { title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_DURATION, R.string.profile_preferences_duration, context); String afterDurationDoTitle = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_AFTER_DURATION_DO, R.string.profile_preferences_afterDurationDo, context); if (!title.isEmpty()) { @@ -2974,11 +3085,11 @@ private boolean setCategorySummaryTouchEffects(Context context, private boolean setCategorySummaryVibrationIntensity(Context context, CattegorySummaryData cattegorySummaryData) { PreferenceAllowed _preferenceAllowed = new PreferenceAllowed(); - PreferenceAllowed.isProfileCategoryAllowed_PREF_PROFILE_VIBRATION_INTENSITY(_preferenceAllowed, context); + _preferenceAllowed.isProfileCategoryAllowed_PREF_PROFILE_VIBRATION_INTENSITY( context); StringBuilder _value = new StringBuilder(cattegorySummaryData.summary); - if (_preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (_preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { String title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_VIBRATION_INTENSITY_RINGING, R.string.profile_preferences_vibrationIntensityRinging, context); if (!title.isEmpty()) { cattegorySummaryData.bold = true; @@ -2987,7 +3098,7 @@ private boolean setCategorySummaryVibrationIntensity(Context context, String value = preferences.getString(Profile.PREF_PROFILE_VIBRATION_INTENSITY_RINGING, Profile.defaultValuesString.get(Profile.PREF_PROFILE_VIBRATION_INTENSITY_RINGING)); - value = ProfileStatic.getVolumeValue(value) + "/" + VibrationIntensityPreference.getMaxValue("RINGING"); + value = ProfileStatic.getVolumeValue(value) + "/" + VibrationIntensityPreference.getMaxValue(VibrationIntensityPreference.RINGING_VYBRATION_INTENSITY_TYPE); _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) .append(ProfileStatic.getColorForChangedPreferenceValue(value, prefMng, PREF_PROFILE_VIBRATION_INTENSITY_CATTEGORY_ROOT, context)) @@ -3001,7 +3112,7 @@ private boolean setCategorySummaryVibrationIntensity(Context context, String value = preferences.getString(Profile.PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS, Profile.defaultValuesString.get(Profile.PREF_PROFILE_VIBRATION_INTENSITY_NOTIFICATIONS)); - value = ProfileStatic.getVolumeValue(value) + "/" + VibrationIntensityPreference.getMaxValue("NOTIFICATIONS"); + value = ProfileStatic.getVolumeValue(value) + "/" + VibrationIntensityPreference.getMaxValue(VibrationIntensityPreference.NOTIFICATIONS_VYBRATION_INTENSITY_TYPE); _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) .append(ProfileStatic.getColorForChangedPreferenceValue(value, prefMng, PREF_PROFILE_VIBRATION_INTENSITY_CATTEGORY_ROOT, context)) @@ -3015,7 +3126,7 @@ private boolean setCategorySummaryVibrationIntensity(Context context, String value = preferences.getString(Profile.PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION, Profile.defaultValuesString.get(Profile.PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION)); - value = ProfileStatic.getVolumeValue(value) + "/" + VibrationIntensityPreference.getMaxValue("TOUCHINTERACTION"); + value = ProfileStatic.getVolumeValue(value) + "/" + VibrationIntensityPreference.getMaxValue(VibrationIntensityPreference.TOUCHINTERACTION_VYBRATION_INTENSITY_TYPE); _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) .append(ProfileStatic.getColorForChangedPreferenceValue(value, prefMng, PREF_PROFILE_VIBRATION_INTENSITY_CATTEGORY_ROOT, context)) @@ -3389,9 +3500,15 @@ private boolean setCategorySummaryRadios(Context context, int vpnApplication; - String[] splits = value.split(StringConstants.STR_SPLIT_REGEX); + String[] splits = null; + if (value != null) + splits = value.split(StringConstants.STR_SPLIT_REGEX); + try { - vpnApplication = Integer.parseInt(splits[0]); + if (splits != null) + vpnApplication = Integer.parseInt(splits[0]); + else + vpnApplication = 0; } catch (Exception e) { //Log.e("ProfilesPrefsFragment.setCategorySummaryRadios", Log.getStackTraceString(e)); PPApplicationStatic.recordException(e); @@ -3412,7 +3529,7 @@ private boolean setCategorySummaryRadios(Context context, boolean enableVPN = true; try { - enableVPN = Integer.parseInt(splits[1]) == 0; + enableVPN = (splits != null) && Integer.parseInt(splits[1]) == 0; } catch (Exception e) { //Log.e("ProfilesPrefsFragment.setCategorySummaryRadios", Log.getStackTraceString(e)); PPApplicationStatic.recordException(e); @@ -3522,6 +3639,20 @@ private boolean setCategorySummaryScreen(Context context, .append(ProfileStatic.getColorForChangedPreferenceValue(value, prefMng, PREF_PROFILE_SCREEN_CATTEGORY_ROOT, context)) .append(StringConstants.TAG_BOLD_END_HTML); } + title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_SCREEN_ON_OFF, R.string.profile_preferences_deviceScreenOnOff, context); + if (!title.isEmpty()) { + cattegorySummaryData.bold = true; + if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); + + String value = StringFormatUtils.getListPreferenceString( + preferences.getString(Profile.PREF_PROFILE_SCREEN_ON_OFF, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_SCREEN_ON_OFF)), + R.array.screenOnOffValues, R.array.screenOnOffArray, context); + + _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(value, prefMng, PREF_PROFILE_SCREEN_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + } title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_DEVICE_KEYGUARD, R.string.profile_preferences_deviceKeyguard, context); if (!title.isEmpty()) { cattegorySummaryData.bold = true; @@ -3551,8 +3682,9 @@ private boolean setCategorySummaryScreen(Context context, .append(ProfileStatic.getColorForChangedPreferenceValue(sValue, prefMng, PREF_PROFILE_SCREEN_CATTEGORY_ROOT, context)) .append(StringConstants.TAG_BOLD_END_HTML); - if (wallpaperChangeValue.equals("1") || - wallpaperChangeValue.equals("3")) { + if ((wallpaperChangeValue != null) && + (wallpaperChangeValue.equals("1") || + wallpaperChangeValue.equals("3"))) { if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); String value = StringFormatUtils.getListPreferenceString( @@ -3623,6 +3755,35 @@ private boolean setCategorySummaryScreen(Context context, .append(StringConstants.TAG_BOLD_END_HTML); } + title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT, ProfileStatic.getNightLightStringId(), context); + if (!title.isEmpty()) { + cattegorySummaryData.bold = true; + if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); + + String value = StringFormatUtils.getListPreferenceString( + preferences.getString(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT)), + R.array.screenNightLightValues, R.array.screenNightLightArray, context); + + _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(value, prefMng, PREF_PROFILE_SCREEN_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + } + title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS, ProfileStatic.getNightLightStringPrefsId(), context); + if (!title.isEmpty()) { + cattegorySummaryData.bold = true; + if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); + + String value = StringFormatUtils.getListPreferenceString( + preferences.getString(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS)), + R.array.screenNightLightPrefsValues, R.array.screenNightLightPrefsArray, context); + + _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(value, prefMng, PREF_PROFILE_SCREEN_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + } + cattegorySummaryData.summary = _value.toString(); Profile profile = new Profile(); @@ -3632,6 +3793,8 @@ private boolean setCategorySummaryScreen(Context context, profile._deviceAutoRotate = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_DEVICE_AUTOROTATE, "0")); profile._deviceWallpaperChange = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_DEVICE_WALLPAPER_CHANGE, "0")); profile._alwaysOnDisplay = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_ALWAYS_ON_DISPLAY, "0")); + profile._screenNightLight = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT, "0")); + profile._screenOnOff = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_SCREEN_ON_OFF, "0")); ArrayList permissions = new ArrayList<>(); Permissions.checkProfileScreenTimeout(context, profile, permissions); Permissions.checkProfileScreenOnPermanent(context, profile, permissions); @@ -3640,6 +3803,8 @@ private boolean setCategorySummaryScreen(Context context, Permissions.checkProfileImageWallpaper(context, profile, permissions); Permissions.checkProfileWallpaperFolder(context, profile, permissions); Permissions.checkProfileAlwaysOnDisplay(context, profile, permissions); + Permissions.checkProfileScreenNightLight(context, profile, permissions); + Permissions.checkProfileScreenOnOff(context, profile, permissions); cattegorySummaryData.permissionGranted = permissions.isEmpty(); profile._lockDevice = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_LOCK_DEVICE, "0")); @@ -3697,103 +3862,70 @@ private boolean setCategorySummaryLedAccessories(Context context, } @SuppressWarnings("SameReturnValue") - private boolean setCategorySummaryPhoneCalls(Context context, + private boolean setCategorySummarySendSMS(Context context, CattegorySummaryData cattegorySummaryData) { StringBuilder _value = new StringBuilder(cattegorySummaryData.summary); - boolean isHeld = false; - if (Build.VERSION.SDK_INT >= 29) { - RoleManager roleManager = (RoleManager) context.getSystemService(ROLE_SERVICE); - isHeld = roleManager.isRoleHeld(ROLE_CALL_SCREENING); - } - if (isHeld) { - int contactListType = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE, - Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE))); - String contactGroupsValue = preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS, - Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS)); - String contactsValue = preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACTS, - Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_CONTACTS)); - boolean blockCalls = preferences.getBoolean(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS, false); - //boolean sendSMS = preferences.getBoolean(Profile.PREF_PROFILE_PHONE_CALLS_SEND_SMS, false); - - if (blockCalls) { - String title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS, R.string.profile_preference_phoneCallsContactGroups, context); - if (!title.isEmpty()) { - cattegorySummaryData.bold = true; - //if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); - - contactGroupsValue = ContactGroupsMultiSelectDialogPreference.getSummary(contactGroupsValue, context); - - _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) - .append(ProfileStatic.getColorForChangedPreferenceValue(contactGroupsValue, prefMng, PREF_PROFILE_PHONE_CALLS_CATTEGORY_ROOT, context)) - .append(StringConstants.TAG_BOLD_END_HTML); - - } - title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_PHONE_CALLS_CONTACTS, R.string.profile_preference_phoneCallsContacts, context); - if (!title.isEmpty()) { - cattegorySummaryData.bold = true; - if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); + //int contactListType = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE, + // Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE))); + String contactGroupsValue = preferences.getString(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS)); + String contactsValue = preferences.getString(Profile.PREF_PROFILE_SEND_SMS_CONTACTS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_SEND_SMS_CONTACTS)); + boolean sendSMS = false; + + if ( + /*(contactListType == EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) ||*/ + ((contactGroupsValue != null) && (!contactGroupsValue.isEmpty())) || + ((contactsValue != null) && (!contactsValue.isEmpty())) + ) { + String title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS, R.string.profile_preference_sendSMSSendSMS, context); + if (!title.isEmpty()) { + sendSMS = true; + cattegorySummaryData.bold = true; + _value.append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(title, prefMng, PREF_PROFILE_SEND_SMS_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + } + } - contactsValue = ContactsMultiSelectDialogPreference.getSummary(contactsValue, false, context); + if (sendSMS) { + String title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS, R.string.profile_preference_sendSMSContactGroups, context); + if (!title.isEmpty()) { + cattegorySummaryData.bold = true; + if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); - _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) - .append(ProfileStatic.getColorForChangedPreferenceValue(contactsValue, prefMng, PREF_PROFILE_PHONE_CALLS_CATTEGORY_ROOT, context)) - .append(StringConstants.TAG_BOLD_END_HTML); + contactGroupsValue = ContactGroupsMultiSelectDialogPreference.getSummary(contactGroupsValue, context); - } - if ( - (contactListType == EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) || - ((contactGroupsValue != null) && (!contactGroupsValue.isEmpty())) || - ((contactsValue != null) && (!contactsValue.isEmpty())) - ) { - title = context.getString(R.string.event_preferences_contactListType); - if (!title.isEmpty()) { - cattegorySummaryData.bold = true; - if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); - - String value = StringFormatUtils.getListPreferenceString( - preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE, - Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE)), - R.array.phoneCallsContactListTypeValues, R.array.phoneCallsContactListTypeArray, context); + _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(contactGroupsValue, prefMng, PREF_PROFILE_SEND_SMS_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); - _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) - .append(ProfileStatic.getColorForChangedPreferenceValue(value, prefMng, PREF_PROFILE_PHONE_CALLS_CATTEGORY_ROOT, context)) - .append(StringConstants.TAG_BOLD_END_HTML); - } + } + title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_SEND_SMS_CONTACTS, R.string.profile_preference_sendSMSContacts, context); + if (!title.isEmpty()) { + cattegorySummaryData.bold = true; + if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); - title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS, R.string.profile_preference_phoneCallsBlockCalls, context); - if (!title.isEmpty()) { - cattegorySummaryData.bold = true; - _value.append(StringConstants.STR_BULLET) - .append(StringConstants.TAG_BOLD_START_HTML) - .append(ProfileStatic.getColorForChangedPreferenceValue(title, prefMng, PREF_PROFILE_PHONE_CALLS_CATTEGORY_ROOT, context)) - .append(StringConstants.TAG_BOLD_END_HTML); - } + contactsValue = ContactsMultiSelectDialogPreference.getSummary(contactsValue, false, context); - title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_PHONE_CALLS_SEND_SMS, R.string.profile_preference_phoneCallsSendSMS, context); - if (!title.isEmpty()) { - cattegorySummaryData.bold = true; - _value.append(StringConstants.STR_BULLET) - .append(StringConstants.TAG_BOLD_START_HTML) - .append(ProfileStatic.getColorForChangedPreferenceValue(title, prefMng, PREF_PROFILE_PHONE_CALLS_CATTEGORY_ROOT, context)) - .append(StringConstants.TAG_BOLD_END_HTML); - } + _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(contactsValue, prefMng, PREF_PROFILE_SEND_SMS_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); - } } } cattegorySummaryData.summary = _value.toString(); - if (isHeld) { - Profile profile = new Profile(); - profile._phoneCallsContacts = preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACTS, ""); - profile._phoneCallsContactGroups = preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS, ""); - ArrayList permissions = new ArrayList<>(); - Permissions.checkProfilePhoneCalls(context, profile, permissions); - cattegorySummaryData.permissionGranted = permissions.isEmpty(); - } + Profile profile = new Profile(); + profile._sendSMSContacts = preferences.getString(Profile.PREF_PROFILE_SEND_SMS_CONTACTS, ""); + profile._sendSMSContactGroups = preferences.getString(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS, ""); + profile._sendSMSSendSMS = preferences.getBoolean(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS, false); + ArrayList permissions = new ArrayList<>(); + Permissions.checkProfileSendSMS(context, profile, permissions); + cattegorySummaryData.permissionGranted = permissions.isEmpty(); return false; } @@ -3871,48 +4003,44 @@ private boolean setCategorySummaryOthers(Context context, profile._deviceForceStopApplicationChange = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_DEVICE_FORCE_STOP_APPLICATION_CHANGE, "0")); cattegorySummaryData.accessibilityEnabled = profile.isAccessibilityServiceEnabled(context, false) == 1; } - title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_GENERATE_NOTIFICATION, R.string.profile_preferences_generateNotification, context); + title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS, R.string.profile_preference_sendSMSSendSMS, context); if (!title.isEmpty()) { - cattegorySummaryData.bold = true; - if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); - - String value = preferences.getString(Profile.PREF_PROFILE_GENERATE_NOTIFICATION, - Profile.defaultValuesString.get(Profile.PREF_PROFILE_GENERATE_NOTIFICATION)); - - //boolean generate = Profile.getGenerateNotificationChange(value); - int iconType = ProfileStatic.getGenerateNotificationIconType(value); - boolean replaceWithPPPIcon = ProfileStatic.getGenerateNotificationReplaceWithPPPIcon(value); - boolean showLargeIcon = ProfileStatic.getGenerateNotificationShowLargeIcon(value); - String notificationTitle = ProfileStatic.getGenerateNotificationTitle(value); - String notificationBody = ProfileStatic.getGenerateNotificationBody(value); - - String summaryString = ""; - - if (iconType == 0) - summaryString = summaryString + getString(R.string.preference_profile_generate_notification_information_icon) + "; "; - else if (iconType == 1) - summaryString = summaryString + getString(R.string.preference_profile_generate_notification_exclamation_icon) + "; "; - else - summaryString = summaryString + getString(R.string.preference_profile_generate_notification_profile_icon) + "; "; - - if (replaceWithPPPIcon) - summaryString = summaryString + getString(R.string.preference_profile_generate_notification_replace_with_ppp_icon) + "; "; - if (showLargeIcon) - summaryString = summaryString + getString(R.string.preference_profile_generate_notification_show_large_icon) + "; "; + String contactGroupsValue = preferences.getString(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS)); + String contactsValue = preferences.getString(Profile.PREF_PROFILE_SEND_SMS_CONTACTS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_SEND_SMS_CONTACTS)); - if (notificationBody.isEmpty()) - summaryString = summaryString + StringConstants.CHAR_QUOTE_HTML + notificationTitle + StringConstants.CHAR_QUOTE_HTML; - else - summaryString = summaryString + StringConstants.CHAR_QUOTE_HTML + notificationTitle + StringConstants.CHAR_QUOTE_HTML - + "; " + StringConstants.CHAR_QUOTE_HTML + notificationBody + StringConstants.CHAR_QUOTE_HTML; + if ( + /*(contactListType == EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) ||*/ + ((contactGroupsValue != null) && (!contactGroupsValue.isEmpty())) || + ((contactsValue != null) && (!contactsValue.isEmpty())) + ) { + cattegorySummaryData.bold = true; + if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); - _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) - .append(ProfileStatic.getColorForChangedPreferenceValue(summaryString, prefMng, PREF_PROFILE_OTHERS_CATTEGORY_ROOT, context)) - .append(StringConstants.TAG_BOLD_END_HTML); + _value.append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(title, prefMng, PREF_PROFILE_SEND_SMS_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + } } cattegorySummaryData.summary = _value.toString(); + Profile profile = new Profile(); + profile._deviceCloseAllApplications = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_DEVICE_CLOSE_ALL_APPLICATIONS, "0")); + profile._deviceRunApplicationChange = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_DEVICE_RUN_APPLICATION_CHANGE, "0")); + profile._sendSMSContacts = preferences.getString(Profile.PREF_PROFILE_SEND_SMS_CONTACTS, ""); + profile._sendSMSContactGroups = preferences.getString(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS, ""); + profile._sendSMSSendSMS = preferences.getBoolean(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS, false); + ArrayList permissions = new ArrayList<>(); + Permissions.checkProfileCloseAllApplications(context, profile, permissions); + Permissions.checkProfileRunApplications(context, profile, permissions); + Permissions.checkProfileSendSMS(context, profile, permissions); + cattegorySummaryData.permissionGranted = permissions.isEmpty(); + + profile._deviceForceStopApplicationChange = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_DEVICE_FORCE_STOP_APPLICATION_CHANGE, "0")); + cattegorySummaryData.accessibilityEnabled = profile.isAccessibilityServiceEnabled(context, false) == 1; + return false; } @@ -3997,6 +4125,11 @@ private boolean setCategorySummaryLockDevice(Context context, StringBuilder _value = new StringBuilder(); // must be empty for this cattegory + String title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_LOCK_DEVICE, R.string.profile_preferences_lockDevice, context); + if (!title.isEmpty()) { + _value.append(title).append(": "); + } + int index = 0; String sValue; @@ -4012,7 +4145,7 @@ private boolean setCategorySummaryLockDevice(Context context, if (index == 0) _value.append(ProfileStatic.getColorForChangedPreferenceValue(entries[index], prefMng, PREF_LOCK_DEVICE_CATEGORY_ROOT, context)); else - _value.append(cattegorySummaryData.summary = StringConstants.TAG_BOLD_START_HTML) + _value.append(StringConstants.TAG_BOLD_START_HTML) .append(ProfileStatic.getColorForChangedPreferenceValue(entries[index], prefMng, PREF_LOCK_DEVICE_CATEGORY_ROOT, context)) .append(StringConstants.TAG_BOLD_END_HTML); @@ -4037,10 +4170,6 @@ private boolean setCategorySummaryLockDevice(Context context, .append(": ").append(getString(R.string.preference_not_allowed_reason_state_of_accessibility_setting_for_extender_is_determined)); } } - String title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_LOCK_DEVICE, R.string.profile_preferences_lockDevice, context); - if (!title.isEmpty()) { - _value.append(title).append(": ").append(cattegorySummaryData.summary); - } cattegorySummaryData.summary = _value.toString(); @@ -4073,7 +4202,7 @@ private boolean setCategorySummaryApplication(Context context, String value = StringFormatUtils.getListPreferenceString(enabledValue, R.array.applicationEnableScanningValues, R.array.applicationEnableScanningArray, context); - if (enabledValue.equals("3")) { + if ((enabledValue != null) && enabledValue.equals("3")) { String interval = preferences.getString(Profile.PREF_PROFILE_APPLICATION_WIFI_SCAN_INTERVAL, ""); value = value + ": "+interval; } @@ -4091,7 +4220,7 @@ private boolean setCategorySummaryApplication(Context context, String value = StringFormatUtils.getListPreferenceString(enabledValue, R.array.applicationEnableScanningValues, R.array.applicationEnableScanningArray, context); - if (enabledValue.equals("3")) { + if ((enabledValue != null) && enabledValue.equals("3")) { String interval = preferences.getString(Profile.PREF_PROFILE_APPLICATION_BLUETOOTH_SCAN_INTERVAL, ""); String duration = preferences.getString(Profile.PREF_PROFILE_APPLICATION_BLUETOOTH_LE_SCAN_DURATION, ""); value = value + ": "+interval+", "+duration; @@ -4110,7 +4239,7 @@ private boolean setCategorySummaryApplication(Context context, String value = StringFormatUtils.getListPreferenceString(enabledValue, R.array.applicationEnableScanningValues, R.array.applicationEnableScanningArray, context); - if (enabledValue.equals("3")) { + if ((enabledValue != null) && enabledValue.equals("3")) { String interval = preferences.getString(Profile.PREF_PROFILE_APPLICATION_LOCATION_UPDATE_INTERVAL, ""); value = value + ": "+interval; } @@ -4145,7 +4274,7 @@ private boolean setCategorySummaryApplication(Context context, String value = StringFormatUtils.getListPreferenceString(enabledValue, R.array.applicationEnableScanningValues, R.array.applicationEnableScanningArray, context); - if (enabledValue.equals("3")) { + if ((enabledValue != null) && enabledValue.equals("3")) { String interval = preferences.getString(Profile.PREF_PROFILE_APPLICATION_ORIENTATION_SCAN_INTERVAL, ""); value = value + ": "+interval; } @@ -4180,7 +4309,7 @@ private boolean setCategorySummaryApplication(Context context, String value = StringFormatUtils.getListPreferenceString(enabledValue, R.array.applicationEnableScanningValues, R.array.applicationEnableScanningArray, context); - if (enabledValue.equals("3")) { + if ((enabledValue != null) && enabledValue.equals("3")) { String interval = preferences.getString(Profile.PREF_PROFILE_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL, ""); value = value + ": "+interval; } @@ -4262,27 +4391,29 @@ private boolean setCategorySummaryRadiosDualSIMSupport(Context context, String value = preferences.getString(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS, Profile.defaultValuesString.get(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS)); - String[] splits = value.split(StringConstants.STR_SPLIT_REGEX); String voiceStr = ""; - try { - String[] arrayStrings = context.getResources().getStringArray(R.array.defaultSIMVoiceArray); - int index = Integer.parseInt(splits[0]); - voiceStr = arrayStrings[index]; - } catch (Exception ignored) { - } String smsStr = ""; - try { - String[] arrayStrings = context.getResources().getStringArray(R.array.defaultSIMSMSArray); - int index = Integer.parseInt(splits[1]); - smsStr = arrayStrings[index]; - } catch (Exception ignored) { - } String dataStr = ""; - try { - String[] arrayStrings = context.getResources().getStringArray(R.array.defaultSIMDataArray); - int index = Integer.parseInt(splits[2]); - dataStr = arrayStrings[index]; - } catch (Exception ignored) { + if (value != null) { + String[] splits = value.split(StringConstants.STR_SPLIT_REGEX); + try { + String[] arrayStrings = context.getResources().getStringArray(R.array.defaultSIMVoiceArray); + int index = Integer.parseInt(splits[0]); + voiceStr = arrayStrings[index]; + } catch (Exception ignored) { + } + try { + String[] arrayStrings = context.getResources().getStringArray(R.array.defaultSIMSMSArray); + int index = Integer.parseInt(splits[1]); + smsStr = arrayStrings[index]; + } catch (Exception ignored) { + } + try { + String[] arrayStrings = context.getResources().getStringArray(R.array.defaultSIMDataArray); + int index = Integer.parseInt(splits[2]); + dataStr = arrayStrings[index]; + } catch (Exception ignored) { + } } _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) @@ -4525,8 +4656,9 @@ private boolean setCategorySummaryDeviceWallpaper(Context context, .append(ProfileStatic.getColorForChangedPreferenceValue(sValue, prefMng, PREF_DEVICE_WALLPAPER_CATEGORY_ROOT, context)) .append(StringConstants.TAG_BOLD_END_HTML); - if (wallpaperChangeValue.equals("1") || - wallpaperChangeValue.equals("3")) { + if ((wallpaperChangeValue != null) && + (wallpaperChangeValue.equals("1") || + wallpaperChangeValue.equals("3"))) { if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); String value = StringFormatUtils.getListPreferenceString( @@ -4541,86 +4673,348 @@ private boolean setCategorySummaryDeviceWallpaper(Context context, } else { cattegorySummaryData.bold = false; - int index = 0; - String defaultValue = Profile.defaultValuesString.get(Profile.PREF_PROFILE_DEVICE_WALLPAPER_CHANGE); - //Log.e("ProfilePrefsFragment.setCategorySummaryDeviceWallpaper", "defaultValue="+defaultValue); - String[] entryValues = getResources().getStringArray(R.array.changeWallpaperValues); - for (String v : entryValues) { - if (v.equals(defaultValue)) - break; - index++; - } - //Log.e("ProfilePrefsFragment.setCategorySummaryDeviceWallpaper", "index="+index); - String[] entries = getResources().getStringArray(R.array.changeWallpaperArray); - if (index == 0) { - _value.append(entries[index]); + int index = 0; + String defaultValue = Profile.defaultValuesString.get(Profile.PREF_PROFILE_DEVICE_WALLPAPER_CHANGE); + //Log.e("ProfilePrefsFragment.setCategorySummaryDeviceWallpaper", "defaultValue="+defaultValue); + String[] entryValues = getResources().getStringArray(R.array.changeWallpaperValues); + for (String v : entryValues) { + if (v.equals(defaultValue)) + break; + index++; + } + //Log.e("ProfilePrefsFragment.setCategorySummaryDeviceWallpaper", "index="+index); + String[] entries = getResources().getStringArray(R.array.changeWallpaperArray); + if (index == 0) { + _value.append(entries[index]); + } + } + + cattegorySummaryData.summary = _value.toString(); + cattegorySummaryData.forceSet = true; + + Profile profile = new Profile(); + profile._deviceWallpaperChange = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_DEVICE_WALLPAPER_CHANGE, "0")); + ArrayList permissions = new ArrayList<>(); + Permissions.checkProfileImageWallpaper(context, profile, permissions); + Permissions.checkProfileWallpaperFolder(context, profile, permissions); + cattegorySummaryData.permissionGranted = permissions.isEmpty(); + + cattegorySummaryData.forceSet = true; + + return false; + } + + @SuppressWarnings("SameReturnValue") + private boolean setCategorySummaryAirplaneMode(Context context, + CattegorySummaryData cattegorySummaryData) { + + StringBuilder _value = new StringBuilder(cattegorySummaryData.summary); + + String title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE, R.string.profile_preferences_deviceAirplaneMode, context); + if (!title.isEmpty()) { + cattegorySummaryData.bold = true; + //if (!summary.isEmpty()) summary = summary + " • "; + + String value = StringFormatUtils.getListPreferenceString( + preferences.getString(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE)), + R.array.onOffSIMValues, R.array.onOffSIMArray, context); + + _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(value, prefMng, PREF_PROFILE_DEVICE_RADIOS_DUAL_SIM_SUPPORT_CATEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + } else { + cattegorySummaryData.bold = false; + + int index = 0; + String defaultValue = Profile.defaultValuesString.get(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE); + String[] entryValues = getResources().getStringArray(R.array.airplaneModeValues); + for (String v : entryValues) { + if (v.equals(defaultValue)) + break; + index++; + } + String[] entries = getResources().getStringArray(R.array.airplaneModeArray); + if (index == 0) { + _value.append(entries[index]); + } + } + + cattegorySummaryData.summary = _value.toString(); + cattegorySummaryData.forceSet = true; + + Profile profile = new Profile(); + profile._deviceAirplaneMode = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE, "0")); + ArrayList permissions = new ArrayList<>(); + Permissions.checkProfileRadioPreferences(context, profile, permissions); + //Permissions.checkProfileLinkUnkinkAndSpeakerPhone(context, profile, permissions); + cattegorySummaryData.permissionGranted = permissions.isEmpty(); + + return false; + } + + @SuppressWarnings("SameReturnValue") + private boolean setCategorySummaryNotifications(Context context, + CattegorySummaryData cattegorySummaryData) { + + StringBuilder _value = new StringBuilder(cattegorySummaryData.summary); + + String title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_GENERATE_NOTIFICATION, R.string.profile_preferences_generateNotification, context); + if (!title.isEmpty()) { + cattegorySummaryData.bold = true; + if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); + + String value = preferences.getString(Profile.PREF_PROFILE_GENERATE_NOTIFICATION, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_GENERATE_NOTIFICATION)); + + //boolean generate = Profile.getGenerateNotificationChange(value); + int iconType = ProfileStatic.getGenerateNotificationIconType(value); + boolean replaceWithPPPIcon = ProfileStatic.getGenerateNotificationReplaceWithPPPIcon(value); + boolean showLargeIcon = ProfileStatic.getGenerateNotificationShowLargeIcon(value); + String notificationTitle = ProfileStatic.getGenerateNotificationTitle(value); + String notificationBody = ProfileStatic.getGenerateNotificationBody(value); + + String summaryString = ""; + + if (iconType == 0) + summaryString = summaryString + getString(R.string.preference_profile_generate_notification_information_icon) + "; "; + else if (iconType == 1) + summaryString = summaryString + getString(R.string.preference_profile_generate_notification_exclamation_icon) + "; "; + else + summaryString = summaryString + getString(R.string.preference_profile_generate_notification_profile_icon) + "; "; + + if (replaceWithPPPIcon) + summaryString = summaryString + getString(R.string.preference_profile_generate_notification_replace_with_ppp_icon) + "; "; + if (showLargeIcon) + summaryString = summaryString + getString(R.string.preference_profile_generate_notification_show_large_icon) + "; "; + + if (notificationBody.isEmpty()) + summaryString = summaryString + StringConstants.CHAR_QUOTE_HTML + notificationTitle + StringConstants.CHAR_QUOTE_HTML; + else + summaryString = summaryString + StringConstants.CHAR_QUOTE_HTML + notificationTitle + StringConstants.CHAR_QUOTE_HTML + + "; " + StringConstants.CHAR_QUOTE_HTML + notificationBody + StringConstants.CHAR_QUOTE_HTML; + + _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(summaryString, prefMng, PREF_PROFILE_OTHERS_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + } + title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED, R.string.profile_preferences_category_clear_notifications, context); + if (!title.isEmpty()) { + cattegorySummaryData.bold = true; + if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); + + if (PPNotificationListenerService.isNotificationListenerServiceEnabled(context, false)) { + //boolean applications = false; + //boolean contactGroups = false; + //boolean contacts = false; + String value = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS)); + if ((value != null) && + (!value.equals(Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS)))) { + //applications = true; + _value.append(title).append(": "); + + String[] splits = value.split(StringConstants.STR_SPLIT_REGEX); + _value.append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(context.getString(R.string.profile_preferences_clearNotification_applications_summary_text) + " " + splits.length, prefMng, PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + //noinspection DataFlowIssue + if (preferences.getBoolean(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS, + Profile.defaultValuesBoolean.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS))) { + value = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS)); + if ((value != null) && + (!value.equals(Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS)))) { + //contactGroups = true; + //if (applications) + _value.append("; "); + //else + // _value.append(title).append(": "); + + splits = value.split(StringConstants.STR_SPLIT_REGEX); + _value.append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(context.getString(R.string.profile_preferences_clearNotification_contact_groups_summary_text) + " " + splits.length, prefMng, PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + } + value = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS)); + if ((value != null) && + (!value.equals(Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS)))) { + //contacts = true; + //if (applications || contactGroups) + _value.append("; "); + //else + // _value.append(title).append(": "); + + splits = value.split(StringConstants.STR_SPLIT_REGEX); + _value.append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(context.getString(R.string.profile_preferences_clearNotification_contacts_summary_text) + " " + splits.length, prefMng, PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + } + } + //noinspection DataFlowIssue + if (preferences.getBoolean(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT, + Profile.defaultValuesBoolean.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT))) { + //if (applications || contactGroups || contacts) + _value.append("; "); + //else + // _value.append(title).append(": "); + + _value.append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(context.getString(R.string.profile_preferences_clearNotification_text_summary_text), prefMng, PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + } + } else { + value = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS)); + _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) + .append( + ProfileStatic.getColorForChangedPreferenceValue( + context.getString(R.string.profile_preferences_clearNotification_applications_summary_text) + " " + + ApplicationsMultiSelectDialogPreference.getSummaryForPreferenceCategory(value, "notifications", context, true), + prefMng, PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT, context) + ).append(StringConstants.TAG_BOLD_END_HTML); + + } + } else { + String value = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS)); + _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) + .append( + ProfileStatic.getColorForChangedPreferenceValue( + ApplicationsMultiSelectDialogPreference.getSummaryForPreferenceCategory(value, "notifications", context, true), + prefMng, PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT, context) + ).append(StringConstants.TAG_BOLD_END_HTML); } } cattegorySummaryData.summary = _value.toString(); - cattegorySummaryData.forceSet = true; Profile profile = new Profile(); - profile._deviceWallpaperChange = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_DEVICE_WALLPAPER_CHANGE, "0")); + profile._clearNotificationEnabled = preferences.getBoolean(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED, false); + profile._clearNotificationApplications = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS, ""); + profile._clearNotificationCheckContacts = preferences.getBoolean(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS, false); + profile._clearNotificationContacts = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS, ""); + profile._clearNotificationContactGroups = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS, ""); ArrayList permissions = new ArrayList<>(); - Permissions.checkProfileImageWallpaper(context, profile, permissions); - Permissions.checkProfileWallpaperFolder(context, profile, permissions); + Permissions.checkProfileClearNotifications(context, profile, permissions); cattegorySummaryData.permissionGranted = permissions.isEmpty(); - cattegorySummaryData.forceSet = true; - return false; } - @SuppressWarnings("SameReturnValue") - private boolean setCategorySummaryAirplaneMode(Context context, - CattegorySummaryData cattegorySummaryData) { + /** @noinspection SameReturnValue*/ + private boolean setCategorySummaryClearNotifications(Context context, + CattegorySummaryData cattegorySummaryData) { StringBuilder _value = new StringBuilder(cattegorySummaryData.summary); - String title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE, R.string.profile_preferences_deviceAirplaneMode, context); + String title = getCategoryTitleWhenPreferenceChanged(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED, R.string.profile_preferences_category_clear_notifications, context); if (!title.isEmpty()) { cattegorySummaryData.bold = true; - //if (!summary.isEmpty()) summary = summary + " • "; - - String value = StringFormatUtils.getListPreferenceString( - preferences.getString(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE, - Profile.defaultValuesString.get(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE)), - R.array.onOffSIMValues, R.array.onOffSIMArray, context); + if (_value.length() > 0) _value.append(StringConstants.STR_BULLET); - _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) - .append(ProfileStatic.getColorForChangedPreferenceValue(value, prefMng, PREF_PROFILE_DEVICE_RADIOS_DUAL_SIM_SUPPORT_CATEGORY_ROOT, context)) - .append(StringConstants.TAG_BOLD_END_HTML); - } else { - cattegorySummaryData.bold = false; + if (PPNotificationListenerService.isNotificationListenerServiceEnabled(context, false)) { + //boolean applications = false; + //boolean contactGroups = false; + //boolean contacts = false; + String value = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS)); + if ((value != null) && + (!value.equals(Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS)))) { + //applications = true; + _value.append(title).append(": "); + + String[] splits = value.split(StringConstants.STR_SPLIT_REGEX); + _value.append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(context.getString(R.string.profile_preferences_clearNotification_applications_summary_text) + " " + splits.length, prefMng, PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + //noinspection DataFlowIssue + if (preferences.getBoolean(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS, + Profile.defaultValuesBoolean.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS))) { + value = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS)); + if ((value != null) && + (!value.equals(Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS)))) { + //contactGroups = true; + //if (applications) + _value.append("; "); + //else + // _value.append(title).append(": "); + + splits = value.split(StringConstants.STR_SPLIT_REGEX); + _value.append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(context.getString(R.string.profile_preferences_clearNotification_contact_groups_summary_text) + " " + splits.length, prefMng, PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + } + value = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS)); + if ((value != null) && + (!value.equals(Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS)))) { + //contacts = true; + //if (applications || contactGroups) + _value.append("; "); + //else + // _value.append(title).append(": "); + + splits = value.split(StringConstants.STR_SPLIT_REGEX); + _value.append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(context.getString(R.string.profile_preferences_clearNotification_contacts_summary_text) + " " + splits.length, prefMng, PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + } + } + //noinspection DataFlowIssue + if (preferences.getBoolean(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT, + Profile.defaultValuesBoolean.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT))) { + //if (applications || contactGroups || contacts) + _value.append("; "); + //else + // _value.append(title).append(": "); + + _value.append(StringConstants.TAG_BOLD_START_HTML) + .append(ProfileStatic.getColorForChangedPreferenceValue(context.getString(R.string.profile_preferences_clearNotification_text_summary_text), prefMng, PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT, context)) + .append(StringConstants.TAG_BOLD_END_HTML); + } + } else { + value = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS)); + _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) + .append( + ProfileStatic.getColorForChangedPreferenceValue( + context.getString(R.string.profile_preferences_clearNotification_applications_summary_text) + " " + + ApplicationsMultiSelectDialogPreference.getSummaryForPreferenceCategory(value, "notifications", context, true), + prefMng, PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT, context) + ).append(StringConstants.TAG_BOLD_END_HTML); - int index = 0; - String defaultValue = Profile.defaultValuesString.get(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE); - String[] entryValues = getResources().getStringArray(R.array.airplaneModeValues); - for (String v : entryValues) { - if (v.equals(defaultValue)) - break; - index++; - } - String[] entries = getResources().getStringArray(R.array.airplaneModeArray); - if (index == 0) { - _value.append(entries[index]); + } + } else { + String value = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS)); + _value.append(title).append(": ").append(StringConstants.TAG_BOLD_START_HTML) + .append( + ProfileStatic.getColorForChangedPreferenceValue( + ApplicationsMultiSelectDialogPreference.getSummaryForPreferenceCategory(value, "notifications", context, true), + prefMng, PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT, context) + ).append(StringConstants.TAG_BOLD_END_HTML); } } cattegorySummaryData.summary = _value.toString(); - cattegorySummaryData.forceSet = true; Profile profile = new Profile(); - profile._deviceAirplaneMode = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_DEVICE_AIRPLANE_MODE, "0")); + profile._clearNotificationEnabled = preferences.getBoolean(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED, false); + profile._clearNotificationApplications = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS, ""); + profile._clearNotificationCheckContacts = preferences.getBoolean(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS, false); + profile._clearNotificationContacts = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS, ""); + profile._clearNotificationContactGroups = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS, ""); ArrayList permissions = new ArrayList<>(); - Permissions.checkProfileRadioPreferences(context, profile, permissions); - //Permissions.checkProfileLinkUnkinkAndSpeakerPhone(context, profile, permissions); + Permissions.checkProfileClearNotifications(context, profile, permissions); cattegorySummaryData.permissionGranted = permissions.isEmpty(); return false; } + private void setCategorySummary(String key, Context context) { Preference preferenceScreen = prefMng.findPreference(key); if (preferenceScreen == null) @@ -4696,6 +5090,11 @@ private void setCategorySummary(String key, Context context) { return; } + if (key.equals(PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT)) { + if (setCategorySummaryNotifications(context, cattegorySummaryData)) + return; + } + if (key.equals(PREF_PROFILE_OTHERS_CATTEGORY_ROOT)) { if (setCategorySummaryOthers(context, cattegorySummaryData)) return; @@ -4738,11 +5137,15 @@ private void setCategorySummary(String key, Context context) { return; } - if (key.equals(PREF_PROFILE_PHONE_CALLS_CATTEGORY_ROOT)) { - if (setCategorySummaryPhoneCalls(context, cattegorySummaryData)) + if (key.equals(PREF_PROFILE_SEND_SMS_CATTEGORY_ROOT)) { + if (setCategorySummarySendSMS(context, cattegorySummaryData)) return; } + if (key.equals(PREF_PROFILE_CLEAR_NOTIFICATIONS_CATTEGORY_ROOT)) { + if (setCategorySummaryClearNotifications(context, cattegorySummaryData)) + return; + } GlobalGUIRoutines.setPreferenceTitleStyleX(preferenceScreen, true, cattegorySummaryData.bold, false, false, (!cattegorySummaryData.permissionGranted) || @@ -5025,23 +5428,24 @@ private void setSummary(String key, Object value) PPListPreference listPreference = prefMng.findPreference(key); if (listPreference != null) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { boolean errorColor = false; - if ((preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && - (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && - (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && - (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED) && - (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS)) - listPreference.setEnabled(false); - else - errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + listPreference.setEnabled(false); + Preference preference = findPreference(PREF_PROFILE_DEVICE_KEYGUARD_INFO); + //noinspection DataFlowIssue + preference.setEnabled(false); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) listPreference.setSummary(getString(R.string.profile_preferences_device_not_allowed)+ ": "+ preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(listPreference, true, false, false, false, errorColor, true); } else { + //listPreference.setEnabled(true); String sValue = value.toString(); + disableDependentPrefsScreenOnOffDeviceKeyguard(Profile.PREF_PROFILE_DEVICE_KEYGUARD, sValue); + Preference preference = findPreference(PREF_PROFILE_DEVICE_KEYGUARD_INFO); + //noinspection DataFlowIssue + preference.setEnabled(true); int index = listPreference.findIndexOfValue(sValue); CharSequence summary = (index >= 0) ? listPreference.getEntries()[index] : null; listPreference.setSummary(summary); @@ -5052,7 +5456,7 @@ private void setSummary(String key, Object value) if (key.equals(Profile.PREF_PROFILE_DEVICE_SCREEN_TIMEOUT)) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { Preference preference = prefMng.findPreference(key); if (preference != null) { @@ -5065,7 +5469,7 @@ private void setSummary(String key, Object value) preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); } @@ -5132,14 +5536,14 @@ private void setSummary(String key, Object value) } else { preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_NOT_ALLOWED; } } else { preferenceAllowed = new PreferenceAllowed(); - preferenceAllowed.allowed = PreferenceAllowed.PREFERENCE_ALLOWED; + preferenceAllowed.preferenceAllowed = PreferenceAllowed.PREFERENCE_ALLOWED; } - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { Preference preference = prefMng.findPreference(key); if (preference != null) { @@ -5152,7 +5556,7 @@ private void setSummary(String key, Object value) preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed)+ ": "+ preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -5211,12 +5615,12 @@ private void setSummary(String key, Object value) key.equals(Profile.PREF_PROFILE_VIBRATION_INTENSITY_TOUCH_INTERACTION)) { PreferenceAllowed _preferenceAllowed = new PreferenceAllowed(); - PreferenceAllowed.isProfileCategoryAllowed_PREF_PROFILE_VIBRATION_INTENSITY(_preferenceAllowed, context); - if (_preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) { + _preferenceAllowed.isProfileCategoryAllowed_PREF_PROFILE_VIBRATION_INTENSITY( context); + if (_preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { String sValue = value.toString(); PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { Preference preference = prefMng.findPreference(key); if (preference != null) { @@ -5229,7 +5633,7 @@ private void setSummary(String key, Object value) preference.setEnabled(false); else errorColor = ProfileStatic.getVibrationIntensityChange(sValue); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -5267,7 +5671,7 @@ private void setSummary(String key, Object value) PPListPreference listPreference = prefMng.findPreference(key); if (listPreference != null) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { boolean errorColor = false; if ((preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && @@ -5277,7 +5681,7 @@ private void setSummary(String key, Object value) listPreference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) listPreference.setSummary(getString(R.string.profile_preferences_device_not_allowed)+ ": "+ preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(listPreference, true, false, false, false, errorColor, true); @@ -5300,12 +5704,15 @@ private void setSummary(String key, Object value) if (key.equals(Profile.PREF_PROFILE_HEADS_UP_NOTIFICATIONS) || key.equals(Profile.PREF_PROFILE_SCREEN_DARK_MODE) || key.equals(Profile.PREF_PROFILE_ALWAYS_ON_DISPLAY) || - key.equals(Profile.PREF_PROFILE_SCREEN_ON_PERMANENT)) + key.equals(Profile.PREF_PROFILE_SCREEN_ON_PERMANENT) || + key.equals(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT) || + key.equals(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS) || + key.equals(Profile.PREF_PROFILE_SCREEN_ON_OFF)) { PPListPreference listPreference = prefMng.findPreference(key); if (listPreference != null) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { boolean errorColor = false; if ((preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && @@ -5315,7 +5722,7 @@ private void setSummary(String key, Object value) listPreference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) listPreference.setSummary(getString(R.string.profile_preferences_device_not_allowed)+ ": "+ preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(listPreference, true, false, false, false, errorColor, true); @@ -5328,13 +5735,19 @@ private void setSummary(String key, Object value) boolean _permissionGranted = true; if (key.equals(Profile.PREF_PROFILE_SCREEN_ON_PERMANENT) || - key.equals(Profile.PREF_PROFILE_ALWAYS_ON_DISPLAY)) { + key.equals(Profile.PREF_PROFILE_ALWAYS_ON_DISPLAY) || + key.equals(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT) || + key.equals(Profile.PREF_PROFILE_SCREEN_ON_OFF)) { Profile profile = new Profile(); ArrayList permissions = new ArrayList<>(); profile._screenOnPermanent = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_SCREEN_ON_PERMANENT, "0")); profile._alwaysOnDisplay = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_ALWAYS_ON_DISPLAY, "0")); + profile._screenNightLight = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT, "0")); + profile._screenOnOff = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_SCREEN_ON_OFF, "0")); Permissions.checkProfileScreenOnPermanent(context, profile, permissions); Permissions.checkProfileAlwaysOnDisplay(context, profile, permissions); + Permissions.checkProfileScreenNightLight(context, profile, permissions); + Permissions.checkProfileScreenOnOff(context, profile, permissions); _permissionGranted = permissions.isEmpty(); } @@ -5406,7 +5819,7 @@ private void setSummary(String key, Object value) PPListPreference listPreference = prefMng.findPreference(key); if (listPreference != null) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { boolean enabled = true; boolean errorColor = false; if ((preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && @@ -5419,7 +5832,7 @@ private void setSummary(String key, Object value) } else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) listPreference.setSummary(getString(R.string.profile_preferences_device_not_allowed)+ ": "+ preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(listPreference, true, false, false, false, errorColor, true); @@ -5791,7 +6204,7 @@ private void setSummary(String key, Object value) if (key.equals(Profile.PREF_PROFILE_CAMERA_FLASH)) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { Preference preference = prefMng.findPreference(key); if (preference != null) { @@ -5804,7 +6217,7 @@ private void setSummary(String key, Object value) preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed)+ ": "+ preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -5864,25 +6277,7 @@ private void setSummary(String key, Object value) GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, change, false, false, false, false); } } - if (key.equals(PREF_PROFILE_PHONE_CALLS_SET_CALL_SCREENING_ROLE)) { - if (Build.VERSION.SDK_INT >= 29) { - String summary = getString(R.string.profile_preferences_phoneCalls_setCallScreeningRole_summary); - Preference preference = prefMng.findPreference(key); - if (preference != null) { - RoleManager roleManager = (RoleManager) context.getSystemService(ROLE_SERVICE); - boolean isHeld = roleManager.isRoleHeld(ROLE_CALL_SCREENING); - if (isHeld) { - summary = getString(R.string.profile_preferences_phoneCalls_setCallScreeningRole_summary_ststus_1) + - StringConstants.STR_DOUBLE_NEWLINE + summary; - } else { - summary = getString(R.string.profile_preferences_phoneCalls_setCallScreeningRole_summary_ststus_0) + - StringConstants.STR_DOUBLE_NEWLINE + summary; - } - preference.setSummary(summary); - } - } - } - if (key.equals(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE)) { + /*if (key.equals(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE)) { PPListPreference listPreference = prefMng.findPreference(key); if (listPreference != null) { String sValue = value.toString(); @@ -5890,8 +6285,8 @@ private void setSummary(String key, Object value) CharSequence summary = (index >= 0) ? listPreference.getEntries()[index] : null; listPreference.setSummary(summary); } - } - if (key.equals(Profile.PREF_PROFILE_PHONE_CALLS_SMS_TEXT)) { + }*/ + if (key.equals(Profile.PREF_PROFILE_SEND_SMS_SMS_TEXT)) { Preference preference = prefMng.findPreference(key); if (preference != null) { String sValue = value.toString(); @@ -5899,6 +6294,90 @@ private void setSummary(String key, Object value) } } + if (key.equals(PREF_NOTIFICATION_ACCESS_SYSTEM_SETTINGS)) { + Preference preference = prefMng.findPreference(key); + if (preference != null) { + String summary = getString(R.string.profile_preferences_clearNotificationsAccessSettings_summary); + if (!PPNotificationListenerService.isNotificationListenerServiceEnabled(context, true)) { + summary = "* " + getString(R.string.phone_profiles_pref_applicationEventScanningNotificationAccessSettingsDisabled_summary) + "! *" + StringConstants.STR_DOUBLE_NEWLINE + + summary; + } else { + summary = getString(R.string.phone_profiles_pref_applicationEventScanningNotificationAccessSettingsEnabled_summary) + StringConstants.STR_DOUBLE_NEWLINE_WITH_DOT + + summary; + } + preference.setSummary(summary); + } + } + if (key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS)) { + //boolean isEnabled = preferences.getBoolean(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED, false); + //boolean listenerEnabled = PPNotificationListenerService.isNotificationListenerServiceEnabled(context, false); + ApplicationsMultiSelectDialogPreference appPreference = + prefMng.findPreference(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS); + if (appPreference != null) { + appPreference.setSummaryAMSDP(); + } + } + if (key.equals(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT)) + { + PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) + { + Preference preference = prefMng.findPreference(key); + if (preference != null) { + boolean errorColor = false; + if ((preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && + (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && + (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) && + (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED) && + (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS)) + preference.setEnabled(false); + else + errorColor = !value.toString().equals("0"); + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + preference.setSummary(getString(R.string.profile_preferences_device_not_allowed)+ + ": "+ preferenceAllowed.getNotAllowedPreferenceReasonString(context)); + GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); + } + } else { + String sValue = value.toString(); + PPListPreference listPreference = prefMng.findPreference(key); + if (listPreference != null) { + int index = listPreference.findIndexOfValue(sValue); + CharSequence summary = (index >= 0) ? listPreference.getEntries()[index] : null; + listPreference.setSummary(summary); + + Profile profile = new Profile(); + ArrayList permissions = new ArrayList<>(); + profile._screenNightLight = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT, "0")); + Permissions.checkProfileCameraFlash(context, profile, permissions); + boolean _permissionGranted = permissions.isEmpty(); + + GlobalGUIRoutines.setPreferenceTitleStyleX(listPreference, true, index > 0, false, false, !_permissionGranted, false); + } + } + } + if (key.equals(Profile.PREF_PROFILE_DEVICE_CLOSE_ALL_APPLICATIONS) || + key.equals(Profile.PREF_PROFILE_DEVICE_RUN_APPLICATION_CHANGE)) + { + String sValue = value.toString(); + PPListPreference listPreference = prefMng.findPreference(key); + if (listPreference != null) { + int index = listPreference.findIndexOfValue(sValue); + CharSequence summary = (index >= 0) ? listPreference.getEntries()[index] : null; + listPreference.setSummary(summary); + + Profile profile = new Profile(); + ArrayList permissions = new ArrayList<>(); + profile._deviceCloseAllApplications = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_DEVICE_CLOSE_ALL_APPLICATIONS, "0")); + profile._deviceRunApplicationChange = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_DEVICE_RUN_APPLICATION_CHANGE, "0")); + Permissions.checkProfileCloseAllApplications(context, profile, permissions); + Permissions.checkProfileRunApplications(context, profile, permissions); + boolean _permissionGranted = permissions.isEmpty(); + + GlobalGUIRoutines.setPreferenceTitleStyleX(listPreference, true, index > 0, false, false, !_permissionGranted, false); + } + } + } private void setSummaryTones(String key, Object value, Context context, int phoneCount) { @@ -5942,7 +6421,7 @@ private void setSummaryTones(String key, Object value, Context context, int phon if (key.equals(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1) || key.equals(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2)) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { Preference preference = prefMng.findPreference(key); if (preference != null) { boolean errorColor = false; @@ -5954,7 +6433,7 @@ private void setSummaryTones(String key, Object value, Context context, int phon preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -5970,7 +6449,7 @@ private void setSummaryTones(String key, Object value, Context context, int phon preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -5987,7 +6466,7 @@ private void setSummaryTones(String key, Object value, Context context, int phon preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -6018,7 +6497,7 @@ private void setSummaryTones(String key, Object value, Context context, int phon if (key.equals(Profile.PREF_PROFILE_SOUND_SAME_RINGTONE_FOR_BOTH_SIM_CARDS)) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { Preference preference = prefMng.findPreference(key); if (preference != null) { boolean errorColor = false; @@ -6030,7 +6509,7 @@ private void setSummaryTones(String key, Object value, Context context, int phon preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -6051,7 +6530,7 @@ private void setSummaryTones(String key, Object value, Context context, int phon if (key.equals(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM1) || key.equals(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2)) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { Preference preference = prefMng.findPreference(key); if (preference != null) { boolean errorColor = false; @@ -6063,7 +6542,7 @@ private void setSummaryTones(String key, Object value, Context context, int phon preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -6079,7 +6558,7 @@ private void setSummaryTones(String key, Object value, Context context, int phon preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -6096,7 +6575,7 @@ private void setSummaryTones(String key, Object value, Context context, int phon preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -6147,7 +6626,7 @@ private void setSummaryRadios(String key, Object value, Context context, int pho key.equals(Profile.PREF_PROFILE_DEVICE_VPN_SETTINGS_PREFS)) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { // if (key.equals(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE)) // Log.e("ProfilesPrefsFragment.setSummaryRadios", "network type not allowed"); @@ -6162,7 +6641,7 @@ private void setSummaryRadios(String key, Object value, Context context, int pho preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) { preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); } @@ -6205,7 +6684,7 @@ private void setSummaryRadios(String key, Object value, Context context, int pho PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); Preference preference = prefMng.findPreference(key); if (preference != null) { - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { boolean errorColor; // = false; /*if ((preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && @@ -6259,7 +6738,7 @@ private void setSummaryRadios(String key, Object value, Context context, int pho PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); Preference preference = prefMng.findPreference(key); if (preference != null) { - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { boolean errorColor = false; if ((preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && @@ -6269,7 +6748,7 @@ private void setSummaryRadios(String key, Object value, Context context, int pho preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -6293,7 +6772,7 @@ private void setSummaryRadios(String key, Object value, Context context, int pho PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); Preference preference = prefMng.findPreference(key); if (preference != null) { - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { boolean errorColor = false; if ((preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) && (preferenceAllowed.notAllowedReason != PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) && @@ -6303,7 +6782,7 @@ private void setSummaryRadios(String key, Object value, Context context, int pho preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -6316,6 +6795,7 @@ private void setSummaryRadios(String key, Object value, Context context, int pho Profile profile = new Profile(); ArrayList permissions = new ArrayList<>(); profile._deviceVPN = preferences.getString(Profile.PREF_PROFILE_DEVICE_VPN, "0|0|||0"); + Permissions.checkProfileVPN(context, profile, permissions); Permissions.checkProfileWireGuard(context, profile, permissions); boolean _permissionGranted = permissions.isEmpty(); @@ -6372,7 +6852,7 @@ private void setSummaryRadios(String key, Object value, Context context, int pho if (key.equals(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM1) || key.equals(Profile.PREF_PROFILE_DEVICE_NETWORK_TYPE_SIM2)) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { Preference preference = prefMng.findPreference(key); if (preference != null) { boolean errorColor = false; @@ -6384,7 +6864,7 @@ private void setSummaryRadios(String key, Object value, Context context, int pho preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -6413,7 +6893,7 @@ private void setSummaryRadios(String key, Object value, Context context, int pho } if (key.equals(Profile.PREF_PROFILE_DEVICE_DEFAULT_SIM_CARDS)) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { Preference preference = prefMng.findPreference(key); if (preference != null) { boolean errorColor = false; @@ -6425,7 +6905,7 @@ private void setSummaryRadios(String key, Object value, Context context, int pho preference.setEnabled(false); else errorColor = !value.toString().equals("0|0|0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -6454,7 +6934,7 @@ private void setSummaryRadios(String key, Object value, Context context, int pho if (key.equals(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM1) || key.equals(Profile.PREF_PROFILE_DEVICE_ONOFF_SIM2)) { PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { Preference preference = prefMng.findPreference(key); if (preference != null) { boolean errorColor = false; @@ -6466,7 +6946,7 @@ private void setSummaryRadios(String key, Object value, Context context, int pho preference.setEnabled(false); else errorColor = !value.toString().equals("0"); - if (preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) + if (preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_NOT_ALLOWED) preference.setSummary(getString(R.string.profile_preferences_device_not_allowed) + ": " + preferenceAllowed.getNotAllowedPreferenceReasonString(context)); GlobalGUIRoutines.setPreferenceTitleStyleX(preference, true, false, false, false, errorColor, true); @@ -6505,8 +6985,10 @@ private void setSummary(String key) { key.equals(Profile.PREF_PROFILE_DURATION_NOTIFICATION_VIBRATE) || key.equals(Profile.PREF_PROFILE_HIDE_STATUS_BAR_ICON) || key.equals(Profile.PREF_PROFILE_VOLUME_MUTE_SOUND) || - key.equals(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS) || - key.equals(Profile.PREF_PROFILE_PHONE_CALLS_SEND_SMS)) { + key.equals(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT)) { boolean b = preferences.getBoolean(key, false); value = Boolean.toString(b); setSummary(key, value); @@ -6549,9 +7031,8 @@ private void updateAllSummary() { disableDependedPref(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM2); disableDependedPref(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE_SIM2); disableDependedPref(Profile.PREF_PROFILE_LOCK_DEVICE); - disableDependedPref(PREF_PROFILE_PHONE_CALLS_SET_CALL_SCREENING_ROLE); - //disableDependedPref(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS); - //disableDependedPref(Profile.PREF_PROFILE_PHONE_CALLS_SEND_SMS); + disableDependedPref(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS); + disableDependedPref(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED); //if (startupSource != PPApplication.PREFERENCES_STARTUP_SOURCE_SHARED_PROFILE) //{ @@ -6670,13 +7151,22 @@ private void updateAllSummary() { setSummary(Profile.PREF_PROFILE_APPLICATION_LOCATION_UPDATE_INTERVAL); setSummary(Profile.PREF_PROFILE_APPLICATION_ORIENTATION_SCAN_INTERVAL); setSummary(Profile.PREF_PROFILE_APPLICATION_PERIODIC_SCANNING_SCAN_INTERVAL); - setSummary(PREF_PROFILE_PHONE_CALLS_SET_CALL_SCREENING_ROLE); - setSummary(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS); - setSummary(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS); - setSummary(Profile.PREF_PROFILE_PHONE_CALLS_CONTACTS); - setSummary(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE); - setSummary(Profile.PREF_PROFILE_PHONE_CALLS_SEND_SMS); - setSummary(Profile.PREF_PROFILE_PHONE_CALLS_SMS_TEXT); + setSummary(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS); + setSummary(Profile.PREF_PROFILE_SEND_SMS_CONTACTS); + //setSummary(Profile.PREF_PROFILE_SEND_SMS_CONTACT_LIST_TYPE); + setSummary(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS); + setSummary(Profile.PREF_PROFILE_SEND_SMS_SMS_TEXT); + setSummary(PREF_NOTIFICATION_ACCESS_SYSTEM_SETTINGS); + setSummary(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED); + setSummary(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS); + setSummary(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS); + setSummary(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS); + setSummary(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS); + setSummary(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT); + setSummary(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_TEXT); + setSummary(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT); + setSummary(Profile.PREF_PROFILE_SCREEN_NIGHT_LIGHT_PREFS); + setSummary(Profile.PREF_PROFILE_SCREEN_ON_OFF); setCategorySummary(PREF_PROFILE_ACTIVATION_DURATION_CATTEGORY_ROOT, context); setCategorySummary(PREF_PROFILE_SOUND_PROFILE_CATTEGORY_ROOT, context); @@ -6687,6 +7177,7 @@ private void updateAllSummary() { setCategorySummary(PREF_PROFILE_RADIOS_CATTEGORY_ROOT, context); setCategorySummary(PREF_PROFILE_SCREEN_CATTEGORY_ROOT, context); setCategorySummary(PREF_PROFILE_LED_ACCESSORIES_CATTEGORY_ROOT, context); + setCategorySummary(PREF_PROFILE_NOTIFICATIONS_CATTEGORY_ROOT, context); setCategorySummary(PREF_PROFILE_OTHERS_CATTEGORY_ROOT, context); setCategorySummary(PREF_PROFILE_APPLICATION_CATTEGORY_ROOT, context); setCategorySummary(PREF_FORCE_STOP_APPLICATIONS_CATEGORY_ROOT, context); @@ -6695,7 +7186,8 @@ private void updateAllSummary() { setCategorySummary(PREF_PROFILE_SOUNDS_DUAL_SIM_SUPPORT_CATEGORY_ROOT, context); setCategorySummary(PREF_DEVICE_WALLPAPER_CATEGORY_ROOT, context); setCategorySummary(PREF_PROFILE_DEVICE_AIRPLANE_MODE_CATEGORY_ROOT, context); - setCategorySummary(PREF_PROFILE_PHONE_CALLS_CATTEGORY_ROOT, context); + setCategorySummary(PREF_PROFILE_SEND_SMS_CATTEGORY_ROOT, context); + setCategorySummary(PREF_PROFILE_CLEAR_NOTIFICATIONS_CATTEGORY_ROOT, context); } private boolean getEnableVolumeNotificationByRingtone(String ringtoneValue) { @@ -6714,8 +7206,47 @@ private boolean getEnableVolumeNotificationVolume0(boolean notificationEnabled, ProfileStatic.getVolumeChange(notificationValue) && (ProfileStatic.getVolumeValue(notificationValue) == 0); } - private void disableDependedPref(String key, Object value) - { + private void disableDependentPrefsScreenOnOffDeviceKeyguard(String key, String value) { + if (getActivity() == null) + return; + Context context = getActivity().getApplicationContext(); + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_KEYGUARD, null, preferences, true, context).preferenceAllowed + != PreferenceAllowed.PREFERENCE_ALLOWED) { + Preference preference = findPreference(Profile.PREF_PROFILE_DEVICE_KEYGUARD); + if (preference != null) + preference.setEnabled(false); + } + if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_SCREEN_ON_OFF, null, preferences, true, context).preferenceAllowed + != PreferenceAllowed.PREFERENCE_ALLOWED) { + Preference preference = findPreference(Profile.PREF_PROFILE_SCREEN_ON_OFF); + if (preference != null) + preference.setEnabled(false); + } + + String screenOnOffValue = preferences.getString(Profile.PREF_PROFILE_SCREEN_ON_OFF, ""); + String deviceKeyguardValue = preferences.getString(Profile.PREF_PROFILE_DEVICE_KEYGUARD, ""); + if ((!screenOnOffValue.equals("0")) && (!deviceKeyguardValue.equals("0"))) { + // if both are configured, force disable devcieKeyguard + Preference preference = findPreference(Profile.PREF_PROFILE_DEVICE_KEYGUARD); + if (preference != null) + preference.setEnabled(false); + } else { + if (key.equals(Profile.PREF_PROFILE_SCREEN_ON_OFF)) { + //value = sharedPreferences.getString(Profile.PREF_PROFILE_SCREEN_ON_OFF, "0"); + Preference preference = findPreference(Profile.PREF_PROFILE_DEVICE_KEYGUARD); + if (preference != null) + preference.setEnabled(value.equals("0")); + } + if (key.equals(Profile.PREF_PROFILE_DEVICE_KEYGUARD)) { + //value = sharedPreferences.getString(Profile.PREF_PROFILE_DEVICE_KEYGUARD, "0"); + Preference preference = findPreference(Profile.PREF_PROFILE_SCREEN_ON_OFF); + if (preference != null) + preference.setEnabled(value.equals("0")); + } + } + } + + private void disableDependedPref(String key, Object value) { if (getActivity() == null) return; @@ -6751,8 +7282,7 @@ private void disableDependedPref(String key, Object value) preference = prefMng.findPreference(PREF_PROFILE_VOLUME_SOUND_MODE_INFO); if (preference != null) preference.setEnabled(enabled); - } - else { + } else { Preference preference = prefMng.findPreference(Profile.PREF_PROFILE_VOLUME_RINGTONE); if (preference != null) preference.setEnabled(false); @@ -6786,29 +7316,25 @@ private void disableDependedPref(String key, Object value) if (_preference != null) _preference.setEnabled(!enabledMuteSound); - if (key.equals(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE)) - { + if (key.equals(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE)) { boolean enabled = !(/*sValue.equals(Profile.SHARED_PROFILE_VALUE_STR) ||*/ sValue.equals(Profile.NO_CHANGE_VALUE_STR)); Preference preference = prefMng.findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE); if (preference != null) preference.setEnabled(enabled); } - if (key.equals(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE)) - { + if (key.equals(Profile.PREF_PROFILE_SOUND_NOTIFICATION_CHANGE)) { boolean enabled = !(/*sValue.equals(Profile.SHARED_PROFILE_VALUE_STR) ||*/ sValue.equals(Profile.NO_CHANGE_VALUE_STR)); Preference preference = prefMng.findPreference(Profile.PREF_PROFILE_SOUND_NOTIFICATION); if (preference != null) preference.setEnabled(enabled); } - if (key.equals(Profile.PREF_PROFILE_SOUND_ALARM_CHANGE)) - { + if (key.equals(Profile.PREF_PROFILE_SOUND_ALARM_CHANGE)) { boolean enabled = !(/*sValue.equals(Profile.SHARED_PROFILE_VALUE_STR) ||*/ sValue.equals(Profile.NO_CHANGE_VALUE_STR)); Preference preference = prefMng.findPreference(Profile.PREF_PROFILE_SOUND_ALARM); if (preference != null) preference.setEnabled(enabled); } - if (key.equals(Profile.PREF_PROFILE_DEVICE_WALLPAPER_CHANGE)) - { + if (key.equals(Profile.PREF_PROFILE_DEVICE_WALLPAPER_CHANGE)) { boolean enabled = !(/*sValue.equals(Profile.SHARED_PROFILE_VALUE_STR) ||*/ sValue.equals(Profile.NO_CHANGE_VALUE_STR)); Preference preference = prefMng.findPreference(Profile.PREF_PROFILE_DEVICE_WALLPAPER); if (preference != null) @@ -6829,8 +7355,7 @@ private void disableDependedPref(String key, Object value) if (preference != null) preference.setEnabled(enabled && sValue.equals("3")); } - if (key.equals(Profile.PREF_PROFILE_DEVICE_RUN_APPLICATION_CHANGE)) - { + if (key.equals(Profile.PREF_PROFILE_DEVICE_RUN_APPLICATION_CHANGE)) { boolean enabled = !(/*sValue.equals(Profile.SHARED_PROFILE_VALUE_STR) ||*/ sValue.equals(Profile.NO_CHANGE_VALUE_STR)); Preference preference = prefMng.findPreference(Profile.PREF_PROFILE_DEVICE_RUN_APPLICATION_PACKAGE_NAME); if (preference != null) @@ -6840,19 +7365,19 @@ private void disableDependedPref(String key, Object value) preference.setEnabled(enabled); } //if (Build.VERSION.SDK_INT < 30) { - if (key.equals(Profile.PREF_PROFILE_DEVICE_WIFI_AP)) { - PPListPreference preference = prefMng.findPreference(Profile.PREF_PROFILE_DEVICE_WIFI); - if (preference != null) { - PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); - if (preferenceAllowed.allowed != PreferenceAllowed.PREFERENCE_ALLOWED) { - int iValue = Integer.parseInt(sValue); - if (iValue > 0) - preference.setValue(Profile.NO_CHANGE_VALUE_STR); - preference.setEnabled(false); - } else - preference.setEnabled(true); - } + if (key.equals(Profile.PREF_PROFILE_DEVICE_WIFI_AP)) { + PPListPreference preference = prefMng.findPreference(Profile.PREF_PROFILE_DEVICE_WIFI); + if (preference != null) { + PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(key, null, preferences, true, context); + if (preferenceAllowed.preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { + int iValue = Integer.parseInt(sValue); + if (iValue > 0) + preference.setValue(Profile.NO_CHANGE_VALUE_STR); + preference.setEnabled(false); + } else + preference.setEnabled(true); } + } //} if (key.equals(Profile.PREF_PROFILE_VOLUME_RINGER_MODE) || key.equals(Profile.PREF_PROFILE_VOLUME_ZEN_MODE)) { @@ -6861,12 +7386,12 @@ private void disableDependedPref(String key, Object value) boolean enabled = false; PreferenceAllowed preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATE_WHEN_RINGING, null, preferences, true, context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || ((preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || - (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || - (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || - (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED)|| - (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))) { + (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || + (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || + (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED) || + (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))) { if (ringerMode.equals("1") || ringerMode.equals("4")) enabled = true; if (ringerMode.equals("5")) { @@ -6884,12 +7409,12 @@ private void disableDependedPref(String key, Object value) if ((Build.VERSION.SDK_INT >= 28) && (Build.VERSION.SDK_INT < 33)) { enabled = false; preferenceAllowed = ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_VIBRATE_NOTIFICATIONS, null, preferences, true, context); - if ((preferenceAllowed.allowed == PreferenceAllowed.PREFERENCE_ALLOWED) || + if ((preferenceAllowed.preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) || ((preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_GRANTED_G1_PERMISSION) || - (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || - (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED)|| - (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED) || - (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))) { + (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOTED) || + (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_ROOT_GRANTED) || + (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_SHIZUKU_NOT_GRANTED) || + (preferenceAllowed.notAllowedReason == PreferenceAllowed.PREFERENCE_NOT_ALLOWED_NOT_INSTALLED_PPPPS))) { if (ringerMode.equals("1") || ringerMode.equals("4")) enabled = true; if (ringerMode.equals("5")) { @@ -6942,9 +7467,9 @@ private void disableDependedPref(String key, Object value) } if (key.equals(Profile.PREF_PROFILE_DURATION) || - key.equals(Profile.PREF_PROFILE_AFTER_DURATION_DO) || - key.equals(Profile.PREF_PROFILE_ASK_FOR_DURATION) || - key.equals(Profile.PREF_PROFILE_END_OF_ACTIVATION_TYPE)) { + key.equals(Profile.PREF_PROFILE_AFTER_DURATION_DO) || + key.equals(Profile.PREF_PROFILE_ASK_FOR_DURATION) || + key.equals(Profile.PREF_PROFILE_END_OF_ACTIVATION_TYPE)) { String sEndOfActivationType = preferences.getString(Profile.PREF_PROFILE_END_OF_ACTIVATION_TYPE, Profile.defaultValuesString.get(Profile.PREF_PROFILE_END_OF_ACTIVATION_TYPE)); int endOfActivationType = Integer.parseInt(sEndOfActivationType); @@ -6973,15 +7498,15 @@ private void disableDependedPref(String key, Object value) String afterDurationDo = preferences.getString(Profile.PREF_PROFILE_AFTER_DURATION_DO, "0"); int afterDurationDoValue = Integer.parseInt(afterDurationDo); preference.setEnabled(enable && - ((afterDurationDoValue == Profile.AFTER_DURATION_DO_SPECIFIC_PROFILE) || - (afterDurationDoValue == Profile.AFTER_DURATION_DO_SPECIFIC_PROFILE_THEN_RESTART_EVENTS))); + ((afterDurationDoValue == Profile.AFTER_DURATION_DO_SPECIFIC_PROFILE) || + (afterDurationDoValue == Profile.AFTER_DURATION_DO_SPECIFIC_PROFILE_THEN_RESTART_EVENTS))); } } if (((PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) || - (PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) || - (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) || - (PPApplication.deviceIsOnePlus))) { + (PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) || + (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) || + (PPApplication.deviceIsOnePlus))) { if (key.equals(Profile.PREF_PROFILE_SOUND_RINGTONE_CHANGE_SIM1)) { boolean enabled = !(/*sValue.equals(Profile.SHARED_PROFILE_VALUE_STR) ||*/ sValue.equals(Profile.NO_CHANGE_VALUE_STR)); Preference preference = prefMng.findPreference(Profile.PREF_PROFILE_SOUND_RINGTONE_SIM1); @@ -7020,55 +7545,75 @@ private void disableDependedPref(String key, Object value) } */ - if (key.equals(PREF_PROFILE_PHONE_CALLS_SET_CALL_SCREENING_ROLE) || - key.equals(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS) || - key.equals(Profile.PREF_PROFILE_PHONE_CALLS_CONTACTS) || - key.equals(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS) || - key.equals(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE) || - key.equals(Profile.PREF_PROFILE_PHONE_CALLS_SEND_SMS)) { - if (Build.VERSION.SDK_INT >= 29) { - RoleManager roleManager = (RoleManager) context.getSystemService(ROLE_SERVICE); - boolean isHeld = roleManager.isRoleHeld(ROLE_CALL_SCREENING); - Preference preference = prefMng.findPreference(PREF_PROFILE_PHONE_CALLS_SET_CALL_SCREENING_ROLE); - if (preference != null) - preference.setEnabled(!isHeld); - - - int phoneCallsContactListType = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE, - Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE))); - String contactGroupsValue = preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS, - Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS)); - String contactsValue = preferences.getString(Profile.PREF_PROFILE_PHONE_CALLS_CONTACTS, - Profile.defaultValuesString.get(Profile.PREF_PROFILE_PHONE_CALLS_CONTACTS)); - - boolean contactsConfigured = - (phoneCallsContactListType == EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) || - ((contactGroupsValue != null) && (!contactGroupsValue.isEmpty())) || - ((contactsValue != null) && (!contactsValue.isEmpty())); + if (key.equals(Profile.PREF_PROFILE_SEND_SMS_CONTACTS) || + key.equals(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS) || + //key.equals(Profile.PREF_PROFILE_SEND_SMS_CONTACT_LIST_TYPE) || + key.equals(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS)) { + //int phoneCallsContactListType = Integer.parseInt(preferences.getString(Profile.PREF_PROFILE_SEND_SMS_CONTACT_LIST_TYPE, + // Profile.defaultValuesString.get(Profile.PREF_PROFILE_SEND_SMS_CONTACT_LIST_TYPE))); + String contactGroupsValue = preferences.getString(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS)); + String contactsValue = preferences.getString(Profile.PREF_PROFILE_SEND_SMS_CONTACTS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_SEND_SMS_CONTACTS)); + + boolean contactsConfigured = + /*(phoneCallsContactListType == EventPreferencesCall.CONTACT_LIST_TYPE_NOT_USE) ||*/ + ((contactGroupsValue != null) && (!contactGroupsValue.isEmpty())) || + ((contactsValue != null) && (!contactsValue.isEmpty())); + + //Preference preference = prefMng.findPreference(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS); + //if (preference != null) + // preference.setEnabled(isHeld); + //preference = prefMng.findPreference(Profile.PREF_PROFILE_SEND_SMS_CONTACTS); + //if (preference != null) + // preference.setEnabled(isHeld); + //preference = prefMng.findPreference(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE); + //if (preference != null) + // preference.setEnabled(isHeld); + + Preference preference = prefMng.findPreference(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS); + if (preference != null) + preference.setEnabled(contactsConfigured); + preference = prefMng.findPreference(Profile.PREF_PROFILE_SEND_SMS_SMS_TEXT); + if (preference != null) + preference.setEnabled(contactsConfigured); + } + + if (key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED) || + key.equals(PREF_NOTIFICATION_ACCESS_SYSTEM_SETTINGS) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_TEXT)) { + + boolean listenerEnabled = PPNotificationListenerService.isNotificationListenerServiceEnabled(context, false); + //noinspection DataFlowIssue + boolean clearEnabled = preferences.getBoolean(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED, + Profile.defaultValuesBoolean.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED)); + String applicationsSetValue = preferences.getString(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS, + Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS)); + boolean applicationsSet = (applicationsSetValue != null) && + (!applicationsSetValue.equals(Profile.defaultValuesString.get(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS))); + + Preference preference = prefMng.findPreference(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS); + if (preference != null) + preference.setEnabled(listenerEnabled); - preference = prefMng.findPreference(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_GROUPS); - if (preference != null) - preference.setEnabled(isHeld); - preference = prefMng.findPreference(Profile.PREF_PROFILE_PHONE_CALLS_CONTACTS); - if (preference != null) - preference.setEnabled(isHeld); - preference = prefMng.findPreference(Profile.PREF_PROFILE_PHONE_CALLS_CONTACT_LIST_TYPE); - if (preference != null) - preference.setEnabled(isHeld); + preference = prefMng.findPreference(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED); + if (preference != null) + preference.setEnabled(listenerEnabled && applicationsSet); - boolean blockCalls = preferences.getBoolean(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS, false); - preference = prefMng.findPreference(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS); - if (preference != null) - preference.setEnabled(isHeld && contactsConfigured); - preference = prefMng.findPreference(Profile.PREF_PROFILE_PHONE_CALLS_SEND_SMS); - if (preference != null) - preference.setEnabled(isHeld && contactsConfigured && blockCalls); - preference = prefMng.findPreference(Profile.PREF_PROFILE_PHONE_CALLS_SMS_TEXT); - if (preference != null) - preference.setEnabled(isHeld && contactsConfigured && blockCalls); - } + preference = prefMng.findPreference(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS); + if (preference != null) + preference.setEnabled(listenerEnabled && clearEnabled && applicationsSet); + preference = prefMng.findPreference(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT); + if (preference != null) + preference.setEnabled(listenerEnabled && clearEnabled && applicationsSet); } + disableDependentPrefsScreenOnOffDeviceKeyguard(key, sValue); } private void disableDependedPref(String key) { @@ -7076,13 +7621,27 @@ private void disableDependedPref(String key) { if (key.equals(Profile.PREF_PROFILE_SHOW_IN_ACTIVATOR) || key.equals(Profile.PREF_PROFILE_ASK_FOR_DURATION) || key.equals(Profile.PREF_PROFILE_VOLUME_MUTE_SOUND) || - key.equals(Profile.PREF_PROFILE_PHONE_CALLS_BLOCK_CALLS) || - key.equals(Profile.PREF_PROFILE_PHONE_CALLS_SEND_SMS)) { + key.equals(Profile.PREF_PROFILE_SEND_SMS_SEND_SMS) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_ENABLED) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_CONTACTS) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CHECK_TEXT)) { boolean b = preferences.getBoolean(key, false); value = Boolean.toString(b); } else value = preferences.getString(key, ""); + + /* + if (key.equals(Profile.PREF_PROFILE_SEND_SMS_CONTACTS) || + key.equals(Profile.PREF_PROFILE_SEND_SMS_CONTACT_GROUPS) || + key.equals(PREF_NOTIFICATION_ACCESS_SYSTEM_SETTINGS) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_APPLICATIONS) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACTS) || + key.equals(Profile.PREF_PROFILE_CLEAR_NOTIFICATION_CONTACT_GROUPS)) { + value = preferences.getString(key, ""); + } + */ + disableDependedPref(key, value); } @@ -7131,6 +7690,7 @@ private void enableNotificationPolicyAccess( true, true, false, false, true, + false, getActivity() ); @@ -7165,6 +7725,7 @@ private void enableNotificationPolicyAccess( true, true, false, false, true, + false, getActivity() ); @@ -7407,6 +7968,7 @@ private void configureAssistant() { true, true, false, false, true, + false, getActivity() ); @@ -7544,7 +8106,8 @@ private void fillDeviceNetworkTypePreference(String key, Context context) { } if (subscriptionId != -1) { - telephonyManager = telephonyManager.createForSubscriptionId(subscriptionId); + if (telephonyManager != null) + telephonyManager = telephonyManager.createForSubscriptionId(subscriptionId); } } @@ -7918,7 +8481,7 @@ protected void onPostExecute(Void result) { String rootScreen = PPApplication.PREF_ROOT_SCREEN; - int errorColor = ContextCompat.getColor(context, R.color.error_color); + int errorColor = ContextCompat.getColor(context, R.color.errorColor); boolean hidePreferences = false; int order = 1; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsNotifications.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsNotifications.java new file mode 100644 index 0000000000..ac98c969a4 --- /dev/null +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsNotifications.java @@ -0,0 +1,12 @@ +package sk.henrichg.phoneprofilesplus; + +import android.os.Bundle; + +public class ProfilesPrefsNotifications extends ProfilesPrefsFragment { + + @Override + public void onCreatePreferences(Bundle bundle, String rootKey) { + setPreferencesFromResource(R.xml.profile_prefs_notifications, rootKey); + } + +} diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsPhoneCalls.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsSendSMS.java similarity index 52% rename from phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsPhoneCalls.java rename to phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsSendSMS.java index ccbbab3dc0..fcf6e2a6a3 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsPhoneCalls.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ProfilesPrefsSendSMS.java @@ -2,11 +2,11 @@ import android.os.Bundle; -public class ProfilesPrefsPhoneCalls extends ProfilesPrefsFragment { +public class ProfilesPrefsSendSMS extends ProfilesPrefsFragment { @Override public void onCreatePreferences(Bundle bundle, String rootKey) { - setPreferencesFromResource(R.xml.profile_prefs_phone_calls, rootKey); + setPreferencesFromResource(R.xml.profile_prefs_send_sms, rootKey); } } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RestartEventsIconColorChooserPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RestartEventsIconColorChooserPreference.java index 8a89bfe6b2..47a9629b88 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RestartEventsIconColorChooserPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RestartEventsIconColorChooserPreference.java @@ -134,25 +134,9 @@ Drawable createSelector(int color) { }*/ String applicationTheme = ApplicationPreferences.applicationTheme(context, true); - //String applicationTheme; // = "white";// = ApplicationPreferences.applicationTheme(context, true); - //if (GlobalGUIRoutines.isNightModeEnabled(context.getApplicationContext())) - // applicationTheme = "dark"; - //else - // applicationTheme = "white"; -// int nightModeFlags = -// context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; -// switch (nightModeFlags) { -// case Configuration.UI_MODE_NIGHT_YES: -// applicationTheme = "dark"; -// break; -// case Configuration.UI_MODE_NIGHT_NO: -// case Configuration.UI_MODE_NIGHT_UNDEFINED: -// applicationTheme = "white"; -// break; -// } - - final String COLOR1 = "#6E6E6E"; - final String COLOR2 = "#AEAEAE"; + +// final String COLOR1 = "#6E6E6E"; +// final String COLOR2 = "#AEAEAE"; GradientDrawable coloredCircle = new GradientDrawable(); coloredCircle.setColor(color); @@ -162,13 +146,15 @@ Drawable createSelector(int color) { //if (position == 2) // dark gray color // coloredCircle.setStroke(2, Color.parseColor("#6E6E6E")); //else - coloredCircle.setStroke(1, Color.parseColor(COLOR1)); +// coloredCircle.setStroke(1, Color.parseColor(COLOR1)); + coloredCircle.setStroke(1, context.getColor(R.color.pppColorChooserColor1)); } else { //if (position == 0) // white color // coloredCircle.setStroke(2, Color.parseColor("#AEAEAE")); //else - coloredCircle.setStroke(1, Color.parseColor(COLOR1)); +// coloredCircle.setStroke(1, Color.parseColor(COLOR1)); + coloredCircle.setStroke(1, context.getColor(R.color.pppColorChooserColor1)); } GradientDrawable darkerCircle = new GradientDrawable(); @@ -178,13 +164,15 @@ Drawable createSelector(int color) { //if (position == 2) // dark gray color // coloredCircle.setStroke(2, Color.parseColor("#6E6E6E")); //else - coloredCircle.setStroke(2, Color.parseColor(COLOR1)); +// coloredCircle.setStroke(2, Color.parseColor(COLOR1)); + coloredCircle.setStroke(2, context.getColor(R.color.pppColorChooserColor1)); } else { //if (position == 0) // white color // darkerCircle.setStroke(2, Color.parseColor("#AEAEAE")); //else - darkerCircle.setStroke(2, Color.parseColor(COLOR2)); +// darkerCircle.setStroke(2, Color.parseColor(COLOR2)); + darkerCircle.setStroke(2, context.getColor(R.color.pppColorChooserColor2)); } StateListDrawable stateListDrawable = new StateListDrawable(); @@ -251,7 +239,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public RestartEventsIconColorChooserPreference.SavedState createFromParcel(Parcel in) { return new RestartEventsIconColorChooserPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RestartEventsIconColorChooserPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RestartEventsIconColorChooserPreferenceFragment.java index 7084cfe113..9417c3bbde 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RestartEventsIconColorChooserPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RestartEventsIconColorChooserPreferenceFragment.java @@ -57,6 +57,7 @@ protected void onBindDialogView(@NonNull View view) { final FrameLayout defaultColorLayout = view.findViewById(R.id.dialog_color_chooser_default_color); + //noinspection DataFlowIssue defaultColorLayout.setTag(-1); defaultColorLayout.setOnClickListener(this); @@ -84,6 +85,7 @@ protected void onBindDialogView(@NonNull View view) { preference.setBackgroundCompat(defaultColorLayout, new RippleDrawable(rippleColors, selector, null)); final TextView defaultColorLabel = view.findViewById(R.id.dialog_color_chooser_default_color_label); + //noinspection DataFlowIssue defaultColorLabel.setTag(-1); defaultColorLabel.setOnClickListener(this); @@ -93,6 +95,7 @@ protected void onBindDialogView(@NonNull View view) { final FrameLayout customColorLayout = view.findViewById(R.id.dialog_color_chooser_custom_color); + //noinspection DataFlowIssue customColorLayout.setTag(-2); customColorLayout.setOnClickListener(this); @@ -122,6 +125,7 @@ protected void onBindDialogView(@NonNull View view) { preference.setBackgroundCompat(customColorLayout, new RippleDrawable(rippleColors, selector, null)); final TextView customColorLabel = view.findViewById(R.id.dialog_color_chooser_custom_color_label); + //noinspection DataFlowIssue customColorLabel.setTag(-2); customColorLabel.setOnClickListener(this); @@ -129,6 +133,7 @@ protected void onBindDialogView(@NonNull View view) { final GridLayout list = view.findViewById(R.id.dialog_color_chooser_grid); + //noinspection DataFlowIssue int count = list.getChildCount(); for (int i = 0; i < count; i++) { FrameLayout child = (FrameLayout) list.getChildAt(i); @@ -175,6 +180,7 @@ public void onClick(View v) { dialogBuilder.setView(layout); final ChromaColorView chromaColorView = layout.findViewById(R.id.custom_color_chroma_color_view); + //noinspection DataFlowIssue chromaColorView.setCurrentColor(Integer.parseInt(preference.value)); chromaColorView.setColorMode(ColorMode.values()[0]); chromaColorView.setIndicatorMode(IndicatorMode.values()[1]); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RingtonePreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RingtonePreference.java index ba405e84ce..7a94627f4e 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RingtonePreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RingtonePreference.java @@ -416,8 +416,8 @@ public void onDetached() { // From DialogPreference private static class SavedState extends BaseSavedState { - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator<>() { public RingtonePreference.SavedState createFromParcel(Parcel in) { return new RingtonePreference.SavedState(in); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RingtonePreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RingtonePreferenceFragment.java index 9b40a74c5f..43e3c95513 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RingtonePreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RingtonePreferenceFragment.java @@ -49,6 +49,7 @@ protected void onBindDialogView(@NonNull View view) listView = view.findViewById(R.id.ringtone_pref_dlg_listview); + //noinspection DataFlowIssue listView.setOnItemClickListener((parent, item, position, id) -> { RingtonePreferenceViewHolder viewHolder = (RingtonePreferenceViewHolder) item.getTag(); preference.setRingtone((String)listAdapter.getItem(position), false); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RootCommandWaitCalledFromConstants.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RootCommandWaitCalledFromConstants.java index b47c69f26b..2616d116ba 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RootCommandWaitCalledFromConstants.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RootCommandWaitCalledFromConstants.java @@ -25,5 +25,6 @@ class RootCommandWaitCalledFromConstants { static final String ROOT_COMMAND_WAIT_CALLED_FROM_SET_SIM_ON_OFF = ROOT_COMMAND_WAIT_CALLED_FROM_ACTIVATE_PROFILE_HELPER+"."+"setSIMOnOff"; static final String ROOT_COMMAND_WAIT_CALLED_FROM_SET_SCREEN_TIMEOUT = ROOT_COMMAND_WAIT_CALLED_FROM_ACTIVATE_PROFILE_HELPER+"."+"setScreenTimeout"; static final String ROOT_COMMAND_WAIT_CALLED_FROM_SET_HYPER_OS_WIFI_BLUETOOTH_DIALOGS_APPOP = ".setHyperOSWifiBluetoothDialogAppOp"; + static final String ROOT_COMMAND_WAIT_CALLED_FROM_SCREEN_NIGHT_LIGHT = ".setScreenNightLight"; } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RootUtils.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RootUtils.java index 848cda3a13..31a7314a00 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RootUtils.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RootUtils.java @@ -322,6 +322,7 @@ public void commandOutput(int id, String line) { public static String getJavaCommandFile(Class mainClass, String fileName, Context context, Object cmdParam) { try { + //noinspection DataFlowIssue String cmd = "#!/system/bin/sh\n" + "base=/system\n" + diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationEditorDialog.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationEditorDialog.java index 17d2da3263..75cf11ff34 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationEditorDialog.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationEditorDialog.java @@ -21,7 +21,6 @@ import androidx.appcompat.widget.AppCompatImageButton; import androidx.appcompat.widget.AppCompatSpinner; import androidx.appcompat.widget.TooltipCompat; -import androidx.core.content.ContextCompat; import androidx.recyclerview.widget.LinearLayoutManager; import androidx.recyclerview.widget.RecyclerView; @@ -106,12 +105,14 @@ class RunApplicationEditorDialog mDialog = dialogBuilder.create(); mDelayValue = layout.findViewById(R.id.run_applications_editor_dialog_startApplicationDelay); + //noinspection DataFlowIssue mDelayValue.setText(StringFormatUtils.getDurationString(startApplicationDelay)); mSelectedAppIcon = layout.findViewById(R.id.run_applications_editor_dialog_selectedIcon); mSelectedAppName = layout.findViewById(R.id.run_applications_editor_dialog_selectedAppName); LinearLayout delayValueRoot = layout.findViewById(R.id.run_applications_editor_dialog_startApplicationDelay_root); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(delayValueRoot, activity.getString(R.string.applications_editor_dialog_edit_delay_tooltip)); mDelayValueDialog = new TimeDurationPickerDialog(activity, (view, duration) -> { int iValue = (int) duration / 1000; @@ -147,13 +148,14 @@ class RunApplicationEditorDialog }); filterSpinner = layout.findViewById(R.id.run_applications_editor_dialog_filter_spinner); - HighlightedSpinnerAdapter spinnerAdapter = new HighlightedSpinnerAdapter( + PPSpinnerAdapter spinnerAdapter = new PPSpinnerAdapter( activity, - R.layout.spinner_highlighted, + R.layout.ppp_spinner, activity.getResources().getStringArray(R.array.runApplicationsEditorDialogFilterArray)); - spinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + spinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); + //noinspection DataFlowIssue filterSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background); - filterSpinner.setBackgroundTintList(ContextCompat.getColorStateList(activity/*.getBaseContext()*/, R.color.highlighted_spinner_all)); +// filterSpinner.setBackgroundTintList(ContextCompat.getColorStateList(activity/*.getBaseContext()*/, R.color.spinner_control_color)); /* switch (ApplicationPreferences.applicationTheme(activity, true)) { case "dark": filterSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background_dark); @@ -194,15 +196,18 @@ class RunApplicationEditorDialog @SuppressLint("NotifyDataSetChanged") public void onItemSelected(AdapterView parent, View view, int position, long id) { - ((HighlightedSpinnerAdapter)filterSpinner.getAdapter()).setSelection(position); + ((PPSpinnerAdapter)filterSpinner.getAdapter()).setSelection(position); selectedFilter = Integer.parseInt(filterValues[position]); if (selectedFilter == 2) + //noinspection DataFlowIssue addButton.setVisibility(View.VISIBLE); else + //noinspection DataFlowIssue addButton.setVisibility(View.GONE); fillApplicationList(); + //noinspection DataFlowIssue listView.getRecycledViewPool().clear(); // maybe fix for java.lang.IndexOutOfBoundsException: Inconsistency detected. listView.setAdapter(null); listView.setAdapter(listAdapter); @@ -224,11 +229,13 @@ public void onNothingSelected(AdapterView parent) { }); addButton = layout.findViewById(R.id.run_applications_editor_dialog_addIntent); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(addButton, activity.getString(R.string.applications_editor_dialog_add_button_tooltip)); addButton.setOnClickListener(view -> startEditor(null)); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(activity); listView = layout.findViewById(R.id.run_applications_editor_dialog_listview); + //noinspection DataFlowIssue listView.setLayoutManager(layoutManager); listView.setHasFixedSize(true); @@ -476,6 +483,7 @@ else if (application.shortcutId != 0) true, true, false, false, true, + false, activity ); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationEditorDialogViewHolder.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationEditorDialogViewHolder.java index a109123b5f..7eaa8c2a2a 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationEditorDialogViewHolder.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationEditorDialogViewHolder.java @@ -37,6 +37,7 @@ class RunApplicationEditorDialogViewHolder extends RecyclerView.ViewHolder imple else imageViewMenu = null; + //noinspection DataFlowIssue radioBtn.setOnClickListener(v -> { RadioButton rb = (RadioButton) v; rb.setChecked(true); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationEditorIntentActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationEditorIntentActivity.java index 4710fb03c5..d06fc9ba43 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationEditorIntentActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationEditorIntentActivity.java @@ -21,6 +21,7 @@ import androidx.appcompat.app.AppCompatActivity; import androidx.appcompat.widget.AppCompatImageButton; import androidx.appcompat.widget.AppCompatSpinner; +import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.TooltipCompat; import androidx.core.content.ContextCompat; @@ -45,6 +46,7 @@ public class RunApplicationEditorIntentActivity extends AppCompatActivity { private EditText intentClassName; private AppCompatSpinner intentActionSpinner; private EditText intentActionEdit; + private TextView intentActionLabel; private EditText intentData; private EditText intentMimeType; private TextView categoryTextView; @@ -76,7 +78,7 @@ public class RunApplicationEditorIntentActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { - GlobalGUIRoutines.setTheme(this, false, false, false, false, false, false); // must by called before super.onCreate() + GlobalGUIRoutines.setTheme(this, false, true, false, false, false, false); // must by called before super.onCreate() //GlobalGUIRoutines.setLanguage(this); super.onCreate(savedInstanceState); @@ -84,6 +86,8 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_run_application_editor_intent); setTaskDescription(new ActivityManager.TaskDescription(getString(R.string.ppp_app_name))); + Toolbar toolbar = findViewById(R.id.application_editor_intent_toolbar); + setSupportActionBar(toolbar); if (getSupportActionBar() != null) { //getSupportActionBar().setHomeButtonEnabled(true); //getSupportActionBar().setDisplayHomeAsUpEnabled(true); @@ -107,7 +111,8 @@ protected void onCreate(Bundle savedInstanceState) { //intentScrollView = findViewById(R.id.application_editor_intent_scroll_view); intentNameEditText = findViewById(R.id.application_editor_intent_intent_name); - intentNameEditText.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentNameEditText.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentNameEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -124,18 +129,18 @@ public void afterTextChanged(Editable s) { }); intentIntentTypeSpinner = findViewById(R.id.application_editor_intent_intent_type_spinner); - HighlightedSpinnerAdapter spinnerAdapter = new HighlightedSpinnerAdapter( + PPSpinnerAdapter spinnerAdapter = new PPSpinnerAdapter( this, - R.layout.spinner_highlighted, + R.layout.ppp_spinner, getResources().getStringArray(R.array.runApplicationEditorIntentIntentTypeArray)); - spinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + spinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); intentIntentTypeSpinner.setAdapter(spinnerAdapter); intentIntentTypeSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background); - intentIntentTypeSpinner.setBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all)); +// intentIntentTypeSpinner.setBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all)); intentIntentTypeSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View view, int position, long id) { - ((HighlightedSpinnerAdapter)intentIntentTypeSpinner.getAdapter()).setSelection(position); + ((PPSpinnerAdapter)intentIntentTypeSpinner.getAdapter()).setSelection(position); enableOKButton(); } @@ -144,7 +149,8 @@ public void onNothingSelected(AdapterView parent) { }); intentPackageName = findViewById(R.id.application_editor_intent_package_name); - intentPackageName.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentPackageName.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentPackageName.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -161,39 +167,45 @@ public void afterTextChanged(Editable s) { }); intentClassName = findViewById(R.id.application_editor_intent_class_name); - intentClassName.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentClassName.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentData = findViewById(R.id.application_editor_intent_data); - intentData.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentData.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentMimeType = findViewById(R.id.application_editor_intent_mime_type); - intentMimeType.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentMimeType.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentActionSpinner = findViewById(R.id.application_editor_intent_action_spinner); - spinnerAdapter = new HighlightedSpinnerAdapter( + spinnerAdapter = new PPSpinnerAdapter( this, - R.layout.spinner_highlighted, + R.layout.ppp_spinner, getResources().getStringArray(R.array.runApplicationEditorIntentActionArray)); - spinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + spinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); intentActionSpinner.setAdapter(spinnerAdapter); intentActionSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background); - intentActionSpinner.setBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all)); +// intentActionSpinner.setBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all)); intentActionSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View view, int position, long id) { - ((HighlightedSpinnerAdapter)intentActionSpinner.getAdapter()).setSelection(position); + ((PPSpinnerAdapter)intentActionSpinner.getAdapter()).setSelection(position); if (position == 0) { intentActionEdit.setText(""); intentActionEdit.setEnabled(false); + intentActionLabel.setEnabled(false); } else if (position == 1) { intentActionEdit.setEnabled(true); + intentActionLabel.setEnabled(true); } else { intentActionEdit.setText(""); intentActionEdit.setEnabled(false); + intentActionLabel.setEnabled(false); } enableOKButton(); @@ -204,7 +216,9 @@ public void onNothingSelected(AdapterView parent) { }); intentActionEdit = findViewById(R.id.application_editor_intent_action_edit); - intentActionEdit.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + intentActionLabel = findViewById(R.id.application_editor_intent_action_label); + //noinspection DataFlowIssue + intentActionEdit.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentActionEdit.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -226,6 +240,7 @@ public void afterTextChanged(Editable s) { categoryArray = getResources().getStringArray(R.array.runApplicationEditorIntentCategoryArray); categoryIndices = new boolean[categoryArray.length]; AppCompatImageButton intentCategoryButton = findViewById(R.id.application_editor_intent_category_btn); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(intentCategoryButton, getString(R.string.application_editor_intent_edit_category_button_tooltip)); intentCategoryButton.setOnClickListener(v -> { MultiSelectListDialog dialog = new MultiSelectListDialog( @@ -265,6 +280,7 @@ public void afterTextChanged(Editable s) { flagArray = getResources().getStringArray(R.array.runApplicationEditorIntentFlagArray); flagIndices = new boolean[flagArray.length]; AppCompatImageButton intentFlagsButton = findViewById(R.id.application_editor_intent_flags_btn); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(intentFlagsButton, getString(R.string.application_editor_intent_edit_flags_button_tooltip)); intentFlagsButton.setOnClickListener(v -> { MultiSelectListDialog dialog = new MultiSelectListDialog( @@ -300,23 +316,25 @@ public void afterTextChanged(Editable s) { }); intentExtraKeyName1 = findViewById(R.id.application_editor_intent_extra_key_1); - intentExtraKeyName1.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentExtraKeyName1.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentExtraKeyValue1 = findViewById(R.id.application_editor_intent_extra_value_1); - intentExtraKeyValue1.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentExtraKeyValue1.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentExtraSpinner1 = findViewById(R.id.application_editor_intent_extra_type_spinner_1); - spinnerAdapter = new HighlightedSpinnerAdapter( + spinnerAdapter = new PPSpinnerAdapter( this, - R.layout.spinner_highlighted, + R.layout.ppp_spinner, getResources().getStringArray(R.array.runApplicationEditorIntentExtraTypeArray)); - spinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + spinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); intentExtraSpinner1.setAdapter(spinnerAdapter); intentExtraSpinner1.setPopupBackgroundResource(R.drawable.popupmenu_background); - intentExtraSpinner1.setBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all)); +// intentExtraSpinner1.setBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all)); intentExtraSpinner1.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View view, int position, long id) { - ((HighlightedSpinnerAdapter)intentExtraSpinner1.getAdapter()).setSelection(position); + ((PPSpinnerAdapter)intentExtraSpinner1.getAdapter()).setSelection(position); } public void onNothingSelected(AdapterView parent) { @@ -324,23 +342,25 @@ public void onNothingSelected(AdapterView parent) { }); intentExtraKeyName2 = findViewById(R.id.application_editor_intent_extra_key_2); - intentExtraKeyName2.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentExtraKeyName2.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentExtraKeyValue2 = findViewById(R.id.application_editor_intent_extra_value_2); - intentExtraKeyValue2.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentExtraKeyValue2.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentExtraSpinner2 = findViewById(R.id.application_editor_intent_extra_type_spinner_2); - spinnerAdapter = new HighlightedSpinnerAdapter( + spinnerAdapter = new PPSpinnerAdapter( this, - R.layout.spinner_highlighted, + R.layout.ppp_spinner, getResources().getStringArray(R.array.runApplicationEditorIntentExtraTypeArray)); - spinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + spinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); intentExtraSpinner2.setAdapter(spinnerAdapter); intentExtraSpinner2.setPopupBackgroundResource(R.drawable.popupmenu_background); - intentExtraSpinner2.setBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all)); +// intentExtraSpinner2.setBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all)); intentExtraSpinner2.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View view, int position, long id) { - ((HighlightedSpinnerAdapter)intentExtraSpinner2.getAdapter()).setSelection(position); + ((PPSpinnerAdapter)intentExtraSpinner2.getAdapter()).setSelection(position); } public void onNothingSelected(AdapterView parent) { @@ -348,23 +368,25 @@ public void onNothingSelected(AdapterView parent) { }); intentExtraKeyName3 = findViewById(R.id.application_editor_intent_extra_key_3); - intentExtraKeyName3.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentExtraKeyName3.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentExtraKeyValue3 = findViewById(R.id.application_editor_intent_extra_value_3); - intentExtraKeyValue3.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentExtraKeyValue3.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentExtraSpinner3 = findViewById(R.id.application_editor_intent_extra_type_spinner_3); - spinnerAdapter = new HighlightedSpinnerAdapter( + spinnerAdapter = new PPSpinnerAdapter( this, - R.layout.spinner_highlighted, + R.layout.ppp_spinner, getResources().getStringArray(R.array.runApplicationEditorIntentExtraTypeArray)); - spinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + spinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); intentExtraSpinner3.setAdapter(spinnerAdapter); intentExtraSpinner3.setPopupBackgroundResource(R.drawable.popupmenu_background); - intentExtraSpinner3.setBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all)); +// intentExtraSpinner3.setBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all)); intentExtraSpinner3.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View view, int position, long id) { - ((HighlightedSpinnerAdapter)intentExtraSpinner3.getAdapter()).setSelection(position); + ((PPSpinnerAdapter)intentExtraSpinner3.getAdapter()).setSelection(position); } public void onNothingSelected(AdapterView parent) { @@ -372,23 +394,25 @@ public void onNothingSelected(AdapterView parent) { }); intentExtraKeyName4 = findViewById(R.id.application_editor_intent_extra_key_4); - intentExtraKeyName4.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentExtraKeyName4.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentExtraKeyValue4 = findViewById(R.id.application_editor_intent_extra_value_4); - intentExtraKeyValue4.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentExtraKeyValue4.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentExtraSpinner4 = findViewById(R.id.application_editor_intent_extra_type_spinner_4); - spinnerAdapter = new HighlightedSpinnerAdapter( + spinnerAdapter = new PPSpinnerAdapter( this, - R.layout.spinner_highlighted, + R.layout.ppp_spinner, getResources().getStringArray(R.array.runApplicationEditorIntentExtraTypeArray)); - spinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + spinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); intentExtraSpinner4.setAdapter(spinnerAdapter); intentExtraSpinner4.setPopupBackgroundResource(R.drawable.popupmenu_background); - intentExtraSpinner4.setBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all)); +// intentExtraSpinner4.setBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all)); intentExtraSpinner4.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View view, int position, long id) { - ((HighlightedSpinnerAdapter)intentExtraSpinner4.getAdapter()).setSelection(position); + ((PPSpinnerAdapter)intentExtraSpinner4.getAdapter()).setSelection(position); } public void onNothingSelected(AdapterView parent) { @@ -396,23 +420,25 @@ public void onNothingSelected(AdapterView parent) { }); intentExtraKeyName5 = findViewById(R.id.application_editor_intent_extra_key_5); - intentExtraKeyName5.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentExtraKeyName5.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentExtraKeyValue5 = findViewById(R.id.application_editor_intent_extra_value_5); - intentExtraKeyValue5.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + intentExtraKeyValue5.setBackgroundTintList(ContextCompat.getColorStateList(this, R.color.edit_text_color)); intentExtraSpinner5 = findViewById(R.id.application_editor_intent_extra_type_spinner_5); - spinnerAdapter = new HighlightedSpinnerAdapter( + spinnerAdapter = new PPSpinnerAdapter( this, - R.layout.spinner_highlighted, + R.layout.ppp_spinner, getResources().getStringArray(R.array.runApplicationEditorIntentExtraTypeArray)); - spinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + spinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); intentExtraSpinner5.setAdapter(spinnerAdapter); intentExtraSpinner5.setPopupBackgroundResource(R.drawable.popupmenu_background); - intentExtraSpinner5.setBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all)); +// intentExtraSpinner5.setBackgroundTintList(ContextCompat.getColorStateList(this/*getBaseContext()*/, R.color.highlighted_spinner_all)); intentExtraSpinner5.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { public void onItemSelected(AdapterView parent, View view, int position, long id) { - ((HighlightedSpinnerAdapter)intentExtraSpinner5.getAdapter()).setSelection(position); + ((PPSpinnerAdapter)intentExtraSpinner5.getAdapter()).setSelection(position); } public void onNothingSelected(AdapterView parent) { @@ -456,6 +482,7 @@ public void onNothingSelected(AdapterView parent) { } } intentActionEdit.setEnabled(false); + intentActionLabel.setEnabled(false); if (ppIntent._categories != null) { String categoryValue = ppIntent._categories.replaceAll(StringConstants.STR_SPLIT_REGEX, StringConstants.CHAR_NEW_LINE); @@ -521,6 +548,7 @@ public void onNothingSelected(AdapterView parent) { } else { intentActionEdit.setEnabled(false); + intentActionLabel.setEnabled(false); } enableOKButton(); @@ -535,6 +563,7 @@ public void onNothingSelected(AdapterView parent) { }); Button cancelButton = findViewById(R.id.application_editor_intent_cancel); + //noinspection DataFlowIssue cancelButton.setOnClickListener(v -> { Intent returnIntent = new Intent(); setResult(Activity.RESULT_CANCELED, returnIntent); @@ -542,6 +571,7 @@ public void onNothingSelected(AdapterView parent) { }); Button testButton = findViewById(R.id.application_editor_intent_test); + //noinspection DataFlowIssue testButton.setOnClickListener(v -> { if (ppIntent == null) { PPAlertDialog mDialog = new PPAlertDialog( @@ -558,6 +588,7 @@ public void onNothingSelected(AdapterView parent) { true, true, false, false, true, + false, activity ); @@ -583,6 +614,7 @@ public void onNothingSelected(AdapterView parent) { true, true, false, false, true, + false, activity ); @@ -609,6 +641,7 @@ public void onNothingSelected(AdapterView parent) { true, true, false, false, true, + false, activity ); @@ -667,6 +700,7 @@ public void onNothingSelected(AdapterView parent) { true, true, false, false, true, + false, activity ); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreference.java index 28f677a5cf..9b08c3650d 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreference.java @@ -394,7 +394,7 @@ private void setSummaryAMSDP() ApplicationInfo app; try { app = packageManager.getApplicationInfo(splits[0], PackageManager.MATCH_ALL); - if (app != null) + //if (app != null) prefSummary = packageManager.getApplicationLabel(app).toString(); } catch (PackageManager.NameNotFoundException e) { //PPApplicationStatic.recordException(e); @@ -534,14 +534,14 @@ private void setIcons() { if (activityName.isEmpty()) { try { app = packageManager.getApplicationInfo(splits[0], PackageManager.MATCH_ALL); - if (app != null) { + //if (app != null) { Drawable icon = packageManager.getApplicationIcon(app); //CharSequence name = packageManager.getApplicationLabel(app); packageIcon.setImageDrawable(icon); _setEnabled = true; - } else { - packageIcon.setImageResource(R.drawable.ic_empty); - } + //} else { + // packageIcon.setImageResource(R.drawable.ic_empty); + //} } catch (Exception e) { packageIcon.setImageResource(R.drawable.ic_empty); } @@ -599,14 +599,14 @@ private void setIcons() { if (activityName.isEmpty()) { try { app = packageManager.getApplicationInfo(splits[i], PackageManager.MATCH_ALL); - if (app != null) { + //if (app != null) { Drawable icon = packageManager.getApplicationIcon(app); //CharSequence name = packageManager.getApplicationLabel(app); packIcon.setImageDrawable(icon); _setEnabled = true; - } else { - packIcon.setImageResource(R.drawable.ic_empty); - } + //} else { + // packIcon.setImageResource(R.drawable.ic_empty); + //} } catch (Exception e) { packIcon.setImageResource(R.drawable.ic_empty); } @@ -689,6 +689,7 @@ else if (application.shortcutId != 0) true, true, false, false, true, + false, fragment.getActivity() ); @@ -941,7 +942,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public RunApplicationsDialogPreference.SavedState createFromParcel(Parcel in) { return new RunApplicationsDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreferenceAdapter.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreferenceAdapter.java index f0f91f33a6..e6e4960676 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreferenceAdapter.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreferenceAdapter.java @@ -41,22 +41,24 @@ public void onBindViewHolder(@NonNull final RunApplicationsDialogPreferenceViewH Application application = preference.applicationsList.get(position); holder.bindApplication(application); - holder.dragHandle.setOnTouchListener((v, event) -> { - switch (event.getAction()) { - case MotionEvent.ACTION_DOWN: + if (holder.dragHandle != null) { + holder.dragHandle.setOnTouchListener((v, event) -> { + switch (event.getAction()) { + case MotionEvent.ACTION_DOWN: + mDragStartListener.onStartDrag(holder); + break; + case MotionEvent.ACTION_UP: + v.performClick(); + break; + default: + break; + } + /*if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) { mDragStartListener.onStartDrag(holder); - break; - case MotionEvent.ACTION_UP: - v.performClick(); - break; - default: - break; - } - /*if (MotionEventCompat.getActionMasked(event) == MotionEvent.ACTION_DOWN) { - mDragStartListener.onStartDrag(holder); - }*/ - return false; - }); + }*/ + return false; + }); + } } @Override diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreferenceFragment.java index e2bb85850d..64d536d720 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreferenceFragment.java @@ -57,11 +57,13 @@ protected void onBindDialogView(@NonNull View view) { super.onBindDialogView(view); AppCompatImageButton addButton = view.findViewById(R.id.run_applications_pref_dlg_add); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(addButton, getString(R.string.applications_pref_dlg_add_button_tooltip)); RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext()); applicationsListView = view.findViewById(R.id.run_applications_pref_dlg_listview); //applicationsListView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL)); + //noinspection DataFlowIssue applicationsListView.setLayoutManager(layoutManager); applicationsListView.setHasFixedSize(true); emptyList = view.findViewById(R.id.run_applications_pref_dlg_empty); @@ -77,6 +79,7 @@ protected void onBindDialogView(@NonNull View view) { itemTouchHelper.attachToRecyclerView(applicationsListView); final ImageView helpIcon = view.findViewById(R.id.run_applications_pref_dlg_helpIcon); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(helpIcon, getString(R.string.help_button_tooltip)); helpIcon.setOnClickListener(v -> { String helpString = getString(R.string.run_applications_preference_application_type); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreferenceViewHolder.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreferenceViewHolder.java index 4139f8e8f1..aec9aaa3d8 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreferenceViewHolder.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunApplicationsDialogPreferenceViewHolder.java @@ -113,7 +113,7 @@ private void setTextStyle(TextView textView, boolean errorColor) sbt.removeSpan(span); } if (errorColor) { - sbt.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.error_color)), 0, sbt.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + sbt.setSpan(new ForegroundColorSpan(ContextCompat.getColor(context, R.color.errorColor)), 0, sbt.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); } textView.setText(sbt); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunStopIndicatorPopupWindow.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunStopIndicatorPopupWindow.java index 4486d29383..708d19a72a 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunStopIndicatorPopupWindow.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/RunStopIndicatorPopupWindow.java @@ -28,6 +28,7 @@ class RunStopIndicatorPopupWindow extends GuiInfoPopupWindow { */ TextView textView = popupView.findViewById(R.id.run_stop_indicator_popup_window_important_info); + //noinspection DataFlowIssue textView.setText(activity.getString(R.string.popup_window_events_status_show_info) + StringConstants.STR_HARD_SPACE_DOUBLE_ARROW); textView.setClickable(true); textView.setOnClickListener(v -> { @@ -54,6 +55,7 @@ class RunStopIndicatorPopupWindow extends GuiInfoPopupWindow { }); final SwitchCompat checkBox = popupView.findViewById(R.id.run_stop_indicator_popup_window_checkbox); + //noinspection DataFlowIssue checkBox.setChecked(EventStatic.getGlobalEventsRunning(activity)); checkBox.setOnCheckedChangeListener((compoundButton, isChecked) -> { if (dataWrapper != null) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ScreenOnOffBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ScreenOnOffBroadcastReceiver.java index 907dc133ce..d01cfdd104 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ScreenOnOffBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ScreenOnOffBroadcastReceiver.java @@ -267,6 +267,7 @@ else if (ApplicationPreferences.applicationEventPeriodicScanningEnableScanning) PPAppNotification.drawNotification(false, appContext); if (EventStatic.getGlobalEventsRunning(appContext)) { +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] ScreenOnOffBroadcastReceiver.doScreenOnOff", "SENSOR_TYPE_SCREEN,SENSOR_TYPE_BRIGHTNESS,SENSOR_TYPE_CALENDAR_EVENT_EXISTS_CHECK"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{ EventsHandler.SENSOR_TYPE_SCREEN, @@ -314,6 +315,7 @@ else if (ApplicationPreferences.applicationEventOrientationEnableScanning && PPAppNotification.drawNotification(false, appContext); if (EventStatic.getGlobalEventsRunning(appContext)) { +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] ScreenOnOffBroadcastReceiver.doScreenOnOff", "SENSOR_TYPE_SCREEN"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_SCREEN}); // do not call this when screen is off @@ -328,6 +330,7 @@ else if (ApplicationPreferences.applicationEventOrientationEnableScanning && setProfileScreenTimeoutSavedWhenScreenOff(appContext); if (EventStatic.getGlobalEventsRunning(appContext)) { +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] ScreenOnOffBroadcastReceiver.doScreenOnOff", "SENSOR_TYPE_SCREEN,SENSOR_TYPE_BRIGHTNESS"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{ EventsHandler.SENSOR_TYPE_SCREEN, diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SearchCalendarEventsWorker.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SearchCalendarEventsWorker.java index 3b0b2f3c53..ff5b9c338b 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SearchCalendarEventsWorker.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SearchCalendarEventsWorker.java @@ -45,7 +45,7 @@ public Result doWork() { if (EventStatic.getGlobalEventsRunning(context)) { // start events handler -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] SearchCalendarEventsWorker.doWork", "sensorType=SENSOR_TYPE_SEARCH_CALENDAR_EVENTS"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] SearchCalendarEventsWorker.doWork", "SENSOR_TYPE_SEARCH_CALENDAR_EVENTS"); EventsHandler eventsHandler = new EventsHandler(context); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_SEARCH_CALENDAR_EVENTS}); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SearchStringPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SearchStringPreferenceFragment.java index 30f35d58a9..2887d30c3e 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SearchStringPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SearchStringPreferenceFragment.java @@ -37,10 +37,12 @@ protected void onBindDialogView(@NonNull View view) { super.onBindDialogView(view); editText = view.findViewById(R.id.search_string_pref_dlg_editText); - editText.setBackgroundTintList(ContextCompat.getColorStateList(prefContext, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + editText.setBackgroundTintList(ContextCompat.getColorStateList(prefContext, R.color.edit_text_color)); editText.setText(preference.value); final ImageView helpIcon = view.findViewById(R.id.search_string_pref_dlg_helpIcon); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(helpIcon, getString(R.string.help_button_tooltip)); helpIcon.setOnClickListener(v -> { String helpString = StringConstants.TAG_LIST_START_FIRST_ITEM_HTML + diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneCallSendSMSDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SendSMSDialogPreference.java similarity index 76% rename from phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneCallSendSMSDialogPreference.java rename to phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SendSMSDialogPreference.java index 5743b5a90d..f31db244f1 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneCallSendSMSDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SendSMSDialogPreference.java @@ -11,9 +11,9 @@ import androidx.preference.DialogPreference; @RequiresApi(api = Build.VERSION_CODES.Q) -public class PhoneCallSendSMSDialogPreference extends DialogPreference { +public class SendSMSDialogPreference extends DialogPreference { - PhoneCallSendSMSDialogPreferenceFragment fragment; + SendSMSDialogPreferenceFragment fragment; private final Context _context; @@ -22,7 +22,7 @@ public class PhoneCallSendSMSDialogPreference extends DialogPreference { private boolean defaultValue; private boolean savedInstanceState; - public PhoneCallSendSMSDialogPreference(Context context, AttributeSet attrs) { + public SendSMSDialogPreference(Context context, AttributeSet attrs) { super(context, attrs); _context = context; @@ -81,7 +81,7 @@ protected Parcelable onSaveInstanceState() return superState; }*/ - final PhoneCallSendSMSDialogPreference.SavedState myState = new PhoneCallSendSMSDialogPreference.SavedState(superState); + final SendSMSDialogPreference.SavedState myState = new SendSMSDialogPreference.SavedState(superState); myState.sendSMS = sendSMS; myState.defaultValue = defaultValue; return myState; @@ -90,7 +90,7 @@ protected Parcelable onSaveInstanceState() @Override protected void onRestoreInstanceState(Parcelable state) { - if ((state == null) || (!state.getClass().equals(PhoneCallSendSMSDialogPreference.SavedState.class))) { + if ((state == null) || (!state.getClass().equals(SendSMSDialogPreference.SavedState.class))) { // Didn't save state for us in onSaveInstanceState super.onRestoreInstanceState(state); sendSMS = false; @@ -99,7 +99,7 @@ protected void onRestoreInstanceState(Parcelable state) } // restore instance state - PhoneCallSendSMSDialogPreference.SavedState myState = (PhoneCallSendSMSDialogPreference.SavedState)state; + SendSMSDialogPreference.SavedState myState = (SendSMSDialogPreference.SavedState)state; super.onRestoreInstanceState(myState.getSuperState()); sendSMS = myState.sendSMS; defaultValue = myState.defaultValue; @@ -134,15 +134,15 @@ public void writeToParcel(Parcel dest, int flags) super(superState); } - public static final Creator CREATOR = - new Creator() { - public PhoneCallSendSMSDialogPreference.SavedState createFromParcel(Parcel in) + public static final Creator CREATOR = + new Creator<>() { + public SendSMSDialogPreference.SavedState createFromParcel(Parcel in) { - return new PhoneCallSendSMSDialogPreference.SavedState(in); + return new SendSMSDialogPreference.SavedState(in); } - public PhoneCallSendSMSDialogPreference.SavedState[] newArray(int size) + public SendSMSDialogPreference.SavedState[] newArray(int size) { - return new PhoneCallSendSMSDialogPreference.SavedState[size]; + return new SendSMSDialogPreference.SavedState[size]; } }; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneCallSendSMSDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SendSMSDialogPreferenceFragment.java similarity index 75% rename from phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneCallSendSMSDialogPreferenceFragment.java rename to phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SendSMSDialogPreferenceFragment.java index 4c16dcca5b..c5ba8737fb 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneCallSendSMSDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SendSMSDialogPreferenceFragment.java @@ -12,10 +12,10 @@ import androidx.preference.PreferenceDialogFragmentCompat; @RequiresApi(api = Build.VERSION_CODES.Q) -public class PhoneCallSendSMSDialogPreferenceFragment extends PreferenceDialogFragmentCompat +public class SendSMSDialogPreferenceFragment extends PreferenceDialogFragmentCompat { - private PhoneCallSendSMSDialogPreference preference; + private SendSMSDialogPreference preference; SwitchCompat sendSMSChBox; @@ -23,18 +23,19 @@ public class PhoneCallSendSMSDialogPreferenceFragment extends PreferenceDialogFr @Override protected View onCreateDialogView(@NonNull Context context) { - preference = (PhoneCallSendSMSDialogPreference) getPreference(); + preference = (SendSMSDialogPreference) getPreference(); preference.fragment = this; LayoutInflater inflater = LayoutInflater.from(context); - return inflater.inflate(R.layout.dialog_phone_calls_send_sms, null, false); + return inflater.inflate(R.layout.dialog_send_sms, null, false); } @Override protected void onBindDialogView(@NonNull View view) { super.onBindDialogView(view); - sendSMSChBox = view.findViewById(R.id.phone_calls_send_sms_checkBox); + sendSMSChBox = view.findViewById(R.id.send_sms_checkBox); + //noinspection DataFlowIssue sendSMSChBox.setChecked(preference.sendSMS); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ShizukuUtils.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ShizukuUtils.java index d74ac5a084..4c8a19189a 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ShizukuUtils.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ShizukuUtils.java @@ -1,5 +1,8 @@ package sk.henrichg.phoneprofilesplus; +import android.content.Context; +import android.content.pm.ApplicationInfo; +import android.content.pm.PackageInfo; import android.content.pm.PackageManager; import java.io.BufferedReader; @@ -12,10 +15,31 @@ */ class ShizukuUtils { + static final String SHIZUKU_PACKAGE_NAME = "moe.shizuku.privileged.api"; + private ShizukuUtils() { // private constructor to prevent instantiation } + static int isShizukuInstalled(Context context) { + try { + PackageManager packageManager = context.getPackageManager(); + ApplicationInfo appInfo = packageManager.getApplicationInfo(SHIZUKU_PACKAGE_NAME, PackageManager.MATCH_ALL); + boolean installed = appInfo.enabled; + if (installed) { + PackageInfo pInfo = packageManager.getPackageInfo(appInfo.packageName, 0); + return PPApplicationStatic.getVersionCode(pInfo); + } else { + return 0; + } + } catch (Exception e) { + // extender is not installed = package not found + //Log.e("PPExtenderBroadcastReceiver.isExtenderInstalled", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + return 0; + } + } + /** * Checks if Shizuku is available. If the Shizuku Manager app * is either uninstalled OR isn't running, this will return @@ -35,7 +59,11 @@ static boolean hasShizukuPermission() { if (!shizukuAvailable()) { return false; } +// Log.e("ShizukuUtils.hasShizukuPermission", "available"); +// Log.e("ShizukuUtils.hasShizukuPermission", "getVersion()="+Shizuku.getVersion()); +// Log.e("ShizukuUtils.hasShizukuPermission", "isPreV11()="+Shizuku.isPreV11()); +// Log.e("ShizukuUtils.hasShizukuPermission", "permission="+(Shizuku.checkSelfPermission() == PackageManager.PERMISSION_GRANTED)); // !!! required is Shizuku v11+ return (Shizuku.getVersion() >= 11) && (!Shizuku.isPreV11()) && diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ShortcutCreatorListFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ShortcutCreatorListFragment.java index 94cf4568fa..100989a27a 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ShortcutCreatorListFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ShortcutCreatorListFragment.java @@ -93,6 +93,7 @@ private void doOnViewCreated(View view/*, Bundle savedInstanceState*/) } }); + //noinspection DataFlowIssue cancelButton.setOnClickListener(v -> { if (getActivity() != null) getActivity().finish(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SimStateChangedBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SimStateChangedBroadcastReceiver.java index 278026a6e5..c221af5d30 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SimStateChangedBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SimStateChangedBroadcastReceiver.java @@ -86,7 +86,7 @@ public void onReceive(Context context, Intent intent) { // start events handler -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] SimStateChangedBroadcastReceiver.onReceive", "sensorType=SENSOR_TYPE_SIM_STATE_CHANGED"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] SimStateChangedBroadcastReceiver.onReceive", "SENSOR_TYPE_SIM_STATE_CHANGED,SENSOR_TYPE_RADIO_SWITCH"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{ EventsHandler.SENSOR_TYPE_SIM_STATE_CHANGED, diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SingleSelectListDialog.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SingleSelectListDialog.java index f68f51479a..2fd8197b0f 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SingleSelectListDialog.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/SingleSelectListDialog.java @@ -42,8 +42,10 @@ class SingleSelectListDialog @SuppressLint("InflateParams") View titleView = layoutInflater.inflate(R.layout.custom_dialog_title_wtih_subtitle, null); TextView titleText = titleView.findViewById(R.id.custom_dialog_title); + //noinspection DataFlowIssue titleText.setText(_title); TextView subtitleText = titleView.findViewById(R.id.custom_dialog_subtitle); + //noinspection DataFlowIssue subtitleText.setText(_subtitle); dialogBuilder.setCustomTitle(titleView); } else @@ -61,8 +63,10 @@ class SingleSelectListDialog View buttonsDivider = layout.findViewById(R.id.pp_list_pref_dlg_buttonBarDivider); if (hideButtonsDivider) + //noinspection DataFlowIssue buttonsDivider.setVisibility(View.GONE); else + //noinspection DataFlowIssue buttonsDivider.setVisibility(View.VISIBLE); mDialog = dialogBuilder.create(); @@ -71,10 +75,12 @@ class SingleSelectListDialog listView = layout.findViewById(R.id.pp_list_pref_dlg_listview); + //noinspection DataFlowIssue listView.setOnItemClickListener((parent, item, position, id) -> { if (itemValue != NOT_USE_RADIO_BUTTONS) { RadioButton rb = item.findViewById(R.id.pp_list_pref_dlg_item_radiobutton); itemValue = position; + //noinspection DataFlowIssue rb.setChecked(true); } itemClick.onClick(mDialog, position); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/StringFormatUtils.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/StringFormatUtils.java index 95044dd756..421ccfbd1c 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/StringFormatUtils.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/StringFormatUtils.java @@ -13,6 +13,7 @@ import android.text.style.LeadingMarginSpan; import android.text.style.URLSpan; +import androidx.annotation.NonNull; import androidx.core.text.HtmlCompat; import org.xml.sax.XMLReader; @@ -130,7 +131,7 @@ public URLSpanline_none(String url) { super(url); } @Override - public void updateDrawState(TextPaint ds) { + public void updateDrawState(@NonNull TextPaint ds) { super.updateDrawState(ds); ds.setUnderlineText(false); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TileChooserActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TileChooserActivity.java index 2c2ddd773d..5bdd601e6d 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TileChooserActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TileChooserActivity.java @@ -165,7 +165,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent data) { // PPApplicationStatic.logE("[PPP_NOTIFICATION] ActivatorActivity.onActivityResult", "call of PPAppNotification.drawNotification"); ImportantInfoNotification.showInfoNotification(appContext); ProfileListNotification.drawNotification(true, appContext); - DrawOverAppsPermissionNotification.showNotification(appContext, true); + //DrawOverAppsPermissionNotification.showNotification(appContext, true); IgnoreBatteryOptimizationNotification.showNotification(appContext, true); DNDPermissionNotification.showNotification(appContext, true); PPAppNotification.drawNotification(true, appContext); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TileChooserListFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TileChooserListFragment.java index f1ef814afe..fbaa7f55c4 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TileChooserListFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TileChooserListFragment.java @@ -88,6 +88,7 @@ private void doOnViewCreated(View view/*, Bundle savedInstanceState*/) } }); + //noinspection DataFlowIssue cancelButton.setOnClickListener(v -> { if (getActivity() != null) getActivity().finish(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TimeDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TimeDialogPreference.java index 82d34a69f8..a548426048 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TimeDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TimeDialogPreference.java @@ -160,7 +160,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public TimeDialogPreference.SavedState createFromParcel(Parcel in) { return new TimeDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TimeDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TimeDialogPreferenceFragment.java index 7572c301a3..7f90e95f3a 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TimeDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TimeDialogPreferenceFragment.java @@ -43,6 +43,7 @@ protected void onBindDialogView(@NonNull View view) super.onBindDialogView(view); mValue = view.findViewById(R.id.time_pref_dlg_value); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(mValue, getString(R.string.time_pref_dlg_edit_time_tooltip)); mSeekBarHours = view.findViewById(R.id.time_pref_dlg_hours); mSeekBarMinutes = view.findViewById(R.id.time_pref_dlg_minutes); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TonesHandler.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TonesHandler.java index a079405111..111cf31f79 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TonesHandler.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TonesHandler.java @@ -296,7 +296,7 @@ private static boolean _installTone(int resID, String title, Context context) { // Cursor cursor = context.getContentResolver().query(contentUri, // new String[]{MediaStore.MediaColumns.DATA}, -// MediaStore.MediaColumns.DATA + "=\"" + outAbsPath + "\"", null, null); +// MediaStore.MediaColumns.DATA + "='" + outAbsPath + "'", null, null); // if (cursor != null) { // if (!cursor.moveToFirst()) { // // not exists in content @@ -305,7 +305,7 @@ private static boolean _installTone(int resID, String title, Context context) { // // //// If the ringtone already exists in the database, delete it first // //context.getContentResolver().delete(contentUri, -// // MediaStore.MediaColumns.DATA + "=\"" + outAbsPath + "\"", null); +// // MediaStore.MediaColumns.DATA + "='" + outAbsPath + "'", null); // // // Add the metadata to the file in the database // ContentValues contentValues = new ContentValues(); @@ -403,7 +403,7 @@ private void removeTone(String voiceFile, Context context) { // If the ringtone already exists in the database, delete it first context.getContentResolver().delete(contentUri, - MediaStore.MediaColumns.DATA + "=\"" + outAbsPath + "\"", null); + MediaStore.MediaColumns.DATA + "='" + outAbsPath + "'", null); // delete the file outFile.delete(); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TwilightScanner.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TwilightScanner.java index e3f73842cd..8c1d354030 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TwilightScanner.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/TwilightScanner.java @@ -22,6 +22,8 @@ import android.text.format.DateUtils; import android.text.format.Time; +import androidx.annotation.NonNull; + import java.util.Calendar; import java.util.Iterator; @@ -478,15 +480,15 @@ static void doWork() { // A LocationListener to initialize the network location provider. The location updates // are handled through the passive location provider. private final LocationListener mEmptyLocationListener = new LocationListener() { - public void onLocationChanged(Location location) { + public void onLocationChanged(@NonNull Location location) { // PPApplicationStatic.logE("[IN_LISTENER] TwilightScanner.mEmptyLocationListener.onLocationChanged", "xxx"); } - public void onProviderDisabled(String provider) { + public void onProviderDisabled(@NonNull String provider) { // PPApplicationStatic.logE("[IN_LISTENER] TwilightScanner.mEmptyLocationListener.onProviderDisabled", "xxx"); } - public void onProviderEnabled(String provider) { + public void onProviderEnabled(@NonNull String provider) { // PPApplicationStatic.logE("[IN_LISTENER] TwilightScanner.mEmptyLocationListener.onProviderEnabled", "xxx"); } @@ -496,16 +498,16 @@ public void onStatusChanged(String provider, int status, Bundle extras) { }; private final LocationListener mLocationListener = new LocationListener() { - public void onLocationChanged(Location location) { + public void onLocationChanged(@NonNull Location location) { // PPApplicationStatic.logE("[IN_LISTENER] TwilightScanner.mLocationListener.onLocationChanged", "xxx"); mLocationHandler.processNewLocation(location); } - public void onProviderDisabled(String provider) { + public void onProviderDisabled(@NonNull String provider) { // PPApplicationStatic.logE("[IN_LISTENER] TwilightScanner.mLocationListener.onProviderDisabled", "xxx"); } - public void onProviderEnabled(String provider) { + public void onProviderEnabled(@NonNull String provider) { // PPApplicationStatic.logE("[IN_LISTENER] TwilightScanner.mLocationListener.onProviderEnabled", "xxx"); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VPNDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VPNDialogPreference.java index e5947f5329..b067e59921 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VPNDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VPNDialogPreference.java @@ -203,8 +203,8 @@ public void writeToParcel(Parcel dest, int flags) super(superState); } - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator<>() { public VPNDialogPreference.SavedState createFromParcel(Parcel in) { return new VPNDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VPNDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VPNDialogPreferenceFragment.java index 2ea98a94ce..6f47b68af9 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VPNDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VPNDialogPreferenceFragment.java @@ -56,28 +56,31 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { vpnApplicationSpinner = layout.findViewById(R.id.vpnPrefDialogVPNApplication); - HighlightedSpinnerAdapter vpnApplicationSpinnerAdapter = new HighlightedSpinnerAdapter( + PPSpinnerAdapter vpnApplicationSpinnerAdapter = new PPSpinnerAdapter( (ProfilesPrefsActivity) preference._context, - R.layout.spinner_highlighted, + R.layout.ppp_spinner, getResources().getStringArray(R.array.vpnApplicationArray)); - vpnApplicationSpinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + vpnApplicationSpinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); vpnApplicationSpinner.setAdapter(vpnApplicationSpinnerAdapter); vpnApplicationSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background); - vpnApplicationSpinner.setBackgroundTintList(ContextCompat.getColorStateList(preference._context/*getBaseContext()*/, R.color.highlighted_spinner_all)); +// vpnApplicationSpinner.setBackgroundTintList(ContextCompat.getColorStateList(preference._context/*getBaseContext()*/, R.color.spinner_control_color)); enableVPNRBtn = layout.findViewById(R.id.vpnPrefDialogEnableVPNEnableRB); + //noinspection DataFlowIssue enableVPNRBtn.setOnCheckedChangeListener((buttonView, isChecked) -> { preference.enableVPN = enableVPNRBtn.isChecked(); //preference.callChangeListener(preference.getSValue()); }); disableVPNRBtn = layout.findViewById(R.id.vpnPrefDialogEnableVPNDisableRB); + //noinspection DataFlowIssue disableVPNRBtn.setOnCheckedChangeListener((buttonView, isChecked) -> { preference.enableVPN = enableVPNRBtn.isChecked(); //preference.callChangeListener(preference.getSValue()); }); profileNameEditText = layout.findViewById(R.id.vpnPrefDialogProfileName); - profileNameEditText.setBackgroundTintList(ContextCompat.getColorStateList(preference._context, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + profileNameEditText.setBackgroundTintList(ContextCompat.getColorStateList(preference._context, R.color.edit_text_color)); profileNameEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -96,7 +99,8 @@ public void afterTextChanged(Editable s) { }); tunnelNameEditText = layout.findViewById(R.id.vpnPrefDialogTunnelName); - tunnelNameEditText.setBackgroundTintList(ContextCompat.getColorStateList(preference._context, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + tunnelNameEditText.setBackgroundTintList(ContextCompat.getColorStateList(preference._context, R.color.edit_text_color)); tunnelNameEditText.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -134,6 +138,7 @@ public void afterTextChanged(Editable s) { tunnelNameLabel = layout.findViewById(R.id.vpnPrefDialogTunnelNameLabel); doNotSwith = layout.findViewById(R.id.vpnPrefDialogNotSetWhenIsInState); + //noinspection DataFlowIssue doNotSwith.setChecked(preference.doNotSetWhenIsinState); doNotSwith.setOnCheckedChangeListener((compoundButton, isChecked) -> { preference.doNotSetWhenIsinState = doNotSwith.isChecked(); @@ -212,7 +217,7 @@ private boolean isCompatibleWithWireGuard() { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { - ((HighlightedSpinnerAdapter)vpnApplicationSpinner.getAdapter()).setSelection(position); + ((PPSpinnerAdapter)vpnApplicationSpinner.getAdapter()).setSelection(position); String[] vpnApplicationValues = preference._context.getResources().getStringArray(R.array.vpnApplicationValues); preference.vpnApplication = Integer.parseInt(vpnApplicationValues[position]); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VPNNetworkCallback.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VPNNetworkCallback.java index c2c4325c5c..7c885d666c 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VPNNetworkCallback.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VPNNetworkCallback.java @@ -117,7 +117,7 @@ private void _doConnection(Context appContext) { // start events handler -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] VPNNetworkCallback._doConnection", "sensorType=SENSOR_TYPE_RADIO_VPN"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] VPNNetworkCallback._doConnection", "SENSOR_TYPE_VPN"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_VPN}); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VibrationIntensityPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VibrationIntensityPreference.java index dace0db666..75b2bee948 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VibrationIntensityPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VibrationIntensityPreference.java @@ -2,7 +2,6 @@ import android.content.Context; import android.content.res.TypedArray; -import android.os.Build; import android.os.Parcel; import android.os.Parcelable; import android.util.AttributeSet; @@ -29,6 +28,10 @@ public class VibrationIntensityPreference extends DialogPreference { int value = 0; + static final String RINGING_VYBRATION_INTENSITY_TYPE = "RINGING"; + static final String NOTIFICATIONS_VYBRATION_INTENSITY_TYPE = "NOTIFICATIONS"; + static final String TOUCHINTERACTION_VYBRATION_INTENSITY_TYPE = "TOUCHINTERACTION"; + public VibrationIntensityPreference(Context context, AttributeSet attrs) { super(context, attrs); @@ -66,37 +69,37 @@ private void getValueVIDP() value = Integer.parseInt(splits[0]); if (value == -1) { - if (Build.VERSION.SDK_INT < 33) { + //if (Build.VERSION.SDK_INT < 33) { if (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) { - if (vibrationIntensityType.equalsIgnoreCase("RINGING")) + if (vibrationIntensityType.equalsIgnoreCase(RINGING_VYBRATION_INTENSITY_TYPE)) value = 3; - else if (vibrationIntensityType.equalsIgnoreCase("NOTIFICATIONS")) + else if (vibrationIntensityType.equalsIgnoreCase(NOTIFICATIONS_VYBRATION_INTENSITY_TYPE)) value = 3; - else if (vibrationIntensityType.equalsIgnoreCase("TOUCHINTERACTION")) + else if (vibrationIntensityType.equalsIgnoreCase(TOUCHINTERACTION_VYBRATION_INTENSITY_TYPE)) value = 1; } else if (PPApplication.deviceIsOnePlus) { - if (vibrationIntensityType.equalsIgnoreCase("RINGING")) + if (vibrationIntensityType.equalsIgnoreCase(RINGING_VYBRATION_INTENSITY_TYPE)) value = 1060; - else if (vibrationIntensityType.equalsIgnoreCase("NOTIFICATIONS")) + else if (vibrationIntensityType.equalsIgnoreCase(NOTIFICATIONS_VYBRATION_INTENSITY_TYPE)) value = 1060; - else if (vibrationIntensityType.equalsIgnoreCase("TOUCHINTERACTION")) + else if (vibrationIntensityType.equalsIgnoreCase(TOUCHINTERACTION_VYBRATION_INTENSITY_TYPE)) value = 430; } else { - if (vibrationIntensityType.equalsIgnoreCase("RINGING")) + if (vibrationIntensityType.equalsIgnoreCase(RINGING_VYBRATION_INTENSITY_TYPE)) value = 3; - else if (vibrationIntensityType.equalsIgnoreCase("NOTIFICATIONS")) + else if (vibrationIntensityType.equalsIgnoreCase(NOTIFICATIONS_VYBRATION_INTENSITY_TYPE)) value = 3; - else if (vibrationIntensityType.equalsIgnoreCase("TOUCHINTERACTION")) + else if (vibrationIntensityType.equalsIgnoreCase(TOUCHINTERACTION_VYBRATION_INTENSITY_TYPE)) value = 1; } - } else { - if (vibrationIntensityType.equalsIgnoreCase("RINGING")) + /*} else { + if (vibrationIntensityType.equalsIgnoreCase(RINGING_VYBRATION_INTENSITY_TYPE)) value = 2; - else if (vibrationIntensityType.equalsIgnoreCase("NOTIFICATIONS")) + else if (vibrationIntensityType.equalsIgnoreCase(NOTIFICATIONS_VYBRATION_INTENSITY_TYPE)) value = 2; - else if (vibrationIntensityType.equalsIgnoreCase("TOUCHINTERACTION")) + else if (vibrationIntensityType.equalsIgnoreCase(TOUCHINTERACTION_VYBRATION_INTENSITY_TYPE)) value = 1; - } + }*/ } } catch (Exception e) { //Log.e("VibrationIntensityPreference.getValueVDP", Log.getStackTraceString(e)); @@ -227,8 +230,8 @@ public void writeToParcel(Parcel dest, int flags) super(superState); } - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator<>() { public VibrationIntensityPreference.SavedState createFromParcel(Parcel in) { return new VibrationIntensityPreference.SavedState(in); @@ -244,7 +247,7 @@ public VibrationIntensityPreference.SavedState[] newArray(int size) static int getMaxValue(String vibrationIntensityType) { int maxValue; - if (Build.VERSION.SDK_INT < 33) { + //if (Build.VERSION.SDK_INT < 33) { if (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) maxValue = 5; else if (PPApplication.deviceIsOnePlus) { @@ -253,30 +256,30 @@ else if (PPApplication.deviceIsOnePlus) { } else maxValue = 3; - } else - maxValue = 3; + //} else + // maxValue = 3; return maxValue; } static int getMinValue(String vibrationIntensityType) { int minValue; - if (Build.VERSION.SDK_INT < 33) { + //if (Build.VERSION.SDK_INT < 33) { if (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) minValue = 0; else if (PPApplication.deviceIsOnePlus) { - if (vibrationIntensityType.equalsIgnoreCase("RINGING")) + if (vibrationIntensityType.equalsIgnoreCase(RINGING_VYBRATION_INTENSITY_TYPE)) minValue = 800; - else if (vibrationIntensityType.equalsIgnoreCase("NOTIFICATIONS")) + else if (vibrationIntensityType.equalsIgnoreCase(NOTIFICATIONS_VYBRATION_INTENSITY_TYPE)) minValue = 800; - else if (vibrationIntensityType.equalsIgnoreCase("TOUCHINTERACTION")) + else if (vibrationIntensityType.equalsIgnoreCase(TOUCHINTERACTION_VYBRATION_INTENSITY_TYPE)) minValue = 1100; else minValue = 800; } else minValue = 0; - } else - minValue = 0; + //} else + // minValue = 0; return minValue; } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VibrationIntensityPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VibrationIntensityPreferenceFragment.java index f67caff463..3c6ccad14d 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VibrationIntensityPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VibrationIntensityPreferenceFragment.java @@ -39,10 +39,10 @@ protected View onCreateDialogView(@NonNull Context context) protected void onBindDialogView(@NonNull View view) { super.onBindDialogView(view); - SwitchCompat noChangeChBox = view.findViewById(R.id.volumePrefDialogNoChange); + SwitchCompat noChangeChBox = view.findViewById(R.id.vibrationIntensityPrefDialogNoChange); - seekBar = view.findViewById(R.id.volumePrefDialogSeekbar); - valueText = view.findViewById(R.id.volumePrefDialogValueText); + seekBar = view.findViewById(R.id.vibrationIntensityPrefDialogSeekbar); + valueText = view.findViewById(R.id.vibrationIntensityPrefDialogValueText); seekBar.setKeyProgressIncrement(preference.stepSize); seekBar.setMax(preference.maximumValue); @@ -58,6 +58,8 @@ protected void onBindDialogView(@NonNull View view) { valueText.setEnabled((preference.noChange == 0) /*&& (preference.sharedProfile == 0)*/); seekBar.setEnabled((preference.noChange == 0) /*&& (preference.sharedProfile == 0)*/); + //setVibrationIntensityFromSeekBar(preference.value); + seekBar.setOnSeekBarChangeListener(this); if (noChangeChBox != null) noChangeChBox.setOnCheckedChangeListener(this); @@ -77,7 +79,7 @@ public void onDialogClosed(boolean positiveResult) { @Override public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - if (buttonView.getId() == R.id.volumePrefDialogNoChange) { + if (buttonView.getId() == R.id.vibrationIntensityPrefDialogNoChange) { preference.noChange = (isChecked) ? 1 : 0; valueText.setEnabled((preference.noChange == 0) /*&& (preference.sharedProfile == 0)*/); @@ -103,7 +105,9 @@ public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { valueText.setText(String.valueOf(preference.value/* + preference.minimumValue*/)); preference.callChangeListener(preference.getSValue()); - } + }// else { + // setVibrationIntensityFromSeekBar(preference.value); + //} } @Override @@ -113,7 +117,62 @@ public void onStartTrackingTouch(SeekBar seekBar) { @Override public void onStopTrackingTouch(SeekBar seekBar) { + //setVibrationIntensityFromSeekBar(preference.value); + } + /* + private void setVibrationIntensityFromSeekBar(int value) { + if (Build.VERSION.SDK_INT >= 33) { + //noinspection deprecation + Vibrator vibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE); + if ((vibrator != null) && vibrator.hasVibrator()) { + try { + // Vibration intensity is also used + + //if (Build.VERSION.SDK_INT >= 33) { + //noinspection ExtractMethodRecommender + int attribute = VibrationAttributes.USAGE_NOTIFICATION; + if (preference.vibrationIntensityType != null) { + if (preference.vibrationIntensityType.equalsIgnoreCase( + VibrationIntensityPreference.RINGING_VYBRATION_INTENSITY_TYPE)) + attribute = VibrationAttributes.USAGE_RINGTONE; + else if (preference.vibrationIntensityType.equalsIgnoreCase( + VibrationIntensityPreference.NOTIFICATIONS_VYBRATION_INTENSITY_TYPE)) + //noinspection DataFlowIssue + attribute = VibrationAttributes.USAGE_NOTIFICATION; + else if (preference.vibrationIntensityType.equalsIgnoreCase( + VibrationIntensityPreference.TOUCHINTERACTION_VYBRATION_INTENSITY_TYPE)) + attribute = VibrationAttributes.USAGE_TOUCH; + } + vibrator.vibrate(VibrationEffect.createOneShot(300, VibrationEffect.DEFAULT_AMPLITUDE), + VibrationAttributes.createForUsage(attribute)); +// } else { +// //noinspection ExtractMethodRecommender +// int attribute = AudioAttributes.USAGE_NOTIFICATION; +// if (preference.vibrationIntensityType != null) { +// if (preference.vibrationIntensityType.equalsIgnoreCase( +// VibrationIntensityPreference.RINGING_VYBRATION_INTENSITY_TYPE)) +// attribute = AudioAttributes.USAGE_NOTIFICATION_RINGTONE; +// else if (preference.vibrationIntensityType.equalsIgnoreCase( +// VibrationIntensityPreference.NOTIFICATIONS_VYBRATION_INTENSITY_TYPE)) +// //noinspection DataFlowIssue +// attribute = AudioAttributes.USAGE_NOTIFICATION; +// else if (preference.vibrationIntensityType.equalsIgnoreCase( +// VibrationIntensityPreference.TOUCHINTERACTION_VYBRATION_INTENSITY_TYPE)) +// //noinspection DataFlowIssue +// attribute = AudioAttributes.USAGE_NOTIFICATION; +// } +// vibrator.vibrate(VibrationEffect.createOneShot(300, VibrationEffect.DEFAULT_AMPLITUDE), +// new AudioAttributes.Builder() +// .setUsage(attribute) +// .build()); +// } + } catch (Exception e) { + PPApplicationStatic.recordException(e); + } + } + } } + */ } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VolumeDialogPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VolumeDialogPreference.java index bcba50efa5..aa180d5223 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VolumeDialogPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VolumeDialogPreference.java @@ -363,8 +363,8 @@ public void writeToParcel(Parcel dest, int flags) super(superState); } - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator<>() { public VolumeDialogPreference.SavedState createFromParcel(Parcel in) { return new VolumeDialogPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VolumeDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VolumeDialogPreferenceFragment.java index 8361aaa284..b42d511134 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VolumeDialogPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/VolumeDialogPreferenceFragment.java @@ -18,7 +18,6 @@ import androidx.annotation.NonNull; import androidx.appcompat.widget.AppCompatSpinner; import androidx.appcompat.widget.SwitchCompat; -import androidx.core.content.ContextCompat; import androidx.preference.PreferenceDialogFragmentCompat; import java.lang.ref.WeakReference; @@ -63,14 +62,14 @@ protected void onBindDialogView(@NonNull View view) { operatorSpinner = view.findViewById(R.id.volumePrefDialogVolumesSensorOperator); if (preference.forVolumesSensor == 1) { - HighlightedSpinnerAdapter voiceSpinnerAdapter = new HighlightedSpinnerAdapter( + PPSpinnerAdapter voiceSpinnerAdapter = new PPSpinnerAdapter( (EventsPrefsActivity) context, - R.layout.spinner_highlighted, + R.layout.ppp_spinner, getResources().getStringArray(R.array.volumesSensorOperatorArray)); - voiceSpinnerAdapter.setDropDownViewResource(R.layout.spinner_highlighted_dropdown); + voiceSpinnerAdapter.setDropDownViewResource(R.layout.ppp_spinner_dropdown); operatorSpinner.setAdapter(voiceSpinnerAdapter); operatorSpinner.setPopupBackgroundResource(R.drawable.popupmenu_background); - operatorSpinner.setBackgroundTintList(ContextCompat.getColorStateList(context/*getBaseContext()*/, R.color.highlighted_spinner_all)); +// operatorSpinner.setBackgroundTintList(ContextCompat.getColorStateList(context/*getBaseContext()*/, R.color.spinner_control_color)); } seekBar = view.findViewById(R.id.volumePrefDialogSeekbar); @@ -316,49 +315,53 @@ public void onStopTrackingTouch(SeekBar seekBar) { } try { - if (_preference.volumeType.equalsIgnoreCase("RINGTONE")) { - Uri _ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE); - if ((_ringtoneUri == null) || (_ringtoneUri.toString().equals(TonesHandler.RINGING_TONE_URI_NONE))) + if (_preference.volumeType != null) { + if (_preference.volumeType.equalsIgnoreCase("RINGTONE")) { + Uri _ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE); + if ((_ringtoneUri == null) || (_ringtoneUri.toString().equals(TonesHandler.RINGING_TONE_URI_NONE))) + mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); + else + mediaPlayer = MediaPlayer.create(appContext, _ringtoneUri); + } else if (_preference.volumeType.equalsIgnoreCase("NOTIFICATION")) { + Uri _ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_NOTIFICATION); + if ((_ringtoneUri == null) || (_ringtoneUri.toString().equals(TonesHandler.NOTIFICATION_TONE_URI_NONE))) + mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); + else + mediaPlayer = MediaPlayer.create(appContext, _ringtoneUri); + } else if (_preference.volumeType.equalsIgnoreCase("MEDIA")) { + Uri _ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE); + if ((_ringtoneUri == null) || (_ringtoneUri.toString().equals(TonesHandler.RINGING_TONE_URI_NONE))) + mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); + else + mediaPlayer = MediaPlayer.create(appContext, _ringtoneUri); + } else if (_preference.volumeType.equalsIgnoreCase("ALARM")) { + Uri _ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_ALARM); + if ((_ringtoneUri == null) || (_ringtoneUri.toString().equals(TonesHandler.ALARM_TONE_URI_NONE))) + mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); + else + mediaPlayer = MediaPlayer.create(appContext, _ringtoneUri); + } else if (_preference.volumeType.equalsIgnoreCase("SYSTEM")) mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); - else - mediaPlayer = MediaPlayer.create(appContext, _ringtoneUri); - } else if (_preference.volumeType.equalsIgnoreCase("NOTIFICATION")) { - Uri _ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_NOTIFICATION); - if ((_ringtoneUri == null) || (_ringtoneUri.toString().equals(TonesHandler.NOTIFICATION_TONE_URI_NONE))) + else if (_preference.volumeType.equalsIgnoreCase("VOICE")) { + Uri _ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE); + if ((_ringtoneUri == null) || (_ringtoneUri.toString().equals(TonesHandler.RINGING_TONE_URI_NONE))) + mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); + else + mediaPlayer = MediaPlayer.create(appContext, _ringtoneUri); + } else if (_preference.volumeType.equalsIgnoreCase("DTMF")) mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); - else - mediaPlayer = MediaPlayer.create(appContext, _ringtoneUri); - } else if (_preference.volumeType.equalsIgnoreCase("MEDIA")) { - Uri _ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE); - if ((_ringtoneUri == null) || (_ringtoneUri.toString().equals(TonesHandler.RINGING_TONE_URI_NONE))) + else if (_preference.volumeType.equalsIgnoreCase("ACCESSIBILITY")) mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); - else - mediaPlayer = MediaPlayer.create(appContext, _ringtoneUri); - } else if (_preference.volumeType.equalsIgnoreCase("ALARM")) { - Uri _ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_ALARM); - if ((_ringtoneUri == null) || (_ringtoneUri.toString().equals(TonesHandler.ALARM_TONE_URI_NONE))) + else if (_preference.volumeType.equalsIgnoreCase("BLUETOOTHSCO")) { + Uri _ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE); + if ((_ringtoneUri == null) || (_ringtoneUri.toString().equals(TonesHandler.RINGING_TONE_URI_NONE))) + mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); + else + mediaPlayer = MediaPlayer.create(appContext, _ringtoneUri); + } else mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); - else - mediaPlayer = MediaPlayer.create(appContext, _ringtoneUri); - } else if (_preference.volumeType.equalsIgnoreCase("SYSTEM")) - mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); - else if (_preference.volumeType.equalsIgnoreCase("VOICE")) { - Uri _ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE); - if ((_ringtoneUri == null) || (_ringtoneUri.toString().equals(TonesHandler.RINGING_TONE_URI_NONE))) - mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); - else - mediaPlayer = MediaPlayer.create(appContext, _ringtoneUri); - } else if (_preference.volumeType.equalsIgnoreCase("DTMF")) - mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); - else if (_preference.volumeType.equalsIgnoreCase("ACCESSIBILITY")) - mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); - else if (_preference.volumeType.equalsIgnoreCase("BLUETOOTHSCO")) { - Uri _ringtoneUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE); - if ((_ringtoneUri == null) || (_ringtoneUri.toString().equals(TonesHandler.RINGING_TONE_URI_NONE))) - mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); - else - mediaPlayer = MediaPlayer.create(appContext, _ringtoneUri); - } else + } + else mediaPlayer = MediaPlayer.create(appContext, R.raw.volume_change_notif); if (mediaPlayer != null) { @@ -420,7 +423,7 @@ public void run() { @Override public void onItemSelected(AdapterView parent, View view, int position, long id) { if (preference.forVolumesSensor == 1) { - ((HighlightedSpinnerAdapter)operatorSpinner.getAdapter()).setSelection(position); + ((PPSpinnerAdapter)operatorSpinner.getAdapter()).setSelection(position); preference.sensorOperator = Integer.parseInt(preference.operatorValues[position]); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WakelockTags.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WakelockTags.java index bd120ec54e..02b629577e 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WakelockTags.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WakelockTags.java @@ -80,6 +80,8 @@ class WakelockTags { static final String WAKELOCK_TAG_VPNNetworkCallback_doConnection_1 = PPApplication.PACKAGE_NAME + ":VPNNetworkCallback_doConnection_1"; static final String WAKELOCK_TAG_WifiAPStateChangeBroadcastReceiver_onReceive = PPApplication.PACKAGE_NAME + ":WifiAPStateChangeBroadcastReceiver_onReceive"; static final String WAKELOCK_TAG_WifiStateChangedBroadcastReceiver_onReceive = PPApplication.PACKAGE_NAME + ":WifiStateChangedBroadcastReceiver_onReceive"; + static final String WAKELOCK_TAG_ActivateProfileHelper_screenOff = PPApplication.PACKAGE_NAME + ":ActivateProfileHelper_screenOff"; + static final String WAKELOCK_TAG_ActivateProfileHelper_screenOn = PPApplication.PACKAGE_NAME + ":ActivateProfileHelper_screenOn"; private WakelockTags() { // private constructor to prevent instantiation diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WallpaperFolderPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WallpaperFolderPreference.java index fc720dd59a..4fffb1a491 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WallpaperFolderPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WallpaperFolderPreference.java @@ -147,21 +147,23 @@ void setWallpaperFolder(String newWallpaperFolder) void startGallery() { - Intent intent; + Intent intent = null; boolean _ok = false; try { if (Build.VERSION.SDK_INT >= 29) { StorageManager sm = (StorageManager) prefContext.getSystemService(Context.STORAGE_SERVICE); - intent = sm.getPrimaryStorageVolume().createOpenDocumentTreeIntent(); + if (sm != null) + intent = sm.getPrimaryStorageVolume().createOpenDocumentTreeIntent(); } else { intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE); } - // not supported by ACTION_OPEN_DOCUMENT_TREE - //intent.putExtra(Intent.EXTRA_LOCAL_ONLY, false); + if (intent != null) { + // not supported by ACTION_OPEN_DOCUMENT_TREE + //intent.putExtra(Intent.EXTRA_LOCAL_ONLY, false); - intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); - intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); + intent.addFlags(Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); + intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); boolean ok = false; if (!(wallpaperFolder.isEmpty() || wallpaperFolder.equals("-"))) { @@ -184,8 +186,9 @@ void startGallery() } } - ((Activity)prefContext).startActivityForResult(intent, RESULT_GET_FOLDER); - _ok = true; + ((Activity) prefContext).startActivityForResult(intent, RESULT_GET_FOLDER); + _ok = true; + } } catch (Exception e) { //PPApplicationStatic.recordException(e); } @@ -205,6 +208,7 @@ void startGallery() true, true, false, false, true, + false, (Activity) prefContext ); @@ -244,8 +248,8 @@ public void writeToParcel(Parcel dest, int flags) super(superState); } - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator<>() { public WallpaperFolderPreference.SavedState createFromParcel(Parcel in) { return new WallpaperFolderPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WallpaperViewPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WallpaperViewPreference.java index f0f366ba5a..aaa3dba3de 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WallpaperViewPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WallpaperViewPreference.java @@ -225,8 +225,8 @@ public void writeToParcel(Parcel dest, int flags) super(superState); } - public static final Creator CREATOR = - new Creator() { + public static final Creator CREATOR = + new Creator<>() { public WallpaperViewPreference.SavedState createFromParcel(Parcel in) { return new WallpaperViewPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiApManager.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiApManager.java index 14d1048c99..d39ce6ee04 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiApManager.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiApManager.java @@ -128,7 +128,10 @@ static boolean isWifiAPEnabledA30(Context context) { enabled = adapter.getWifiApEnabledState() == WifiManager.WIFI_AP_STATE_ENABLED; return enabled;*/ WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); - return wifiManager.isWifiApEnabled(); + if (wifiManager != null) + return wifiManager.isWifiApEnabled(); + else + return false; } catch (Throwable e) { //Log.e("WifiApManager.isWifiAPEnabledA30", Log.getStackTraceString(e)); PPApplicationStatic.recordException(e); @@ -259,7 +262,10 @@ static class MyOnStartTetheringCallback extends MyOnStartTetheringCallbackAbstra static boolean canExploitWifiTethering30(Context context) { try { WifiManager wifiManager = (WifiManager) context.getApplicationContext().getSystemService(Context.WIFI_SERVICE); - wifiManager.isWifiApEnabled(); + if (wifiManager != null) + wifiManager.isWifiApEnabled(); + else + return false; } catch (Throwable e) { return false; } @@ -285,12 +291,15 @@ static boolean canExploitWifiTethering30(Context context) { } try { - Method declaredMethod = connectivityManager.getClass().getDeclaredMethod("startTethering", - new Class[]{Integer.TYPE, Boolean.TYPE, myOnStartTetheringCallbackAbstractObjCls, Handler.class}); - //noinspection ConstantConditions - if (declaredMethod == null) { + if (connectivityManager != null) { + Method declaredMethod = connectivityManager.getClass().getDeclaredMethod("startTethering", + new Class[]{Integer.TYPE, Boolean.TYPE, myOnStartTetheringCallbackAbstractObjCls, Handler.class}); + //noinspection ConstantConditions + if (declaredMethod == null) { + return false; + } + } else return false; - } } catch (Exception e) { return false; } @@ -361,14 +370,16 @@ static private void _startTethering30(Context context, return; } try { - Method declaredMethod = connectivityManager.getClass().getDeclaredMethod("startTethering", - new Class[]{Integer.TYPE, Boolean.TYPE, myOnStartTetheringCallbackAbstractObjCls, Handler.class}); - //noinspection ConstantConditions - if (declaredMethod == null) { - //Log.e("WifiApManager._startTethering30", "startTetheringMethod is null"); - return; + if (connectivityManager != null) { + Method declaredMethod = connectivityManager.getClass().getDeclaredMethod("startTethering", + new Class[]{Integer.TYPE, Boolean.TYPE, myOnStartTetheringCallbackAbstractObjCls, Handler.class}); + //noinspection ConstantConditions + if (declaredMethod == null) { + //Log.e("WifiApManager._startTethering30", "startTetheringMethod is null"); + return; + } + declaredMethod.invoke(connectivityManager, new Object[]{0, Boolean.FALSE, myOnStartTetheringCallbackAbstractObj, handler}); } - declaredMethod.invoke(connectivityManager, new Object[]{0, Boolean.FALSE, myOnStartTetheringCallbackAbstractObj, handler}); } catch (Exception e) { //Log.e("WifiApManager._startTethering30 (3)", Log.getStackTraceString(e)); PPApplicationStatic.recordException(e); @@ -382,12 +393,14 @@ static private void _startTethering30(Context context, static void stopTethering30(Context context) { ConnectivityManager connectivityManager = context.getApplicationContext().getSystemService(ConnectivityManager.class); try { - Method declaredMethod = connectivityManager.getClass().getDeclaredMethod("stopTethering", new Class[]{Integer.TYPE}); - //noinspection ConstantConditions - if (declaredMethod == null) { - return; + if (connectivityManager != null) { + Method declaredMethod = connectivityManager.getClass().getDeclaredMethod("stopTethering", new Class[]{Integer.TYPE}); + //noinspection ConstantConditions + if (declaredMethod == null) { + return; + } + declaredMethod.invoke(connectivityManager, new Object[]{0}); } - declaredMethod.invoke(connectivityManager, new Object[]{0}); } catch (Exception e) { PPApplicationStatic.recordException(e); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiNetworkCallback.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiNetworkCallback.java index 4487925529..336802acd5 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiNetworkCallback.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiNetworkCallback.java @@ -198,11 +198,12 @@ static void _doConnection(Context appContext, boolean forCapabilities) { // start events handler -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] WifiNetworkCallback._doConnection", "sensorType=SENSOR_TYPE_RADIO_SWITCH"); EventsHandler eventsHandler = new EventsHandler(appContext); if (forCapabilities) { +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] WifiNetworkCallback._doConnection", "SENSOR_TYPE_RADIO_SWITCH"); eventsHandler.handleEvents(new int[]{EventsHandler.SENSOR_TYPE_RADIO_SWITCH}); } else { +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] WifiNetworkCallback._doConnection", "SENSOR_TYPE_RADIO_SWITCH,SENSOR_TYPE_WIFI_CONNECTION"); eventsHandler.handleEvents(new int[]{ EventsHandler.SENSOR_TYPE_RADIO_SWITCH, EventsHandler.SENSOR_TYPE_WIFI_CONNECTION}); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiSSIDPreference.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiSSIDPreference.java index fbf7e11826..3a868748ca 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiSSIDPreference.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiSSIDPreference.java @@ -229,7 +229,7 @@ public void writeToParcel(Parcel dest, int flags) } public static final Creator CREATOR = - new Creator() { + new Creator<>() { public WifiSSIDPreference.SavedState createFromParcel(Parcel in) { return new WifiSSIDPreference.SavedState(in); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiSSIDPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiSSIDPreferenceFragment.java index 349ae97559..6c2a34d5dd 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiSSIDPreferenceFragment.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiSSIDPreferenceFragment.java @@ -89,6 +89,7 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { dataLinearLayout = layout.findViewById(R.id.wifi_ssid_pref_dlg_linla_data); addIcon = layout.findViewById(R.id.wifi_ssid_pref_dlg_addIcon); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(addIcon, getString(R.string.wifi_ssid_pref_dlg_add_button_tooltip)); addIcon.setOnClickListener(v -> { String ssid = SSIDName.getText().toString(); @@ -106,7 +107,8 @@ public Dialog onCreateDialog(Bundle savedInstanceState) { }); SSIDName = layout.findViewById(R.id.wifi_ssid_pref_dlg_bt_name); - SSIDName.setBackgroundTintList(ContextCompat.getColorStateList(prefContext, R.color.highlighted_spinner_all)); + //noinspection DataFlowIssue + SSIDName.setBackgroundTintList(ContextCompat.getColorStateList(prefContext, R.color.edit_text_color)); SSIDName.addTextChangedListener(new TextWatcher() { @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { @@ -119,12 +121,12 @@ public void onTextChanged(CharSequence s, int start, int before, int count) { @Override public void afterTextChanged(Editable s) { GlobalGUIRoutines.setImageButtonEnabled(!SSIDName.getText().toString().isEmpty(), - addIcon, prefContext.getApplicationContext()); + addIcon, prefContext); } }); GlobalGUIRoutines.setImageButtonEnabled(!SSIDName.getText().toString().isEmpty(), - addIcon, prefContext.getApplicationContext()); + addIcon, prefContext); SSIDListView = layout.findViewById(R.id.wifi_ssid_pref_dlg_listview); emptyList = layout.findViewById(R.id.wifi_ssid_pref_dlg_empty); @@ -154,6 +156,7 @@ public void afterTextChanged(Editable s) { */ final ImageView helpIcon = layout.findViewById(R.id.wifi_ssid_pref_dlg_helpIcon); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(helpIcon, getString(R.string.help_button_tooltip)); helpIcon.setOnClickListener(v -> { String helpString = getString(R.string.event_preference_wifi_ssidName_type)+StringConstants.STR_DOUBLE_NEWLINE+ @@ -166,6 +169,7 @@ public void afterTextChanged(Editable s) { }); ImageView changeSelectionIcon = layout.findViewById(R.id.wifi_ssid_pref_dlg_changeSelection); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(changeSelectionIcon, getString(R.string.wifi_ssid_pref_dlg_select_button_tooltip)); changeSelectionIcon.setOnClickListener(view1 -> { if (getActivity() != null) @@ -200,6 +204,7 @@ public void afterTextChanged(Editable s) { }); rescanButton = layout.findViewById(R.id.wifi_ssid_pref_dlg_rescanButton); + //noinspection DataFlowIssue rescanButton.setOnClickListener(v -> { if (Permissions.grantWifiScanDialogPermissions(prefContext)) refreshListView(true, ""); @@ -208,6 +213,7 @@ public void afterTextChanged(Editable s) { locationSystemSettingsRelLa = layout.findViewById(R.id.wifi_ssid_pref_dlg_locationSystemSettingsRelLa); locationEnabledStatusTextView = layout.findViewById(R.id.wifi_ssid_pref_dlg_locationEnableStatus); locationSystemSettingsButton = layout.findViewById(R.id.wifi_ssid_pref_dlg_locationSystemSettingsButton); + //noinspection DataFlowIssue TooltipCompat.setTooltipText(locationSystemSettingsButton, getString(R.string.location_settings_button_tooltip)); mDialog.setOnShowListener(dialog -> { @@ -444,6 +450,7 @@ void setLocationEnableStatus() { true, true, false, false, true, + false, getActivity() ); @@ -571,6 +578,7 @@ void showEditMenu(View view, WifiSSIDData wifiSSID) { true, true, false, false, true, + false, getActivity() ); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiScanWorker.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiScanWorker.java index 13ea7739b5..b1e95e5799 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiScanWorker.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiScanWorker.java @@ -65,7 +65,7 @@ public Result doWork() { // application is not started return Result.success(); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, context).allowed != + if (EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false, context).preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) { cancelWork(context, false/*, null*/); // if (PPApplicationStatic.logEnabled()) { @@ -248,7 +248,7 @@ static void scheduleWork(Context context, final boolean shortInterval) { // PPApplicationStatic.logE("[SHEDULE_WORK] WifiScanWorker.scheduleWork", "shortInterval="+shortInterval); // PPApplicationStatic.logE("[RESTART_WIFI_SCANNER] WifiScanWorker.scheduleWork", "shortInterval="+shortInterval); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, context).allowed + if (EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED) { if (shortInterval) { _cancelWork(context, false); @@ -415,7 +415,7 @@ static void initialize(Context context, boolean clearScanResult) setScanRequest(context, false); setWaitForResults(context, false); - if (EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, context).allowed != + if (EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false, context).preferenceAllowed != PreferenceAllowed.PREFERENCE_ALLOWED) return; diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiScanner.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiScanner.java index 753b144979..865688dec5 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiScanner.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiScanner.java @@ -69,7 +69,7 @@ void doScan(boolean fromDialog) { WifiScanWorker.fillWifiConfigurationList(context/*, false*/); - boolean canScan = EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, context).allowed == PreferenceAllowed.PREFERENCE_ALLOWED; + boolean canScan = EventStatic.isEventPreferenceAllowed(EventPreferencesWifi.PREF_EVENT_WIFI_ENABLED, false, context).preferenceAllowed == PreferenceAllowed.PREFERENCE_ALLOWED; if (canScan) { if (!ApplicationPreferences.applicationEventWifiScanIgnoreHotspot) { if (Build.VERSION.SDK_INT < 30) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiStateChangedBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiStateChangedBroadcastReceiver.java index d38e69e914..6f3bd6bc04 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiStateChangedBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiStateChangedBroadcastReceiver.java @@ -121,7 +121,7 @@ public void onReceive(Context context, Intent intent) { // start events handler -// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] WifiStateChangedBroadcastReceiver.onReceive", "sensorType=SENSOR_TYPE_RADIO_SWITCH"); +// PPApplicationStatic.logE("[EVENTS_HANDLER_CALL] WifiStateChangedBroadcastReceiver.onReceive", "SENSOR_TYPE_RADIO_SWITCH,SENSOR_TYPE_WIFI_STATE,SENSOR_TYPE_WIFI_CONNECTION"); EventsHandler eventsHandler = new EventsHandler(appContext); eventsHandler.handleEvents(new int[]{ EventsHandler.SENSOR_TYPE_RADIO_SWITCH, diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiTetheringCallbackMaker.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiTetheringCallbackMaker.java index 0eda3d0c42..4bbe64fddf 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiTetheringCallbackMaker.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/WifiTetheringCallbackMaker.java @@ -13,8 +13,6 @@ import com.android.dx.MethodId; import com.android.dx.TypeId; -import java.io.IOException; - public final class WifiTetheringCallbackMaker { @SuppressWarnings({"FieldCanBeLocal", "unused"}) @@ -46,7 +44,8 @@ public WifiTetheringCallbackMaker(Context context, invokeOnStartTetheringCallback(typeIdOfLTetheringCallback, typeIdOfOnStartTetheringCallback); try { this.tetheringCallback = this.dexMaker.generateAndLoad(WifiTetheringCallbackMaker.class.getClassLoader(), this.context.getCodeCacheDir()).loadClass("TetheringCallback"); - } catch (IOException | ClassNotFoundException e2) { + //} catch (IOException | ClassNotFoundException e2) { + } catch (Exception e2) { Log.e("WifiTetheringCallbackMaker.WifiTetheringCallbackMaker", Log.getStackTraceString(e2)); } } diff --git a/phoneProfilesPlus/src/main/res/color/highlighted_spinner_all.xml b/phoneProfilesPlus/src/main/res/color/edit_text_color.xml similarity index 89% rename from phoneProfilesPlus/src/main/res/color/highlighted_spinner_all.xml rename to phoneProfilesPlus/src/main/res/color/edit_text_color.xml index 29101d6568..948d09aeee 100644 --- a/phoneProfilesPlus/src/main/res/color/highlighted_spinner_all.xml +++ b/phoneProfilesPlus/src/main/res/color/edit_text_color.xml @@ -1,4 +1,5 @@ + diff --git a/phoneProfilesPlus/src/main/res/color/mp_body_color.xml b/phoneProfilesPlus/src/main/res/color/mp_body_color.xml index 5198b4a00f..f6a96def94 100644 --- a/phoneProfilesPlus/src/main/res/color/mp_body_color.xml +++ b/phoneProfilesPlus/src/main/res/color/mp_body_color.xml @@ -6,6 +6,6 @@ /> \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/color/highlighted_spinner_all_editor.xml b/phoneProfilesPlus/src/main/res/color/spinner_control_color.xml similarity index 74% rename from phoneProfilesPlus/src/main/res/color/highlighted_spinner_all_editor.xml rename to phoneProfilesPlus/src/main/res/color/spinner_control_color.xml index 33357f39b0..948d09aeee 100644 --- a/phoneProfilesPlus/src/main/res/color/highlighted_spinner_all_editor.xml +++ b/phoneProfilesPlus/src/main/res/color/spinner_control_color.xml @@ -1,7 +1,8 @@ + - - + - + - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_clear_notifications.webp b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_clear_notifications.webp new file mode 100644 index 0000000000..a87ea9b1e2 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_clear_notifications.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_generate_notification.webp b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_generate_notification.webp index 97d985ee48..95e6cb6b45 100644 Binary files a/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_generate_notification.webp and b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_generate_notification.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_phonecalls.webp b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_phonecalls.webp deleted file mode 100644 index 9b935ada1b..0000000000 Binary files a/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_phonecalls.webp and /dev/null differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_screen_night_light.webp b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_screen_night_light.webp new file mode 100644 index 0000000000..eb8c50a8f9 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_screen_night_light.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_screen_night_light_pref.webp b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_screen_night_light_pref.webp new file mode 100644 index 0000000000..e865ab96e8 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_screen_night_light_pref.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_screen_on_off.webp b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_screen_on_off.webp new file mode 100644 index 0000000000..d7c8582b4c Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_screen_on_off.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_screen_on_permanent.webp b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_screen_on_permanent.webp index d7c8582b4c..098e27b4b4 100644 Binary files a/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_screen_on_permanent.webp and b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_screen_on_permanent.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_send_sms.webp b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_send_sms.webp new file mode 100644 index 0000000000..c1aa440f57 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_profile_pref_send_sms.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_spinner.webp b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_spinner.webp new file mode 100644 index 0000000000..d30bc8e6ea Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_spinner.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_spinner_small.webp b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_spinner_small.webp new file mode 100644 index 0000000000..9481cf6ec9 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_spinner_small.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_title_back.png b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_title_back.png new file mode 100644 index 0000000000..60dda29141 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xhdpi/ic_title_back.png differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_clear_notifications.webp b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_clear_notifications.webp new file mode 100644 index 0000000000..98b472b2f5 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_clear_notifications.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_generate_notification.webp b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_generate_notification.webp index 8bdac6923e..7678535501 100644 Binary files a/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_generate_notification.webp and b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_generate_notification.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_phonecalls.webp b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_phonecalls.webp deleted file mode 100644 index ee0e109f71..0000000000 Binary files a/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_phonecalls.webp and /dev/null differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_screen_night_light.webp b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_screen_night_light.webp new file mode 100644 index 0000000000..b3e40a3a83 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_screen_night_light.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_screen_night_light_pref.webp b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_screen_night_light_pref.webp new file mode 100644 index 0000000000..dd955458e5 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_screen_night_light_pref.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_screen_on_off.webp b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_screen_on_off.webp new file mode 100644 index 0000000000..4b7e9d1552 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_screen_on_off.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_screen_on_permanent.webp b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_screen_on_permanent.webp index 4b7e9d1552..2145f77951 100644 Binary files a/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_screen_on_permanent.webp and b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_screen_on_permanent.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_send_sms.webp b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_send_sms.webp new file mode 100644 index 0000000000..77ce83a46a Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_profile_pref_send_sms.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_spinner.webp b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_spinner.webp new file mode 100644 index 0000000000..c5247cbf8c Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_spinner.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_spinner_small.webp b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_spinner_small.webp new file mode 100644 index 0000000000..77f02987a7 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_spinner_small.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_title_back.png b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_title_back.png new file mode 100644 index 0000000000..65dc344a5a Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxhdpi/ic_title_back.png differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_clear_notifications.webp b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_clear_notifications.webp new file mode 100644 index 0000000000..2b82f49e59 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_clear_notifications.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_generate_notification.webp b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_generate_notification.webp index 70e4faae38..850bb76631 100644 Binary files a/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_generate_notification.webp and b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_generate_notification.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_phonecalls.webp b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_phonecalls.webp deleted file mode 100644 index a34a0b703d..0000000000 Binary files a/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_phonecalls.webp and /dev/null differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_screen_night_light.webp b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_screen_night_light.webp new file mode 100644 index 0000000000..f6b42edbcd Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_screen_night_light.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_screen_night_light_pref.webp b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_screen_night_light_pref.webp new file mode 100644 index 0000000000..4a86bade79 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_screen_night_light_pref.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_screen_on_off.webp b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_screen_on_off.webp new file mode 100644 index 0000000000..33e5c20144 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_screen_on_off.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_screen_on_permanent.webp b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_screen_on_permanent.webp index 33e5c20144..64166bb0a2 100644 Binary files a/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_screen_on_permanent.webp and b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_screen_on_permanent.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_send_sms.webp b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_send_sms.webp new file mode 100644 index 0000000000..96059decb5 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_profile_pref_send_sms.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_spinner.webp b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_spinner.webp new file mode 100644 index 0000000000..ac920b610a Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_spinner.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_spinner_small.webp b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_spinner_small.webp new file mode 100644 index 0000000000..6b8e9f1d21 Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_spinner_small.webp differ diff --git a/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_title_back.png b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_title_back.png new file mode 100644 index 0000000000..6405a474ab Binary files /dev/null and b/phoneProfilesPlus/src/main/res/drawable-xxxhdpi/ic_title_back.png differ diff --git a/phoneProfilesPlus/src/main/res/drawable/actionbar_item_background.xml b/phoneProfilesPlus/src/main/res/drawable/actionbar_item_background.xml new file mode 100644 index 0000000000..f365145d03 --- /dev/null +++ b/phoneProfilesPlus/src/main/res/drawable/actionbar_item_background.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/drawable/edit_text_border.xml b/phoneProfilesPlus/src/main/res/drawable/edit_text_border.xml new file mode 100644 index 0000000000..a0a065c466 --- /dev/null +++ b/phoneProfilesPlus/src/main/res/drawable/edit_text_border.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/drawable/editor_ripple_event_status.xml b/phoneProfilesPlus/src/main/res/drawable/editor_ripple_event_status.xml index 2fd17f97ed..0c49529eb3 100644 --- a/phoneProfilesPlus/src/main/res/drawable/editor_ripple_event_status.xml +++ b/phoneProfilesPlus/src/main/res/drawable/editor_ripple_event_status.xml @@ -1,13 +1,32 @@ + - - + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/drawable/editor_ripple_item_right_button.xml b/phoneProfilesPlus/src/main/res/drawable/editor_ripple_item_right_button.xml index 5fbf1dbcaf..27b069f22b 100644 --- a/phoneProfilesPlus/src/main/res/drawable/editor_ripple_item_right_button.xml +++ b/phoneProfilesPlus/src/main/res/drawable/editor_ripple_item_right_button.xml @@ -1,13 +1,32 @@ + - - + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/drawable/ic_launcher_monochrome.xml b/phoneProfilesPlus/src/main/res/drawable/ic_launcher_monochrome.xml index 4dc60b94f1..ac6c6b6059 100644 --- a/phoneProfilesPlus/src/main/res/drawable/ic_launcher_monochrome.xml +++ b/phoneProfilesPlus/src/main/res/drawable/ic_launcher_monochrome.xml @@ -4,19 +4,13 @@ android:height="72dp" android:viewportWidth="496" android:viewportHeight="496"> - - - - + + diff --git a/phoneProfilesPlus/src/main/res/drawable/listview_item_background.xml b/phoneProfilesPlus/src/main/res/drawable/listview_item_background.xml index a20241a88b..7233693df0 100644 --- a/phoneProfilesPlus/src/main/res/drawable/listview_item_background.xml +++ b/phoneProfilesPlus/src/main/res/drawable/listview_item_background.xml @@ -1,10 +1,29 @@ + - - + + - \ No newline at end of file + + + + + + + + + + + + + + + + + + + diff --git a/phoneProfilesPlus/src/main/res/drawable/listview_item_background_no_ripple.xml b/phoneProfilesPlus/src/main/res/drawable/listview_item_background_no_ripple.xml deleted file mode 100644 index b9f5bb6b09..0000000000 --- a/phoneProfilesPlus/src/main/res/drawable/listview_item_background_no_ripple.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/drawable/listview_item_background_selector_no_ripple.xml b/phoneProfilesPlus/src/main/res/drawable/listview_item_background_selector_no_ripple.xml deleted file mode 100644 index d32f5b80a9..0000000000 --- a/phoneProfilesPlus/src/main/res/drawable/listview_item_background_selector_no_ripple.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/phoneProfilesPlus/src/main/res/drawable/popup_menu_item_background.xml b/phoneProfilesPlus/src/main/res/drawable/popup_menu_item_background.xml index 6c5fb68ab2..3e0e4c1b8c 100644 --- a/phoneProfilesPlus/src/main/res/drawable/popup_menu_item_background.xml +++ b/phoneProfilesPlus/src/main/res/drawable/popup_menu_item_background.xml @@ -1,10 +1,28 @@ + - - + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/drawable/popup_menu_item_background_no_ripple.xml b/phoneProfilesPlus/src/main/res/drawable/popup_menu_item_background_no_ripple.xml deleted file mode 100644 index 351952e8fa..0000000000 --- a/phoneProfilesPlus/src/main/res/drawable/popup_menu_item_background_no_ripple.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/drawable/popup_menu_item_background_selector_no_ripple.xml b/phoneProfilesPlus/src/main/res/drawable/popup_menu_item_background_selector_no_ripple.xml deleted file mode 100644 index d22f1c4a46..0000000000 --- a/phoneProfilesPlus/src/main/res/drawable/popup_menu_item_background_selector_no_ripple.xml +++ /dev/null @@ -1,18 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/phoneProfilesPlus/src/main/res/drawable/popupmenu_background.xml b/phoneProfilesPlus/src/main/res/drawable/popupmenu_background.xml index 1aa710bee6..f83dbff33b 100644 --- a/phoneProfilesPlus/src/main/res/drawable/popupmenu_background.xml +++ b/phoneProfilesPlus/src/main/res/drawable/popupmenu_background.xml @@ -9,7 +9,7 @@ android:right="1dp" android:top="1dp" /> - + diff --git a/phoneProfilesPlus/src/main/res/drawable/popupwindow_background.xml b/phoneProfilesPlus/src/main/res/drawable/popupwindow_background.xml index f35a4a308f..cfda32bdf3 100644 --- a/phoneProfilesPlus/src/main/res/drawable/popupwindow_background.xml +++ b/phoneProfilesPlus/src/main/res/drawable/popupwindow_background.xml @@ -10,7 +10,7 @@ android:right="1dp" android:top="1dp" /> - + diff --git a/phoneProfilesPlus/src/main/res/drawable/pp_alert_button_background.xml b/phoneProfilesPlus/src/main/res/drawable/pp_alert_button_background.xml index 7a689c70ff..c821b45fc3 100644 --- a/phoneProfilesPlus/src/main/res/drawable/pp_alert_button_background.xml +++ b/phoneProfilesPlus/src/main/res/drawable/pp_alert_button_background.xml @@ -14,10 +14,10 @@ + android:bottom="@dimen/button_border_thickness" + android:left="@dimen/button_border_thickness" + android:right="@dimen/button_border_thickness" + android:top="@dimen/button_border_thickness" /> diff --git a/phoneProfilesPlus/src/main/res/drawable/pp_alert_button_background_clicked.xml b/phoneProfilesPlus/src/main/res/drawable/pp_alert_button_background_clicked.xml index 4ccbe64e27..48a810ad4d 100644 --- a/phoneProfilesPlus/src/main/res/drawable/pp_alert_button_background_clicked.xml +++ b/phoneProfilesPlus/src/main/res/drawable/pp_alert_button_background_clicked.xml @@ -14,10 +14,10 @@ + android:bottom="@dimen/button_border_thickness" + android:left="@dimen/button_border_thickness" + android:right="@dimen/button_border_thickness" + android:top="@dimen/button_border_thickness" /> diff --git a/phoneProfilesPlus/src/main/res/drawable/pp_button_background.xml b/phoneProfilesPlus/src/main/res/drawable/pp_button_background.xml index 140835eac3..43442be91b 100644 --- a/phoneProfilesPlus/src/main/res/drawable/pp_button_background.xml +++ b/phoneProfilesPlus/src/main/res/drawable/pp_button_background.xml @@ -4,10 +4,10 @@ + android:bottom="@dimen/button_border_thickness" + android:left="@dimen/button_border_thickness" + android:right="@dimen/button_border_thickness" + android:top="@dimen/button_border_thickness" /> diff --git a/phoneProfilesPlus/src/main/res/drawable/pp_button_background_clicked.xml b/phoneProfilesPlus/src/main/res/drawable/pp_button_background_clicked.xml index 106fdd0c78..a08476b392 100644 --- a/phoneProfilesPlus/src/main/res/drawable/pp_button_background_clicked.xml +++ b/phoneProfilesPlus/src/main/res/drawable/pp_button_background_clicked.xml @@ -4,10 +4,10 @@ + android:bottom="@dimen/button_border_thickness" + android:left="@dimen/button_border_thickness" + android:right="@dimen/button_border_thickness" + android:top="@dimen/button_border_thickness" /> diff --git a/phoneProfilesPlus/src/main/res/drawable/pp_button_background_disabled.xml b/phoneProfilesPlus/src/main/res/drawable/pp_button_background_disabled.xml new file mode 100644 index 0000000000..de3e1e87ea --- /dev/null +++ b/phoneProfilesPlus/src/main/res/drawable/pp_button_background_disabled.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/phoneProfilesPlus/src/main/res/drawable/pp_button_background_selector.xml b/phoneProfilesPlus/src/main/res/drawable/pp_button_background_selector.xml index 36822d2955..911b1dff4a 100644 --- a/phoneProfilesPlus/src/main/res/drawable/pp_button_background_selector.xml +++ b/phoneProfilesPlus/src/main/res/drawable/pp_button_background_selector.xml @@ -3,6 +3,9 @@ + \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/drawable/profile_icon_mark.xml b/phoneProfilesPlus/src/main/res/drawable/profile_icon_mark.xml new file mode 100644 index 0000000000..e4a60f9294 --- /dev/null +++ b/phoneProfilesPlus/src/main/res/drawable/profile_icon_mark.xml @@ -0,0 +1,11 @@ + + + + + + + + + \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_background_1.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_background_1.xml index e9e279f370..deb9acc6a6 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_background_1.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_background_1.xml @@ -3,7 +3,7 @@ android:shape="rectangle" android:padding="0dp"> - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_10.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_10.xml index 437ec165f5..92f6a9c67a 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_10.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_10.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_11.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_11.xml index 41722e4fcf..ca9a33954d 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_11.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_11.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_12.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_12.xml index 888209ad73..f4ceda33f7 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_12.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_12.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_13.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_13.xml index 0b0f9486ea..57565263b0 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_13.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_13.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_14.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_14.xml index 8dcbe83c1e..7cfae99ea4 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_14.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_14.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_15.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_15.xml index 6884d70c5f..75ff587244 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_15.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_15.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_2.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_2.xml index c586a2483c..bbb7e5d333 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_2.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_2.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_3.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_3.xml index c6a035dacb..a26121acb7 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_3.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_3.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_4.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_4.xml index 5d7b70d5a3..ef20ac55b1 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_4.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_4.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_5.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_5.xml index 7799ea13da..5118515edb 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_5.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_5.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_6.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_6.xml index 9e209f2b03..04dc18dd55 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_6.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_6.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_7.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_7.xml index 5325a0a207..18384332f5 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_7.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_7.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_8.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_8.xml index e738d2a4e4..2c88e71ae0 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_8.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_8.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_9.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_9.xml index 4b666a4e49..3f1ad88cc2 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_9.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_9.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_miui_launcher.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_miui_launcher.xml index e0e60e2b1e..43cf39b0fe 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_miui_launcher.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_miui_launcher.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_oneui_launcher.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_oneui_launcher.xml index f306182af5..52b3f87998 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_oneui_launcher.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_oneui_launcher.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_pixel_launcher.xml b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_pixel_launcher.xml index e0e60e2b1e..43cf39b0fe 100644 --- a/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_pixel_launcher.xml +++ b/phoneProfilesPlus/src/main/res/drawable/rounded_widget_border_pixel_launcher.xml @@ -2,7 +2,7 @@ - + - + diff --git a/phoneProfilesPlus/src/main/res/drawable/spinner_background.xml b/phoneProfilesPlus/src/main/res/drawable/spinner_background.xml new file mode 100644 index 0000000000..53da2ed438 --- /dev/null +++ b/phoneProfilesPlus/src/main/res/drawable/spinner_background.xml @@ -0,0 +1,28 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/phoneProfilesPlus/src/main/res/drawable/tab_indicator.xml b/phoneProfilesPlus/src/main/res/drawable/tab_indicator.xml new file mode 100644 index 0000000000..ed7736c546 --- /dev/null +++ b/phoneProfilesPlus/src/main/res/drawable/tab_indicator.xml @@ -0,0 +1,7 @@ + + + + + \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/drawable/widget_background.xml b/phoneProfilesPlus/src/main/res/drawable/widget_background.xml new file mode 100644 index 0000000000..1d7d122db4 --- /dev/null +++ b/phoneProfilesPlus/src/main/res/drawable/widget_background.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/drawable/widget_list_item.xml b/phoneProfilesPlus/src/main/res/drawable/widget_list_item.xml new file mode 100644 index 0000000000..7e941af95b --- /dev/null +++ b/phoneProfilesPlus/src/main/res/drawable/widget_list_item.xml @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/phoneProfilesPlus/src/main/res/drawable/widget_restart_events.xml b/phoneProfilesPlus/src/main/res/drawable/widget_restart_events.xml new file mode 100644 index 0000000000..66fd02ce4d --- /dev/null +++ b/phoneProfilesPlus/src/main/res/drawable/widget_restart_events.xml @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/phoneProfilesPlus/src/main/res/drawable/widget_ripple_background.xml b/phoneProfilesPlus/src/main/res/drawable/widget_ripple_background.xml deleted file mode 100644 index 798df03b8d..0000000000 --- a/phoneProfilesPlus/src/main/res/drawable/widget_ripple_background.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/drawable/widget_ripple_background_selector.xml b/phoneProfilesPlus/src/main/res/drawable/widget_ripple_background_selector.xml deleted file mode 100644 index 69595ea668..0000000000 --- a/phoneProfilesPlus/src/main/res/drawable/widget_ripple_background_selector.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/phoneProfilesPlus/src/main/res/drawable/widget_ripple_list_item.xml b/phoneProfilesPlus/src/main/res/drawable/widget_ripple_list_item.xml deleted file mode 100644 index 09e3fef760..0000000000 --- a/phoneProfilesPlus/src/main/res/drawable/widget_ripple_list_item.xml +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/drawable/widget_ripple_list_item_selector.xml b/phoneProfilesPlus/src/main/res/drawable/widget_ripple_list_item_selector.xml deleted file mode 100644 index 0ec7049cf4..0000000000 --- a/phoneProfilesPlus/src/main/res/drawable/widget_ripple_list_item_selector.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/phoneProfilesPlus/src/main/res/drawable/widget_ripple_restart_events.xml b/phoneProfilesPlus/src/main/res/drawable/widget_ripple_restart_events.xml deleted file mode 100644 index cae1acd3bd..0000000000 --- a/phoneProfilesPlus/src/main/res/drawable/widget_ripple_restart_events.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/drawable/widget_ripple_restart_events_selector.xml b/phoneProfilesPlus/src/main/res/drawable/widget_ripple_restart_events_selector.xml deleted file mode 100644 index 083f2c2176..0000000000 --- a/phoneProfilesPlus/src/main/res/drawable/widget_ripple_restart_events_selector.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/phoneProfilesPlus/src/main/res/drawable/widget_ripple_samsung_edge_settings.xml b/phoneProfilesPlus/src/main/res/drawable/widget_ripple_samsung_edge_settings.xml index b3a4df4d33..aee10a5641 100644 --- a/phoneProfilesPlus/src/main/res/drawable/widget_ripple_samsung_edge_settings.xml +++ b/phoneProfilesPlus/src/main/res/drawable/widget_ripple_samsung_edge_settings.xml @@ -1,14 +1,32 @@ + android:color="@color/pppColorDarkSemitransparent"> + + android:width="@dimen/samsung_edge_settings_icon_size" + android:height="@dimen/samsung_edge_settings_icon_size" /> - \ No newline at end of file + + + + + + + + + + + + + + + + + + diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_dn.xml index 245d520928..f06c22d3cd 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_dn.xml index bc7ac85b6d..5595994ea9 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_height_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_height_dn.xml index da4f3fa75c..8b984e89c2 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_height_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_height_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_height_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_height_no_profile_name_dn.xml index 19e79ffb45..635ac0a033 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_height_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_height_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_no_profile_name_dn.xml index 0a40a6b372..51c13e11ec 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_width_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_width_dn.xml index 38774205b7..86f02706b0 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_width_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_width_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_width_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_width_no_profile_name_dn.xml index 17a515eae6..5c480a1b23 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_width_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_fill_width_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_dn.xml index 0dfd3444f0..8a282dffd3 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_dn.xml index 83db2d1fd5..0a6dfc0b62 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_height_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_height_dn.xml index 0a838f18d7..b880f8d3eb 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_height_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_height_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_height_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_height_no_profile_name_dn.xml index fe9e12af4a..6179690a86 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_height_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_height_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_no_profile_name_dn.xml index 23a193a431..e6267bd815 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_width_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_width_dn.xml index af02d7fd54..0c893f743f 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_width_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_width_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_width_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_width_no_profile_name_dn.xml index c720c7b4f7..9f44edc137 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_width_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_fill_width_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_no_profile_name_dn.xml index d230e83f7b..8f4128f5e1 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_higher_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_dn.xml index eca91c23c7..3ad289c5fc 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_dn.xml index 3e2c1dac54..bd0701d6e8 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_height_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_height_dn.xml index 2f329d1091..9f5f09cd74 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_height_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_height_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_height_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_height_no_profile_name_dn.xml index 75a073db83..5c08978875 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_height_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_height_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_no_profile_name_dn.xml index a145316c78..a0ca42ff6a 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_width_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_width_dn.xml index e1e10ce37f..cc218265cf 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_width_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_width_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_width_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_width_no_profile_name_dn.xml index fb9a65345c..b3d6496b3e 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_width_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_fill_width_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_no_profile_name_dn.xml index 9f0b1d0edb..eb98ec23bf 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_highest_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_dn.xml index 331eb9bf0e..5012387875 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_dn.xml index 5435119fff..f5f1cec385 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_height_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_height_dn.xml index 2847c7dc8c..d74f58b79d 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_height_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_height_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_height_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_height_no_profile_name_dn.xml index f4aa3b0efe..4a3416d23e 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_height_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_height_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_no_profile_name_dn.xml index 7e1a4dcbd0..30b46e2a5b 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_width_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_width_dn.xml index f9a3412d8c..f9755d4287 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_width_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_width_dn.xml @@ -30,7 +30,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" + android:background="@drawable/widget_background" android:weightSum = "2" android:orientation="vertical" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_width_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_width_no_profile_name_dn.xml index 71a38385f3..b293f9cdf5 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_width_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_fill_width_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_no_profile_name_dn.xml index b56075e5a0..e7f6405ed1 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_more_compact_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_no_profile_name_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_no_profile_name_dn.xml index 4f9ca022bf..e1581cb50d 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_no_profile_name_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_icon_no_profile_name_dn.xml @@ -27,7 +27,7 @@ android:gravity="center" android:clickable="true" android:focusable="true" - android:background="@drawable/widget_ripple_background" > + android:background="@drawable/widget_background" > diff --git a/phoneProfilesPlus/src/main/res/layout-v31/widget_one_row_dn.xml b/phoneProfilesPlus/src/main/res/layout-v31/widget_one_row_dn.xml index c53a7dfb36..552ba1440c 100644 --- a/phoneProfilesPlus/src/main/res/layout-v31/widget_one_row_dn.xml +++ b/phoneProfilesPlus/src/main/res/layout-v31/widget_one_row_dn.xml @@ -22,22 +22,26 @@ + android:layout_gravity="center" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_restart_events" > + android:layout_alignParentStart="true"> + android:layout_gravity="center" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item" > + android:background="@drawable/widget_restart_events" > + android:layout_alignParentStart="true" > + android:layout_gravity="center" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_restart_events" > + android:layout_alignParentStart="true"> + android:layout_gravity="center" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item" > + android:background="@drawable/widget_restart_events" > + android:layout_alignParentStart="true"> + android:layout_gravity="center" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item" > + android:background="@drawable/widget_restart_events" > + + android:layout_alignParentStart="true"> + android:layout_gravity="center" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item" > + android:layout_alignParentStart="true"> + android:layout_gravity="center" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item" > + android:layout_alignParentStart="true"> + android:layout_gravity="center" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item" > + android:background="@drawable/widget_list_item" > + android:layout_alignParentStart="true"> + android:layout_gravity="center" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item" > + android:background="@drawable/widget_list_item" > + android:layout_alignParentStart="true"> + android:layout_gravity="center" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item" > + android:layout_alignParentStart="true"> + android:layout_gravity="center" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item" > + android:layout_alignParentStart="true"> + android:layout_gravity="center" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item" > + android:layout_alignParentStart="true"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item"> + android:orientation="horizontal" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_restart_events"> + android:layout_alignParentStart="true"> + android:orientation="horizontal" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item" > + android:background="@drawable/widget_restart_events" > + android:layout_alignParentStart="true"> + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_list_item" > + android:orientation="horizontal" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item"> + android:background="@drawable/widget_restart_events"> + android:layout_alignParentStart="true"> + android:orientation="horizontal" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item" > + android:background="@drawable/widget_restart_events" > + android:layout_alignParentStart="true"> + android:orientation="horizontal" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item" > + android:background="@drawable/widget_restart_events" > + android:layout_alignParentStart="true"> + android:listSelector="@drawable/widget_list_item"/> + android:listSelector="@drawable/widget_list_item" /> + android:orientation="horizontal" + android:clickable="true" + android:focusable="true" + android:background="@drawable/widget_list_item" > + android:background="@drawable/widget_restart_events" > + android:layout_alignParentStart="true"> + android:listSelector="@drawable/widget_list_item" /> + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/phoneProfilesPlus/src/main/res/layout-v33/dialog_extender_preference.xml b/phoneProfilesPlus/src/main/res/layout-v33/dialog_extender_preference.xml index 3587ae70f0..d7d3ecaf51 100644 --- a/phoneProfilesPlus/src/main/res/layout-v33/dialog_extender_preference.xml +++ b/phoneProfilesPlus/src/main/res/layout-v33/dialog_extender_preference.xml @@ -13,7 +13,7 @@ android:layout_height="@dimen/divider_height" android:layout_marginStart="@dimen/divider_margin" android:layout_marginEnd="@dimen/divider_margin" - android:background="@color/dialog_divider" /> + android:background="@color/dialogDividerColor" /> + + + + + - + + + + + +