Remove several threads fixes battery drain

This commit is contained in:
Arne 2024-04-14 19:16:54 +02:00
parent e91669502c
commit 6e70d465f2
5 changed files with 49 additions and 60 deletions

View file

@ -11,48 +11,9 @@
"type": "UNIVERSAL",
"filters": [],
"attributes": [],
"versionCode": 170,
"versionName": "1.7.9.5.2",
"outputFile": "monocles chat-1.7.9.5.2-git-universal-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 17001,
"versionName": "1.7.9.5.2",
"outputFile": "monocles chat-1.7.9.5.2-git-armeabi-v7a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86_64"
}
],
"attributes": [],
"versionCode": 17003,
"versionName": "1.7.9.5.2",
"outputFile": "monocles chat-1.7.9.5.2-git-x86_64-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86"
}
],
"attributes": [],
"versionCode": 17002,
"versionName": "1.7.9.5.2",
"outputFile": "monocles chat-1.7.9.5.2-git-x86-release.apk"
"versionCode": 171,
"versionName": "1.7.9.5.3",
"outputFile": "monocles chat-1.7.9.5.3-git-universal-release.apk"
},
{
"type": "ONE_OF_MANY",
@ -63,9 +24,48 @@
}
],
"attributes": [],
"versionCode": 17004,
"versionName": "1.7.9.5.2",
"outputFile": "monocles chat-1.7.9.5.2-git-arm64-v8a-release.apk"
"versionCode": 17104,
"versionName": "1.7.9.5.3",
"outputFile": "monocles chat-1.7.9.5.3-git-arm64-v8a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86_64"
}
],
"attributes": [],
"versionCode": 17103,
"versionName": "1.7.9.5.3",
"outputFile": "monocles chat-1.7.9.5.3-git-x86_64-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "armeabi-v7a"
}
],
"attributes": [],
"versionCode": 17101,
"versionName": "1.7.9.5.3",
"outputFile": "monocles chat-1.7.9.5.3-git-armeabi-v7a-release.apk"
},
{
"type": "ONE_OF_MANY",
"filters": [
{
"filterType": "ABI",
"value": "x86"
}
],
"attributes": [],
"versionCode": 17102,
"versionName": "1.7.9.5.3",
"outputFile": "monocles chat-1.7.9.5.3-git-x86-release.apk"
}
],
"elementType": "File"

View file

@ -2861,9 +2861,7 @@ public class XmppConnectionService extends Service {
private void markChangedFiles(List<DatabaseBackend.FilePathInfo> infos) {
final boolean[] changed = {false};
for (Conversation conversation : getConversations()) {
new Thread( new Runnable() { @Override public void run() {
changed[0] |= conversation.markAsChanged(infos);
} } ).start();
changed[0] |= conversation.markAsChanged(infos);
}
if (changed[0]) {
updateConversationUi();

View file

@ -1945,7 +1945,6 @@ public class ConversationFragment extends XmppFragment
public void LoadStickers() {
activity.runOnUiThread(() -> {
if (!hasStoragePermission(activity)) return;
// Load and show Stickers
if (!dirStickers.exists()) {
@ -1990,11 +1989,9 @@ public class ConversationFragment extends XmppFragment
return true;
}
});
});
}
public void LoadGifs() {
activity.runOnUiThread(() -> {
if (!hasStoragePermission(activity)) return;
// Load and show GIFs
if (!dirGifs.exists()) {
@ -2039,7 +2036,6 @@ public class ConversationFragment extends XmppFragment
return true;
}
});
});
}
protected void newThreadTutorialToast(String s) {

View file

@ -1331,11 +1331,8 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
@Override
public void onRosterUpdate() {
new Thread( new Runnable() { @Override public void run() {
refreshForNewCaps = true;
refreshUi();
} } ).start();
refreshForNewCaps = true;
refreshUi();
}
@Override

View file

@ -303,9 +303,7 @@ public class StartConversationActivity extends XmppActivity implements XmppConne
@Override
public void onRosterUpdate() {
new Thread( new Runnable() { @Override public void run() {
refreshUi();
} } ).start();
refreshUi();
}
@Override