diff --git a/README.md b/README.md
index 15c92bca7e..6df7be8b46 100644
--- a/README.md
+++ b/README.md
@@ -5,7 +5,7 @@
PhoneProfilesPlus (aka PPP)
===========================
-[![version](https://img.shields.io/badge/version-6.3-blue)](https://github.com/henrichg/PhoneProfilesPlus/releases/tag/6.3)
+[![version](https://img.shields.io/badge/version-6.3.0.1-blue)](https://github.com/henrichg/PhoneProfilesPlus/releases/tag/6.3.0.1)
[![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)
diff --git a/common/src/main/res/values-zh-rCN/strings.xml b/common/src/main/res/values-zh-rCN/strings.xml
index 9ba64b264e..0993733ceb 100644
--- a/common/src/main/res/values-zh-rCN/strings.xml
+++ b/common/src/main/res/values-zh-rCN/strings.xml
@@ -36,7 +36,7 @@
启动应用
启动时激活
激活情景后关闭
- 设置指示器
+ 配置指示灯
显示激活的情景
确定激活情景
显示Toast通知
@@ -147,7 +147,7 @@
显示
不要运行
运行
- 显示设置指示器
+ 显示配置指示灯
从小部件中启动
从通知中启动
激活清单
@@ -598,10 +598,10 @@
应用程序图标
排序更改手柄
联系人照片
- 事件状态指示器
+ 事件状态指示灯
事件情景开始图标
事件情景结束图标
- 启用/停止事件运行指示器
+ 启用/停止事件运行指示灯
此重要信息可以通过点击编辑器底部工具栏中的问号图标查看。
应用程序不支持
旧的 Android 版本
@@ -995,7 +995,7 @@
支持:
联系:
支持
- 以设置指示器显示激活的情景。触碰时打开激活清单。
+ 以配置指示灯显示激活的情景。触碰时打开激活清单。
使用图标亮度自定义情景图标
无法启用辅助功能服务!
语音通话音量
@@ -1160,7 +1160,7 @@
点击此处配置事件参数“[»] 忽略手动激活”。
“信号灯”图标
点击此处显示此“信号灯”图标的颜色,表示全局事件运行状态。
- 事件状态指示器
+ 事件状态指示灯
点击此处显示此图标的显示类型,代表事件的运行状态。
半径 (米)
生成预定义情景
@@ -1211,9 +1211,9 @@
锁定时启动
锁定时启动
此传感器将在屏幕开启/关闭时启动一个事件。参数:事件类型(屏幕开启,屏幕关闭),解锁/锁定时启动(当设备解锁/锁定时启动事件)。
- 在激活清单, 编辑器, 快捷方式中显示情景首选项指示器
- 在通知中显示情景首选项指示器
- 在小部件中显示情景首选项指示器
+ 在激活清单, 编辑器, 快捷方式中显示情景配置指示灯
+ 在通知中显示情景配置指示灯
+ 在小部件中显示情景配置指示灯
下划线参数是必需的。
检查标记为红色的传感器参数。
传感器参数处于主要事件参数之下。
@@ -1520,7 +1520,7 @@
当任意情景被手动激活时,事件将会开始且不会暂停
\"Assets\" 位于发行说明下方, \"Assets\" 在手机视图模式可被点击。
快速磁贴情景选择器
- 设置指示灯亮度
+ 配置指示灯亮度
通知装饰(如果启用的话) 将仅在背景颜色为“原生”的时候显示。
删除所有已选
删除此应用程序?
@@ -1725,13 +1725,13 @@
在事件设置中,顶部显示的红色文本为错误提示。 请修复它。
已保存情景设置
点此显示已保存的情景设置。
- 情景图标和设置标志颜色类型
+ 情景图标和配置指示灯的颜色类型
情景图标亮度
自定义情景图标亮度
通知面板 - 背景颜色
通知面板 - 文本颜色
通知面板 - 情景图标
- 通知面板 - 设置标志
+ 通知面板 - 配置指示灯
通知面板 - 按钮
显示更改者
点此切换显示情景列表和事件列表
@@ -1741,9 +1741,9 @@
这是旧的,但功能支持最新的 Android 版本。
在 Google Play 中搜索。
关闭
- 情景设置标志
- 开始事件情景设置标志
- 结束事件情景设置标志
+ 情景配置指示灯
+ 开始事件情景配置指示灯
+ 结束事件情景配置指示灯
情景设置图标
信号灯图标
透明/亮度 图标
@@ -1788,7 +1788,7 @@
此传感器用于更改音量。参数:铃声音量,通知音量,媒体音量,闹钟音量,系统音量,语音通话音量,蓝牙通话音量。
音量
不测试
- 等到
+ 等于
不等于
小于
大于
@@ -2076,49 +2076,49 @@
PhoneProfilesPlus 发布于 F-Droid:
Huawei AppGallery的PhoneProfilesPlus 版本:
点此显示
- Change media volume while playing music
- Scanning paused
- error code
- "GitHub download is not supported. Please install PhoneProfilesPlus with Droid-ify."
- Brightness sensor
- This sensor will start an event by brightness level change. Parameters: Operator from\/to, Brightness level from\/to.
- Brightness level from
- Operator from
- Brightness level to
- Operator to
- Brightness
- Volume from
- Volume to
- Current brightness
- Current volume
- Cell names
- Mobile cells editor
- Connected cell:
- Connected cell (SIM 1):
- Connected cell (SIM 2):
- 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 \"Cell Names\".\n\nClick here to configure cell names. That opens \"Mobile cells scanning\" screen and in it is \"Mobile cells 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.
- Cell registration is for registering new mobile cells. \n\nClick here if you want to start cell registration. That opens \"Mobile cells scanning\" screen and in it is \"Cell registration\".
- Scanning enabled, interval set
- Mobile cell scan interval
- Mobile cell scanning do not have scan interval.
- Notification scan interval
- Notification scanning do not have scan interval.
- What to do
- Start Activator
- Start Editor
- Restart events
- Enable\/Disable events run
- Shortcut to \"Mobile cell scanning\"
- Click here, to create shortcut to \"Mobile cell scanning\" in home launcher.
- Shortcut to \"Mobile cell scanning\" created
- Click here to grant root.
- Hide not used sensors
- Added new logs. Use \"Reload\" to display it.
- Note: Contacts will also be included in the exported settings. If you share the backup with other people, select the parameters that should not be exported.
- Contacts for Call sensor
- Contacts for SMS/MMS sensor
- Contacts for Notification sensor
+ 播放音乐时更改媒体音量
+ 扫描已暂停
+ 错误代码
+ "不支持 GitHub 下载。请用 Droid-ify 安装 PhoneProfilesPlus。"
+ 亮度传感器
+ 此传感器将通过亮度级别的改变来启动一个事件。参数:运算从\/到,亮度级别从\/到
+ 亮度级别从
+ 运算符从
+ 亮度级别到
+ 运算符到
+ 亮度
+ 音量从
+ 音量到
+ 当前亮度
+ 当前音量
+ 基站名称
+ 移动基站编辑器
+ 已连接基站:
+ 已连接基站 (SIM 1):
+ 已连接基站 (SIM 2):
+ 每个移动基站必须有一个名称。多个基站可以有相同的名称。 一个名称代表一组基站,这些基站被配置为“基站名称”。\n\n点击这里配置基站名称。打开“移动基站扫描”,进入“移动基站编辑器”。
+ 每个移动基站必须有一个名称。多个基站可以有相同的名称。 一个名称代表一组基站,这些基站在“移动基站传感器”\/\"基站名称”中配置。
+ 新检测到移动基站时显示通知
+ 基站注册是为了注册新的移动基站。注册将在后台运行。在运行注册时,建议不要更改设备的位置。
+ 基站注册是为了注册新的移动基站。 \n\n如果您想要进行基站注册,请单击此处。 打开“移动基站扫描”,进入“基站注册”。
+ 启用扫描,间隔设为
+ 移动基站扫描间隔
+ 移动基站扫描没有扫描间隔。
+ 通知扫描间隔
+ 通知扫描没有扫描间隔。
+ 要做什么
+ 启动激活清单
+ 启动编辑器
+ 重启事件
+ 启用\/禁用事件运行
+ \"移动基站扫描\"的快捷方式
+ 单击此处可在桌面启动器中创建“移动基站扫描”的快捷方式。
+ 已创建\"移动基站扫描\"的快捷方式
+ 点此授予root权限。
+ 隐藏未使用的传感器
+ 已添加新日志。使用“重新加载”来显示它。
+ 注意:联系人也将包含在导出的设置中。 如果您与其他人共享备份,请选择不应导出的参数。
+ 联系人用于通话传感器
+ 联系人用于 短信/彩信 传感器
+ 联系人用于通知传感器
diff --git a/dependencies.gradle b/dependencies.gradle
index 319210abc4..443fee484d 100644
--- a/dependencies.gradle
+++ b/dependencies.gradle
@@ -30,11 +30,11 @@
// 6800 = removed widgets parameter "Rounded corners", Force set rounded corners = true, radius = 1.
// 6920 = enabled PPP notification decorator for Pixel (Android 12+) and OneUI 5 (Samsung Galaxy).
// 6960 = Increased default value for "Bluetooth LE scan duration".
-// 7050 = Convered old contacts data format in sensors to new format
+// 7065 = Convered old contacts data format in sensors to new format
ext.ppVersions = [
- publishVersion : '6.3',
- publishVersionCode: 7050,
+ publishVersion : '6.3.0.1',
+ publishVersionCode: 7065,
minSdk : 26,
targetSdk : 28,
diff --git a/docs/FDroid_ChangeLog.html b/docs/FDroid_ChangeLog.html
index fc979dd37a..6df45d8ba8 100644
--- a/docs/FDroid_ChangeLog.html
+++ b/docs/FDroid_ChangeLog.html
@@ -7,7 +7,7 @@
PhoneProfilesPlus Changelog
-Version: 6.3
+Version: 6.3, 6.3.0.1
- Add: New event sensor: "Brightness sensor"
diff --git a/docs/FDroid_ChangeLog_CS.html b/docs/FDroid_ChangeLog_CS.html
index e099efbeeb..c6961d5f4c 100644
--- a/docs/FDroid_ChangeLog_CS.html
+++ b/docs/FDroid_ChangeLog_CS.html
@@ -7,7 +7,7 @@
PhoneProfilesPlus Seznam změn
-Verze: 6.3
+Verze: 6.3, 6.3.0.1
- Add: New event sensor: "Brightness sensor"
diff --git a/docs/FDroid_ChangeLog_SK.html b/docs/FDroid_ChangeLog_SK.html
index 6da7515ce5..6acb633bd7 100644
--- a/docs/FDroid_ChangeLog_SK.html
+++ b/docs/FDroid_ChangeLog_SK.html
@@ -7,7 +7,7 @@
PhoneProfilesPlus Zoznam zmien
-Verzia: 6.3
+Verzia: 6.3, 6.3.0.1
- Add: New event sensor: "Brightness sensor"
diff --git a/docs/releases-debug.md b/docs/releases-debug.md
index a9858c9cb1..b464e282b7 100644
--- a/docs/releases-debug.md
+++ b/docs/releases-debug.md
@@ -1 +1 @@
-@@@ppp-release:6.3:7050:normal***@@@
\ No newline at end of file
+@@@ppp-release:6.3.0.1:7065:normal***@@@
\ No newline at end of file
diff --git a/docs/releases.md b/docs/releases.md
index a9858c9cb1..b464e282b7 100644
--- a/docs/releases.md
+++ b/docs/releases.md
@@ -1 +1 @@
-@@@ppp-release:6.3:7050:normal***@@@
\ No newline at end of file
+@@@ppp-release:6.3.0.1:7065:normal***@@@
\ No newline at end of file
diff --git a/fastlane/android/metadata/cs-CZ/changelogs/7065.txt b/fastlane/android/metadata/cs-CZ/changelogs/7065.txt
new file mode 100644
index 0000000000..d540af6c51
--- /dev/null
+++ b/fastlane/android/metadata/cs-CZ/changelogs/7065.txt
@@ -0,0 +1,9 @@
+6.3, 6.3.0.1
+Seznam změn:
+- Novinky v GUI a procesech na pozadí.
+- Změny GUI a procesech na pozadí.
+- Opravy v GUI a procesů na pozadí.
+- Opravy pádů aplikace.
+- Aktualizované překlady.
+
+Úplný seznam změn je ve GitHub vydáních. (https://henrichg.github.io/PhoneProfilesPlus/FDroid_ChangeLog_CS)
diff --git a/fastlane/android/metadata/de/changelogs/7065.txt b/fastlane/android/metadata/de/changelogs/7065.txt
new file mode 100644
index 0000000000..4cad1780fb
--- /dev/null
+++ b/fastlane/android/metadata/de/changelogs/7065.txt
@@ -0,0 +1,9 @@
+6.3, 6.3.0.1
+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/7065.txt b/fastlane/android/metadata/en-US/changelogs/7065.txt
new file mode 100644
index 0000000000..4cad1780fb
--- /dev/null
+++ b/fastlane/android/metadata/en-US/changelogs/7065.txt
@@ -0,0 +1,9 @@
+6.3, 6.3.0.1
+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/sk-SK/changelogs/7065.txt b/fastlane/android/metadata/sk-SK/changelogs/7065.txt
new file mode 100644
index 0000000000..e026cb6100
--- /dev/null
+++ b/fastlane/android/metadata/sk-SK/changelogs/7065.txt
@@ -0,0 +1,9 @@
+6.3, 6.3.0.1
+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/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectDialogPreferenceFragment.java
index ba3b481f23..c61c486a7f 100644
--- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectDialogPreferenceFragment.java
+++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactGroupsMultiSelectDialogPreferenceFragment.java
@@ -147,7 +147,7 @@ protected Void doInBackground(Void... params) {
ContactsCache contactsCache = PPApplicationStatic.getContactsCache();
if (contactsCache == null) {
// cache not created, create it
- PPApplicationStatic.createContactsCache(prefContext.getApplicationContext(), false/*, false*//*, true*/);
+ PPApplicationStatic.createContactsCache(prefContext.getApplicationContext(), false, false/*, true*/);
/*contactsCache = PPApplicationStatic.getContactsCache();
while (contactsCache.getCaching())
GlobalUtils.sleep(100);*/
@@ -157,7 +157,7 @@ protected Void doInBackground(Void... params) {
List contactList = contactsCache.getList(/*withoutNumbers*/);
if (contactList == null) {
// not cached, cache it
- PPApplicationStatic.createContactsCache(prefContext.getApplicationContext(), false/*, false*//*, true*/);
+ PPApplicationStatic.createContactsCache(prefContext.getApplicationContext(), false, false/*, true*/);
/*contactsCache = PPApplicationStatic.getContactsCache();
while (contactsCache.getCaching())
GlobalUtils.sleep(100);*/
diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsCache.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsCache.java
index 2e2159bb31..be7274b715 100644
--- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsCache.java
+++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsCache.java
@@ -23,7 +23,7 @@ class ContactsCache {
caching = false;
}
- void getContactList(Context context/*, boolean fixEvents*//*, boolean forceCache*/)
+ void getContactList(Context context, boolean fixEvents)
{
//if ((cached || caching) && (!forceCache)) return;
@@ -40,48 +40,6 @@ void getContactList(Context context/*, boolean fixEvents*//*, boolean forceCache
try {
if (Permissions.checkContacts(context)) {
- /*
- if (fixEvents && (contactList.size() != 0)) {
-// Log.e("ContactsCache.getContactList", "contactList.size() != 0");
-
- dataWrapper = new DataWrapper(context.getApplicationContext(), false, 0, false, 0, 0, 0f);
- dataWrapper.fillEventList();
-
- // fill array with events, which uses contact cache
- for (Event _event : dataWrapper.eventList) {
- if (_event._eventPreferencesCall._enabled) {
- ContactsInEvent contactsInEvent = new ContactsInEvent();
- contactsInEvent.event = _event;
- contactsInEvent.contacts = _event._eventPreferencesCall._contacts;
- //contactsInEvent.sensorType = EventsHandler.SENSOR_TYPE_PHONE_CALL;
- _contactInEventsCall.add(contactsInEvent);
- }
- }
- for (Event _event : dataWrapper.eventList) {
- if (_event._eventPreferencesSMS._enabled) {
- ContactsInEvent contactsInEvent = new ContactsInEvent();
- contactsInEvent.event = _event;
- contactsInEvent.contacts = _event._eventPreferencesSMS._contacts;
- //contactsInEvent.sensorType = EventsHandler.SENSOR_TYPE_SMS;
- _contactInEventsSMS.add(contactsInEvent);
- }
- }
- for (Event _event : dataWrapper.eventList) {
- if (_event._eventPreferencesNotification._enabled) {
- ContactsInEvent contactsInEvent = new ContactsInEvent();
- contactsInEvent.event = _event;
- contactsInEvent.contacts = _event._eventPreferencesNotification._contacts;
- //contactsInEvent.sensorType = EventsHandler.SENSOR_TYPE_NOTIFICATION;
- _contactInEventsNotification.add(contactsInEvent);
- }
- }
-// Log.e("ContactsCache.getContactList", "_contactInEventsCall.size()="+_contactInEventsCall.size());
-// Log.e("ContactsCache.getContactList", "_contactInEventsSMS.size()="+_contactInEventsSMS.size());
-// Log.e("ContactsCache.getContactList", "_contactInEventsNotification.size()="+_contactInEventsNotification.size());
- } //else
-// Log.e("ContactsCache.getContactList", "contactList.size() == 0");
- */
-
long contactId = 0;
String name = null;
String photoId = "0";
@@ -210,67 +168,182 @@ void getContactList(Context context/*, boolean fixEvents*//*, boolean forceCache
rawCursor.close();
}
+// Log.e("ContactsCache.getContactList", "(1) xxxxxx");
+
//_contactList.sort(new ContactsComparator());
synchronized (PPApplication.contactsCacheMutex) {
-
- /*
- if (fixEvents && (contactList.size() != 0)) {
-// Log.e("ContactsCache.getContactList", "contactList.size() != 0");
-
- // do copy of old contactList
- for (Contact _contact : contactList) {
- Contact dContact = new Contact();
- dContact.contactId = _contact.contactId;
- dContact.name = _contact.name;
- dContact.phoneId = _contact.phoneId;
- dContact.phoneNumber = _contact.phoneNumber;
- dContact.photoId = _contact.photoId;
- dContact.accountType = _contact.accountType;
- dContact.accountName = _contact.accountName;
- _oldContactList.add(dContact);
- }
-// Log.e("ContactsCache.getContactList", "_oldContactList.size()="+_oldContactList.size());
- } //else
-// Log.e("ContactsCache.getContactList", "contactList.size() == 0");
- PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsCache.getContactList", "contactList.size()="+_contactList.size());
- */
+// Log.e("ContactsCache.getContactList", "(1.1) xxxxxx");
updateContacts(_contactList/*, false*/);
//updateContacts(_contactListWithoutNumber, true);
- /*
- if (fixEvents && (_oldContactList.size() != 0)) {
-// Log.e("ContactsCache.getContactList", "_oldContactList.size() != 0");
-
- for (ContactsInEvent contactsInEvent : _contactInEventsCall) {
- // for each contactsInEvent for call sensor
- PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsCache.getContactList", "(1) contactsInEvent.event._eventPreferencesCall._contacts="+contactsInEvent.event._eventPreferencesCall._contacts);
- contactsInEvent.event._eventPreferencesCall._contacts =
- covertOldContactToNewContact(contactsInEvent, _oldContactList);
- DatabaseHandler.getInstance(context.getApplicationContext()).updateEvent(contactsInEvent.event);
- PPApplicationStatic.logE("[CONTACTS_CACHE] ContactsCache.getContactList", "(2) contactsInEvent.event._eventPreferencesCall._contacts="+contactsInEvent.event._eventPreferencesCall._contacts);
- }
- for (ContactsInEvent contactsInEvent : _contactInEventsSMS) {
- // for each contactsInEvent for sms sensor
-// Log.e("ContactsCache.getContactList", "(1) contactsInEvent.event._eventPreferencesSMS._contacts="+contactsInEvent.event._eventPreferencesSMS._contacts);
- contactsInEvent.event._eventPreferencesSMS._contacts =
- covertOldContactToNewContact(contactsInEvent, _oldContactList);
- DatabaseHandler.getInstance(context.getApplicationContext()).updateEvent(contactsInEvent.event);
-// Log.e("ContactsCache.getContactList", "(2) contactsInEvent.event._eventPreferencesSMS._contacts="+contactsInEvent.event._eventPreferencesSMS._contacts);
- }
- for (ContactsInEvent contactsInEvent : _contactInEventsNotification) {
- // for each contactsInEvent for notification sensor
-// Log.e("ContactsCache.getContactList", "(1) contactsInEvent.event._eventPreferencesNotification._contacts="+contactsInEvent.event._eventPreferencesNotification._contacts);
- contactsInEvent.event._eventPreferencesNotification._contacts =
- covertOldContactToNewContact(contactsInEvent, _oldContactList);
- DatabaseHandler.getInstance(context.getApplicationContext()).updateEvent(contactsInEvent.event);
-// Log.e("ContactsCache.getContactList", "(2) contactsInEvent.event._eventPreferencesNotification._contacts="+contactsInEvent.event._eventPreferencesNotification._contacts);
+ if (fixEvents) {
+ Context appContext = context.getApplicationContext();
+
+ List eventList = DatabaseHandler.getInstance(appContext).getAllEvents();
+
+ for (Event event : eventList) {
+ boolean dataChanged = false;
+
+ if (!event._eventPreferencesCall._contacts.isEmpty()) {
+ String[] splits = event._eventPreferencesCall._contacts.split(StringConstants.STR_SPLIT_REGEX);
+ String _split = splits[0];
+ String[] _splits2 = _split.split("#");
+ boolean oldData = false;
+ try {
+// if (event._name.equals("Белый лист"))
+// Log.e("PhoneProfilesService.doForPackageReplaced", "_splits2[0]="+_splits2[0]);
+ //noinspection unused
+ long l = Long.parseLong(_splits2[0]);
+ oldData = true;
+ } catch (Exception ignored) {
+ }
+// if (event._name.equals("Белый лист"))
+// Log.e("PhoneProfilesService.doForPackageReplaced", "oldData="+oldData);
+ if (oldData) {
+ StringBuilder newContacts = new StringBuilder();
+ for (String split : splits) {
+ String[] splits2 = split.split("#");
+ 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._eventPreferencesCall._contacts = newContacts.toString();
+ dataChanged = true;
+ }
+ }
+
+ if (!event._eventPreferencesSMS._contacts.isEmpty()) {
+ String[] splits = event._eventPreferencesSMS._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._eventPreferencesSMS._contacts = newContacts.toString();
+ dataChanged = true;
+ }
+ }
+
+ if (!event._eventPreferencesNotification._contacts.isEmpty()) {
+ String[] splits = event._eventPreferencesNotification._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._eventPreferencesNotification._contacts = newContacts.toString();
+ dataChanged = true;
+ }
+ }
+
+ if (dataChanged)
+ DatabaseHandler.getInstance(appContext).updateEvent(event);
}
- } //else
-// Log.e("ContactsCache.getContactList", "_oldContactList.size() == 0");
- */
+ }
}
+// Log.e("ContactsCache.getContactList", "(2) xxxxxx");
+
cached = true;
}
} catch (SecurityException e) {
diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsContentObserverWorker.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsContentObserverWorker.java
index b3efee1c9a..bb0e738efe 100644
--- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsContentObserverWorker.java
+++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsContentObserverWorker.java
@@ -33,7 +33,7 @@ public Result doWork() {
Context appContext = context.getApplicationContext();
// must be first
- PPApplicationStatic.createContactsCache(appContext, false/*, true*//*, true*/);
+ PPApplicationStatic.createContactsCache(appContext, false, true/*, true*/);
//must be seconds, this ads groups into contacts
PPApplicationStatic.createContactGroupsCache(appContext, false/*, true*//*, true*/);
diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreferenceFragment.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreferenceFragment.java
index 7e80748347..3d36641219 100644
--- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreferenceFragment.java
+++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ContactsMultiSelectDialogPreferenceFragment.java
@@ -143,7 +143,7 @@ protected Void doInBackground(Void... params) {
ContactsCache contactsCache = PPApplicationStatic.getContactsCache();
if (contactsCache == null) {
// cache not created, create it
- PPApplicationStatic.createContactsCache(prefContext.getApplicationContext(), false/*, false*//*, true*/);
+ PPApplicationStatic.createContactsCache(prefContext.getApplicationContext(), false, false/*, true*/);
/*contactsCache = PPApplicationStatic.getContactsCache();
while (contactsCache.getCaching())
GlobalUtils.sleep(100);*/
@@ -153,7 +153,7 @@ protected Void doInBackground(Void... params) {
List contactList = contactsCache.getList(/*withoutNumbers*/);
if (contactList == null) {
// not cached, cache it
- PPApplicationStatic.createContactsCache(prefContext.getApplicationContext(), false/*, false*//*, true*/);
+ PPApplicationStatic.createContactsCache(prefContext.getApplicationContext(), false, false/*, true*/);
/*contactsCache = PPApplicationStatic.getContactsCache();
while (contactsCache.getCaching())
GlobalUtils.sleep(100);*/
diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerImportExport.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerImportExport.java
index db6fb237de..34f0ce2fdb 100644
--- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerImportExport.java
+++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/DatabaseHandlerImportExport.java
@@ -705,12 +705,20 @@ static private void afterImportDb(DatabaseHandler instance, SQLiteDatabase db) {
}
// convert contacts data to new format
+ boolean contactsConverted = false;
+// Log.e("DatabaseHandlerImportExport.afterImportDb", "(1) convert contacts data to new format");
ContactsCache contactsCache = PPApplicationStatic.getContactsCache();
+// Log.e("DatabaseHandlerImportExport.afterImportDb", "(1.1) convert contacts data to new format");
if (contactsCache == null) {
- PPApplicationStatic.createContactsCache(instance.context, false/*, false*//*, true*/);
+// Log.e("DatabaseHandlerImportExport.afterImportDb", "(1.2) convert contacts data to new format");
+ PPApplicationStatic.createContactsCache(instance.context, false, false);
+// Log.e("DatabaseHandlerImportExport.afterImportDb", "(1.3) convert contacts data to new format");
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");
List contactList = contactsCache.getList(/*withoutNumbers*/);
+// Log.e("DatabaseHandlerImportExport.afterImportDb", "(3) convert contacts data to new format");
if (contactList != null) {
try {
cursorImportDB = db.rawQuery("SELECT " +
@@ -723,6 +731,7 @@ static private void afterImportDb(DatabaseHandler instance, SQLiteDatabase db) {
if (cursorImportDB.moveToFirst()) {
do {
long eventId = cursorImportDB.getLong(cursorImportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ID));
+// Log.e("DatabaseHandlerImportExport.afterImportDb", "event="+eventId);
boolean dataChanged = false;
ContentValues values = new ContentValues();
@@ -734,7 +743,7 @@ static private void afterImportDb(DatabaseHandler instance, SQLiteDatabase db) {
if (!callContacts.isEmpty()) {
String[] splits = callContacts.split(StringConstants.STR_SPLIT_REGEX);
String _split = splits[0];
- String[] _splits2 = _split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
+ String[] _splits2 = _split.split("#");
boolean oldData = false;
try {
//noinspection unused
@@ -744,7 +753,7 @@ static private void afterImportDb(DatabaseHandler instance, SQLiteDatabase db) {
if (oldData) {
StringBuilder newContacts = new StringBuilder();
for (String split : splits) {
- String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
+ String[] splits2 = split.split("#");
long contactId = Long.parseLong(splits2[0]);
long phoneId = Long.parseLong(splits2[1]);
@@ -779,7 +788,7 @@ static private void afterImportDb(DatabaseHandler instance, SQLiteDatabase db) {
if (!smsContacts.isEmpty()) {
String[] splits = smsContacts.split(StringConstants.STR_SPLIT_REGEX);
String _split = splits[0];
- String[] _splits2 = _split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
+ String[] _splits2 = _split.split("#");
boolean oldData = false;
try {
//noinspection unused
@@ -790,7 +799,7 @@ static private void afterImportDb(DatabaseHandler instance, SQLiteDatabase db) {
if (oldData) {
StringBuilder newContacts = new StringBuilder();
for (String split : splits) {
- String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
+ String[] splits2 = split.split("#");
if (splits2.length != 3) {
// old data
splits2 = split.split("#");
@@ -831,7 +840,7 @@ static private void afterImportDb(DatabaseHandler instance, SQLiteDatabase db) {
if (!notificationContacts.isEmpty()) {
String[] splits = notificationContacts.split(StringConstants.STR_SPLIT_REGEX);
String _split = splits[0];
- String[] _splits2 = _split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
+ String[] _splits2 = _split.split("#");
boolean oldData = false;
try {
//noinspection unused
@@ -842,7 +851,7 @@ static private void afterImportDb(DatabaseHandler instance, SQLiteDatabase db) {
if (oldData) {
StringBuilder newContacts = new StringBuilder();
for (String split : splits) {
- String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
+ String[] splits2 = split.split("#");
if (splits2.length != 3) {
// old data
splits2 = split.split("#");
@@ -880,9 +889,11 @@ static private void afterImportDb(DatabaseHandler instance, SQLiteDatabase db) {
}
}
- if (dataChanged)
+ if (dataChanged) {
db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_ID + " = ?",
new String[]{String.valueOf(eventId)});
+ contactsConverted = true;
+ }
} while (cursorImportDB.moveToNext());
}
@@ -893,70 +904,73 @@ static private void afterImportDb(DatabaseHandler instance, SQLiteDatabase db) {
}
}
- // decript contacts
- boolean applicationContactsInBackupEncripted =
- ApplicationPreferences.getSharedPreferences(instance.context)
- .getBoolean(ApplicationPreferences.PREF_APPLICATION_CONTACTS_IN_BACKUP_ENCRIPTED,
- false);
+ if (!contactsConverted) {
+ // decript contacts
+ boolean applicationContactsInBackupEncripted =
+ ApplicationPreferences.getSharedPreferences(instance.context)
+ .getBoolean(ApplicationPreferences.PREF_APPLICATION_CONTACTS_IN_BACKUP_ENCRIPTED,
+ false);
// Log.e("DatabaseHandlerImportExport.afterImportDb", "applicationContactsInBackupEncripted="+applicationContactsInBackupEncripted);
- if (applicationContactsInBackupEncripted) {
- try {
- Encryption encryption = Encryption.getDefault(BuildConfig.encrypt_contacts_key, BuildConfig.encrypt_contacts_salt, new byte[16]);
+ if (applicationContactsInBackupEncripted) {
+ try {
+ Encryption encryption = Encryption.getDefault(BuildConfig.encrypt_contacts_key, BuildConfig.encrypt_contacts_salt, new byte[16]);
- cursorImportDB = db.rawQuery("SELECT " +
- DatabaseHandler.KEY_E_ID + "," +
- DatabaseHandler.KEY_E_CALL_CONTACTS + "," +
- DatabaseHandler.KEY_E_SMS_CONTACTS + "," +
- DatabaseHandler.KEY_E_NOTIFICATION_CONTACTS +
- " FROM " + DatabaseHandler.TABLE_EVENTS, null);
+ cursorImportDB = db.rawQuery("SELECT " +
+ DatabaseHandler.KEY_E_ID + "," +
+ DatabaseHandler.KEY_E_CALL_CONTACTS + "," +
+ DatabaseHandler.KEY_E_SMS_CONTACTS + "," +
+ DatabaseHandler.KEY_E_NOTIFICATION_CONTACTS +
+ " FROM " + DatabaseHandler.TABLE_EVENTS, null);
- if (cursorImportDB.moveToFirst()) {
- do {
- long eventId = cursorImportDB.getLong(cursorImportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ID));
+ if (cursorImportDB.moveToFirst()) {
+ do {
+ long eventId = cursorImportDB.getLong(cursorImportDB.getColumnIndexOrThrow(DatabaseHandler.KEY_E_ID));
- 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 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 decryptedCallContacts;
- try {
- decryptedCallContacts = encryption.decryptOrNull(callContacts);
- } catch (Exception e) {
- decryptedCallContacts = "";
- }
- String decryptedSMSContacts;
- try {
- decryptedSMSContacts = encryption.decryptOrNull(smsContacts);
- } catch (Exception e) {
- decryptedSMSContacts = "";
- }
- String decryptedNotificationContacts;
- try {
- decryptedNotificationContacts = encryption.decryptOrNull(notificationContacts);
- } catch (Exception e) {
- decryptedNotificationContacts = "";
- }
+ String decryptedCallContacts;
+ try {
+ decryptedCallContacts = encryption.decryptOrNull(callContacts);
+ } catch (Exception e) {
+ decryptedCallContacts = "";
+ }
+ String decryptedSMSContacts;
+ try {
+ decryptedSMSContacts = encryption.decryptOrNull(smsContacts);
+ } catch (Exception e) {
+ decryptedSMSContacts = "";
+ }
+ String decryptedNotificationContacts;
+ try {
+ decryptedNotificationContacts = encryption.decryptOrNull(notificationContacts);
+ } catch (Exception e) {
+ decryptedNotificationContacts = "";
+ }
// Log.e("DatabaseHandlerImportExport.afterImportDb", "decryptedCallContacts="+decryptedCallContacts);
// Log.e("DatabaseHandlerImportExport.afterImportDb", "decryptedSMSContacts="+decryptedSMSContacts);
// Log.e("DatabaseHandlerImportExport.afterImportDb", "decryptedNotificationContacts="+decryptedNotificationContacts);
- if (decryptedCallContacts == null) decryptedCallContacts="";
- if (decryptedSMSContacts == null) decryptedSMSContacts="";
- if (decryptedNotificationContacts == null) decryptedNotificationContacts="";
+ if (decryptedCallContacts == null) decryptedCallContacts = "";
+ if (decryptedSMSContacts == null) decryptedSMSContacts = "";
+ if (decryptedNotificationContacts == null)
+ decryptedNotificationContacts = "";
- 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);
+ 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);
- db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?",
- new String[]{String.valueOf(eventId)});
+ db.update(DatabaseHandler.TABLE_EVENTS, values, DatabaseHandler.KEY_E_ID + " = ?",
+ new String[]{String.valueOf(eventId)});
- } while (cursorImportDB.moveToNext());
- }
- cursorImportDB.close();
- } finally {
- if ((cursorImportDB != null) && (!cursorImportDB.isClosed()))
+ } while (cursorImportDB.moveToNext());
+ }
cursorImportDB.close();
+ } finally {
+ if ((cursorImportDB != null) && (!cursorImportDB.isClosed()))
+ cursorImportDB.close();
+ }
}
}
diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCall.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCall.java
index 126d9eeb8e..7322e2af22 100644
--- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCall.java
+++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesCall.java
@@ -719,7 +719,11 @@ boolean isPhoneNumberConfigured(String phoneNumber/*, DataWrapper dataWrapper*/)
for (String split : splits) {
String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
- if ((!split.isEmpty()) && (!splits2[0].isEmpty()) && (!splits2[1].isEmpty()) && (!splits2[2].isEmpty())) {
+ 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
diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesNotification.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesNotification.java
index 24fc2050bf..38812136af 100644
--- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesNotification.java
+++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesNotification.java
@@ -1260,7 +1260,11 @@ private boolean isContactConfigured(String text, List contactList) {
for (String split : splits) {
String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
- if ((!split.isEmpty()) && (!splits2[0].isEmpty()) && (!splits2[1].isEmpty()) && (!splits2[2].isEmpty())) {
+ 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
diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesSMS.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesSMS.java
index 55dac0ee39..7282e30c55 100644
--- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesSMS.java
+++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesSMS.java
@@ -684,7 +684,11 @@ void saveStartTime(DataWrapper dataWrapper, String phoneNumber, long startTime,
for (String split : splits) {
String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
- if ((!split.isEmpty()) && (!splits2[0].isEmpty()) && (!splits2[1].isEmpty()) && (!splits2[2].isEmpty())) {
+ 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
diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MainWorker.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MainWorker.java
index ac53ba7c52..525fd69ff8 100644
--- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MainWorker.java
+++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/MainWorker.java
@@ -557,7 +557,7 @@ private void doAfterFirstStart(Context context,
// must be first
// PPApplicationStatic.logE("MainWorker.doAfterFirstStart", "call of createContactsCache (1)");
- PPApplicationStatic.createContactsCache(appContext, true/*, true*//*, true*/);
+ PPApplicationStatic.createContactsCache(appContext, true, true/*, true*/);
//must be seconds, this ads groups into contacts
// PPApplicationStatic.logE("MainWorker.doAfterFirstStart", "call of createContactsCache (2)");
PPApplicationStatic.createContactGroupsCache(appContext, true/*, true*//*, true*/);
diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplicationStatic.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplicationStatic.java
index bc17d2f844..b327842653 100644
--- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplicationStatic.java
+++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplicationStatic.java
@@ -2749,7 +2749,7 @@ static ApplicationsCache getApplicationsCache()
// contacts and contact groups cache -----------------
- static void createContactsCache(Context context, boolean clear/*, boolean fixEvents*//*, boolean forceCache*/)
+ static void createContactsCache(Context context, boolean clear, boolean fixEvents/*, boolean forceCache*/)
{
if (clear) {
if (PPApplication.contactsCache != null)
@@ -2757,7 +2757,7 @@ static void createContactsCache(Context context, boolean clear/*, boolean fixEve
}
if (PPApplication.contactsCache == null)
PPApplication.contactsCache = new ContactsCache();
- PPApplication.contactsCache.getContactList(context/*, fixEvents*//*, forceCache*/);
+ PPApplication.contactsCache.getContactList(context, fixEvents/*, forceCache*/);
}
static ContactsCache getContactsCache()
diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesService.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesService.java
index ef86643b94..38299677d4 100644
--- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesService.java
+++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PhoneProfilesService.java
@@ -1479,16 +1479,17 @@ private boolean doForPackageReplaced(Context appContext) {
}
}
- if (actualVersionCode <= 7050) {
+ /*
+ if (actualVersionCode <= 7060) {
List eventList = DatabaseHandler.getInstance(appContext).getAllEvents();
// convert old contacts data to new
ContactsCache contactsCache = PPApplicationStatic.getContactsCache();
if (contactsCache == null) {
- PPApplicationStatic.createContactsCache(appContext, false/*, false*//*, true*/);
+ PPApplicationStatic.createContactsCache(appContext, false);
contactsCache = PPApplicationStatic.getContactsCache();
}
- List contactList = contactsCache.getList(/*withoutNumbers*/);
+ List contactList = contactsCache.getList();
if (contactList != null) {
for (Event event : eventList) {
boolean dataChanged = false;
@@ -1496,17 +1497,21 @@ private boolean doForPackageReplaced(Context appContext) {
if (!event._eventPreferencesCall._contacts.isEmpty()) {
String[] splits = event._eventPreferencesCall._contacts.split(StringConstants.STR_SPLIT_REGEX);
String _split = splits[0];
- String[] _splits2 = _split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
+ String[] _splits2 = _split.split("#");
boolean oldData = false;
try {
+// if (event._name.equals("Белый лист"))
+// Log.e("PhoneProfilesService.doForPackageReplaced", "_splits2[0]="+_splits2[0]);
//noinspection unused
long l = Long.parseLong(_splits2[0]);
oldData = true;
} catch (Exception ignored) {}
+// if (event._name.equals("Белый лист"))
+// Log.e("PhoneProfilesService.doForPackageReplaced", "oldData="+oldData);
if (oldData) {
StringBuilder newContacts = new StringBuilder();
for (String split : splits) {
- String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
+ String[] splits2 = split.split("#");
long contactId = Long.parseLong(splits2[0]);
long phoneId = Long.parseLong(splits2[1]);
@@ -1540,7 +1545,7 @@ private boolean doForPackageReplaced(Context appContext) {
if (!event._eventPreferencesSMS._contacts.isEmpty()) {
String[] splits = event._eventPreferencesSMS._contacts.split(StringConstants.STR_SPLIT_REGEX);
String _split = splits[0];
- String[] _splits2 = _split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
+ String[] _splits2 = _split.split("#");
boolean oldData = false;
try {
//noinspection unused
@@ -1551,7 +1556,7 @@ private boolean doForPackageReplaced(Context appContext) {
if (oldData) {
StringBuilder newContacts = new StringBuilder();
for (String split : splits) {
- String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
+ String[] splits2 = split.split("#");
if (splits2.length != 3) {
// old data
splits2 = split.split("#");
@@ -1591,7 +1596,7 @@ private boolean doForPackageReplaced(Context appContext) {
if (!event._eventPreferencesNotification._contacts.isEmpty()) {
String[] splits = event._eventPreferencesNotification._contacts.split(StringConstants.STR_SPLIT_REGEX);
String _split = splits[0];
- String[] _splits2 = _split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
+ String[] _splits2 = _split.split("#");
boolean oldData = false;
try {
//noinspection unused
@@ -1602,7 +1607,7 @@ private boolean doForPackageReplaced(Context appContext) {
if (oldData) {
StringBuilder newContacts = new StringBuilder();
for (String split : splits) {
- String[] splits2 = split.split(StringConstants.STR_SPLIT_CONTACTS_REGEX);
+ String[] splits2 = split.split("#");
if (splits2.length != 3) {
// old data
splits2 = split.split("#");
@@ -1646,6 +1651,7 @@ private boolean doForPackageReplaced(Context appContext) {
}
}
+ */
}