1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-11-27 19:52:17 -05:00
This commit is contained in:
Jesse Vincent 2011-01-06 16:55:08 +00:00
parent aa0eeac736
commit de806f7715
16 changed files with 1880 additions and 970 deletions

View File

@ -314,7 +314,7 @@ public class Account implements BaseAccount
try try
{ {
mScrollMessageViewButtons = ScrollButtons.valueOf(prefs.getString(mUuid + ".hideButtonsEnum", mScrollMessageViewButtons = ScrollButtons.valueOf(prefs.getString(mUuid + ".hideButtonsEnum",
ScrollButtons.NEVER.name())); ScrollButtons.NEVER.name()));
} }
catch (Exception e) catch (Exception e)
{ {
@ -324,7 +324,7 @@ public class Account implements BaseAccount
try try
{ {
mScrollMessageViewMoveButtons = ScrollButtons.valueOf(prefs.getString(mUuid + ".hideMoveButtonsEnum", mScrollMessageViewMoveButtons = ScrollButtons.valueOf(prefs.getString(mUuid + ".hideMoveButtonsEnum",
ScrollButtons.NEVER.name())); ScrollButtons.NEVER.name()));
} }
catch (Exception e) catch (Exception e)
{ {
@ -702,7 +702,8 @@ public class Account implements BaseAccount
} }
public ColorChip generateColorChip() { public ColorChip generateColorChip()
{
return new ColorChip( mChipColor); return new ColorChip( mChipColor);
} }

View File

@ -73,7 +73,7 @@ public class ActivityListener extends MessagingListener
} }
else else
{ {
operation = ""; // context.getString(R.string.status_polling_off); operation = ""; // context.getString(R.string.status_polling_off);
} }
} }

View File

@ -2337,9 +2337,9 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
{ {
StringBuilder quotedText = new StringBuilder(body.length() + QUOTE_BUFFER_LENGTH); StringBuilder quotedText = new StringBuilder(body.length() + QUOTE_BUFFER_LENGTH);
quotedText.append(String.format( quotedText.append(String.format(
getString(R.string.message_compose_reply_header_fmt), getString(R.string.message_compose_reply_header_fmt),
Address.toString(originalMessage.getFrom())) Address.toString(originalMessage.getFrom()))
); );
final String prefix = mAccount.getQuotePrefix(); final String prefix = mAccount.getQuotePrefix();
final String wrappedText = Utility.wrap(body, REPLY_WRAP_LINE_WIDTH - prefix.length()); final String wrappedText = Utility.wrap(body, REPLY_WRAP_LINE_WIDTH - prefix.length());

View File

@ -2693,10 +2693,10 @@ public class MessageList
ColorStateList color = holder.subject.getTextColors(); ColorStateList color = holder.subject.getTextColors();
ColorStateList linkColor = holder.subject.getLinkTextColors(); ColorStateList linkColor = holder.subject.getLinkTextColors();
str.setSpan(new TextAppearanceSpan(null, Typeface.NORMAL, mFontSizes.getMessageListSender(), color, linkColor), str.setSpan(new TextAppearanceSpan(null, Typeface.NORMAL, mFontSizes.getMessageListSender(), color, linkColor),
0, 0,
noSender.length(), noSender.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
); );
} }
else else
{ {
@ -2782,18 +2782,18 @@ public class MessageList
*/ */
holder.preview.setText(new SpannableStringBuilder(recipientSigil(message)) holder.preview.setText(new SpannableStringBuilder(recipientSigil(message))
.append(message.sender).append(" ").append(message.message.getPreview()), .append(message.sender).append(" ").append(message.message.getPreview()),
TextView.BufferType.SPANNABLE); TextView.BufferType.SPANNABLE);
Spannable str = (Spannable)holder.preview.getText(); Spannable str = (Spannable)holder.preview.getText();
// Create a span section for the sender, and assign the correct font size and weight. // Create a span section for the sender, and assign the correct font size and weight.
ColorStateList color = holder.subject.getTextColors(); ColorStateList color = holder.subject.getTextColors();
ColorStateList linkColor = holder.subject.getLinkTextColors(); ColorStateList linkColor = holder.subject.getLinkTextColors();
str.setSpan(new TextAppearanceSpan(null, senderTypeface, mFontSizes.getMessageListSender(), color, linkColor), str.setSpan(new TextAppearanceSpan(null, senderTypeface, mFontSizes.getMessageListSender(), color, linkColor),
0, 0,
message.sender.length() + 1, message.sender.length() + 1,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
); );
} }
else else
{ {

View File

@ -1391,7 +1391,7 @@ public class MessageView extends K9Activity implements OnClickListener
private void onCopy() private void onCopy()
{ {
if ((!MessagingController.getInstance(getApplication()).isCopyCapable(mAccount)) if ((!MessagingController.getInstance(getApplication()).isCopyCapable(mAccount))
|| (mMessage == null)) || (mMessage == null))
{ {
return; return;
} }
@ -1964,15 +1964,15 @@ public class MessageView extends K9Activity implements OnClickListener
Message message) Message message)
{ {
if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder) if (!mMessageReference.uid.equals(uid) || !mMessageReference.folderName.equals(folder)
|| !mMessageReference.accountUuid.equals(account.getUuid())) || !mMessageReference.accountUuid.equals(account.getUuid()))
{ {
return; return;
} }
try try
{ {
if (MessageView.this.mMessage != null if (MessageView.this.mMessage != null
&& MessageView.this.mMessage.isSet(Flag.X_DOWNLOADED_PARTIAL) && MessageView.this.mMessage.isSet(Flag.X_DOWNLOADED_PARTIAL)
&& message.isSet(Flag.X_DOWNLOADED_FULL)) && message.isSet(Flag.X_DOWNLOADED_FULL))
{ {
mHandler.setHeaders(message); mHandler.setHeaders(message);
} }
@ -2156,7 +2156,7 @@ public class MessageView extends K9Activity implements OnClickListener
try try
{ {
File file = createUniqueFile(Environment.getExternalStorageDirectory(), File file = createUniqueFile(Environment.getExternalStorageDirectory(),
attachment.name); attachment.name);
Uri uri = AttachmentProvider.getAttachmentUri( Uri uri = AttachmentProvider.getAttachmentUri(
mAccount, mAccount,
attachment.part.getAttachmentId()); attachment.part.getAttachmentId());

View File

@ -100,8 +100,8 @@ public class FontSizeSettings extends K9PreferenceActivity
PREFERENCE_MESSAGE_LIST_DATE_FONT, PREFERENCE_MESSAGE_LIST_DATE_FONT,
Integer.toString(fontSizes.getMessageListDate())); Integer.toString(fontSizes.getMessageListDate()));
mMessageListPreview = setupListPreference( mMessageListPreview = setupListPreference(
PREFERENCE_MESSAGE_LIST_PREVIEW_FONT, PREFERENCE_MESSAGE_LIST_PREVIEW_FONT,
Integer.toString(fontSizes.getMessageListPreview())); Integer.toString(fontSizes.getMessageListPreview()));
mMessageViewSender = setupListPreference( mMessageViewSender = setupListPreference(
PREFERENCE_MESSAGE_VIEW_SENDER_FONT, PREFERENCE_MESSAGE_VIEW_SENDER_FONT,

View File

@ -44,8 +44,8 @@ public class HtmlConverter
public static String htmlToText(final String html) public static String htmlToText(final String html)
{ {
return Html.fromHtml(html, null, new HtmlToTextTagHandler()).toString() return Html.fromHtml(html, null, new HtmlToTextTagHandler()).toString()
.replace(PREVIEW_OBJECT_CHARACTER, PREVIEW_OBJECT_REPLACEMENT) .replace(PREVIEW_OBJECT_CHARACTER, PREVIEW_OBJECT_REPLACEMENT)
.replace(NBSP_CHARACTER, NBSP_REPLACEMENT); .replace(NBSP_CHARACTER, NBSP_REPLACEMENT);
} }
/** /**
@ -56,12 +56,15 @@ public class HtmlConverter
private static class HtmlToTextTagHandler implements Html.TagHandler private static class HtmlToTextTagHandler implements Html.TagHandler
{ {
// List of tags whose content should be ignored. // List of tags whose content should be ignored.
private static final Set<String> TAGS_WITH_IGNORED_CONTENT = Collections.unmodifiableSet(new HashSet<String>() {{ private static final Set<String> TAGS_WITH_IGNORED_CONTENT = Collections.unmodifiableSet(new HashSet<String>()
add("style"); {
add("script"); {
add("title"); add("style");
add("!"); // comments add("script");
}}); add("title");
add("!"); // comments
}
});
@Override @Override
public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader) public void handleTag(boolean opening, String tag, Editable output, XMLReader xmlReader)
@ -96,7 +99,7 @@ public class HtmlConverter
if (opening) if (opening)
{ {
output.setSpan(new Annotation(IGNORED_ANNOTATION_KEY, IGNORED_ANNOTATION_VALUE), len, output.setSpan(new Annotation(IGNORED_ANNOTATION_KEY, IGNORED_ANNOTATION_VALUE), len,
len, Spannable.SPAN_MARK_MARK); len, Spannable.SPAN_MARK_MARK);
} }
else else
{ {

View File

@ -4,8 +4,10 @@ import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.charset.MalformedInputException; import java.nio.charset.MalformedInputException;
class Iso2022JpToShiftJisInputStream extends InputStream { class Iso2022JpToShiftJisInputStream extends InputStream
private enum Charset { {
private enum Charset
{
ASCII, JISX0201, JISX0208, ASCII, JISX0201, JISX0208,
} }
@ -63,24 +65,24 @@ class Iso2022JpToShiftJisInputStream extends InputStream {
switch (charset) switch (charset)
{ {
case ASCII: case ASCII:
return in1; return in1;
case JISX0201: case JISX0201:
return in1 + 0x80; return in1 + 0x80;
case JISX0208: case JISX0208:
int in2 = mIn.read(); int in2 = mIn.read();
if (in2 < 0x21 || in2 >= 0x7e) if (in2 < 0x21 || in2 >= 0x7e)
throw new MalformedInputException(0); throw new MalformedInputException(0);
int out1 = (in1 + 1) / 2 + (in1 < 0x5f ? 0x70 : 0xb0); int out1 = (in1 + 1) / 2 + (in1 < 0x5f ? 0x70 : 0xb0);
int out2 = in2 + (in1 % 2 == 0 ? 0x7e : in2 < 0x60 ? 0x1f : 0x20); int out2 = in2 + (in1 % 2 == 0 ? 0x7e : in2 < 0x60 ? 0x1f : 0x20);
out = out2; out = out2;
hasOut = true; hasOut = true;
return out1; return out1;
default: default:
throw new RuntimeException(); throw new RuntimeException();
} }
} }
} }

View File

@ -330,7 +330,7 @@ public class MimeMessage extends Message
{ {
mMessageId = getFirstHeader("Message-ID"); mMessageId = getFirstHeader("Message-ID");
} }
if (mMessageId == null) // even after checking the header if (mMessageId == null) // even after checking the header
{ {
setMessageId(generateMessageId()); setMessageId(generateMessageId());
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -638,7 +638,7 @@ public class WebDavStore extends Store
// an authentication header for basic authentication. // an authentication header for basic authentication.
info.requiredAuthType = AUTH_TYPE_BASIC; info.requiredAuthType = AUTH_TYPE_BASIC;
} }
else if ((info.statusCode >= 200 && info.statusCode < 300) || // Success else if ((info.statusCode >= 200 && info.statusCode < 300) || // Success
(info.statusCode >= 300 && info.statusCode < 400) || // Redirect (info.statusCode >= 300 && info.statusCode < 400) || // Redirect
(info.statusCode == 440)) // Unauthorized (info.statusCode == 440)) // Unauthorized

View File

@ -320,7 +320,7 @@ public class SmtpTransport extends Transport
message.setRecipients(RecipientType.BCC, null); message.setRecipients(RecipientType.BCC, null);
HashMap<String, ArrayList<String>> charsetAddressesMap = HashMap<String, ArrayList<String>> charsetAddressesMap =
new HashMap<String, ArrayList<String>>(); new HashMap<String, ArrayList<String>>();
for (Address address : addresses) for (Address address : addresses)
{ {
String addressString = address.getAddress(); String addressString = address.getAddress();
@ -335,7 +335,7 @@ public class SmtpTransport extends Transport
} }
for (HashMap.Entry<String, ArrayList<String>> charsetAddressesMapEntry : for (HashMap.Entry<String, ArrayList<String>> charsetAddressesMapEntry :
charsetAddressesMap.entrySet()) charsetAddressesMap.entrySet())
{ {
String charset = charsetAddressesMapEntry.getKey(); String charset = charsetAddressesMapEntry.getKey();
ArrayList<String> addressesOfCharset = charsetAddressesMapEntry.getValue(); ArrayList<String> addressesOfCharset = charsetAddressesMapEntry.getValue();
@ -345,7 +345,8 @@ public class SmtpTransport extends Transport
} }
private void sendMessageTo(ArrayList<String> addresses, Message message) private void sendMessageTo(ArrayList<String> addresses, Message message)
throws MessagingException{ throws MessagingException
{
close(); close();
open(); open();

View File

@ -434,7 +434,7 @@ public class MailService extends CoreService
long lastRefresh = pusher.getLastRefresh(); long lastRefresh = pusher.getLastRefresh();
int refreshInterval = pusher.getRefreshInterval(); int refreshInterval = pusher.getRefreshInterval();
long sinceLast = nowTime - lastRefresh; long sinceLast = nowTime - lastRefresh;
if (sinceLast + 10000 > refreshInterval) // Add 10 seconds to keep pushers in sync, avoid drift if (sinceLast + 10000 > refreshInterval) // Add 10 seconds to keep pushers in sync, avoid drift
{ {
if (K9.DEBUG) if (K9.DEBUG)
{ {

View File

@ -4,7 +4,8 @@ import android.graphics.Path;
import android.graphics.drawable.ShapeDrawable; import android.graphics.drawable.ShapeDrawable;
import android.graphics.drawable.shapes.PathShape; import android.graphics.drawable.shapes.PathShape;
public class ColorChip { public class ColorChip
{
private static final Path CHIP_PATH = new Path(); private static final Path CHIP_PATH = new Path();
static static
@ -22,15 +23,17 @@ public class ColorChip {
private ShapeDrawable mDrawable; private ShapeDrawable mDrawable;
public ColorChip(int color) { public ColorChip(int color)
{
mDrawable = new ShapeDrawable(new PathShape(CHIP_PATH, 10, 10)); mDrawable = new ShapeDrawable(new PathShape(CHIP_PATH, 10, 10));
mDrawable.getPaint().setColor(color); mDrawable.getPaint().setColor(color);
} }
public ShapeDrawable drawable () { public ShapeDrawable drawable ()
{
return mDrawable; return mDrawable;
} }

View File

@ -20,7 +20,8 @@ import java.lang.reflect.Method;
* Time: 3:57 PM * Time: 3:57 PM
* To change this template use File | Settings | File Templates. * To change this template use File | Settings | File Templates.
*/ */
public class MessageWebView extends WebView { public class MessageWebView extends WebView
{
/** /**
* We use WebSettings.getBlockNetworkLoads() to prevent the WebView that displays email * We use WebSettings.getBlockNetworkLoads() to prevent the WebView that displays email