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

r62972@17h: jesse | 2009-05-07 10:49:32 -0400

First stab at a folderlist that doesn't know or care about messages
r62973@17h:  jesse | 2009-05-07 10:50:11 -0400
A very broken first stab at a message list that only knows about one folder.
r62974@17h:  jesse | 2009-05-07 10:50:44 -0400
When you go from an account list to an individual account, open a folderlist, not an fml
r62975@17h:  jesse | 2009-05-07 10:51:24 -0400
Update Welcome activity to open an ml instead of an fml
r62976@17h:  jesse | 2009-05-07 10:51:59 -0400
When setting up accounts is over, open an fl instead of an fml
r62977@17h:  jesse | 2009-05-07 10:52:51 -0400
Update MessageView to use folderinfoholders and messageinfoholders from the 'correct' classes.
r62978@17h:  jesse | 2009-05-07 10:59:07 -0400
MailService now notifies the fl instead of the fml. Not sure if it should also notify the ml. - will require testing
r62979@17h:  jesse | 2009-05-07 11:01:09 -0400
Switch MessagingController's notifications from notifying the FML to notifying an ML
r62980@17h:  jesse | 2009-05-07 11:25:22 -0400
Update AndroidManifest to know about the new world order
r62981@17h:  jesse | 2009-05-07 11:26:11 -0400
Try to follow the android sdk docs for intent creation
r62982@17h:  jesse | 2009-05-07 11:28:30 -0400
reset MessageList for another try at the conversion
r62983@17h:  jesse | 2009-05-07 11:47:33 -0400
This version doesn't crash and has a working 'folder' layer. now to clean up the message list layer
r62984@17h:  jesse | 2009-05-07 15:18:04 -0400
 move step 1
r62985@17h:  jesse | 2009-05-07 15:18:37 -0400
move step 1
r62986@17h:  jesse | 2009-05-07 15:22:47 -0400
rename step 1
r62987@17h:  jesse | 2009-05-07 17:38:02 -0400
 checkpoint to move
r62988@17h:  jesse | 2009-05-07 17:40:01 -0400
checkpointing a state with a working folder list and a message list that doesn't explode
r62989@17h:  jesse | 2009-05-07 17:40:26 -0400
Remove debugging cruft from Welcome
r62990@17h:  jesse | 2009-05-07 22:00:12 -0400
Basic functionality works.
r62991@17h:  jesse | 2009-05-08 04:19:52 -0400
added a tool to build a K-9 "Beta" 
r62992@17h:  jesse | 2009-05-08 04:20:03 -0400
remove a disused file
r62993@17h:  jesse | 2009-05-09 06:07:02 -0400
upgrading build infrastructure for the 1.5 sdk
r62994@17h:  jesse | 2009-05-09 06:22:02 -0400
further refine onOpenMessage, removing more folder assumptions 
r62995@17h:  jesse | 2009-05-09 20:07:20 -0400
Make the Welcome activity open the autoexpandfolder rather than INBOX
r62996@17h:  jesse | 2009-05-09 20:14:10 -0400
MessageList now stores the Folder name it was working with across pause-reload
r62997@17h:  jesse | 2009-05-09 20:14:26 -0400
Removing dead code from FolderList
r63060@17h:  jesse | 2009-05-10 00:07:33 -0400
Replace the old message list refreshing code which cleared and rebuilt the list from scratch with code which updates or deletes existing messages.
Add "go back to folder list" code
r63061@17h:  jesse | 2009-05-10 00:07:50 -0400
fix message list menus for new world order
r63062@17h:  jesse | 2009-05-10 00:08:11 -0400
Remove message list options from folder list menus
r63063@17h:  jesse | 2009-05-10 00:10:02 -0400
remove more message list options from the folder list
r63064@17h:  jesse | 2009-05-10 00:10:19 -0400
fix build.xml for the new android world order
r63065@17h:  jesse | 2009-05-10 00:39:23 -0400
reformatted in advance of bug tracing
r63066@17h:  jesse | 2009-05-10 05:53:28 -0400
fix our 'close' behavior to not leave extra activities around
clean up more vestigal code
r63067@17h:  jesse | 2009-05-10 18:44:25 -0400
Improve "back button / accounts" workflow from FolderList -> AccountList
r63068@17h:  jesse | 2009-05-10 19:11:47 -0400
* Add required code for the 'k9beta' build
r63069@17h:  jesse | 2009-05-10 19:12:05 -0400
Make the folder list white backgrounded.
r63070@17h:  jesse | 2009-05-10 19:12:26 -0400
* Include our required libraries in build.xml 
r63071@17h:  jesse | 2009-05-10 19:13:07 -0400
Added directories for our built code and our generated code
r63072@17h:  jesse | 2009-05-10 19:13:36 -0400
Added a "back" button image
r63073@17h:  jesse | 2009-05-10 20:13:50 -0400
Switch next/prev buttons to triangles for I18N and eventual "more easy-to-hit buttons" win
r63074@17h:  jesse | 2009-05-10 20:17:18 -0400
Tidy Accounts.java for some perf hacking.
r63081@17h:  jesse | 2009-05-10 22:13:33 -0400
First pass reformatting of the MessagingController
r63082@17h:  jesse | 2009-05-10 23:50:28 -0400
MessageList now correctly updates when a background sync happens
r63083@17h:  jesse | 2009-05-10 23:50:53 -0400
Tidying FolderList
r63084@17h:  jesse | 2009-05-10 23:51:09 -0400
tidy
r63085@17h:  jesse | 2009-05-10 23:51:27 -0400
tidy
r63086@17h:  jesse | 2009-05-11 00:17:06 -0400
Properly update unread counts in the FolderList after sync

r63087@17h:  jesse | 2009-05-11 01:38:14 -0400
Minor refactoring for readability. replace a boolean with a constant.
r63090@17h:  jesse | 2009-05-11 02:58:31 -0400
 now that the foreground of message lists is light, we don't need the light messagebox
r63091@17h:  jesse | 2009-05-11 17:15:02 -0400
Added a string for "back to folder list"
r63092@17h:  jesse | 2009-05-11 17:15:24 -0400
Added a message list header with a back button
r63093@17h:  jesse | 2009-05-11 17:15:54 -0400
Remove the "folder list" button from the options menu. no sense duplicating it
r63094@17h:  jesse | 2009-05-11 17:17:06 -0400
Refactored views, adding our replacement scrollable header 
r63184@17h:  jesse | 2009-05-12 07:07:15 -0400
fix weird bug where message lists could show a header element for a child
r63185@17h:  jesse | 2009-05-12 07:08:12 -0400
Add new-style headers to folder lists. reimplement "get folder by name" to not use a bloody for loop
r63211@17h:  jesse | 2009-05-12 18:37:48 -0400
Restore the former glory of the "load more messages"  widget.  it still needs an overhaul
r63296@17h:  jesse | 2009-05-12 23:23:21 -0400
Get the indeterminate progress bar to show up again when you click "get more messages"
r63297@17h:  jesse | 2009-05-13 02:40:39 -0400
Fixed off-by-one errors in click and keybindings for messagelist
r63298@17h:  jesse | 2009-05-13 06:04:01 -0400
Put the folder title in the name of the folderSettings popup
r63299@17h:  jesse | 2009-05-13 06:04:49 -0400
Reformatting. Removing debug logging
r63300@17h:  jesse | 2009-05-13 06:05:32 -0400
Fixing "wrong item selected" bugs in the FolderList 
r63328@17h:  jesse | 2009-05-13 13:20:00 -0400
Update MessageView for 1.5
r63329@17h:  jesse | 2009-05-13 13:50:29 -0400
A couple fixes to "picking the right item"
Titles on the message context menu
r63330@17h:  jesse | 2009-05-13 13:58:37 -0400
Added an "open" context menu item to the folder list
r63347@17h:  jesse | 2009-05-13 18:00:02 -0400
Try to get folderlists to sort in a stable way, so they jump around less in the ui
r63349@17h:  jesse | 2009-05-13 20:37:19 -0400
Switch to using non-message-passing based notifications for redisplay of message lists, cut down redisplay frequency to not overload the display
r63432@17h:  jesse | 2009-05-16 13:38:49 -0400
Android 1.5 no longer gives us apache.commons.codec by default and apache.commons.logging by default. Import them so we have em.
There's probably something smarter to do here.
r63438@17h:  jesse | 2009-05-16 14:12:06 -0400
removed dead code
r63439@17h:  jesse | 2009-05-16 14:30:57 -0400
Minor tidy
r63440@17h:  jesse | 2009-05-16 14:39:34 -0400
First pass implementation making MessageList streamy for faster startup
r63441@17h:  jesse | 2009-05-16 21:57:41 -0400
There's no reason for the FolderList to list local messages
r63442@17h:  jesse | 2009-05-16 21:58:57 -0400
Switch to actually refreshing the message list after each item is loaded
r63450@17h:  jesse | 2009-05-16 22:34:18 -0400
Default to pulling items out of the LocalStore by date, descending. (since that's the uneditable default ordering)
This makes our messages come out of the store in the order the user should see them
r63451@17h:  jesse | 2009-05-16 22:34:44 -0400
Set some new defaults for the FolderList
r63452@17h:  jesse | 2009-05-16 22:35:43 -0400
set some new message list item defaults
r63456@17h:  jesse | 2009-05-17 12:56:10 -0400
It's not clear that Pop and WebDav actually set us an InternalDate. I'd rather use that so that spam doesn't topsort. But I also want this to _work_
r63457@17h:  jesse | 2009-05-17 12:56:47 -0400
actually check to make sure we have a message to remove before removing it.
r63458@17h:  jesse | 2009-05-17 13:10:07 -0400
Flip "security type" to before the port number, since changing security type is the thing more users are likely to know/care about and resets port number
r63469@17h:  jesse | 2009-05-17 18:42:39 -0400
Provisional fix for "see the FoldeRList twice" bug
r63471@17h:  jesse | 2009-05-17 20:47:41 -0400
Remove title bar from the message view
r63544@17h:  jesse | 2009-05-20 23:53:38 -0400
folderlist tidying before i dig into the jumpy ordering bug
r63545@17h:  jesse | 2009-05-20 23:56:00 -0400
Killing dead variables
r63546@17h:  jesse | 2009-05-21 00:58:36 -0400
make the whole title section clicky
r63556@17h:  jesse | 2009-05-21 01:48:13 -0400
Fix where we go when someone deletes a message 
r63558@17h:  jesse | 2009-05-21 22:44:46 -0400
Working toward switchable themes
r63563@17h:  jesse | 2009-05-21 23:53:09 -0400
Make the MessageList's colors actually just inherit from the theme, rather than hardcoding black

r63567@17h:  jesse | 2009-05-22 10:14:13 -0400
Kill a now-redundant comment
r63571@17h:  jesse | 2009-05-22 19:43:30 -0400
further theme-independence work
r63572@17h:  jesse | 2009-05-22 19:55:23 -0400
gete -> get (typo fix)
r63573@17h:  jesse | 2009-05-22 22:48:49 -0400
First cut of a global prefs system as well as a theme preference. not that it works yet
r63577@17h:  jesse | 2009-05-24 14:49:52 -0400
Once a user has actually put in valid user credentials, start syncing mail and folders in the background instantly.
This gives us a much better "new startup" experience
r63578@17h:  jesse | 2009-05-24 14:55:00 -0400
MessageList doesn't need FolderUpdateWorker
r63579@17h:  jesse | 2009-05-24 17:57:15 -0400
Fix "get message by uid"
Switch to showing messages 10 by 10, rather than 1 by 1 for huge loadtime performance improvements
r63587@17h:  jesse | 2009-05-24 19:19:56 -0400
Cut down LocalMessage creation to not generate a MessageId or date formatter.
r63589@17h:  jesse | 2009-05-24 22:22:32 -0400
Switch to null-escaping email address boundaries, rather than a VERY expensive URL-encoding
r63590@17h:  jesse | 2009-05-24 22:23:21 -0400
Clean up our "auto-refresh the list when adding messages after a sync"
r63593@17h:  jesse | 2009-05-24 22:53:45 -0400
replace isDateToday with a "rolling 18 hour window" variant that's more likely to give the user a useful answer and is 30x faster.
r63595@17h:  jesse | 2009-05-24 23:54:14 -0400
When instantiating messges from the LocalStore, there's no need to clear headers before setting them, nor is there a need to set a generated message id
r63596@17h:  jesse | 2009-05-24 23:54:39 -0400
make an overridable setGeneratedMessageId
r63597@17h:  jesse | 2009-05-24 23:54:55 -0400
Remove new lies from comments
r63598@17h:  jesse | 2009-05-24 23:55:35 -0400
Replace insanely expensive message header "name" part quoting with something consistent and cheap that does its work on the way INTO the database
r63605@17h:  jesse | 2009-05-25 17:28:24 -0400
bring back the 1.1 sdk build.xml
r63606@17h:  jesse | 2009-05-25 22:32:11 -0400
Actually enable switchable themese and compilation on 1.1
r63692@17h:  jesse | 2009-05-29 23:55:17 -0400
Switch back to having titles for folder and message lists.
Restore auto-open-folder functionality
r63694@17h:  jesse | 2009-05-30 18:50:39 -0400
Remove several off-by-one errors introduced by yesterday's return to android titlebars
r63696@17h:  jesse | 2009-05-30 23:45:03 -0400
use convertView properly for performance and memory imrpovement in FolderList and MessageList
r63698@17h:  jesse | 2009-05-31 19:42:59 -0400
Switch to using background shading to indicate "not yet fetched"
r63701@17h:  jesse | 2009-05-31 21:28:47 -0400
Remving code we don't actually need these bits of apache commons on 1.1
This commit is contained in:
Jesse Vincent 2009-06-01 01:35:05 +00:00
parent 9ffe4c44ad
commit 909f677f91
66 changed files with 4021 additions and 3005 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="114"
android:versionName="0.114" package="com.fsck.k9">
android:versionCode="199"
android:versionName="0.199" package="com.fsck.k9">
<uses-sdk android:minSdkVersion="1"/>
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
<uses-permission android:name="android.permission.READ_CONTACTS"/>
@ -17,7 +17,7 @@
android:description="@string/read_attachment_desc"/>
<uses-permission android:name="com.android.email.permission.READ_ATTACHMENT"/>
<application android:icon="@drawable/icon" android:label="@string/app_name" android:name="K9"
android:theme="@android:style/Theme.Light">
>
<activity android:name="com.android.email.activity.Welcome">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@ -26,6 +26,11 @@
</intent-filter>
</activity>
<activity
android:name="com.android.email.activity.setup.Prefs"
android:label="@string/prefs_title"
>
</activity>
<activity
android:name="com.android.email.activity.setup.AccountSetupBasics"
android:label="@string/account_setup_basics_title"
@ -77,7 +82,6 @@
</activity>
<activity
android:name="com.android.email.activity.setup.AccountSettings"
android:theme="@android:style/Theme"
android:label="@string/account_settings_title_fmt"
>
</activity>
@ -98,7 +102,7 @@
android:label="@string/accounts_title">
</activity>
<activity
android:name="com.android.email.activity.FolderMessageList">
android:name="com.android.email.activity.FolderList">
<intent-filter>
<action android:name="android.intent.action.view" />
<data
@ -108,6 +112,9 @@
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity
android:name="com.android.email.activity.MessageList">
</activity>
<activity
android:name="com.android.email.activity.MessageView">
</activity>

View File

@ -1,4 +1,11 @@
<html>
<body bgcolor="white">
<table width="100%" height="100%">
<tr>
<td align="center" valign="center">
<font color="gray">No text</font>
</td>
</tr>
</table>
</body>
</html>

305
build-sdk-1.5.xml Normal file
View File

@ -0,0 +1,305 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="K9" default="help">
<!-- The local.properties file is created and updated by the 'android' tool.
It contain the path to the SDK. It should *NOT* be checked in in Version
Control Systems. -->
<property file="local.properties"/>
<!-- The build.properties file can be created by you and is never touched
by the 'android' tool. This is the place to change some of the default property values
used by the Ant rules.
Here are some properties you may want to change/update:
application-package
the name of your application package as defined in the manifest. Used by the
'uninstall' rule.
source-folder
the name of the source folder. Default is 'src'.
out-folder
the name of the output folder. Default is 'bin'.
Properties related to the SDK location or the project target should be updated
using the 'android' tool with the 'update' action.
This file is an integral part of the build system for your application and
should be checked in in Version Control Systems.
-->
<property file="build.properties"/>
<!-- The default.properties file is created and updated by the 'android' tool, as well
as ADT.
This file is an integral part of the build system for your application and
should be checked in in Version Control Systems. -->
<property file="default.properties"/>
<!-- Custom Android task to deal with the project target, and import the proper rules.
This requires ant 1.6.0 or above. -->
<path id="android.antlibs">
<pathelement path="${sdk-location}/tools/lib/anttasks.jar" />
<pathelement path="${sdk-location}/tools/lib/sdklib.jar" />
<pathelement path="${sdk-location}/tools/lib/androidprefs.jar" />
<pathelement path="${sdk-location}/tools/lib/apkbuilder.jar" />
<pathelement path="${sdk-location}/tools/lib/jarutils.jar" />
</path>
<taskdef name="setup"
classname="com.android.ant.SetupTask"
classpathref="android.antlibs"/>
<setup import="false" />
<!-- Execute the Android Setup task that will setup some properties specific to the target,
and import the rules files.
To customize the rules, copy/paste them below the task, and disable import by setting
the import attribute to false:
This will ensure that the properties are setup correctly but that your customized
targets are used.
-->
<!--
This rules file is meant to be imported by the custom Ant task:
com.android.ant.AndroidInitTask
The following properties are put in place by the importing task:
android-jar, android-aidl, aapt, aidl, and dx
Additionnaly, the task sets up the following classpath reference:
android.target.classpath
This is used by the compiler task as the boot classpath.
-->
<!-- Custom tasks -->
<taskdef name="aaptexec"
classname="com.android.ant.AaptExecLoopTask"
classpathref="android.antlibs"/>
<taskdef name="apkbuilder"
classname="com.android.ant.ApkBuilderTask"
classpathref="android.antlibs"/>
<!-- Properties -->
<property name="android-tools" value="${sdk-location}/tools" />
<!-- Input directories -->
<property name="source-folder" value="src" />
<property name="gen-folder" value="gen" />
<property name="resource-folder" value="res" />
<property name="asset-folder" value="assets" />
<property name="source-location" value="${basedir}/${source-folder}" />
<!-- folder for the 3rd party java libraries -->
<property name="external-libs-folder" value="libs" />
<!-- folder for the native libraries -->
<property name="native-libs-folder" value="libs" />
<!-- Output directories -->
<property name="gen-folder" value="gen" />
<property name="out-folder" value="bin" />
<property name="out-classes" value="${out-folder}/classes" />
<property name="out-classes-location" value="${basedir}/${out-classes}"/>
<!-- out folders for a parent project if this project is an instrumentation project -->
<property name="main-out-folder" value="../${out-folder}" />
<property name="main-out-classes" value="${main-out-folder}/classes"/>
<!-- Intermediate files -->
<property name="dex-file" value="classes.dex" />
<property name="intermediate-dex" value="${out-folder}/${dex-file}" />
<!-- dx does not properly support incorrect / or \ based on the platform
and Ant cannot convert them because the parameter is not a valid path.
Because of this we have to compute different paths depending on the platform. -->
<condition property="intermediate-dex-location"
value="${basedir}\${intermediate-dex}"
else="${basedir}/${intermediate-dex}" >
<os family="windows"/>
</condition>
<!-- The final package file to generate -->
<property name="out-debug-package" value="${out-folder}/${ant.project.name}-debug.apk"/>
<!-- Tools -->
<condition property="exe" value=".exe" else=""><os family="windows"/></condition>
<property name="adb" value="${android-tools}/adb${exe}"/>
<!-- rules -->
<!-- Create the output directories if they don't exist yet. -->
<target name="dirs">
<echo>Creating output directories if needed...</echo>
<mkdir dir="${resource-folder}" />
<mkdir dir="${external-libs-folder}" />
<mkdir dir="${gen-folder}" />
<mkdir dir="${out-folder}" />
<mkdir dir="${out-classes}" />
</target>
<!-- Generate the R.java file for this project's resources. -->
<target name="resource-src" depends="dirs">
<echo>Generating R.java / Manifest.java from the resources...</echo>
<exec executable="${aapt}" failonerror="true">
<arg value="package" />
<arg value="-m" />
<arg value="-J" />
<arg path="${gen-folder}" />
<arg value="-M" />
<arg path="AndroidManifest.xml" />
<arg value="-S" />
<arg path="${resource-folder}" />
<arg value="-I" />
<arg path="${android-jar}" />
</exec>
<copy overwrite="true" file="gen/com/fsck/k9/R.java" tofile="gen/com/android/email/R.java">
<filterset begintoken="package " endtoken=";">
<filter token="com.fsck.k9" value="package com.android.email;"/>
</filterset>
</copy>
</target>
<!-- Generate java classes from .aidl files. -->
<target name="aidl" depends="dirs">
<echo>Compiling aidl files into Java classes...</echo>
<apply executable="${aidl}" failonerror="true">
<arg value="-p${android-aidl}" />
<arg value="-I${source-folder}" />
<arg value="-o${gen-folder}" />
<fileset dir="${source-folder}">
<include name="**/*.aidl"/>
</fileset>
</apply>
</target>
<!-- Compile this project's .java files into .class files. -->
<target name="compile" depends="resource-src, aidl">
<javac encoding="ascii" target="1.5" debug="true" extdirs=""
destdir="${out-classes}"
bootclasspathref="android.target.classpath">
<src path="${source-folder}" />
<src path="${gen-folder}" />
<classpath>
<fileset dir="${external-libs-folder}" includes="*.jar"/>
<fileset dir="${sdk-location}/platforms/android-1.5/" includes="**/*.jar"/>
<pathelement path="${main-out-classes}"/>
</classpath>
</javac>
</target>
<!-- Convert this project's .class files into .dex files. -->
<target name="dex" depends="compile">
<echo>Converting compiled files and external libraries into ${out-folder}/${dex-file}...</echo>
<apply executable="${dx}" failonerror="true" parallel="true">
<arg value="-JXmx1024m" />
<arg value="--dex" />
<arg value="--output=${intermediate-dex-location}" />
<arg path="${out-classes-location}" />
<fileset dir="${external-libs-folder}" includes="*.jar"/>
</apply>
</target>
<!-- Put the project's resources into the output package file
This actually can create multiple resource package in case
Some custom apk with specific configuration have been
declared in default.properties.
-->
<target name="package-resources">
<echo>Packaging resources</echo>
<aaptexec executable="${aapt}"
command="package"
manifest="AndroidManifest.xml"
resources="${resource-folder}"
assets="${asset-folder}"
androidjar="${android-jar}"
outfolder="${out-folder}"
basename="${ant.project.name}" />
</target>
<!-- Package the application and sign it with a debug key.
This is the default target when building. It is used for debug. -->
<target name="debug" depends="dex, package-resources">
<apkbuilder
outfolder="${out-folder}"
basename="${ant.project.name}"
signed="true"
verbose="false">
<file path="${intermediate-dex}" />
<sourcefolder path="${source-folder}" />
<jarfolder path="${external-libs-folder}" />
<nativefolder path="${native-libs-folder}" />
</apkbuilder>
</target>
<!-- Package the application without signing it.
This allows for the application to be signed later with an official publishing key. -->
<target name="release" depends="dex, package-resources">
<apkbuilder
outfolder="${out-folder}"
basename="${ant.project.name}"
signed="false"
verbose="false">
<file path="${intermediate-dex}" />
<sourcefolder path="${source-folder}" />
<jarfolder path="${external-libs-folder}" />
<nativefolder path="${native-libs-folder}" />
</apkbuilder>
<echo>Signing ${out-unsigned-package}</echo>
<exec executable="jarsigner" failonerror="true">
<arg value="-verbose" />
<arg value="-storepass" />
<arg value="${env.jarpass}" />
<arg value="-signedjar" />
<arg value="${out-signed-package-ospath}" />
<arg value="${out-unsigned-package-ospath}" />
<arg value="fsckcom" />
</exec>
</target>
<!-- Install the package on the default emulator -->
<target name="install" depends="debug">
<echo>Installing ${out-debug-package} onto default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="install" />
<arg path="${out-debug-package}" />
</exec>
</target>
<target name="reinstall" depends="debug">
<echo>Installing ${out-debug-package} onto default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="install" />
<arg value="-r" />
<arg path="${out-debug-package}" />
</exec>
</target>
<!-- Uinstall the package from the default emulator -->
<target name="uninstall">
<echo>Uninstalling ${application-package} from the default emulator...</echo>
<exec executable="${adb}" failonerror="true">
<arg value="uninstall" />
<arg path="${application-package}" />
</exec>
</target>
<target name="help">
<!-- displays starts at col 13
|13 80| -->
<echo>Android Ant Build. Available targets:</echo>
<echo> help: Displays this help.</echo>
<echo> debug: Builds the application and sign it with a debug key.</echo>
<echo> release: Builds the application. The generated apk file must be</echo>
<echo> signed before it is published.</echo>
<echo> install: Installs the debug package onto a running emulator or</echo>
<echo> device. This can only be used if the application has </echo>
<echo> not yet been installed.</echo>
<echo> reinstall: Installs the debug package on a running emulator or</echo>
<echo> device that already has the application.</echo>
<echo> The signatures must match.</echo>
<echo> uninstall: uninstall the application from a running emulator or</echo>
<echo> device.</echo>
</target>
</project>

2
build.properties Normal file
View File

@ -0,0 +1,2 @@
application-package=com.fsck.k9

11
default.properties Normal file
View File

@ -0,0 +1,11 @@
# This file is automatically generated by Android Tools.
# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
#
# This file must be checked in Version Control Systems.
#
# To customize properties used by the Ant build system use,
# "build.properties", and override values to adapt the script to your
# project structure.
# Project target.
target=Google Inc.:Google APIs:3

Binary file not shown.

After

Width:  |  Height:  |  Size: 934 B

View File

@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_selected="true"
android:drawable="@color/folder_message_list_child_background" />
android:drawable="@color/folder_list_item_background" />
<item android:state_selected="true"
android:drawable="@android:color/transparent" />
<item android:state_pressed="true" android:state_selected="false"
android:drawable="@android:color/transparent" />
<item android:state_selected="false"
android:drawable="@color/folder_message_list_child_background" />
android:drawable="@color/folder_list_item_background" />
</selector>

View File

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_selected="true"
android:drawable="@color/folder_message_list_group_background" />
android:drawable="@android:color/transparent"
/>
<item android:state_selected="true"
android:drawable="@android:color/transparent" />
<item android:state_pressed="true" android:state_selected="false"
android:drawable="@android:color/transparent" />
<item android:state_selected="false"
android:drawable="@color/folder_message_list_group_background" />
android:drawable="@android:color/transparent"
/>
</selector>

View File

@ -1,11 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_window_focused="false" android:state_selected="true"
android:drawable="@color/folder_message_list_child_footer_background" />
android:drawable="@color/message_list_item_footer_background" />
<item android:state_selected="true"
android:drawable="@android:color/transparent" />
<item android:state_pressed="true" android:state_selected="false"
android:drawable="@android:color/transparent" />
<item android:state_selected="false"
android:drawable="@color/folder_message_list_child_footer_background" />
android:drawable="@android:color/transparent"
/>
</selector>

View File

@ -5,7 +5,7 @@
android:layout_height="20px"
android:paddingRight="1px"
android:paddingTop="2px"
android:background="@drawable/folder_message_list_child_background">
android:background="@drawable/message_list_item_background">
<View
android:id="@+id/chip"
android:background="@drawable/appointment_indicator_leftside_1"

View File

@ -30,12 +30,14 @@
android:layout_width="fill_parent"
android:layout_height="57px"
android:background="@drawable/ic_email_thread_open_bottom_default"
android:gravity="bottom">
android:gravity="center_vertical">
<Button
android:id="@+id/previous_scrolling"
android:text="@string/message_view_prev_action"
android:textSize="35px"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:padding="0dip"
android:layout_weight="1" />
<Button
android:id="@+id/reply_scrolling"
@ -58,8 +60,10 @@
<Button
android:id="@+id/next_scrolling"
android:text="@string/message_view_next_action"
android:textSize="35px"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:padding="0dip"
android:layout_weight="1" />
</LinearLayout>
</LinearLayout>
@ -75,7 +79,9 @@
<Button
android:id="@+id/previous"
android:text="@string/message_view_prev_action"
android:textSize="35px"
android:layout_height="wrap_content"
android:padding="0dip"
android:layout_width="0dip"
android:layout_weight="1" />
<Button
@ -99,6 +105,8 @@
<Button
android:id="@+id/next"
android:text="@string/message_view_next_action"
android:textSize="35px"
android:padding="0dip"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />

View File

@ -46,6 +46,16 @@
android:singleLine="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<TextView
android:text="@string/account_setup_incoming_security_label"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />
<Spinner
android:id="@+id/account_security_type"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<TextView
android:text="@string/account_setup_incoming_port_label"
android:layout_height="wrap_content"
@ -57,16 +67,6 @@
android:singleLine="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<TextView
android:text="@string/account_setup_incoming_security_label"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />
<Spinner
android:id="@+id/account_security_type"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<LinearLayout
android:id="@+id/imap_path_prefix_section"
android:layout_width="fill_parent"

View File

@ -21,6 +21,16 @@
android:singleLine="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<TextView
android:text="@string/account_setup_outgoing_security_label"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />
<Spinner
android:id="@+id/account_security_type"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<TextView
android:text="@string/account_setup_outgoing_port_label"
android:layout_height="wrap_content"
@ -32,16 +42,6 @@
android:singleLine="true"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<TextView
android:text="@string/account_setup_outgoing_security_label"
android:layout_height="wrap_content"
android:layout_width="fill_parent"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="?android:attr/textColorPrimary" />
<Spinner
android:id="@+id/account_security_type"
android:layout_height="wrap_content"
android:layout_width="fill_parent" />
<CheckBox
android:id="@+id/account_require_login"
android:layout_width="fill_parent"

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="@drawable/message_list_item_footer_background"
android:gravity="left"
android:orientation="horizontal">
<Button
android:id="@+id/account_list"
android:text="@string/back_to_accounts_action"
android:textSize="30px"
android:padding="5px"
android:layout_width="50px"
android:layout_height="fill_parent"
android:minWidth="@dimen/button_minWidth"
android:layout_centerVertical="true"
/>
<TextView
android:id="@+id/account_name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10px"
android:gravity="left"
/>
</LinearLayout>

View File

@ -5,7 +5,7 @@
android:layout_height="?android:attr/listPreferredItemHeight"
android:orientation="horizontal"
android:gravity="center_vertical"
android:background="@drawable/folder_message_list_group_background"
android:background="@android:color/transparent"
android:paddingLeft="36px"
android:paddingRight="4px">
@ -39,7 +39,7 @@
android:textColor="?android:attr/textColorPrimary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/text_box_light"
android:background="@drawable/text_box"
android:paddingLeft="10px"
android:paddingRight="10px"
android:minWidth="64px"

View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="@android:color/transparent"
android:gravity="left"
android:orientation="horizontal">
<Button
android:id="@+id/folder_list"
android:text="@string/back_to_folder_list_action"
android:textSize="30px"
android:padding="5px"
android:layout_width="50px"
android:layout_height="fill_parent"
android:minWidth="@dimen/button_minWidth"
android:layout_centerVertical="true"
/>
<TextView
android:id="@+id/folder_name"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="?android:attr/textColorPrimary"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10px"
android:gravity="left"
/>
</LinearLayout>

View File

@ -5,7 +5,7 @@
android:layout_height="38px"
android:paddingRight="1px"
android:paddingTop="2px"
android:background="@drawable/folder_message_list_child_background"
android:background="#999999"
>
<View
android:id="@+id/chip"
@ -46,6 +46,6 @@
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:background="@drawable/folder_message_list_child_background"
android:background="@android:color/transparent"
/>
</RelativeLayout>

View File

@ -3,11 +3,11 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:background="@drawable/folder_message_list_child_footer_background"
android:background="@drawable/message_list_item_footer_background"
android:gravity="center"
android:orientation="horizontal">
<ProgressBar
android:id="@+id/progress"
android:id="@+id/message_list_progress"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
style="?android:attr/progressBarStyleSmall"

View File

@ -4,17 +4,19 @@
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@android:color/white">
>
<ScrollView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:scrollbarStyle="outsideInset"
android:fillViewport="true"
android:background="@android:color/transparent"
android:fadingEdge="none">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:background="@android:color/transparent"
android:layout_height="0dip"
android:layout_weight="1">
<include layout="@layout/message_view_header" />
@ -27,7 +29,6 @@
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="57px"
android:background="@drawable/ic_email_thread_open_bottom_default"
android:gravity="center_vertical">
<Button
android:id="@+id/reply"
@ -58,6 +59,8 @@
<Button
android:id="@+id/previous_scrolling"
android:text="@string/message_view_prev_action"
android:textSize="35px"
android:padding="0px"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
@ -70,7 +73,9 @@
android:layout_weight="1" />
<Button
android:id="@+id/next_scrolling"
android:padding="0px"
android:text="@string/message_view_next_action"
android:textSize="35px"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
@ -82,11 +87,13 @@
android:orientation="horizontal"
android:layout_width="fill_parent"
android:layout_height="57px"
android:background="@drawable/ic_email_thread_open_bottom_default"
android:background="@android:color/transparent"
android:gravity="center_vertical">
<Button
android:id="@+id/previous"
android:text="@string/message_view_prev_action"
android:textSize="35px"
android:padding="0px"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />
@ -100,6 +107,8 @@
<Button
android:id="@+id/next"
android:text="@string/message_view_next_action"
android:textSize="35px"
android:padding="0px"
android:layout_height="wrap_content"
android:layout_width="0dip"
android:layout_weight="1" />

View File

@ -5,7 +5,8 @@
<RelativeLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="@drawable/ic_email_thread_open_top_default">
android:padding="2dip"
android:background="@android:color/transparent">
<TextView
android:id="@+id/from"
android:textAppearance="?android:attr/textAppearanceSmall"
@ -79,7 +80,6 @@
android:id="@+id/show_pictures_section"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:background="#ffefefef"
android:layout_marginTop="6dip"
android:paddingLeft="6dip"
android:paddingRight="3dip"
@ -105,6 +105,8 @@
<WebView
android:id="@+id/message_content"
android:layout_height="wrap_content"
android:textColor="?android:attr/textColorPrimary"
android:background="@android:color/transparent"
android:layout_width="fill_parent"
/>
<!-- attachments area -->

View File

@ -8,13 +8,15 @@
android:title="@string/empty_trash_action" />
<item android:id="@+id/edit_account"
android:title="@string/account_settings_action" />
<item android:id="@+id/edit_prefs"
android:title="@string/preferences_action" />
<item android:id="@+id/compact"
android:title="@string/compact_action" />
<item android:id="@+id/clear"
android:title="@string/clear_action" />
<item android:id="@+id/delete_account"
android:title="@string/remove_account_action" />
<item android:id="@+id/clear_pending"
android:title="@string/clear_pending_action" />
<item android:id="@+id/clear"
android:title="@string/clear_action" />
</menu>

View File

@ -25,7 +25,9 @@
<!--
<item android:id="@+id/search"
android:title="@string/search_action" />
<item android:id="@+id/preferences"
android:title="@string/preferences_action" />
-->
<item android:id="@+id/edit_prefs"
android:title="@string/preferences_action"
android:icon="@drawable/ic_menu_preferences"
/>
</menu>

View File

@ -1,10 +1,13 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/open_folder"
android:title="@string/open_action"
/>
<item
android:id="@+id/mark_all_as_read"
android:title="@string/mark_all_as_read_action"
/>
<item
android:id="@+id/empty_trash"
android:title="@string/empty_trash_action"

View File

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/compose"
android:alphabeticShortcut="c"
android:title="@string/compose_action"
android:icon="@drawable/ic_menu_compose"
/>
<item
android:id="@+id/check_mail"
android:alphabeticShortcut="r"
android:title="@string/check_mail_action"
android:icon="@drawable/ic_menu_refresh"
/>
<item
android:id="@+id/accounts"
android:title="@string/accounts_action"
android:icon="@drawable/ic_menu_account_list"
/>
<item
android:id="@+id/list_folders"
android:title="@string/list_folders_action"
android:icon="@drawable/ic_menu_refresh"
/>
<item
android:id="@+id/empty_trash"
android:alphabeticShortcut="e"
android:title="@string/empty_trash_action"
android:icon="@drawable/ic_menu_delete"
/>
<item
android:id="@+id/account_settings"
android:title="@string/account_settings_action"
android:icon="@android:drawable/ic_menu_preferences"
/>
<item
android:id="@+id/compact"
android:title="@string/compact_action"
android:icon="@drawable/ic_menu_compact"
/>
<item
android:id="@+id/clear"
android:title="@string/clear_action"
android:icon="@drawable/ic_menu_clear"
/>
</menu>

View File

@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/open"
android:title="@string/open_action"
/>
<item
android:id="@+id/delete"
android:title="@string/delete_action"
/>
<item
android:id="@+id/forward"
android:title="@string/forward_action"
/>
<item
android:id="@+id/reply_all"
android:title="@string/reply_all_action"
/>
<item
android:id="@+id/reply"
android:title="@string/reply_action"
/>
<item
android:id="@+id/mark_as_read"
android:title="@string/mark_as_read_action"
/>
<item
android:id="@+id/flag"
android:title="@string/flag_action"
/>
<item
android:id="@+id/move"
android:title="@string/move_action"
/>
<item
android:id="@+id/copy"
android:title="@string/copy_action"
/>
<item
android:id="@+id/send_alternate"
android:title="@string/send_alternate_action"
/>
</menu>

View File

@ -49,37 +49,6 @@
android:title="@string/check_mail_action"
android:icon="@drawable/ic_menu_refresh"
/>
<item
android:id="@+id/accounts"
android:title="@string/accounts_action"
android:icon="@drawable/ic_menu_account_list"
/>
<item
android:id="@+id/list_folders"
android:title="@string/list_folders_action"
android:icon="@drawable/ic_menu_refresh"
/>
<item
android:id="@+id/empty_trash"
android:alphabeticShortcut="e"
android:title="@string/empty_trash_action"
android:icon="@drawable/ic_menu_delete"
/>
<item
android:id="@+id/account_settings"
android:title="@string/account_settings_action"
android:icon="@android:drawable/ic_menu_preferences"
/>
<item
android:id="@+id/compact"
android:title="@string/compact_action"
android:icon="@drawable/ic_menu_compact"
/>
<item
android:id="@+id/clear"
android:title="@string/clear_action"
android:icon="@drawable/ic_menu_clear"
/>
</menu>

View File

@ -171,7 +171,7 @@ Willkommen zum K-9 Mail Setup. K-9 ist eine Open-Source E-Mail-Anwendung für A
<string name="message_compose_downloading_attachments_toast">Einige Anlagen wurden nicht heruntergeladen. Sie werden automatisch heruntergeladen bevor diese Nachricht gesendet wird.</string>
<string name="message_compose_attachments_skipped_toast">Einige Anlagen können nicht weitergeleitet werden, da diese nicht heruntergeladen wurden.</string>
<string name="folder_message_list_to_fmt">An: <xliff:g id="counterParty">%s</xliff:g></string>
<string name="message_list_to_fmt">An: <xliff:g id="counterParty">%s</xliff:g></string>
<string name="message_view_to_label">An:</string>
<string name="message_view_attachment_view_action">Öffnen</string>

View File

@ -140,4 +140,15 @@
<item>3</item>
</string-array>
<string-array name="settings_theme_entries">
<item>@string/setting_theme_light</item>
<item>@string/setting_theme_dark</item>
</string-array>
<string-array name="settings_theme_values">
<item>light</item>
<item>dark</item>
</string-array>
</resources>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="folder_message_list_group_background">#cccccc</color>
<color name="folder_message_list_child_background">#ffffff</color>
<color name="folder_message_list_child_footer_background">#eeeeee</color>
<color name="folder_list_item_background">#ffffff</color>
<color name="message_list_item_background">#ffffff</color>
<color name="message_list_item_footer_background">#eeeeee</color>
</resources>

View File

@ -50,6 +50,8 @@
<string name="clear_pending_action">Clear pending actions (danger!)</string>
<string name="accounts_action">Accounts</string>
<string name="back_to_accounts_action"></string>
<string name="back_to_folder_list_action"></string>
<string name="read_action">Read</string>
<string name="mark_as_read_action">Mark as read</string>
<string name="send_alternate_action">Forward (alternate)</string>
@ -75,6 +77,7 @@
<string name="reverse_sort_action">Reverse sort</string>
<string name="about_action">About</string>
<string name="prefs_title">Preferences</string>
<string name="accounts_context_menu_title">Account options</string>
<string name="folder_context_menu_title">Folder options</string>
@ -189,13 +192,13 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
<string name="message_compose_downloading_attachments_toast">Some attachments were not downloaded. They will be downloaded automatically before this message is sent.</string>
<string name="message_compose_attachments_skipped_toast">Some attachments cannot be forwarded because they have not downloaded.</string>
<string name="folder_message_list_to_fmt">To:<xliff:g id="counterParty">%s</xliff:g></string>
<string name="message_list_to_fmt">To:<xliff:g id="counterParty">%s</xliff:g></string>
<string name="message_view_to_label">To:</string>
<string name="message_view_attachment_view_action">Open</string>
<string name="message_view_attachment_download_action">Save</string>
<string name="message_view_prev_action">Prev</string>
<string name="message_view_next_action">Next</string>
<string name="message_view_prev_action"></string>
<string name="message_view_next_action"></string>
<string name="message_view_datetime_fmt">MMM dd yyyy hh:mm a</string>
<string name="message_view_status_attachment_saved">Attachment saved to SD card as <xliff:g id="filename">%s</xliff:g>.</string>
<string name="message_view_status_attachment_not_saved">Unable to save attachment to SD card.</string>
@ -463,4 +466,8 @@ Welcome to K-9 Mail setup. K-9 is an open source email client for Android based
<string name="account_settings_signature__location_label">Signature position</string>
<string name="account_settings_signature__location_before_quoted_text">Before quoted messages</string>
<string name="account_settings_signature__location_after_quoted_text">After quoted messages</string>
<string name="setting_theme_dark">Dark</string>
<string name="setting_theme_light">Light</string>
<string name="display_preferences">Display Preferences</string>
<string name="settings_theme_label">Theme</string>
</resources>

View File

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2008 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<PreferenceCategory android:title="@string/display_preferences" android:key="global_preferences">
<ListPreference
android:key="theme"
android:title="@string/settings_theme_label"
android:entries="@array/settings_theme_entries"
android:entryValues="@array/settings_theme_values"
android:dialogTitle="@string/settings_theme_label" />
</PreferenceCategory>
</PreferenceScreen>

View File

@ -223,10 +223,11 @@ public class Email extends Application {
super.onCreate();
app = this;
Preferences prefs = Preferences.getPreferences(this);
DEBUG = prefs.geteEnableDebugLogging();
DEBUG = prefs.getEnableDebugLogging();
DEBUG_SENSITIVE = prefs.getEnableSensitiveLogging();
MessagingController.getInstance(this).resetVisibleLimits(prefs.getAccounts());
/*
* We have to give MimeMessage a temp directory because File.createTempFile(String, String)
* doesn't work in Android and MimeMessage does not have access to a Context.

View File

@ -0,0 +1,17 @@
package com.android.email;
import com.android.email.Preferences;
import android.app.Activity;
import android.os.Bundle;
public class K9Activity extends Activity {
@Override
public void onCreate(Bundle icicle) {
setTheme(Preferences.getPreferences(this).getTheme());
super.onCreate(icicle);
}
}

View File

@ -0,0 +1,17 @@
package com.android.email;
import com.android.email.Preferences;
import android.app.ListActivity;
import android.os.Bundle;
public class K9ListActivity extends ListActivity {
@Override
public void onCreate(Bundle icicle) {
setTheme(Preferences.getPreferences(this).getTheme());
super.onCreate(icicle);
}
}

View File

@ -0,0 +1,18 @@
package com.android.email;
import com.android.email.Preferences;
import android.preference.PreferenceActivity;
import android.os.Bundle;
public class K9PreferenceActivity extends PreferenceActivity {
@Override
public void onCreate(Bundle icicle) {
setTheme(Preferences.getPreferences(this).getTheme());
super.onCreate(icicle);
}
}

View File

@ -1,6 +1,5 @@
package com.android.email;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileOutputStream;
@ -33,7 +32,7 @@ import android.os.PowerManager.WakeLock;
import android.util.Config;
import android.util.Log;
import com.android.email.activity.FolderMessageList;
import com.android.email.activity.FolderList;
import com.android.email.mail.Address;
import com.android.email.mail.FetchProfile;
import com.android.email.mail.Flag;
@ -87,18 +86,12 @@ public class MessagingController implements Runnable {
*/
private static final int MAX_SMALL_MESSAGE_SIZE = Store.FETCH_BODY_SANE_SUGGESTED_SIZE;
private static final String PENDING_COMMAND_MOVE_OR_COPY =
"com.android.email.MessagingController.moveOrCopy";
private static final String PENDING_COMMAND_EMPTY_TRASH =
"com.android.email.MessagingController.emptyTrash";
private static final String PENDING_COMMAND_SET_FLAG =
"com.android.email.MessagingController.setFlag";
private static final String PENDING_COMMAND_APPEND =
"com.android.email.MessagingController.append";
private static final String PENDING_COMMAND_MARK_ALL_AS_READ =
"com.android.email.MessagingController.markAllAsRead";
private static final String PENDING_COMMAND_CLEAR_ALL_PENDING =
"com.android.email.MessagingController.clearAllPending";
private static final String PENDING_COMMAND_MOVE_OR_COPY = "com.android.email.MessagingController.moveOrCopy";
private static final String PENDING_COMMAND_EMPTY_TRASH = "com.android.email.MessagingController.emptyTrash";
private static final String PENDING_COMMAND_SET_FLAG = "com.android.email.MessagingController.setFlag";
private static final String PENDING_COMMAND_APPEND = "com.android.email.MessagingController.append";
private static final String PENDING_COMMAND_MARK_ALL_AS_READ = "com.android.email.MessagingController.markAllAsRead";
private static final String PENDING_COMMAND_CLEAR_ALL_PENDING = "com.android.email.MessagingController.clearAllPending";
private static MessagingController inst = null;
@ -125,26 +118,21 @@ public class MessagingController implements Runnable {
private int descendingToast;
private boolean defaultAscending;
SORT_TYPE(int ascending, int descending, boolean ndefaultAscending)
{
SORT_TYPE(int ascending, int descending, boolean ndefaultAscending) {
ascendingToast = ascending;
descendingToast = descending;
defaultAscending = ndefaultAscending;
}
public int getToast(boolean ascending)
{
if (ascending)
{
public int getToast(boolean ascending) {
if (ascending) {
return ascendingToast;
}
else
{
else {
return descendingToast;
}
}
public boolean isDefaultAscending()
{
public boolean isDefaultAscending() {
return defaultAscending;
}
};
@ -162,26 +150,21 @@ public class MessagingController implements Runnable {
private ConcurrentHashMap<String, Long> expungedUid = new ConcurrentHashMap<String, Long>();
private String createMessageKey(Account account, String folder, Message message)
{
private String createMessageKey(Account account, String folder, Message message) {
return createMessageKey(account, folder, message.getUid());
}
private String createMessageKey(Account account, String folder, String uid)
{
private String createMessageKey(Account account, String folder, String uid) {
return account.getUuid() + ":" + folder + ":" + uid;
}
private String createFolderKey(Account account, String folder)
{
private String createFolderKey(Account account, String folder) {
return account.getUuid() + ":" + folder;
}
private void suppressMessage(Account account, String folder, Message message)
{
private void suppressMessage(Account account, String folder, Message message) {
if (account == null || folder == null || message == null)
{
if (account == null || folder == null || message == null) {
return;
}
String messKey = createMessageKey(account, folder, message);
@ -189,19 +172,15 @@ public class MessagingController implements Runnable {
deletedUids.put(messKey, "true");
}
private void unsuppressMessage(Account account, String folder, Message message)
{
if (account == null || folder == null || message == null)
{
private void unsuppressMessage(Account account, String folder, Message message) {
if (account == null || folder == null || message == null) {
return;
}
unsuppressMessage(account, folder, message.getUid());
}
private void unsuppressMessage(Account account, String folder, String uid)
{
if (account == null || folder == null || uid == null)
{
private void unsuppressMessage(Account account, String folder, String uid) {
if (account == null || folder == null || uid == null) {
return;
}
String messKey = createMessageKey(account, folder, uid);
@ -210,34 +189,27 @@ public class MessagingController implements Runnable {
}
private boolean isMessageSuppressed(Account account, String folder, Message message)
{
if (account == null || folder == null || message == null)
{
private boolean isMessageSuppressed(Account account, String folder, Message message) {
if (account == null || folder == null || message == null) {
return false;
}
String messKey = createMessageKey(account, folder, message);
//Log.d(Email.LOG_TAG, "Checking suppression of message with key " + messKey);
if (deletedUids.containsKey(messKey))
{
if (deletedUids.containsKey(messKey)) {
//Log.d(Email.LOG_TAG, "Message with key " + messKey + " is suppressed");
return true;
}
Long expungedUidL = expungedUid.get(createFolderKey(account, folder));
if (expungedUidL != null)
{
if (expungedUidL != null) {
long expungedUid = expungedUidL;
String messageUidS = message.getUid();
try
{
try {
long messageUid = Long.parseLong(messageUidS);
if (messageUid <= expungedUid)
{
if (messageUid <= expungedUid) {
return false;
}
}
catch (NumberFormatException nfe)
{
catch (NumberFormatException nfe) {
// Nothing to do
}
}
@ -253,14 +225,11 @@ public class MessagingController implements Runnable {
mThread.start();
}
public void log(String logmess)
{
public void log(String logmess) {
Log.d(Email.LOG_TAG, logmess);
if (Email.logFile != null)
{
if (Email.logFile != null) {
FileOutputStream fos = null;
try
{
try {
File logFile = new File(Email.logFile);
fos = new FileOutputStream(logFile, true);
PrintStream ps = new PrintStream(fos);
@ -270,20 +239,15 @@ public class MessagingController implements Runnable {
fos.flush();
fos.close();
}
catch (Exception e)
{
catch (Exception e) {
Log.e(Email.LOG_TAG, "Unable to log message '" + logmess + "'", e);
}
finally
{
if (fos != null)
{
try
{
finally {
if (fos != null) {
try {
fos.close();
}
catch (Exception e)
{
catch (Exception e) {
}
}
@ -314,17 +278,14 @@ public class MessagingController implements Runnable {
String commandDescription = null;
try {
Command command = mCommands.poll();
if (command == null)
{
if (command == null) {
command = backCommands.poll();
}
if (command == null)
{
if (command == null) {
command = mCommands.poll(1, TimeUnit.SECONDS);
}
if (command != null)
{
if (command != null) {
commandDescription = command.description;
Log.d(Email.LOG_TAG, "Running background command '" + command.description + "'");
mBusy = true;
@ -380,8 +341,7 @@ public class MessagingController implements Runnable {
mListeners.remove(listener);
}
public Set<MessagingListener> getListeners()
{
public Set<MessagingListener> getListeners() {
return mListeners;
}
@ -398,10 +358,7 @@ public class MessagingController implements Runnable {
* @param listener
* @throws MessagingException
*/
public void listFolders(
final Account account,
boolean refreshRemote,
MessagingListener listener) {
public void listFolders( final Account account, boolean refreshRemote, MessagingListener listener) {
for (MessagingListener l : getListeners()) {
l.listFoldersStarted(account);
}
@ -419,8 +376,7 @@ public class MessagingController implements Runnable {
for (MessagingListener l : getListeners()) {
l.listFolders(account, localFolders);
}
if (listener != null)
{
if (listener != null) {
listener.listFolders(account, localFolders);
}
}
@ -451,9 +407,7 @@ public class MessagingController implements Runnable {
Folder[] remoteFolders = store.getPersonalNamespaces();
LocalStore localStore = (LocalStore)Store.getInstance(
account.getLocalStoreUri(),
mApplication);
LocalStore localStore = (LocalStore)Store.getInstance( account.getLocalStoreUri(), mApplication);
HashSet<String> remoteFolderNames = new HashSet<String>();
for (int i = 0, count = remoteFolders.length; i < count; i++) {
LocalFolder localFolder = localStore.getFolder(remoteFolders[i].getName());
@ -513,8 +467,7 @@ public class MessagingController implements Runnable {
* @param listener
* @throws MessagingException
*/
public void listLocalMessages(final Account account, final String folder,
MessagingListener listener) {
public void listLocalMessages(final Account account, final String folder, MessagingListener listener) {
for (MessagingListener l : getListeners()) {
l.listLocalMessagesStarted(account, folder);
}
@ -523,18 +476,30 @@ public class MessagingController implements Runnable {
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
Folder localFolder = localStore.getFolder(folder);
localFolder.open(OpenMode.READ_WRITE);
Message[] localMessages = localFolder.getMessages(null);
ArrayList<Message> messages = new ArrayList<Message>();
for (Message message : localMessages) {
Message[] localMessages = localFolder.getMessages(
new MessageRetrievalListener() {
public void messageStarted(String message, int number, int ofTotal) {}
public void messageFinished(Message message, int number, int ofTotal) {
if (!message.isSet(Flag.DELETED) &&
isMessageSuppressed(account, localFolder.getName(), message) == false) {
messages.add(message);
}
}
if (!message.isSet(Flag.DELETED) && isMessageSuppressed(account, folder, message) == false) {
//messages.add(message);
for (MessagingListener l : getListeners()) {
l.listLocalMessages(account, folder, messages.toArray(new Message[0]));
l.listLocalMessagesAddMessage(account, folder, message);
}
} else {
for (MessagingListener l : getListeners()) {
l.listLocalMessagesRemoveMessage(account, folder, message);
}
}
}
}
);
ArrayList<Message> messages = new ArrayList<Message>();
//for (Message message : localMessages) { }
//for (MessagingListener l : getListeners()) {
// l.listLocalMessages(account, folder, messages.toArray(new Message[0]));
//}
for (MessagingListener l : getListeners()) {
l.listLocalMessagesFinished(account, folder);
}
@ -549,12 +514,9 @@ public class MessagingController implements Runnable {
public void loadMoreMessages(Account account, String folder, MessagingListener listener) {
try {
LocalStore localStore = (LocalStore) Store.getInstance(
account.getLocalStoreUri(),
mApplication);
LocalStore localStore = (LocalStore) Store.getInstance( account.getLocalStoreUri(), mApplication);
LocalFolder localFolder = (LocalFolder) localStore.getFolder(folder);
localFolder.setVisibleLimit(localFolder.getVisibleLimit()
+ account.getDisplayCount());
localFolder.setVisibleLimit(localFolder.getVisibleLimit() + account.getDisplayCount());
synchronizeMailbox(account, folder, listener);
}
catch (MessagingException me) {
@ -585,8 +547,7 @@ public class MessagingController implements Runnable {
* @param folder
* @param listener
*/
public void synchronizeMailbox(final Account account, final String folder,
MessagingListener listener) {
public void synchronizeMailbox(final Account account, final String folder, MessagingListener listener) {
put("synchronizeMailbox", listener, new Runnable() {
public void run() {
synchronizeMailboxSynchronous(account, folder);
@ -628,12 +589,10 @@ public class MessagingController implements Runnable {
Log.v(Email.LOG_TAG, "SYNC: About to process pending commands for folder " +
account.getDescription() + ":" + folder);
}
try
{
try {
processPendingCommandsSynchronous(account);
}
catch (Exception e)
{
catch (Exception e) {
addErrorMessage(account, e);
Log.e(Email.LOG_TAG, "Failure processing command, but allow message sync attempt", e);
@ -647,8 +606,7 @@ public class MessagingController implements Runnable {
if (Config.LOGV) {
Log.v(Email.LOG_TAG, "SYNC: About to get local folder " + folder);
}
final LocalStore localStore =
(LocalStore) Store.getInstance(account.getLocalStoreUri(), mApplication);
final LocalStore localStore = (LocalStore) Store.getInstance(account.getLocalStoreUri(), mApplication);
tLocalFolder = (LocalFolder) localStore.getFolder(folder);
final LocalFolder localFolder = tLocalFolder;
localFolder.open(OpenMode.READ_WRITE);
@ -743,13 +701,11 @@ public class MessagingController implements Runnable {
int remoteEnd = remoteMessageCount;
if (Config.LOGV) {
Log.v(Email.LOG_TAG, "SYNC: About to get messages " + remoteStart + " through "
+ remoteEnd + " for folder " + folder);
Log.v(Email.LOG_TAG, "SYNC: About to get messages " + remoteStart + " through " + remoteEnd + " for folder " + folder);
}
remoteMessageArray = remoteFolder.getMessages(remoteStart, remoteEnd, null);
for (Message thisMess : remoteMessageArray)
{
for (Message thisMess : remoteMessageArray) {
remoteMessages.add(thisMess);
remoteUidMap.put(thisMess.getUid(), thisMess);
}
@ -776,8 +732,7 @@ public class MessagingController implements Runnable {
}
}
}
else if (remoteMessageCount < 0)
{
else if (remoteMessageCount < 0) {
throw new Exception("Message count " + remoteMessageCount + " for folder " + folder);
}
@ -832,20 +787,17 @@ public class MessagingController implements Runnable {
* (POP) may not be able to give us headers for
* ENVELOPE, only size.
*/
if (isMessageSuppressed(account, folder, message) == false)
{
if (isMessageSuppressed(account, folder, message) == false) {
Log.i(Email.LOG_TAG, "place 2 About to notify listeners that we got a new message "+ account + folder + message.getUid());
for (MessagingListener l : getListeners()) {
l.synchronizeMailboxNewMessage(account, folder,
localFolder.getMessage(message.getUid()));
l.synchronizeMailboxNewMessage(account, folder, localFolder.getMessage(message.getUid()));
}
}
}
}
catch (Exception e) {
Log.e(Email.LOG_TAG,
"Error while storing downloaded message.",
e);
Log.e(Email.LOG_TAG, "Error while storing downloaded message.", e);
addErrorMessage(account, e);
}
@ -879,15 +831,13 @@ public class MessagingController implements Runnable {
if (localMessage == null || localMessage.isSet(Flag.DELETED)) {
continue;
}
for (Flag flag : new Flag[] { Flag.SEEN, Flag.FLAGGED, Flag.ANSWERED } )
{
for (Flag flag : new Flag[] { Flag.SEEN, Flag.FLAGGED, Flag.ANSWERED } ) {
if (remoteMessage.isSet(flag) != localMessage.isSet(flag)) {
localMessage.setFlag(flag, remoteMessage.isSet(flag));
messageChanged = true;
}
}
if (messageChanged && isMessageSuppressed(account, folder, localMessage) == false)
{
if (messageChanged && isMessageSuppressed(account, folder, localMessage) == false) {
for (MessagingListener l : getListeners()) {
l.synchronizeMailboxNewMessage(account, folder, localMessage);
}
@ -904,8 +854,7 @@ public class MessagingController implements Runnable {
*/
int remoteUnreadMessageCount = remoteFolder.getUnreadMessageCount();
if (remoteUnreadMessageCount == -1) {
localFolder.setUnreadMessageCount(localFolder.getUnreadMessageCount()
+ newMessages.size());
localFolder.setUnreadMessageCount(localFolder.getUnreadMessageCount() + newMessages.size());
}
else {
localFolder.setUnreadMessageCount(remoteUnreadMessageCount);
@ -915,9 +864,7 @@ public class MessagingController implements Runnable {
* Remove any messages that are in the local store but no longer on the remote store.
*/
for (Message localMessage : localMessages) {
if (remoteUidMap.get(localMessage.getUid()) == null &&
!localMessage.isSet(Flag.DELETED))
{
if (remoteUidMap.get(localMessage.getUid()) == null && !localMessage.isSet(Flag.DELETED)) {
localMessage.setFlag(Flag.X_DESTROYED, true);
// Log.d(Email.LOG_TAG, "Destroying message " + localMessage.getUid() + " which isn't in the most recent group on server");
for (MessagingListener l : getListeners()) {
@ -966,9 +913,7 @@ public class MessagingController implements Runnable {
public void messageFinished(Message message, int number, int ofTotal) {
try {
// Store the updated message locally
localFolder.appendMessages(new Message[] {
message
});
localFolder.appendMessages(new Message[] { message });
Message localMessage = localFolder.getMessage(message.getUid());
@ -978,10 +923,7 @@ public class MessagingController implements Runnable {
{
// Update the listener with what we've found
for (MessagingListener l : getListeners()) {
l.synchronizeMailboxNewMessage(
account,
folder,
localMessage);
l.synchronizeMailboxNewMessage( account, folder, localMessage);
}
}
}
@ -1009,8 +951,7 @@ public class MessagingController implements Runnable {
Log.v(Email.LOG_TAG, "SYNC: Fetching large messages for folder " + folder);
}
remoteFolder.fetch(largeMessages.toArray(new Message[largeMessages.size()]),
fp, null);
remoteFolder.fetch(largeMessages.toArray(new Message[largeMessages.size()]), fp, null);
for (Message message : largeMessages) {
if (message.getBody() == null) {
/*
@ -1029,9 +970,7 @@ public class MessagingController implements Runnable {
remoteFolder.fetch(new Message[] { message }, fp, null);
// Store the updated message locally
localFolder.appendMessages(new Message[] {
message
});
localFolder.appendMessages(new Message[] { message });
Message localMessage = localFolder.getMessage(message.getUid());
@ -1071,9 +1010,7 @@ public class MessagingController implements Runnable {
remoteFolder.fetch(new Message[] { message }, fp, null);
}
// Store the updated message locally
localFolder.appendMessages(new Message[] {
message
});
localFolder.appendMessages(new Message[] { message });
Message localMessage = localFolder.getMessage(message.getUid());
@ -1081,14 +1018,12 @@ public class MessagingController implements Runnable {
// viewed.
localMessage.setFlag(Flag.X_DOWNLOADED_PARTIAL, true);
}
if (isMessageSuppressed(account, folder, message) == false)
{
if (isMessageSuppressed(account, folder, message) == false) {
Log.i(Email.LOG_TAG, "About to notify listeners that we got a new message "+ account + folder + message.getUid());
// Update the listener with what we've found
for (MessagingListener l : getListeners()) {
l.synchronizeMailboxNewMessage(
account,
folder,
localFolder.getMessage(message.getUid()));
l.synchronizeMailboxNewMessage( account, folder, localFolder.getMessage(message.getUid()));
}
}
}//for large messsages
@ -1114,21 +1049,14 @@ public class MessagingController implements Runnable {
}
for (MessagingListener l : getListeners()) {
l.synchronizeMailboxFinished(
account,
folder,
remoteMessageCount, newMessages.size());
l.synchronizeMailboxFinished( account, folder, remoteMessageCount, newMessages.size());
}
if (commandException != null)
{
if (commandException != null) {
String rootMessage = getRootCauseMessage(commandException);
localFolder.setStatus(rootMessage);
for (MessagingListener l : getListeners()) {
l.synchronizeMailboxFailed(
account,
folder,
rootMessage);
l.synchronizeMailboxFailed( account, folder, rootMessage);
}
}
@ -1742,7 +1670,7 @@ public class MessagingController implements Runnable {
final Flag flag,
final boolean newState) {
// TODO: put this into the background, but right now that causes odd behavior
// because the FolderMessageList doesn't have its own cache of the flag states
// because the MessageList doesn't have its own cache of the flag states
try {
Store localStore = Store.getInstance(account.getLocalStoreUri(), mApplication);
Folder localFolder = localStore.getFolder(folder);
@ -2336,7 +2264,8 @@ public class MessagingController implements Runnable {
Notification notif = new Notification(R.drawable.stat_notify_email_generic,
mApplication.getString(R.string.send_failure_subject), System.currentTimeMillis());
Intent i = FolderMessageList.actionHandleAccountIntent(mApplication, account, account.getErrorFolderName());
// JRV XXX TODO - do we want to notify MessageList too?
Intent i = FolderList.actionHandleAccountIntent(mApplication, account, account.getErrorFolderName());
PendingIntent pi = PendingIntent.getActivity(mApplication, 0, i, 0);
@ -2773,7 +2702,8 @@ public class MessagingController implements Runnable {
if (account.isShowOngoing()) {
Notification notif = new Notification(R.drawable.ic_menu_refresh,
context.getString(R.string.notification_bg_send_ticker, account.getDescription()), System.currentTimeMillis());
Intent intent = FolderMessageList.actionHandleAccountIntent(context, account, Email.INBOX);
// JRV XXX TODO - do we want to notify MessageList too?
Intent intent = FolderList.actionHandleAccountIntent(context, account, Email.INBOX);
PendingIntent pi = PendingIntent.getActivity(context, 0, intent, 0);
notif.setLatestEventInfo(context, context.getString(R.string.notification_bg_send_title),
account.getDescription() , pi);
@ -2891,7 +2821,8 @@ public class MessagingController implements Runnable {
Notification notif = new Notification(R.drawable.ic_menu_refresh,
context.getString(R.string.notification_bg_sync_ticker, account.getDescription(), folder.getName()),
System.currentTimeMillis());
Intent intent = FolderMessageList.actionHandleAccountIntent(context, account, Email.INBOX);
// JRV XXX TODO - do we want to notify MessageList too?
Intent intent = FolderList.actionHandleAccountIntent(context, account, Email.INBOX);
PendingIntent pi = PendingIntent.getActivity(context, 0, intent, 0);
notif.setLatestEventInfo(context, context.getString(R.string.notification_bg_sync_title), account.getDescription()
+ context.getString(R.string.notification_bg_title_separator) + folder.getName(), pi);

View File

@ -45,6 +45,12 @@ public class MessagingListener {
public void listLocalMessages(Account account, String folder, Message[] messages) {
}
public void listLocalMessagesAddMessage(Account account, String folder, Message message) {
}
public void listLocalMessagesRemoveMessage(Account account, String folder, Message message) {
}
public void listLocalMessagesFailed(Account account, String folder, String message) {
}

View File

@ -105,10 +105,18 @@ public class Preferences {
getPreferences().edit().putBoolean("enableDebugLogging", value).commit();
}
public boolean geteEnableDebugLogging() {
public boolean getEnableDebugLogging() {
return getPreferences().getBoolean("enableDebugLogging", false);
}
public void setTheme(int theme) {
getPreferences().edit().putInt("theme", theme).commit();
}
public int getTheme() {
return getPreferences().getInt("theme", android.R.style.Theme_Light);
}
public void setEnableSensitiveLogging(boolean value) {
getPreferences().edit().putBoolean("enableSensitiveLogging", value).commit();
}

View File

@ -164,19 +164,17 @@ public class Utility {
}
/**
* Returns true if the specified date is within today. Returns false otherwise.
* Returns true if the specified date is within 18 hours of "now". Returns false otherwise.
* @param date
* @return
*/
public static boolean isDateToday(Date date) {
// TODO But Calendar is so slowwwwwww....
Date today = new Date();
if (date.getYear() == today.getYear() &&
date.getMonth() == today.getMonth() &&
date.getDate() == today.getDate()) {
Date now = new Date();
if (now.getTime() - 64800000 > date.getTime() || now.getTime() + 64800000 < date.getTime()) {
return false;
} else {
return true;
}
return false;
}
/*

View File

@ -6,7 +6,7 @@ import java.util.concurrent.ConcurrentHashMap;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.ListActivity;
import com.android.email.K9ListActivity;
import android.app.NotificationManager;
import android.content.Context;
import android.content.DialogInterface;
@ -42,6 +42,7 @@ import com.android.email.MessagingController;
import com.android.email.MessagingListener;
import com.android.email.Preferences;
import com.android.email.R;
import com.android.email.activity.setup.Prefs;
import com.android.email.activity.setup.AccountSettings;
import com.android.email.activity.setup.AccountSetupBasics;
import com.android.email.activity.setup.AccountSetupCheckSettings;
@ -51,7 +52,7 @@ import com.android.email.mail.Store;
import com.android.email.mail.store.LocalStore;
import com.android.email.mail.store.LocalStore.LocalFolder;
public class Accounts extends ListActivity implements OnItemClickListener, OnClickListener {
public class Accounts extends K9ListActivity implements OnItemClickListener, OnClickListener {
private static final int DIALOG_REMOVE_ACCOUNT = 1;
private ConcurrentHashMap<String, Integer> unreadMessageCounts = new ConcurrentHashMap<String, Integer>();
@ -254,10 +255,27 @@ public class Accounts extends ListActivity implements OnItemClickListener, OnCli
private static String UNREAD_MESSAGE_COUNTS = "unreadMessageCounts";
private static String SELECTED_CONTEXT_ACCOUNT = "selectedContextAccount";
private static final String EXTRA_STARTUP = "startup";
public static void actionLaunch(Context context) {
Intent intent = new Intent(context, Accounts.class);
intent.putExtra(EXTRA_STARTUP, true);
context.startActivity(intent);
}
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Account[] accounts = Preferences.getPreferences(this).getAccounts();
Intent intent = getIntent();
boolean startup =(boolean)intent.getBooleanExtra(EXTRA_STARTUP, false);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
requestWindowFeature(Window.FEATURE_PROGRESS);
@ -273,14 +291,16 @@ public class Accounts extends ListActivity implements OnItemClickListener, OnCli
mSelectedContextAccount = (Account) icicle.getSerializable("selectedContextAccount");
}
if (icicle != null)
{
Map<String, Integer> oldUnreadMessageCounts =
(Map<String, Integer>)icicle.get(UNREAD_MESSAGE_COUNTS);
if (icicle != null) {
Map<String, Integer> oldUnreadMessageCounts = (Map<String, Integer>)icicle.get(UNREAD_MESSAGE_COUNTS);
if (oldUnreadMessageCounts != null) {
unreadMessageCounts.putAll(oldUnreadMessageCounts);
}
}
if (startup && accounts.length == 1) {
intent.putExtra(EXTRA_STARTUP, false);
FolderList.actionHandleAccount(this, accounts[0], accounts[0].getAutoExpandFolderName());
}
}
@Override
@ -301,8 +321,7 @@ public class Accounts extends ListActivity implements OnItemClickListener, OnCli
}
@Override
public void onPause()
{
public void onPause() {
super.onPause();
MessagingController.getInstance(getApplication()).removeListener(mListener);
}
@ -315,8 +334,7 @@ public class Accounts extends ListActivity implements OnItemClickListener, OnCli
mHandler.progress(Window.PROGRESS_START);
}
for (Account account : accounts)
{
for (Account account : accounts) {
MessagingController.getInstance(getApplication()).getAccountUnreadCount(Accounts.this, account, mListener);
pendingWork.put(account, "true");
}
@ -331,8 +349,12 @@ public class Accounts extends ListActivity implements OnItemClickListener, OnCli
AccountSettings.actionSettings(this, account);
}
private void onCheckMail(Account account) {
private void onEditPrefs() {
Prefs.actionPrefs(this);
}
private void onCheckMail(Account account) {
MessagingController.getInstance(getApplication()).checkMail(this, account, true, true, null);
}
@ -340,15 +362,13 @@ public class Accounts extends ListActivity implements OnItemClickListener, OnCli
MessagingController.getInstance(getApplication()).clearAllPending(account);
}
private void onEmptyTrash(Account account)
{
private void onEmptyTrash(Account account) {
MessagingController.getInstance(getApplication()).emptyTrash(account, null);
}
private void onCompose() {
Account defaultAccount =
Preferences.getPreferences(this).getDefaultAccount();
Account defaultAccount = Preferences.getPreferences(this).getDefaultAccount();
if (defaultAccount != null) {
MessageCompose.actionCompose(this, defaultAccount);
}
@ -358,7 +378,7 @@ public class Accounts extends ListActivity implements OnItemClickListener, OnCli
}
private void onOpenAccount(Account account) {
FolderMessageList.actionHandleAccount(this, account);
FolderList.actionHandleAccount(this, account);
}
public void onClick(View view) {
@ -384,15 +404,12 @@ public class Accounts extends ListActivity implements OnItemClickListener, OnCli
private Dialog createRemoveAccountDialog() {
return new AlertDialog.Builder(this)
.setTitle(R.string.account_delete_dlg_title)
.setMessage(getString(R.string.account_delete_dlg_instructions_fmt,
mSelectedContextAccount.getDescription()))
.setMessage(getString(R.string.account_delete_dlg_instructions_fmt, mSelectedContextAccount.getDescription()))
.setPositiveButton(R.string.okay_action, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dismissDialog(DIALOG_REMOVE_ACCOUNT);
try {
((LocalStore)Store.getInstance(
mSelectedContextAccount.getLocalStoreUri(),
getApplication())).delete();
((LocalStore)Store.getInstance( mSelectedContextAccount.getLocalStoreUri(), getApplication())).delete();
} catch (Exception e) {
// Ignore
}
@ -413,6 +430,9 @@ public class Accounts extends ListActivity implements OnItemClickListener, OnCli
AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo)item.getMenuInfo();
Account account = (Account)getListView().getItemAtPosition(menuInfo.position);
switch (item.getItemId()) {
case R.id.edit_prefs:
onEditPrefs();
break;
case R.id.delete_account:
onDeleteAccount(account);
break;
@ -441,14 +461,12 @@ public class Accounts extends ListActivity implements OnItemClickListener, OnCli
return true;
}
private void onCompact(Account account)
{
private void onCompact(Account account) {
mHandler.workingAccount(account, R.string.compacting_account);
MessagingController.getInstance(getApplication()).compact(account, null);
}
private void onClear(Account account)
{
private void onClear(Account account) {
mHandler.workingAccount(account, R.string.clearing_account);
MessagingController.getInstance(getApplication()).clear(account, null);
}
@ -465,6 +483,9 @@ public class Accounts extends ListActivity implements OnItemClickListener, OnCli
case R.id.add_new_account:
onAddNewAccount();
break;
case R.id.edit_prefs:
onEditPrefs();
break;
case R.id.check_mail:
onCheckMail(null);
break;
@ -513,8 +534,7 @@ public class Accounts extends ListActivity implements OnItemClickListener, OnCli
private String getVersionNumber() {
String version = "?";
try {
PackageInfo pi =
getPackageManager().getPackageInfo(getPackageName(), 0);
PackageInfo pi = getPackageManager().getPackageInfo(getPackageName(), 0);
version = pi.versionName;
} catch (PackageManager.NameNotFoundException e) {
//Log.e(TAG, "Package name not found", e);
@ -585,13 +605,11 @@ getPackageManager().getPackageInfo(getPackageName(), 0);
}
Integer unreadMessageCount = unreadMessageCounts.get(account.getUuid());
if (unreadMessageCount != null)
{
if (unreadMessageCount != null) {
holder.newMessageCount.setText(Integer.toString(unreadMessageCount));
holder.newMessageCount.setVisibility(unreadMessageCount > 0 ? View.VISIBLE : View.GONE);
}
else
{
else {
//holder.newMessageCount.setText("-");
holder.newMessageCount.setVisibility(View.GONE);
}

View File

@ -5,7 +5,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import android.app.ListActivity;
import com.android.email.K9ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
@ -27,7 +27,7 @@ import com.android.email.R;
import com.android.email.mail.Folder;
import com.android.email.mail.MessagingException;
public class ChooseFolder extends ListActivity
public class ChooseFolder extends K9ListActivity
{
String mFolder;
Account mAccount;

View File

@ -1,7 +1,7 @@
package com.android.email.activity;
import android.app.Activity;
import com.android.email.K9Activity;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Bundle;
@ -19,7 +19,7 @@ import com.android.email.R;
import java.lang.Integer;
public class Debug extends Activity implements OnCheckedChangeListener {
public class Debug extends K9Activity implements OnCheckedChangeListener {
private TextView mVersionView;
private CheckBox mEnableDebugLoggingView;
private CheckBox mEnableSensitiveLoggingView;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,7 @@ import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import android.app.Activity;
import com.android.email.K9Activity;
import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
@ -62,7 +62,7 @@ import com.android.email.mail.internet.TextBody;
import com.android.email.mail.store.LocalStore;
import com.android.email.mail.store.LocalStore.LocalAttachmentBody;
public class MessageCompose extends Activity implements OnClickListener, OnFocusChangeListener {
public class MessageCompose extends K9Activity implements OnClickListener, OnFocusChangeListener {
private static final String ACTION_REPLY = "com.android.email.intent.action.REPLY";
private static final String ACTION_REPLY_ALL = "com.android.email.intent.action.REPLY_ALL";
private static final String ACTION_FORWARD = "com.android.email.intent.action.FORWARD";
@ -314,8 +314,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
/*
* This data gets used in onCreate, so grab it here instead of onRestoreIntstanceState
*/
mSourceMessageProcessed =
savedInstanceState.getBoolean(STATE_KEY_SOURCE_MESSAGE_PROCED, false);
mSourceMessageProcessed = savedInstanceState.getBoolean(STATE_KEY_SOURCE_MESSAGE_PROCED, false);
}
Intent intent = getIntent();
@ -372,13 +371,11 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
}
String text = intent.getStringExtra(Intent.EXTRA_TEXT);
if (text != null)
{
if (text != null) {
mMessageContentView.setText(text);
}
String subject = intent.getStringExtra(Intent.EXTRA_SUBJECT);
if (subject != null)
{
if (subject != null) {
mSubjectView.setText(subject);
}
@ -451,16 +448,14 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
}
Log.d(Email.LOG_TAG, "action = " + action + ", mAccount = " + mAccount + ", mFolder = " + mFolder + ", mSourceMessageUid = " + mSourceMessageUid);
if ((ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action)) && mAccount != null && mFolder != null && mSourceMessageUid != null)
{
if ((ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action)) && mAccount != null && mFolder != null && mSourceMessageUid != null) {
Log.d(Email.LOG_TAG, "Setting message ANSWERED flag to true");
// TODO: Really, we should wait until we send the message, but that would require saving the original
// message info along with a Draft copy, in case it is left in Drafts for a while before being sent
MessagingController.getInstance(getApplication()).setMessageFlag(mAccount, mFolder, mSourceMessageUid, Flag.ANSWERED, true);
}
if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action) ||
ACTION_FORWARD.equals(action) || ACTION_EDIT_DRAFT.equals(action)) {
if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action) || ACTION_FORWARD.equals(action) || ACTION_EDIT_DRAFT.equals(action)) {
/*
* If we need to load the message we add ourself as a message listener here
* so we can kick it off. Normally we add in onResume but we don't
@ -468,14 +463,9 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
* There is no harm in adding twice.
*/
MessagingController.getInstance(getApplication()).addListener(mListener);
MessagingController.getInstance(getApplication()).loadMessageForView(
mAccount,
mFolder,
mSourceMessageUid,
null);
MessagingController.getInstance(getApplication()).loadMessageForView( mAccount, mFolder, mSourceMessageUid, null);
}
if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action) ||
ACTION_EDIT_DRAFT.equals(action)) {
if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action) || ACTION_EDIT_DRAFT.equals(action)) {
//change focus to message body.
mMessageContentView.requestFocus();
}
@ -525,8 +515,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
outState.putParcelableArrayList(STATE_KEY_ATTACHMENTS, attachments);
outState.putBoolean(STATE_KEY_CC_SHOWN, mCcView.getVisibility() == View.VISIBLE);
outState.putBoolean(STATE_KEY_BCC_SHOWN, mBccView.getVisibility() == View.VISIBLE);
outState.putBoolean(STATE_KEY_QUOTED_TEXT_SHOWN,
mQuotedTextBar.getVisibility() == View.VISIBLE);
outState.putBoolean(STATE_KEY_QUOTED_TEXT_SHOWN, mQuotedTextBar.getVisibility() == View.VISIBLE);
outState.putBoolean(STATE_KEY_SOURCE_MESSAGE_PROCED, mSourceMessageProcessed);
outState.putString(STATE_KEY_DRAFT_UID, mDraftUid);
}
@ -534,22 +523,17 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
@Override
protected void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
ArrayList<Parcelable> attachments = (ArrayList<Parcelable>)
savedInstanceState.getParcelableArrayList(STATE_KEY_ATTACHMENTS);
ArrayList<Parcelable> attachments = (ArrayList<Parcelable>) savedInstanceState.getParcelableArrayList(STATE_KEY_ATTACHMENTS);
mAttachments.removeAllViews();
for (Parcelable p : attachments) {
Uri uri = (Uri) p;
addAttachment(uri);
}
mCcView.setVisibility(savedInstanceState.getBoolean(STATE_KEY_CC_SHOWN) ?
View.VISIBLE : View.GONE);
mBccView.setVisibility(savedInstanceState.getBoolean(STATE_KEY_BCC_SHOWN) ?
View.VISIBLE : View.GONE);
mQuotedTextBar.setVisibility(savedInstanceState.getBoolean(STATE_KEY_QUOTED_TEXT_SHOWN) ?
View.VISIBLE : View.GONE);
mQuotedText.setVisibility(savedInstanceState.getBoolean(STATE_KEY_QUOTED_TEXT_SHOWN) ?
View.VISIBLE : View.GONE);
mCcView.setVisibility(savedInstanceState.getBoolean(STATE_KEY_CC_SHOWN) ? View.VISIBLE : View.GONE);
mBccView.setVisibility(savedInstanceState.getBoolean(STATE_KEY_BCC_SHOWN) ? View.VISIBLE : View.GONE);
mQuotedTextBar.setVisibility(savedInstanceState.getBoolean(STATE_KEY_QUOTED_TEXT_SHOWN) ? View.VISIBLE : View.GONE);
mQuotedText.setVisibility(savedInstanceState.getBoolean(STATE_KEY_QUOTED_TEXT_SHOWN) ? View.VISIBLE : View.GONE);
mDraftUid = savedInstanceState.getString(STATE_KEY_DRAFT_UID);
mDraftNeedsSaving = false;
}
@ -610,15 +594,12 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
String action = getIntent().getAction();
if (mQuotedTextBar.getVisibility() == View.VISIBLE) {
String quotedText = null;
Part part = MimeUtility.findFirstPartByMimeType(mSourceMessage,
"text/plain");
Part part = MimeUtility.findFirstPartByMimeType(mSourceMessage, "text/plain");
if (part != null) {
quotedText = MimeUtility.getTextFromPart(part);
}
if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action)) {
text += String.format(
getString(R.string.message_compose_reply_header_fmt),
Address.toString(mSourceMessage.getFrom()));
text += String.format( getString(R.string.message_compose_reply_header_fmt), Address.toString(mSourceMessage.getFrom()));
if (quotedText != null) {
text += quotedText.replaceAll("(?m)^", ">");
}
@ -628,10 +609,8 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
getString(R.string.message_compose_fwd_header_fmt),
mSourceMessage.getSubject(),
Address.toString(mSourceMessage.getFrom()),
Address.toString(
mSourceMessage.getRecipients(RecipientType.TO)),
Address.toString(
mSourceMessage.getRecipients(RecipientType.CC)));
Address.toString( mSourceMessage.getRecipients(RecipientType.TO)),
Address.toString( mSourceMessage.getRecipients(RecipientType.CC)));
if (quotedText != null) {
text += quotedText;
}
@ -661,15 +640,10 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
for (int i = 0, count = mAttachments.getChildCount(); i < count; i++) {
Attachment attachment = (Attachment) mAttachments.getChildAt(i).getTag();
MimeBodyPart bp = new MimeBodyPart(
new LocalStore.LocalAttachmentBody(attachment.uri, getApplication()));
bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE, String.format("%s;\n name=\"%s\"",
attachment.contentType,
attachment.name));
MimeBodyPart bp = new MimeBodyPart( new LocalStore.LocalAttachmentBody(attachment.uri, getApplication()));
bp.setHeader(MimeHeader.HEADER_CONTENT_TYPE, String.format("%s;\n name=\"%s\"", attachment.contentType, attachment.name));
bp.setHeader(MimeHeader.HEADER_CONTENT_TRANSFER_ENCODING, "base64");
bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION,
String.format("attachment;\n filename=\"%s\"",
attachment.name));
bp.setHeader(MimeHeader.HEADER_CONTENT_DISPOSITION, String.format("attachment;\n filename=\"%s\"", attachment.name));
mp.addBodyPart(bp);
}
@ -740,16 +714,11 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
* TODO Is it possible for us to be editing a draft with a null source message? Don't
* think so. Could probably remove below check.
*/
if (ACTION_EDIT_DRAFT.equals(getIntent().getAction())
&& mSourceMessageUid != null) {
if (ACTION_EDIT_DRAFT.equals(getIntent().getAction()) && mSourceMessageUid != null) {
/*
* We're sending a previously saved draft, so delete the old draft first.
*/
MessagingController.getInstance(getApplication()).deleteMessage(
mAccount,
mFolder,
mSourceMessage,
null);
MessagingController.getInstance(getApplication()).deleteMessage( mAccount, mFolder, mSourceMessage, null);
}
MessagingController.getInstance(getApplication()).sendMessage(mAccount, message, null);
}
@ -764,12 +733,9 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
}
private void onSend() {
if (getAddresses(mToView).length == 0 &&
getAddresses(mCcView).length == 0 &&
getAddresses(mBccView).length == 0) {
if (getAddresses(mToView).length == 0 && getAddresses(mCcView).length == 0 && getAddresses(mBccView).length == 0) {
mToView.setError(getString(R.string.message_compose_error_no_recipients));
Toast.makeText(this, getString(R.string.message_compose_error_no_recipients),
Toast.LENGTH_LONG).show();
Toast.makeText(this, getString(R.string.message_compose_error_no_recipients), Toast.LENGTH_LONG).show();
return;
}
sendOrSaveMessage(false);
@ -780,11 +746,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
private void onDiscard() {
if (mSourceMessageUid != null) {
if (ACTION_EDIT_DRAFT.equals(getIntent().getAction()) && mSourceMessageUid != null) {
MessagingController.getInstance(getApplication()).deleteMessage(
mAccount,
mFolder,
mSourceMessage,
null);
MessagingController.getInstance(getApplication()).deleteMessage( mAccount, mFolder, mSourceMessage, null);
}
}
mHandler.sendEmptyMessage(MSG_DISCARDED_DRAFT);
@ -832,12 +794,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
attachment.uri = uri;
if (attachment.size == -1 || attachment.name == null) {
Cursor metadataCursor = contentResolver.query(
uri,
new String[]{ OpenableColumns.DISPLAY_NAME, OpenableColumns.SIZE },
null,
null,
null);
Cursor metadataCursor = contentResolver.query( uri, new String[]{ OpenableColumns.DISPLAY_NAME, OpenableColumns.SIZE }, null, null, null);
if (metadataCursor != null) {
try {
if (metadataCursor.moveToFirst()) {
@ -858,10 +815,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
attachment.name = uri.getLastPathSegment();
}
View view = getLayoutInflater().inflate(
R.layout.message_compose_attachment,
mAttachments,
false);
View view = getLayoutInflater().inflate( R.layout.message_compose_attachment, mAttachments, false);
TextView nameView = (TextView)view.findViewById(R.id.attachment_name);
ImageButton delete = (ImageButton)view.findViewById(R.id.attachment_delete);
nameView.setText(attachment.name);
@ -971,8 +925,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
String action = getIntent().getAction();
if (ACTION_REPLY.equals(action) || ACTION_REPLY_ALL.equals(action)) {
try {
if (message.getSubject() != null &&
!message.getSubject().toLowerCase().startsWith("re:")) {
if (message.getSubject() != null && !message.getSubject().toLowerCase().startsWith("re:")) {
mSubjectView.setText("Re: " + message.getSubject());
}
else {
@ -1014,8 +967,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
if (text != null) {
mQuotedTextBar.setVisibility(View.VISIBLE);
mQuotedText.setVisibility(View.VISIBLE);
mQuotedText.loadDataWithBaseURL("email://", text, part.getMimeType(),
"utf-8", null);
mQuotedText.loadDataWithBaseURL("email://", text, part.getMimeType(), "utf-8", null);
}
}
}
@ -1028,8 +980,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
}
else if (ACTION_FORWARD.equals(action)) {
try {
if (message.getSubject() != null &&
!message.getSubject().toLowerCase().startsWith("fwd:")) {
if (message.getSubject() != null && !message.getSubject().toLowerCase().startsWith("fwd:")) {
mSubjectView.setText("Fwd: " + message.getSubject());
}
else {
@ -1045,8 +996,7 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
if (text != null) {
mQuotedTextBar.setVisibility(View.VISIBLE);
mQuotedText.setVisibility(View.VISIBLE);
mQuotedText.loadDataWithBaseURL("email://", text, part.getMimeType(),
"utf-8", null);
mQuotedText.loadDataWithBaseURL("email://", text, part.getMimeType(), "utf-8", null);
}
}
if (!mSourceMessageProcessed) {
@ -1098,14 +1048,12 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
}
@Override
public void loadMessageForViewFinished(Account account, String folder, String uid,
Message message) {
public void loadMessageForViewFinished(Account account, String folder, String uid, Message message) {
mHandler.sendEmptyMessage(MSG_PROGRESS_OFF);
}
@Override
public void loadMessageForViewBodyAvailable(Account account, String folder, String uid,
final Message message) {
public void loadMessageForViewBodyAvailable(Account account, String folder, String uid, final Message message) {
mSourceMessage = message;
runOnUiThread(new Runnable() {
public void run() {
@ -1115,22 +1063,14 @@ public class MessageCompose extends Activity implements OnClickListener, OnFocus
}
@Override
public void loadMessageForViewFailed(Account account, String folder, String uid,
final String message) {
public void loadMessageForViewFailed(Account account, String folder, String uid, final String message) {
mHandler.sendEmptyMessage(MSG_PROGRESS_OFF);
// TODO show network error
}
@Override
public void messageUidChanged(
Account account,
String folder,
String oldUid,
String newUid) {
if (account.equals(mAccount)
&& (folder.equals(mFolder)
|| (mFolder == null
&& folder.equals(mAccount.getDraftsFolderName())))) {
public void messageUidChanged( Account account, String folder, String oldUid, String newUid) {
if (account.equals(mAccount) && (folder.equals(mFolder) || (mFolder == null && folder.equals(mAccount.getDraftsFolderName())))) {
if (oldUid.equals(mDraftUid)) {
mDraftUid = newUid;
}

File diff suppressed because it is too large Load Diff

View File

@ -12,7 +12,7 @@ import java.util.Map;
import org.apache.commons.io.IOUtils;
import android.app.Activity;
import com.android.email.K9Activity;
import android.content.Context;
import android.content.Intent;
import android.content.res.Configuration;
@ -36,7 +36,9 @@ import android.view.View;
import android.view.Window;
import android.view.View.OnClickListener;
import android.webkit.CacheManager;
import android.webkit.CacheManager;
import android.webkit.UrlInterceptHandler;
// import android.webkit.PluginData; // XXX TODO reenable when we switch to sdk 1.5
import android.webkit.WebView;
import android.webkit.CacheManager.CacheResult;
import android.widget.Button;
@ -67,7 +69,7 @@ import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class MessageView extends Activity
public class MessageView extends K9Activity
implements UrlInterceptHandler, OnClickListener {
private static final String EXTRA_ACCOUNT = "com.android.email.MessageView_account";
private static final String EXTRA_FOLDER = "com.android.email.MessageView_folder";
@ -85,6 +87,7 @@ public class MessageView extends Activity
private TextView mDateView;
private TextView mToView;
private TextView mSubjectView;
private int defaultSubjectColor;
private WebView mMessageContentView;
private LinearLayout mAttachments;
private View mAttachmentIcon;
@ -108,6 +111,7 @@ public class MessageView extends Activity
private Menu optionsMenu = null;
// public PluginData getPluginData(String x, Map<String,String> y) {return null;} // XXX TODO reenable when we switch to 1.5
private DateFormat getDateFormat()
{
@ -145,9 +149,6 @@ public class MessageView extends Activity
private Listener mListener = new Listener();
private MessageViewHandler mHandler = new MessageViewHandler();
public boolean onKeyDown(int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_DEL: { onDelete(); return true;}
@ -179,8 +180,6 @@ public class MessageView extends Activity
return super.onKeyDown(keyCode, event);
}
class MessageViewHandler extends Handler {
private static final int MSG_PROGRESS = 2;
private static final int MSG_ADD_ATTACHMENT = 3;
@ -223,7 +222,7 @@ public class MessageView extends Activity
mSubjectView.setTextColor(0xff000000 | Email.FLAGGED_COLOR);
}
else {
mSubjectView.setTextColor(0xff000000);
mSubjectView.setTextColor(0xff000000 | defaultSubjectColor );
}
if ((msg.arg2 & FLAG_ANSWERED) != 0) {
Drawable answeredIcon = getResources().getDrawable(
@ -342,13 +341,11 @@ public class MessageView extends Activity
public ImageView iconView;
}
public static void actionView(Context context, Account account,
String folder, String messageUid, ArrayList<String> folderUids) {
public static void actionView(Context context, Account account, String folder, String messageUid, ArrayList<String> folderUids) {
actionView(context, account, folder, messageUid, folderUids, null);
}
public static void actionView(Context context, Account account,
String folder, String messageUid, ArrayList<String> folderUids, Bundle extras) {
public static void actionView(Context context, Account account, String folder, String messageUid, ArrayList<String> folderUids, Bundle extras) {
Intent i = new Intent(context, MessageView.class);
i.putExtra(EXTRA_ACCOUNT, account);
i.putExtra(EXTRA_FOLDER, folder);
@ -364,12 +361,16 @@ public class MessageView extends Activity
super.onCreate(icicle);
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.message_view);
mFromView = (TextView)findViewById(R.id.from);
mToView = (TextView)findViewById(R.id.to);
mSubjectView = (TextView)findViewById(R.id.subject);
defaultSubjectColor = mSubjectView.getCurrentTextColor();
mDateView = (TextView)findViewById(R.id.date);
mMessageContentView = (WebView)findViewById(R.id.message_content);
//mMessageContentView.setWebViewClient(new MessageWebViewClient());
@ -377,6 +378,7 @@ public class MessageView extends Activity
mAttachmentIcon = findViewById(R.id.attachment);
mShowPicturesSection = findViewById(R.id.show_pictures_section);
mMessageContentView.setVerticalScrollBarEnabled(false);
mAttachments.setVisibility(View.GONE);
mAttachmentIcon.setVisibility(View.GONE);
@ -1075,8 +1077,8 @@ public class MessageView extends Activity
* TODO this should be smarter, change to regex for img, but consider how to
* get background images and a million other things that HTML allows.
*/
mHandler.showShowPictures(text.contains("<img"));
mMessageContentView.loadDataWithBaseURL("email://", text, "text/html", "utf-8", null);
mHandler.showShowPictures(text.contains("<img"));
}
else {
mMessageContentView.loadUrl("file:///android_asset/empty.html");

View File

@ -1,11 +1,10 @@
package com.android.email.activity;
import com.android.email.Account;
import com.android.email.Email;
import com.android.email.Preferences;
import android.app.Activity;
import com.android.email.K9Activity;
import android.content.Intent;
import android.os.Bundle;
@ -14,23 +13,17 @@ import android.os.Bundle;
* the user should start with.
* If no accounts are configured the user is taken to the Accounts Activity where they
* can configure an account.
* If a single account is configured the user is taken directly to the FolderMessageList for
* If a single account is configured the user is taken directly to the MessageList for
* the INBOX of that account.
* If more than one account is configuref the user is takaen to the Accounts Activity so they
* can select an account.
*/
public class Welcome extends Activity {
public class Welcome extends K9Activity {
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
Account[] accounts = Preferences.getPreferences(this).getAccounts();
if (accounts.length == 1) {
FolderMessageList.actionHandleAccount(this, accounts[0], Email.INBOX);
} else {
startActivity(new Intent(this, Accounts.class));
}
Accounts.actionLaunch(this);
finish();
}
}

View File

@ -9,7 +9,7 @@ import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.preference.PreferenceActivity;
import com.android.email.K9PreferenceActivity;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.CheckBoxPreference;
@ -24,7 +24,7 @@ import com.android.email.Preferences;
import com.android.email.R;
import com.android.email.activity.ChooseFolder;
public class AccountSettings extends PreferenceActivity {
public class AccountSettings extends K9PreferenceActivity {
private static final String EXTRA_ACCOUNT = "account";
private static final int SELECT_AUTO_EXPAND_FOLDER = 1;

View File

@ -4,7 +4,7 @@ package com.android.email.activity.setup;
import java.net.URI;
import java.net.URISyntaxException;
import android.app.Activity;
import com.android.email.K9Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@ -20,7 +20,7 @@ import com.android.email.R;
* passed in email address, password and makeDefault are then passed on to the
* AccountSetupIncoming activity.
*/
public class AccountSetupAccountType extends Activity implements OnClickListener {
public class AccountSetupAccountType extends K9Activity implements OnClickListener {
private static final String EXTRA_ACCOUNT = "account";
private static final String EXTRA_MAKE_DEFAULT = "makeDefault";

View File

@ -5,7 +5,7 @@ import java.io.Serializable;
import java.net.URI;
import java.net.URISyntaxException;
import android.app.Activity;
import com.android.email.K9Activity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.Context;
@ -41,7 +41,7 @@ import com.android.email.Utility;
* activity. If no settings are found the settings are handed off to the
* AccountSetupAccountType activity.
*/
public class AccountSetupBasics extends Activity
public class AccountSetupBasics extends K9Activity
implements OnClickListener, TextWatcher {
private final static String EXTRA_ACCOUNT = "com.android.email.AccountSetupBasics.account";
private final static int DIALOG_NOTE = 1;

View File

@ -19,8 +19,10 @@ import android.widget.Button;
import android.widget.ProgressBar;
import android.widget.TextView;
import com.android.email.K9Activity;
import com.android.email.Account;
import com.android.email.Email;
import com.android.email.MessagingController;
import com.android.email.R;
import com.android.email.mail.AuthenticationFailedException;
import com.android.email.mail.MessagingException;
@ -36,7 +38,7 @@ import com.android.email.mail.store.TrustManagerFactory;
* XXX NOTE: The manifest for this app has it ignore config changes, because
* it doesn't correctly deal with restarting while its thread is running.
*/
public class AccountSetupCheckSettings extends Activity implements OnClickListener {
public class AccountSetupCheckSettings extends K9Activity implements OnClickListener {
public static final int ACTIVITY_REQUEST_CODE = 1;
@ -102,6 +104,17 @@ public class AccountSetupCheckSettings extends Activity implements OnClickListen
setMessage(R.string.account_setup_check_settings_check_incoming_msg);
store = Store.getInstance(mAccount.getStoreUri(), getApplication());
store.checkSettings();
new Thread() {
public void run() {
Process.setThreadPriority(Process.THREAD_PRIORITY_BACKGROUND);
MessagingController.getInstance(getApplication()).listFolders(mAccount, true, null);
MessagingController.getInstance(getApplication()).synchronizeMailbox( mAccount, Email.INBOX , null);
}
}.start();
}
if (mDestroyed) {
return;

View File

@ -1,6 +1,6 @@
package com.android.email.activity.setup;
import android.app.Activity;
import com.android.email.K9Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
@ -13,7 +13,7 @@ import com.android.email.Email;
import com.android.email.Preferences;
import com.android.email.R;
public class AccountSetupComposition extends Activity {
public class AccountSetupComposition extends K9Activity {
private static final String EXTRA_ACCOUNT = "account";

View File

@ -3,8 +3,8 @@ package com.android.email.activity.setup;
import java.net.URI;
import java.net.URISyntaxException;
import android.app.Activity;
import com.android.email.K9Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
@ -29,7 +29,7 @@ import com.android.email.R;
import com.android.email.Utility;
import com.android.email.activity.ChooseFolder;
public class AccountSetupIncoming extends Activity implements OnClickListener {
public class AccountSetupIncoming extends K9Activity implements OnClickListener {
private static final String EXTRA_ACCOUNT = "account";
private static final String EXTRA_MAKE_DEFAULT = "makeDefault";

View File

@ -1,7 +1,7 @@
package com.android.email.activity.setup;
import android.app.Activity;
import com.android.email.K9Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@ -19,9 +19,9 @@ import com.android.email.Email;
import com.android.email.Preferences;
import com.android.email.R;
import com.android.email.Utility;
import com.android.email.activity.FolderMessageList;
import com.android.email.activity.FolderList;
public class AccountSetupNames extends Activity implements OnClickListener {
public class AccountSetupNames extends K9Activity implements OnClickListener {
private static final String EXTRA_ACCOUNT = "account";
private EditText mDescription;
@ -89,7 +89,7 @@ public class AccountSetupNames extends Activity implements OnClickListener {
}
mAccount.setName(mName.getText().toString());
mAccount.save(Preferences.getPreferences(this));
FolderMessageList.actionHandleAccount(this, mAccount, Email.INBOX);
FolderList.actionHandleAccount(this, mAccount, Email.INBOX);
finish();
}

View File

@ -1,7 +1,7 @@
package com.android.email.activity.setup;
import android.app.Activity;
import com.android.email.K9Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@ -16,7 +16,7 @@ import com.android.email.Email;
import com.android.email.Preferences;
import com.android.email.R;
public class AccountSetupOptions extends Activity implements OnClickListener {
public class AccountSetupOptions extends K9Activity implements OnClickListener {
private static final String EXTRA_ACCOUNT = "account";
private static final String EXTRA_MAKE_DEFAULT = "makeDefault";

View File

@ -4,7 +4,7 @@ package com.android.email.activity.setup;
import java.net.URI;
import java.net.URISyntaxException;
import android.app.Activity;
import com.android.email.K9Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
@ -28,7 +28,7 @@ import com.android.email.Preferences;
import com.android.email.R;
import com.android.email.Utility;
public class AccountSetupOutgoing extends Activity implements OnClickListener,
public class AccountSetupOutgoing extends K9Activity implements OnClickListener,
OnCheckedChangeListener {
private static final String EXTRA_ACCOUNT = "account";

View File

@ -7,7 +7,7 @@ import android.content.SharedPreferences;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.preference.PreferenceActivity;
import com.android.email.K9PreferenceActivity;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.CheckBoxPreference;
@ -24,7 +24,7 @@ import com.android.email.mail.Store;
import com.android.email.mail.Folder.FolderClass;
import com.android.email.mail.store.LocalStore.LocalFolder;
public class FolderSettings extends PreferenceActivity {
public class FolderSettings extends K9PreferenceActivity {
private static final String EXTRA_FOLDER_NAME = "com.android.email.folderName";
private static final String EXTRA_ACCOUNT = "com.android.email.account";
@ -68,7 +68,7 @@ public class FolderSettings extends PreferenceActivity {
addPreferencesFromResource(R.xml.folder_settings_preferences);
Preference category = findPreference(PREFERENCE_TOP_CATERGORY);
category.setTitle(getString(R.string.folder_settings_title));
category.setTitle(folderName);
mDisplayClass = (ListPreference) findPreference(PREFERENCE_DISPLAY_CLASS);
mDisplayClass.setValue(mFolder.getDisplayClass().name());

View File

@ -0,0 +1,79 @@
package com.android.email.activity.setup;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.preference.EditTextPreference;
import android.preference.ListPreference;
import android.preference.CheckBoxPreference;
import android.preference.Preference;
import android.preference.PreferenceScreen;
import android.preference.RingtonePreference;
import android.preference.Preference.OnPreferenceClickListener;
import com.android.email.K9PreferenceActivity;
import com.android.email.Account;
import com.android.email.Email;
import com.android.email.Preferences;
import com.android.email.R;
public class Prefs extends K9PreferenceActivity {
private static final String PREFERENCE_TOP_CATERGORY = "preferences";
private static final String PREFERENCE_THEME = "theme";
private ListPreference mTheme;
public static void actionPrefs(Context context) {
Intent i = new Intent(context, Prefs.class);
context.startActivity(i);
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.global_preferences);
Preference category = findPreference(PREFERENCE_TOP_CATERGORY);
mTheme = (ListPreference) findPreference(PREFERENCE_THEME);
mTheme.setValue(String.valueOf(Preferences.getPreferences(this).getTheme() == android.R.style.Theme ? "dark" : "light"));
mTheme.setSummary(mTheme.getEntry());
mTheme.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
public boolean onPreferenceChange(Preference preference, Object newValue) {
final String summary = newValue.toString();
int index = mTheme.findIndexOfValue(summary);
mTheme.setSummary(mTheme.getEntries()[index]);
mTheme.setValue(summary);
return false;
}
});
}
@Override
public void onResume() {
super.onResume();
}
private void saveSettings() {
Preferences.getPreferences(this).setTheme(mTheme.getValue().equals("dark") ? android.R.style.Theme : android.R.style.Theme_Light);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
saveSettings();
}
return super.onKeyDown(keyCode, event);
}
}

View File

@ -94,11 +94,11 @@ public class Address {
public String toString() {
if (mPersonal != null) {
if (mPersonal.matches(".*[\\(\\)<>@,;:\\\\\".\\[\\]].*")) {
return Utility.quoteString(mPersonal) + " <" + mAddress + ">";
} else {
return mPersonal + " <" + mAddress + ">";
}
// if (mPersonal.matches(".*[\\(\\)<>@,;:\\\\\".\\[\\]].*")) {
return "\"" + mPersonal+ "\" " + " <" + mAddress + ">";
// } else {
// return mPersonal + " <" + mAddress + ">";
// }
} else {
return mAddress;
}
@ -161,22 +161,22 @@ public class Address {
int pairEndIndex = 0;
int addressEndIndex = 0;
while (pairStartIndex < length) {
pairEndIndex = addressList.indexOf(',', pairStartIndex);
pairEndIndex = addressList.indexOf(",\u0000", pairStartIndex);
if (pairEndIndex == -1) {
pairEndIndex = length;
}
addressEndIndex = addressList.indexOf(';', pairStartIndex);
addressEndIndex = addressList.indexOf(";\u0000", pairStartIndex);
String address = null;
String personal = null;
if (addressEndIndex == -1 || addressEndIndex > pairEndIndex) {
address = Utility.fastUrlDecode(addressList.substring(pairStartIndex, pairEndIndex));
address = addressList.substring(pairStartIndex, pairEndIndex);
}
else {
address = Utility.fastUrlDecode(addressList.substring(pairStartIndex, addressEndIndex));
personal = Utility.fastUrlDecode(addressList.substring(addressEndIndex + 1, pairEndIndex));
address = addressList.substring(pairStartIndex, addressEndIndex);
personal =addressList.substring(addressEndIndex + 2, pairEndIndex);
}
addresses.add(new Address(address, personal));
pairStartIndex = pairEndIndex + 1;
pairStartIndex = pairEndIndex + 2;
}
return addresses.toArray(new Address[] { });
}
@ -184,8 +184,8 @@ public class Address {
/**
* Packs an address list into a String that is very quick to read
* and parse. Packed lists can be unpacked with unpackAddressList()
* The packed list is a comma seperated list of:
* URLENCODE(address)[;URLENCODE(personal)]
* The packed list is a "\u0000," seperated list of:
* address\u0000;personal
* @param list
* @return
*/
@ -196,18 +196,16 @@ public class Address {
StringBuffer sb = new StringBuffer();
for (int i = 0, count = addresses.length; i < count; i++) {
Address address = addresses[i];
try {
sb.append(URLEncoder.encode(address.getAddress(), "UTF-8"));
if (address.getPersonal() != null) {
sb.append(';');
sb.append(URLEncoder.encode(address.getPersonal(), "UTF-8"));
sb.append(address.getAddress());
String personal = address.getPersonal();
if (personal != null) {
sb.append(";\u0000");
// Escape quotes in the address part on the way in
personal.replaceAll("\"","\\\"");
sb.append(personal);
}
if (i < count - 1) {
sb.append(',');
}
}
catch (UnsupportedEncodingException uee) {
return null;
sb.append(",\u0000");
}
}
return sb.toString();

View File

@ -37,11 +37,17 @@ public class MimeMessage extends Message {
protected Address[] mBcc;
protected Address[] mReplyTo;
protected Date mSentDate;
protected SimpleDateFormat mDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
protected SimpleDateFormat mDateFormat;
protected Body mBody;
protected int mSize;
public MimeMessage() {
setGeneratedMessageId();
}
public void setGeneratedMessageId () {
/*
* Every new messages gets a Message-ID
*/
@ -107,10 +113,19 @@ public class MimeMessage extends Message {
}
public void setSentDate(Date sentDate) throws MessagingException {
if (mDateFormat == null) {
mDateFormat = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.US);
}
setHeader("Date", mDateFormat.format(sentDate));
setInternalSentDate(sentDate);
}
public void setInternalSentDate(Date sentDate) throws MessagingException {
this.mSentDate = sentDate;
}
public String getContentType() throws MessagingException {
String contentType = getFirstHeader(MimeHeader.HEADER_CONTENT_TYPE);
if (contentType == null) {

View File

@ -65,7 +65,7 @@ public class LocalStore extends Store implements Serializable {
// If you are going to change the DB_VERSION, please also go into Email.java and local for the comment
// on LOCAL_UID_PREFIX and follow the instructions there. If you follow the instructions there,
// please delete this comment.
private static final int DB_VERSION = 24;
private static final int DB_VERSION = 25;
private static final Flag[] PERMANENT_FLAGS = { Flag.DELETED, Flag.X_DESTROYED, Flag.SEEN };
private String mPath;
@ -134,7 +134,8 @@ public class LocalStore extends Store implements Serializable {
+ "html_content TEXT, text_content TEXT, attachment_count INTEGER, internal_date INTEGER, message_id TEXT)");
mDb.execSQL("CREATE INDEX IF NOT EXISTS msg_uid ON messages (uid, folder_id)");
mDb.execSQL("CREATE INDEX IF NOT EXISTS msg_folder_id ON messages (folder_id)");
mDb.execSQL("DROP INDEX IF EXISTS msg_folder_id");
mDb.execSQL("CREATE INDEX IF NOT EXISTS msg_folder_id_date ON messages (folder_id,internal_date)");
mDb.execSQL("DROP TABLE IF EXISTS attachments");
mDb.execSQL("CREATE TABLE attachments (id INTEGER PRIMARY KEY, message_id INTEGER,"
+ "store_data TEXT, content_uri TEXT, size INTEGER, name TEXT,"
@ -882,14 +883,14 @@ public class LocalStore extends Store implements Serializable {
if (from.length > 0) {
message.setFrom(from[0]);
}
message.setSentDate(new Date(cursor.getLong(2)));
message.setInternalSentDate(new Date(cursor.getLong(2)));
message.setUid(cursor.getString(3));
String flagList = cursor.getString(4);
if (flagList != null && flagList.length() > 0) {
String[] flags = flagList.split(",");
try {
for (String flag : flags) {
message.setFlagInternal(Flag.valueOf(flag.toUpperCase()), true);
message.setFlagInternal(Flag.valueOf(flag), true);
}
} catch (Exception e) {
}
@ -901,7 +902,7 @@ public class LocalStore extends Store implements Serializable {
message.setReplyTo(Address.unpack(cursor.getString(9)));
message.mAttachmentCount = cursor.getInt(10);
message.setInternalDate(new Date(cursor.getLong(11)));
message.setHeader("Message-ID", cursor.getString(12));
message.addHeader("Message-ID", cursor.getString(12));
}
@Override
@ -944,17 +945,25 @@ public class LocalStore extends Store implements Serializable {
ArrayList<Message> messages = new ArrayList<Message>();
Cursor cursor = null;
try {
// pull out messages most recent first, since that's what the default sort is
cursor = mDb.rawQuery(
"SELECT subject, sender_list, date, uid, flags, id, to_list, cc_list, "
+ "bcc_list, reply_to_list, attachment_count, internal_date, message_id "
+ "FROM messages " + "WHERE folder_id = ?", new String[] {
+ "FROM messages " + "WHERE folder_id = ? ORDER BY date DESC"
, new String[] {
Long.toString(mFolderId)
});
int i = 0;
while (cursor.moveToNext()) {
LocalMessage message = new LocalMessage(null, this);
populateMessageFromGetMessageCursor(message, cursor);
messages.add(message);
if (listener != null) {
listener.messageFinished(message, i, -1);
}
i++;
}
}
finally {
@ -1524,6 +1533,13 @@ public class LocalStore extends Store implements Serializable {
private long mId;
private int mAttachmentCount;
public LocalMessage() {
}
// We don't want to do this for local messages
@Override public void setGeneratedMessageId () {}
LocalMessage(String uid, Folder folder) throws MessagingException {
this.mUid = uid;
this.mFolder = folder;
@ -1537,6 +1553,33 @@ public class LocalStore extends Store implements Serializable {
super.parse(in);
}
public void setFrom(Address from) throws MessagingException {
if (from != null) {
addHeader("From", from.toString());
this.mFrom = new Address[] {
from
};
} else {
this.mFrom = null;
}
}
public void setRecipients(RecipientType type, Address[] addresses) throws MessagingException {
if (type == RecipientType.TO) {
addHeader("To", Address.toString(addresses));
this.mTo = addresses;
} else if (type == RecipientType.CC) {
addHeader("CC", Address.toString(addresses));
this.mCc = addresses;
} else if (type == RecipientType.BCC) {
addHeader("BCC", Address.toString(addresses));
this.mBcc = addresses;
} else {
throw new MessagingException("Unrecognized recipient type.");
}
}
public void setFlagInternal(Flag flag, boolean set) throws MessagingException {
super.setFlag(flag, set);
}

View File

@ -27,7 +27,7 @@ import com.android.email.MessagingListener;
import com.android.email.Preferences;
import com.android.email.R;
import com.android.email.activity.Accounts;
import com.android.email.activity.FolderMessageList;
import com.android.email.activity.FolderList;
import com.android.email.mail.Folder;
import com.android.email.mail.MessagingException;
import com.android.email.mail.Store;
@ -262,12 +262,15 @@ public class MailService extends Service {
notif.number = unreadMessageCount;
Intent i = FolderMessageList.actionHandleAccountIntent(context, thisAccount);
Intent i = FolderList.actionHandleAccountIntent(context, thisAccount);
PendingIntent pi = PendingIntent.getActivity(context, 0, i, 0);
notif.setLatestEventInfo(context, getString(R.string.notification_new_title), notice, pi);
// JRV XXX TODO - Do we also need to notify the messagelist here?
String ringtone = thisAccount.getRingtone();
notif.sound = TextUtils.isEmpty(ringtone) ? null : Uri.parse(ringtone);

View File

@ -0,0 +1,6 @@
package com.fsck.k9beta;
import com.android.email.Email;
public class K9 extends Email {
}

6
tools/build-beta Executable file
View File

@ -0,0 +1,6 @@
perl -pi -e's|\@string/app_name|K9 BETA|' AndroidManifest.xml
perl -pi -e's/com(.)fsck(.)k9/com$1fsck$2k9beta/' build.xml AndroidManifest.xml
ant $@
perl -pi -e's/com(.)fsck(.)k9beta/com$1fsck$2k9/' build.xml AndroidManifest.xml
perl -pi -e's|K9 BETA|\@string/app_name|' AndroidManifest.xml
perl -pi -e's/K9-BETA/K9/' AndroidManifest.xml