Re-enable view prefetching.

master
Greyson Parrelli 2020-06-30 11:55:06 -07:00
parent eafccc5721
commit 4ea8bac10d
3 changed files with 14 additions and 2 deletions

View File

@ -168,6 +168,8 @@ public class ConversationFragment extends LoggingFragment {
FrameLayout parent = new FrameLayout(context);
parent.setLayoutParams(new FrameLayout.LayoutParams(FrameLayout.LayoutParams.MATCH_PARENT, FrameLayout.LayoutParams.WRAP_CONTENT));
CachedInflater.from(context).cacheUntilLimit(R.layout.conversation_item_received_text_only, parent, 15);
CachedInflater.from(context).cacheUntilLimit(R.layout.conversation_item_sent_text_only, parent, 15);
CachedInflater.from(context).cacheUntilLimit(R.layout.conversation_item_received_multimedia, parent, 10);
CachedInflater.from(context).cacheUntilLimit(R.layout.conversation_item_sent_multimedia, parent, 10);
CachedInflater.from(context).cacheUntilLimit(R.layout.conversation_item_update, parent, 5);

View File

@ -88,6 +88,7 @@ import org.thoughtcrime.securesms.components.reminder.ServiceOutageReminder;
import org.thoughtcrime.securesms.components.reminder.ShareReminder;
import org.thoughtcrime.securesms.components.reminder.SystemSmsImportReminder;
import org.thoughtcrime.securesms.components.reminder.UnauthorizedReminder;
import org.thoughtcrime.securesms.conversation.ConversationFragment;
import org.thoughtcrime.securesms.conversationlist.model.Conversation;
import org.thoughtcrime.securesms.conversationlist.model.MessageResult;
import org.thoughtcrime.securesms.conversationlist.model.SearchResult;
@ -266,8 +267,7 @@ public class ConversationListFragment extends MainFragment implements ActionMode
@Override
public void onStart() {
super.onStart();
// TODO [greyson] Re-enable when we figure out how to invalidate the cache after a system theme change
// ConversationFragment.prepare(requireContext());
ConversationFragment.prepare(requireContext());
}
@Override

View File

@ -17,11 +17,21 @@ public class DynamicTheme {
public static final String LIGHT = "light";
public static final String SYSTEM = "system";
private static boolean isDarkTheme;
private int currentTheme;
public void onCreate(Activity activity) {
boolean wasDarkTheme = isDarkTheme;
currentTheme = getSelectedTheme(activity);
isDarkTheme = isDarkTheme(activity);
activity.setTheme(currentTheme);
if (isDarkTheme != wasDarkTheme) {
CachedInflater.from(activity).clear();
}
}
public void onResume(Activity activity) {