1
0
mirror of https://github.com/moparisthebest/k-9 synced 2024-12-24 08:38:51 -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
{
mScrollMessageViewButtons = ScrollButtons.valueOf(prefs.getString(mUuid + ".hideButtonsEnum",
ScrollButtons.NEVER.name()));
ScrollButtons.NEVER.name()));
}
catch (Exception e)
{
@ -324,7 +324,7 @@ public class Account implements BaseAccount
try
{
mScrollMessageViewMoveButtons = ScrollButtons.valueOf(prefs.getString(mUuid + ".hideMoveButtonsEnum",
ScrollButtons.NEVER.name()));
ScrollButtons.NEVER.name()));
}
catch (Exception e)
{
@ -702,7 +702,8 @@ public class Account implements BaseAccount
}
public ColorChip generateColorChip() {
public ColorChip generateColorChip()
{
return new ColorChip( mChipColor);
}

View File

@ -73,7 +73,7 @@ public class ActivityListener extends MessagingListener
}
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);
quotedText.append(String.format(
getString(R.string.message_compose_reply_header_fmt),
Address.toString(originalMessage.getFrom()))
);
getString(R.string.message_compose_reply_header_fmt),
Address.toString(originalMessage.getFrom()))
);
final String prefix = mAccount.getQuotePrefix();
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 linkColor = holder.subject.getLinkTextColors();
str.setSpan(new TextAppearanceSpan(null, Typeface.NORMAL, mFontSizes.getMessageListSender(), color, linkColor),
0,
noSender.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
);
0,
noSender.length(),
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
);
}
else
{
@ -2782,18 +2782,18 @@ public class MessageList
*/
holder.preview.setText(new SpannableStringBuilder(recipientSigil(message))
.append(message.sender).append(" ").append(message.message.getPreview()),
TextView.BufferType.SPANNABLE);
.append(message.sender).append(" ").append(message.message.getPreview()),
TextView.BufferType.SPANNABLE);
Spannable str = (Spannable)holder.preview.getText();
// Create a span section for the sender, and assign the correct font size and weight.
ColorStateList color = holder.subject.getTextColors();
ColorStateList linkColor = holder.subject.getLinkTextColors();
str.setSpan(new TextAppearanceSpan(null, senderTypeface, mFontSizes.getMessageListSender(), color, linkColor),
0,
message.sender.length() + 1,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
);
0,
message.sender.length() + 1,
Spannable.SPAN_EXCLUSIVE_EXCLUSIVE
);
}
else
{

View File

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

View File

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

View File

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

View File

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

View File

@ -330,7 +330,7 @@ public class MimeMessage extends Message
{
mMessageId = getFirstHeader("Message-ID");
}
if (mMessageId == null) // even after checking the header
if (mMessageId == null) // even after checking the header
{
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.
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 == 440)) // Unauthorized

View File

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

View File

@ -434,7 +434,7 @@ public class MailService extends CoreService
long lastRefresh = pusher.getLastRefresh();
int refreshInterval = pusher.getRefreshInterval();
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)
{

View File

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

View File

@ -20,7 +20,8 @@ import java.lang.reflect.Method;
* Time: 3:57 PM
* 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