From 50b239d9375d35d1d3c8904d3e43ae6ec2d4ca2c Mon Sep 17 00:00:00 2001 From: Antonis Lilis Date: Tue, 16 Apr 2024 17:18:24 +0300 Subject: [PATCH] Moves database operation to the background --- .../android/ui/reader/actions/ReaderPostActions.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/WordPress/src/main/java/org/wordpress/android/ui/reader/actions/ReaderPostActions.java b/WordPress/src/main/java/org/wordpress/android/ui/reader/actions/ReaderPostActions.java index 7b6e9527bba4..90d40d3a04af 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/reader/actions/ReaderPostActions.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/reader/actions/ReaderPostActions.java @@ -291,8 +291,10 @@ private static void requestPost(RestClientUtils restClientUtils, String path, fi @Override public void onResponse(JSONObject jsonObject) { ReaderPost post = ReaderPost.fromJson(jsonObject); - ReaderPostTable.addPost(post); - handlePostLikes(post, jsonObject); + new Thread(() -> { + ReaderPostTable.addPost(post); + handlePostLikes(post, jsonObject); + }).start(); if (requestListener != null) { requestListener.onSuccess(post.getBlogUrl()); }