mirror of
https://github.com/moparisthebest/k-9
synced 2025-02-17 07:30:16 -05:00
Merge branch 'master' into pull-128
This commit is contained in:
commit
81c9fdcb13
BIN
images/drawable-src/ic_menu_envelope.png
Normal file
BIN
images/drawable-src/ic_menu_envelope.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.7 KiB |
@ -103,7 +103,6 @@
|
|||||||
<SOURCES />
|
<SOURCES />
|
||||||
</library>
|
</library>
|
||||||
</orderEntry>
|
</orderEntry>
|
||||||
<orderEntry type="library" scope="PROVIDED" name="Android 2.3.1 Platform" level="application" />
|
|
||||||
</component>
|
</component>
|
||||||
</module>
|
</module>
|
||||||
|
|
||||||
|
BIN
res/drawable-hdpi/ic_menu_reply_receipt.png
Normal file
BIN
res/drawable-hdpi/ic_menu_reply_receipt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
res/drawable/ic_menu_reply_receipt.png
Normal file
BIN
res/drawable/ic_menu_reply_receipt.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.0 KiB |
@ -1,9 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout
|
||||||
|
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="fill_parent">
|
android:layout_height="fill_parent">
|
||||||
<ListView android:id="@+id/android:list"
|
|
||||||
|
<ListView
|
||||||
|
android:id="@+id/android:list"
|
||||||
android:layout_width="fill_parent"
|
android:layout_width="fill_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="fill_parent"/>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
@ -32,8 +32,9 @@
|
|||||||
/>
|
/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/read_receipt"
|
android:id="@+id/read_receipt"
|
||||||
android:alphabeticShortcut="r"
|
android:alphabeticShortcut="r"
|
||||||
android:title="@string/read_receipt"
|
android:title="@string/read_receipt"
|
||||||
|
android:icon="@drawable/ic_menu_reply_receipt"
|
||||||
/>
|
/>
|
||||||
<item
|
<item
|
||||||
android:id="@+id/add_attachment_image"
|
android:id="@+id/add_attachment_image"
|
||||||
|
@ -13,6 +13,10 @@ import com.fsck.k9.R;
|
|||||||
import com.fsck.k9.helper.ContactItem;
|
import com.fsck.k9.helper.ContactItem;
|
||||||
|
|
||||||
public class EmailAddressList extends K9ListActivity implements OnItemClickListener {
|
public class EmailAddressList extends K9ListActivity implements OnItemClickListener {
|
||||||
|
public static final String EXTRA_CONTACT_ITEM = "contact";
|
||||||
|
public static final String EXTRA_EMAIL_ADDRESS = "emailAddress";
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -20,17 +24,19 @@ public class EmailAddressList extends K9ListActivity implements OnItemClickListe
|
|||||||
setContentView(R.layout.email_address_list);
|
setContentView(R.layout.email_address_list);
|
||||||
|
|
||||||
Intent i = getIntent();
|
Intent i = getIntent();
|
||||||
ContactItem contact = (ContactItem) i.getSerializableExtra("contact");
|
ContactItem contact = (ContactItem) i.getSerializableExtra(EXTRA_CONTACT_ITEM);
|
||||||
if (contact == null) {
|
if (contact == null) {
|
||||||
|
finish();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, R.layout.email_address_list_item, contact.getEmailAddresses());
|
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
|
||||||
|
R.layout.email_address_list_item, contact.emailAddresses);
|
||||||
|
|
||||||
ListView listView = getListView();
|
ListView listView = getListView();
|
||||||
listView.setOnItemClickListener(this);
|
listView.setOnItemClickListener(this);
|
||||||
listView.setAdapter(adapter);
|
listView.setAdapter(adapter);
|
||||||
setTitle(contact.getDisplayName());
|
setTitle(contact.displayName);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -40,7 +46,7 @@ public class EmailAddressList extends K9ListActivity implements OnItemClickListe
|
|||||||
Toast.makeText(EmailAddressList.this, item, Toast.LENGTH_LONG).show();
|
Toast.makeText(EmailAddressList.this, item, Toast.LENGTH_LONG).show();
|
||||||
|
|
||||||
Intent intent = new Intent();
|
Intent intent = new Intent();
|
||||||
intent.putExtra("EMAIL_ADDRESS", item);
|
intent.putExtra(EXTRA_EMAIL_ADDRESS, item);
|
||||||
setResult(RESULT_OK, intent);
|
setResult(RESULT_OK, intent);
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
@ -26,7 +26,6 @@ import android.content.pm.ActivityInfo;
|
|||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.AsyncTask;
|
import android.os.AsyncTask;
|
||||||
import android.os.Build;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.os.Parcelable;
|
import android.os.Parcelable;
|
||||||
@ -136,8 +135,6 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
private static final int MSG_DISCARDED_DRAFT = 6;
|
private static final int MSG_DISCARDED_DRAFT = 6;
|
||||||
|
|
||||||
private static final int ACTIVITY_REQUEST_PICK_ATTACHMENT = 1;
|
private static final int ACTIVITY_REQUEST_PICK_ATTACHMENT = 1;
|
||||||
private static final int ACTIVITY_CHOOSE_IDENTITY = 2;
|
|
||||||
private static final int ACTIVITY_CHOOSE_ACCOUNT = 3;
|
|
||||||
private static final int CONTACT_PICKER_TO = 4;
|
private static final int CONTACT_PICKER_TO = 4;
|
||||||
private static final int CONTACT_PICKER_CC = 5;
|
private static final int CONTACT_PICKER_CC = 5;
|
||||||
private static final int CONTACT_PICKER_BCC = 6;
|
private static final int CONTACT_PICKER_BCC = 6;
|
||||||
@ -1797,14 +1794,14 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
case CONTACT_PICKER_TO:
|
case CONTACT_PICKER_TO:
|
||||||
case CONTACT_PICKER_CC:
|
case CONTACT_PICKER_CC:
|
||||||
case CONTACT_PICKER_BCC:
|
case CONTACT_PICKER_BCC:
|
||||||
ContactItem contact = mContacts.getEmailFromContactPicker(data);
|
ContactItem contact = mContacts.extractInfoFromContactPickerIntent(data);
|
||||||
if (contact == null) {
|
if (contact == null) {
|
||||||
Toast.makeText(this, getString(R.string.error_contact_address_not_found), Toast.LENGTH_LONG).show();
|
Toast.makeText(this, getString(R.string.error_contact_address_not_found), Toast.LENGTH_LONG).show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (contact.getEmailAddresses().size() > 1) {
|
if (contact.emailAddresses.size() > 1) {
|
||||||
Intent i = new Intent(this, EmailAddressList.class);
|
Intent i = new Intent(this, EmailAddressList.class);
|
||||||
i.putExtra("contact", contact);
|
i.putExtra(EmailAddressList.EXTRA_CONTACT_ITEM, contact);
|
||||||
|
|
||||||
if (requestCode == CONTACT_PICKER_TO) {
|
if (requestCode == CONTACT_PICKER_TO) {
|
||||||
startActivityForResult(i, CONTACT_PICKER_TO2);
|
startActivityForResult(i, CONTACT_PICKER_TO2);
|
||||||
@ -1816,14 +1813,14 @@ public class MessageCompose extends K9Activity implements OnClickListener, OnFoc
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (K9.DEBUG) {
|
if (K9.DEBUG) {
|
||||||
ArrayList<String> emails = contact.getEmailAddresses();
|
List<String> emails = contact.emailAddresses;
|
||||||
for (int i = 0; i < emails.size(); i++) {
|
for (int i = 0; i < emails.size(); i++) {
|
||||||
Log.v(K9.LOG_TAG, "email[" + i + "]: " + emails.get(i));
|
Log.v(K9.LOG_TAG, "email[" + i + "]: " + emails.get(i));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
String email = contact.getEmailAddresses().get(0);
|
String email = contact.emailAddresses.get(0);
|
||||||
if (requestCode == CONTACT_PICKER_TO) {
|
if (requestCode == CONTACT_PICKER_TO) {
|
||||||
addAddress(mToView, new Address(email, ""));
|
addAddress(mToView, new Address(email, ""));
|
||||||
} else if (requestCode == CONTACT_PICKER_CC) {
|
} else if (requestCode == CONTACT_PICKER_CC) {
|
||||||
|
@ -1,24 +1,17 @@
|
|||||||
package com.fsck.k9.helper;
|
package com.fsck.k9.helper;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.ArrayList;
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
public class ContactItem implements Serializable {
|
public class ContactItem implements Serializable {
|
||||||
private static final long serialVersionUID = 4893328130147843375L;
|
private static final long serialVersionUID = 4893328130147843375L;
|
||||||
|
|
||||||
private String displayName = null;
|
public final String displayName;
|
||||||
private ArrayList<String> emailAddresses = null;
|
public final List<String> emailAddresses;
|
||||||
|
|
||||||
public String getDisplayName() {
|
public ContactItem(String displayName, List<String> emailAddresses) {
|
||||||
return displayName;
|
|
||||||
}
|
|
||||||
public void setDisplayName(String displayName) {
|
|
||||||
this.displayName = displayName;
|
this.displayName = displayName;
|
||||||
}
|
this.emailAddresses = Collections.unmodifiableList(emailAddresses);
|
||||||
public ArrayList<String> getEmailAddresses() {
|
|
||||||
return emailAddresses;
|
|
||||||
}
|
|
||||||
public void setEmailAddresses(ArrayList<String> emailAddresses) {
|
|
||||||
this.emailAddresses = emailAddresses;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -175,13 +175,15 @@ public abstract class Contacts {
|
|||||||
public abstract Intent contactPickerIntent();
|
public abstract Intent contactPickerIntent();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a contact picker intent, returns the primary email address of that
|
* Given a contact picker intent, returns a {@code ContactItem} instance for that contact.
|
||||||
* contact.
|
|
||||||
*
|
*
|
||||||
* @param intent The {@link Intent} returned by this contact picker.
|
* @param intent
|
||||||
* @return The primary email address of the picked contact.
|
* The {@link Intent} returned by the contact picker.
|
||||||
|
*
|
||||||
|
* @return A {@link ContactItem} instance describing the picked contact. Or {@code null} if the
|
||||||
|
* contact doesn't have any email addresses.
|
||||||
*/
|
*/
|
||||||
public abstract ContactItem getEmailFromContactPicker(final Intent intent);
|
public abstract ContactItem extractInfoFromContactPickerIntent(final Intent intent);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Does the device actually have a Contacts application suitable for
|
* Does the device actually have a Contacts application suitable for
|
||||||
|
@ -193,45 +193,48 @@ public class ContactsSdk5 extends com.fsck.k9.helper.Contacts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ContactItem getEmailFromContactPicker(final Intent data) {
|
public ContactItem extractInfoFromContactPickerIntent(final Intent data) {
|
||||||
Cursor cursor = null;
|
Cursor cursor = null;
|
||||||
Cursor cursor2 = null;
|
|
||||||
ContactItem item = new ContactItem();
|
|
||||||
ArrayList<String> email = new ArrayList<String>();
|
ArrayList<String> email = new ArrayList<String>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Uri result = data.getData();
|
Uri result = data.getData();
|
||||||
String displayName = null;
|
String displayName = null;
|
||||||
|
|
||||||
cursor = mContentResolver.query(result, null, null, null, null);
|
|
||||||
if (cursor.moveToFirst()) {
|
|
||||||
displayName = cursor.getString(cursor.getColumnIndexOrThrow(ContactsContract.Contacts.DISPLAY_NAME));
|
|
||||||
}
|
|
||||||
// Get the contact id from the Uri
|
// Get the contact id from the Uri
|
||||||
String id = result.getLastPathSegment();
|
String id = result.getLastPathSegment();
|
||||||
cursor2 = mContentResolver.query(Email.CONTENT_URI,
|
|
||||||
null, Email.CONTACT_ID + "=?", new String[] { id },
|
|
||||||
null);
|
|
||||||
|
|
||||||
if (cursor2 != null) {
|
cursor = mContentResolver.query(Email.CONTENT_URI, PROJECTION,
|
||||||
int emailIdx = cursor2.getColumnIndex(Email.DATA);
|
Email.CONTACT_ID + "=?", new String[] { id }, null);
|
||||||
|
|
||||||
while (cursor2.moveToNext()) {
|
if (cursor != null) {
|
||||||
email.add(cursor2.getString(emailIdx));
|
while (cursor.moveToNext()) {
|
||||||
|
String address = cursor.getString(EMAIL_INDEX);
|
||||||
|
if (address != null) {
|
||||||
|
email.add(address);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (displayName == null) {
|
||||||
|
displayName = cursor.getString(NAME_INDEX);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Return 'null' if no email addresses have been found
|
||||||
if (email.size() == 0) {
|
if (email.size() == 0) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
item.setDisplayName(displayName);
|
|
||||||
item.setEmailAddresses(email);
|
// Use the first email address found as display name
|
||||||
return item;
|
if (displayName == null) {
|
||||||
|
displayName = email.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new ContactItem(displayName, email);
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Log.e(K9.LOG_TAG, "Failed to get email data", e);
|
Log.e(K9.LOG_TAG, "Failed to get email data", e);
|
||||||
} finally {
|
} finally {
|
||||||
Utility.closeQuietly(cursor);
|
Utility.closeQuietly(cursor);
|
||||||
Utility.closeQuietly(cursor2);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@ -2794,6 +2794,8 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
text = text.replaceAll("(?m)^On .*wrote.?$", "");
|
text = text.replaceAll("(?m)^On .*wrote.?$", "");
|
||||||
// Remove a more generic quote header from the preview
|
// Remove a more generic quote header from the preview
|
||||||
text = text.replaceAll("(?m)^.*\\w+:$", "");
|
text = text.replaceAll("(?m)^.*\\w+:$", "");
|
||||||
|
// Remove horizontal rules.
|
||||||
|
text = text.replaceAll("\\s*([-=_]{30,}+)\\s*", " ");
|
||||||
|
|
||||||
// URLs in the preview should just be shown as "..." - They're not
|
// URLs in the preview should just be shown as "..." - They're not
|
||||||
// clickable and they usually overwhelm the preview
|
// clickable and they usually overwhelm the preview
|
||||||
@ -2802,6 +2804,9 @@ public class LocalStore extends Store implements Serializable {
|
|||||||
text = text.replaceAll("(\\r|\\n)+", " ");
|
text = text.replaceAll("(\\r|\\n)+", " ");
|
||||||
// Collapse whitespace in the preview
|
// Collapse whitespace in the preview
|
||||||
text = text.replaceAll("\\s+", " ");
|
text = text.replaceAll("\\s+", " ");
|
||||||
|
// Remove any whitespace at the beginning and end of the string.
|
||||||
|
text = text.trim();
|
||||||
|
|
||||||
if (text.length() <= 512) {
|
if (text.length() <= 512) {
|
||||||
return text;
|
return text;
|
||||||
} else {
|
} else {
|
||||||
|
@ -25,6 +25,11 @@ public class AccountSettings {
|
|||||||
Map<String, TreeMap<Integer, SettingsDescription>> s =
|
Map<String, TreeMap<Integer, SettingsDescription>> s =
|
||||||
new LinkedHashMap<String, TreeMap<Integer, SettingsDescription>>();
|
new LinkedHashMap<String, TreeMap<Integer, SettingsDescription>>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When adding new settings here, be sure to increment {@link Settings.VERSION}
|
||||||
|
* and use that for whatever you add here.
|
||||||
|
*/
|
||||||
|
|
||||||
s.put("archiveFolderName", Settings.versions(
|
s.put("archiveFolderName", Settings.versions(
|
||||||
new V(1, new StringSetting("Archive"))
|
new V(1, new StringSetting("Archive"))
|
||||||
));
|
));
|
||||||
|
@ -20,6 +20,11 @@ public class FolderSettings {
|
|||||||
Map<String, TreeMap<Integer, SettingsDescription>> s =
|
Map<String, TreeMap<Integer, SettingsDescription>> s =
|
||||||
new LinkedHashMap<String, TreeMap<Integer, SettingsDescription>>();
|
new LinkedHashMap<String, TreeMap<Integer, SettingsDescription>>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When adding new settings here, be sure to increment {@link Settings.VERSION}
|
||||||
|
* and use that for whatever you add here.
|
||||||
|
*/
|
||||||
|
|
||||||
s.put("displayMode", Settings.versions(
|
s.put("displayMode", Settings.versions(
|
||||||
new V(1, new EnumSetting(FolderClass.class, FolderClass.NO_CLASS))
|
new V(1, new EnumSetting(FolderClass.class, FolderClass.NO_CLASS))
|
||||||
));
|
));
|
||||||
|
@ -26,6 +26,11 @@ public class GlobalSettings {
|
|||||||
Map<String, TreeMap<Integer, SettingsDescription>> s =
|
Map<String, TreeMap<Integer, SettingsDescription>> s =
|
||||||
new LinkedHashMap<String, TreeMap<Integer, SettingsDescription>>();
|
new LinkedHashMap<String, TreeMap<Integer, SettingsDescription>>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When adding new settings here, be sure to increment {@link Settings.VERSION}
|
||||||
|
* and use that for whatever you add here.
|
||||||
|
*/
|
||||||
|
|
||||||
s.put("animations", Settings.versions(
|
s.put("animations", Settings.versions(
|
||||||
new V(1, new BooleanSetting(false))
|
new V(1, new BooleanSetting(false))
|
||||||
));
|
));
|
||||||
|
@ -22,6 +22,11 @@ public class IdentitySettings {
|
|||||||
Map<String, TreeMap<Integer, SettingsDescription>> s =
|
Map<String, TreeMap<Integer, SettingsDescription>> s =
|
||||||
new LinkedHashMap<String, TreeMap<Integer, SettingsDescription>>();
|
new LinkedHashMap<String, TreeMap<Integer, SettingsDescription>>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When adding new settings here, be sure to increment {@link Settings.VERSION}
|
||||||
|
* and use that for whatever you add here.
|
||||||
|
*/
|
||||||
|
|
||||||
s.put("signature", Settings.versions(
|
s.put("signature", Settings.versions(
|
||||||
new V(1, new SignatureSetting())
|
new V(1, new SignatureSetting())
|
||||||
));
|
));
|
||||||
|
Loading…
Reference in New Issue
Block a user