1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-24 02:12:15 -05:00
This commit is contained in:
Jesse Vincent 2010-08-18 02:48:55 +00:00
parent de142b7faa
commit ff5024eaec
15 changed files with 145 additions and 106 deletions

View File

@ -313,7 +313,7 @@ public class Account implements BaseAccount
try
{
mShowPictures = ShowPictures.valueOf(prefs.getString(mUuid + ".showPicturesEnum",
ShowPictures.NEVER.name()));
ShowPictures.NEVER.name()));
}
catch (Exception e)
{

View File

@ -224,10 +224,12 @@ public class ChooseFolder extends K9ListActivity
}
}
private void setDisplayMode(FolderMode aMode) {
private void setDisplayMode(FolderMode aMode)
{
mMode = aMode;
// invalidate the current filter as it is working on an inval
if (myFilter != null) {
if (myFilter != null)
{
myFilter.invalidate();
}
//re-populate the list

View File

@ -1614,19 +1614,19 @@ public class FolderList extends K9ListActivity
SearchSpecification searchSpec = new SearchSpecification()
{
//interface has no override @Override
//interface has no override @Override
public String[] getAccountUuids()
{
return new String[] { account.getUuid() };
}
//interface has no override @Override
//interface has no override @Override
public Flag[] getForbiddenFlags()
{
return UNREAD_FLAG_ARRAY;
}
//interface has no override @Override
//interface has no override @Override
public String getQuery()
{
return "";

View File

@ -136,7 +136,8 @@ public class FolderListFilter<T> extends Filter
mFolders.notifyDataSetChanged();
}
public void invalidate() {
public void invalidate()
{
mOriginalValues = null;
}
}

View File

@ -2322,7 +2322,7 @@ public class MessageList
/**
* Associate model data to view object.
*
*
* @param position
* The position of the item within the adapter's data set of
* the item whose view we want.
@ -2335,7 +2335,7 @@ public class MessageList
* Never <code>null</code>.
*/
private void bindView(final int position, final View view, final MessageViewHolder holder,
final MessageInfoHolder message)
final MessageInfoHolder message)
{
holder.subject.setTypeface(null, message.read ? Typeface.NORMAL : Typeface.BOLD);

View File

@ -1964,7 +1964,7 @@ public class MessageView extends K9Activity implements OnClickListener
// Inline parts with a content-id are almost certainly components of an HTML message
// not attachments. Don't show attachment download buttons for them.
if ( contentDisposition != null &&
if (contentDisposition != null &&
MimeUtility.getHeaderParameter(contentDisposition, null).matches("^(?i:inline)")
&& part.getHeader("Content-ID") != null)
{
@ -2224,7 +2224,7 @@ public class MessageView extends K9Activity implements OnClickListener
{
if ((account.getShowPictures() == Account.ShowPictures.ALWAYS) ||
((account.getShowPictures() == Account.ShowPictures.ONLY_FROM_CONTACTS) &&
mContacts.isInContacts(message.getFrom()[0].getAddress())))
mContacts.isInContacts(message.getFrom()[0].getAddress())))
{
onShowPictures();
}
@ -2552,7 +2552,9 @@ public class MessageView extends K9Activity implements OnClickListener
}
mCryptoSignatureLayout.setVisibility(View.VISIBLE);
mDecryptLayout.setVisibility(View.VISIBLE);
} else {
}
else
{
mCryptoSignatureLayout.setVisibility(View.INVISIBLE);
}

View File

@ -398,7 +398,7 @@ public class MessagingController implements Runnable
*/
public void listFolders(final Account account, final boolean refreshRemote, final MessagingListener listener)
{
new Thread (new Runnable()
new Thread(new Runnable()
{
public void run()
{

View File

@ -31,11 +31,12 @@ public class ContactsSdk3_4 extends com.fsck.k9.helper.Contacts
* {@link com.fsck.k9.EmailAddressAdapter} or more specificly by
* {@link android.widget.ResourceCursorAdapter}.
*/
private static final String PROJECTION[] = {
Contacts.People.ContactMethods._ID,
Contacts.People.ContactMethods.NAME,
Contacts.People.ContactMethods.DATA
};
private static final String PROJECTION[] =
{
Contacts.People.ContactMethods._ID,
Contacts.People.ContactMethods.NAME,
Contacts.People.ContactMethods.DATA
};
/**
* Index of the name field in the projection. This must match the order in
@ -65,7 +66,7 @@ public class ContactsSdk3_4 extends com.fsck.k9.helper.Contacts
// Pass along full E-mail string for possible create dialog
contactIntent.putExtra(Contacts.Intents.EXTRA_CREATE_DESCRIPTION,
email.toString());
email.toString());
// Only provide personal name hint if we have one
final String senderPersonal = email.getPersonal();
@ -82,11 +83,11 @@ public class ContactsSdk3_4 extends com.fsck.k9.helper.Contacts
{
String name = null;
final Cursor c = mContentResolver.query(
Uri.withAppendedPath(Contacts.People.CONTENT_URI, "owner"),
PROJECTION,
null,
null,
null);
Uri.withAppendedPath(Contacts.People.CONTENT_URI, "owner"),
PROJECTION,
null,
null,
null);
if (c != null)
{
@ -110,15 +111,15 @@ public class ContactsSdk3_4 extends com.fsck.k9.helper.Contacts
final String[] args = new String[] {emailAddress};
final Cursor c = mContentResolver.query(
Contacts.ContactMethods.CONTENT_EMAIL_URI,
PROJECTION,
where,
args,
null);
Contacts.ContactMethods.CONTENT_EMAIL_URI,
PROJECTION,
where,
args,
null);
if (c != null)
{
if (c.getCount() > 0)
if (c.getCount() > 0)
{
result = true;
}
@ -141,20 +142,20 @@ public class ContactsSdk3_4 extends com.fsck.k9.helper.Contacts
else
{
where = "(" +
Contacts.People.NAME + " LIKE ?" +
") OR (" +
Contacts.ContactMethods.DATA + " LIKE ?" +
")";
Contacts.People.NAME + " LIKE ?" +
") OR (" +
Contacts.ContactMethods.DATA + " LIKE ?" +
")";
final String filter = constraint.toString() + "%";
args = new String[] {filter, filter};
}
final Cursor c = mContentResolver.query(
Contacts.ContactMethods.CONTENT_EMAIL_URI,
PROJECTION,
where,
args,
SORT_ORDER);
Contacts.ContactMethods.CONTENT_EMAIL_URI,
PROJECTION,
where,
args,
SORT_ORDER);
if (c != null)
{

View File

@ -34,11 +34,12 @@ public class ContactsSdk5 extends com.fsck.k9.helper.Contacts
* {@link com.fsck.k9.EmailAddressAdapter} or more specificly by
* {@link android.widget.ResourceCursorAdapter}.
*/
private static final String PROJECTION[] = {
Contacts._ID,
Contacts.DISPLAY_NAME,
Email.DATA
};
private static final String PROJECTION[] =
{
Contacts._ID,
Contacts.DISPLAY_NAME,
Email.DATA
};
/**
* Index of the name field in the projection. This must match the order in
@ -68,7 +69,7 @@ public class ContactsSdk5 extends com.fsck.k9.helper.Contacts
// Pass along full E-mail string for possible create dialog
contactIntent.putExtra(Intents.EXTRA_CREATE_DESCRIPTION,
email.toString());
email.toString());
// Only provide personal name hint if we have one
final String senderPersonal = email.getPersonal();
@ -110,7 +111,7 @@ public class ContactsSdk5 extends com.fsck.k9.helper.Contacts
if (c != null)
{
if (c.getCount() > 0)
if (c.getCount() > 0)
{
result = true;
}
@ -126,11 +127,11 @@ public class ContactsSdk5 extends com.fsck.k9.helper.Contacts
final String filter = (constraint == null) ? "" : constraint.toString();
final Uri uri = Uri.withAppendedPath(Email.CONTENT_FILTER_URI, Uri.encode(filter));
final Cursor c = mContentResolver.query(
uri,
PROJECTION,
null,
null,
SORT_ORDER);
uri,
PROJECTION,
null,
null,
SORT_ORDER);
if (c != null)
{

View File

@ -597,10 +597,10 @@ public class MimeUtility
private static String fixupCharset(String charset)
{
charset = charset.toLowerCase();
if (charset.equals("cp932"))
return "shift-jis";
else if (charset.equals("koi8-u"))
return "koi8-r";
if (charset.equals("cp932"))
return "shift-jis";
else if (charset.equals("koi8-u"))
return "koi8-r";
return charset;

View File

@ -1212,14 +1212,14 @@ public class ImapStore extends Store
try
{
mConnection.sendCommand(String.format("UID FETCH %s (%s)",
Utility.combine(uidWindow.toArray(new String[uidWindow.size()]), ','),
Utility.combine(uidWindow.toArray(new String[uidWindow.size()]), ','),
Utility.combine(fetchFields.toArray(new String[fetchFields.size()]), ' ')
), false);
ImapResponse response;
int messageNumber = 0;
ImapResponseParser.IImapResponseCallback callback = null;
if (fp.contains(FetchProfile.Item.BODY) || fp.contains(FetchProfile.Item.BODY_SANE) )
if (fp.contains(FetchProfile.Item.BODY) || fp.contains(FetchProfile.Item.BODY_SANE))
{
callback = new FetchBodyCallback(messageMap);
}

View File

@ -1416,8 +1416,8 @@ public class LocalStore extends Store implements Serializable
"mime_type",
"store_data",
"content_uri",
"content_id",
"content_disposition"
"content_id",
"content_disposition"
},
"message_id = ?",
new String[] { Long.toString(localMessage.mId) },
@ -1437,7 +1437,7 @@ public class LocalStore extends Store implements Serializable
String contentDisposition = cursor.getString(7);
Body body = null;
if (contentDisposition == null )
if (contentDisposition == null)
{
contentDisposition = "attachment";
}
@ -2475,7 +2475,7 @@ public class LocalStore extends Store implements Serializable
{
switch (c)
{
// These emoji codepoints are generated by tools/make_emoji in the K-9 source tree
// These emoji codepoints are generated by tools/make_emoji in the K-9 source tree
case 0xE6F9: //docomo kissmark
buff.append("<img src=\"file:///android_asset/emoticons/kissmark.gif\" alt=\"kissmark\" />");
@ -3233,9 +3233,9 @@ public class LocalStore extends Store implements Serializable
case 0xE6D3: //docomo mail
buff.append("<img src=\"file:///android_asset/emoticons/mail.gif\" alt=\"mail\" />");
break;
// These emoji codepoints are generated by tools/make_emoji in the K-9 source tree
// The spaces between the < and the img are a hack to avoid triggering
// K-9's 'load images' button
// These emoji codepoints are generated by tools/make_emoji in the K-9 source tree
// The spaces between the < and the img are a hack to avoid triggering
// K-9's 'load images' button
case 0xE223: //softbank eight
buff.append("<img src=\"file:///android_asset/emoticons/eight.gif\" alt=\"eight\" />");
@ -3804,9 +3804,9 @@ public class LocalStore extends Store implements Serializable
case 0xE313: //softbank hairsalon
buff.append("<img src=\"file:///android_asset/emoticons/hairsalon.gif\" alt=\"hairsalon\" />");
break;
// These emoji codepoints are generated by tools/make_emoji in the K-9 source tree
// The spaces between the < and the img are a hack to avoid triggering
// K-9's 'load images' button
// These emoji codepoints are generated by tools/make_emoji in the K-9 source tree
// The spaces between the < and the img are a hack to avoid triggering
// K-9's 'load images' button
case 0xE488: //kddi sun
buff.append("<img src=\"file:///android_asset/emoticons/sun.gif\" alt=\"sun\" />");
@ -3886,9 +3886,9 @@ public class LocalStore extends Store implements Serializable
case 0xE4A5: //kddi toilet
buff.append("<img src=\"file:///android_asset/emoticons/toilet.gif\" alt=\"toilet\" />");
break;
// Skipping kddi codepoint E523 two
// It conflicts with an earlier definition from another carrier:
// softbank chick
// Skipping kddi codepoint E523 two
// It conflicts with an earlier definition from another carrier:
// softbank chick
case 0xE496: //kddi scorpius
buff.append("<img src=\"file:///android_asset/emoticons/scorpius.gif\" alt=\"scorpius\" />");
@ -3968,9 +3968,9 @@ public class LocalStore extends Store implements Serializable
case 0xE514: //kddi ring
buff.append("<img src=\"file:///android_asset/emoticons/ring.gif\" alt=\"ring\" />");
break;
// Skipping kddi codepoint E502 tv
// It conflicts with an earlier definition from another carrier:
// softbank art
// Skipping kddi codepoint E502 tv
// It conflicts with an earlier definition from another carrier:
// softbank art
case 0xE4AC: //kddi restaurant
buff.append("<img src=\"file:///android_asset/emoticons/restaurant.gif\" alt=\"restaurant\" />");
@ -4161,9 +4161,9 @@ public class LocalStore extends Store implements Serializable
case 0xE520: //kddi faxto
buff.append("<img src=\"file:///android_asset/emoticons/faxto.gif\" alt=\"faxto\" />");
break;
// Skipping kddi codepoint E503 karaoke
// It conflicts with an earlier definition from another carrier:
// softbank drama
// Skipping kddi codepoint E503 karaoke
// It conflicts with an earlier definition from another carrier:
// softbank drama
case 0xE4D6: //kddi fastfood
buff.append("<img src=\"file:///android_asset/emoticons/fastfood.gif\" alt=\"fastfood\" />");

View File

@ -412,7 +412,8 @@ public class MailService extends CoreService
}
else
{
if (K9.DEBUG) {
if (K9.DEBUG)
{
Log.i(K9.LOG_TAG, "Not scheduling pushers: connectivity? "+hasConnectivity + " -- doBackground? "+doBackground);
}

View File

@ -24,8 +24,10 @@ import android.text.Html;
import android.text.Spanned;
import android.widget.ArrayAdapter;
public class AccessibleEmailContentActivity extends ListActivity {
String[] listItems = {
public class AccessibleEmailContentActivity extends ListActivity
{
String[] listItems =
{
""
};
@ -35,7 +37,8 @@ public class AccessibleEmailContentActivity extends ListActivity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
htmlSource = getIntent().getStringExtra("content");
@ -43,8 +46,10 @@ public class AccessibleEmailContentActivity extends ListActivity {
String[] rawListItems = parsedHtml.toString().split("\n");
cleanedList = new ArrayList<String>();
for (int i = 0; i < rawListItems.length; i++) {
if (rawListItems[i].trim().length() > 0) {
for (int i = 0; i < rawListItems.length; i++)
{
if (rawListItems[i].trim().length() > 0)
{
addToCleanedList(rawListItems[i]);
}
}
@ -55,21 +60,30 @@ public class AccessibleEmailContentActivity extends ListActivity {
setListAdapter(new ArrayAdapter(this, android.R.layout.simple_list_item_1, listItems));
}
private void addToCleanedList(String line) {
if (line.length() < 80) {
private void addToCleanedList(String line)
{
if (line.length() < 80)
{
cleanedList.add(line);
} else {
while (line.length() > 80) {
}
else
{
while (line.length() > 80)
{
int cutPoint = line.indexOf(" ", 80);
if ((cutPoint > 0) && (cutPoint < line.length())) {
if ((cutPoint > 0) && (cutPoint < line.length()))
{
cleanedList.add(line.substring(0, cutPoint));
line = line.substring(cutPoint).trim();
} else {
}
else
{
cleanedList.add(line);
line = "";
}
}
if (line.length() > 0) {
if (line.length() > 0)
{
cleanedList.add(line);
}
}

View File

@ -26,84 +26,101 @@ import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.TextView;
public class AccessibleWebView extends TextView {
public class AccessibleWebView extends TextView
{
private Activity parent;
private String htmlSource;
private WebView dummyWebView;
public AccessibleWebView(Context context) {
public AccessibleWebView(Context context)
{
super(context);
parent = (Activity) context;
dummyWebView = new WebView(context);
setFocusable(true);
setFocusableInTouchMode(true);
setOnClickListener(new OnClickListener() {
setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0) {
public void onClick(View arg0)
{
diveIn();
}
});
}
public AccessibleWebView(Context context, AttributeSet attributes) {
public AccessibleWebView(Context context, AttributeSet attributes)
{
super(context, attributes);
parent = (Activity) context;
dummyWebView = new WebView(context);
setFocusable(true);
setFocusableInTouchMode(true);
setOnClickListener(new OnClickListener() {
setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View arg0) {
public void onClick(View arg0)
{
diveIn();
}
});
}
public void loadData(String data, String mimeType, String encoding) {
public void loadData(String data, String mimeType, String encoding)
{
htmlSource = data;
this.setText(Html.fromHtml(htmlSource, null, null));
}
public WebSettings getSettings() {
public WebSettings getSettings()
{
return dummyWebView.getSettings();
}
public void setVerticalScrollbarOverlay(boolean booleanValue) {
public void setVerticalScrollbarOverlay(boolean booleanValue)
{
// Do nothing here; dummy stub method to maintain compatibility with
// standard WebView.
}
public void loadDataWithBaseURL(String baseUrl, String data, String mimeType, String encoding,
String historyUrl) {
String historyUrl)
{
htmlSource = data;
this.setText(Html.fromHtml(htmlSource, null, null));
}
public void loadUrl(String url) {
public void loadUrl(String url)
{
// Do nothing here; dummy stub method to maintain compatibility with
// standard WebView.
}
public boolean zoomIn() {
if (getTextSize() < 100) {
public boolean zoomIn()
{
if (getTextSize() < 100)
{
setTextSize(getTextSize() + 5);
return true;
}
return false;
}
public boolean zoomOut() {
if (getTextSize() > 5) {
public boolean zoomOut()
{
if (getTextSize() > 5)
{
setTextSize(getTextSize() - 5);
return true;
}
return false;
}
private void diveIn() {
private void diveIn()
{
Intent i = new Intent();
i.setClass(parent, AccessibleEmailContentActivity.class);
i.putExtra("content", htmlSource);