1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00

An attempt to make message lists start displaying messages earlier by precomputing a list item.

This commit is contained in:
Jesse Vincent 2009-12-15 02:51:44 +00:00
parent e82bbc25ab
commit 5d34ef2f19

View File

@ -1,5 +1,5 @@
package com.fsck.k9.activity; package com.fsck.k9.activity;
import android.os.Debug; // import android.os.Debug;
import android.app.AlertDialog; import android.app.AlertDialog;
import android.app.Dialog; import android.app.Dialog;
@ -293,7 +293,7 @@ public class MessageList
public void onItemClick(AdapterView parent, View v, int position, long id) public void onItemClick(AdapterView parent, View v, int position, long id)
{ {
Debug.stopMethodTracing(); //Debug.stopMethodTracing();
if ((position+1) == (mAdapter.getCount())) if ((position+1) == (mAdapter.getCount()))
{ {
MessagingController.getInstance(getApplication()).loadMoreMessages( MessagingController.getInstance(getApplication()).loadMoreMessages(
@ -317,7 +317,7 @@ public class MessageList
@Override @Override
public void onCreate(Bundle savedInstanceState) public void onCreate(Bundle savedInstanceState)
{ {
Debug.startMethodTracing("k9"); //Debug.startMethodTracing("k9");
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
@ -343,6 +343,26 @@ public class MessageList
mInflater = getLayoutInflater(); mInflater = getLayoutInflater();
/*
* Dirty hack - the first time we inflate a message list item
* actually takes a lot longer as Android is doing a fair bit of
* work. Instead of letting that happen when the first item
* is displayed, do it in a thread as we're doing initial setup
* Subjective performance feels a lot better, but who knows.
*
*/
new Thread(new Runnable()
{
public void run()
{
mInflater.inflate(R.layout.message_list_item, mListView, false);
}
}).start();
mBatchButtonArea = findViewById(R.id.batch_button_area); mBatchButtonArea = findViewById(R.id.batch_button_area);
mBatchReadButton = (Button) findViewById(R.id.batch_read_button); mBatchReadButton = (Button) findViewById(R.id.batch_read_button);
mBatchReadButton.setOnClickListener(this); mBatchReadButton.setOnClickListener(this);