mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 00:58:50 -05:00
Code style cleanup
This commit is contained in:
parent
fff94956f4
commit
20ed1ebe61
@ -36,8 +36,8 @@ import com.fsck.k9.mail.Message;
|
||||
import com.fsck.k9.mail.store.StorageManager;
|
||||
import com.fsck.k9.search.LocalSearch;
|
||||
import com.fsck.k9.search.SearchSpecification;
|
||||
import com.fsck.k9.search.SearchSpecification.ATTRIBUTE;
|
||||
import com.fsck.k9.search.SearchSpecification.SEARCHFIELD;
|
||||
import com.fsck.k9.search.SearchSpecification.Attribute;
|
||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchCondition;
|
||||
|
||||
|
||||
@ -134,8 +134,8 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
||||
mSearch.addAllowedFolder(appData.getString(EXTRA_SEARCH_FOLDER));
|
||||
|
||||
String query = intent.getStringExtra(SearchManager.QUERY);
|
||||
mSearch.or(new SearchCondition(SEARCHFIELD.SENDER, ATTRIBUTE.CONTAINS, query));
|
||||
mSearch.or(new SearchCondition(SEARCHFIELD.SUBJECT, ATTRIBUTE.CONTAINS, query));
|
||||
mSearch.or(new SearchCondition(Searchfield.SENDER, Attribute.CONTAINS, query));
|
||||
mSearch.or(new SearchCondition(Searchfield.SUBJECT, Attribute.CONTAINS, query));
|
||||
|
||||
mIsRemote = true;
|
||||
}
|
||||
@ -583,7 +583,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
||||
public void showMoreFromSameSender(String senderAddress) {
|
||||
LocalSearch tmpSearch = new LocalSearch("From " + senderAddress);
|
||||
tmpSearch.addAccountUuids(mSearch.getAccountUuids());
|
||||
tmpSearch.and(SEARCHFIELD.SENDER, senderAddress, ATTRIBUTE.CONTAINS);
|
||||
tmpSearch.and(Searchfield.SENDER, senderAddress, Attribute.CONTAINS);
|
||||
|
||||
MessageListFragment fragment = MessageListFragment.newInstance(tmpSearch, false);
|
||||
|
||||
@ -670,7 +670,7 @@ public class MessageList extends K9FragmentActivity implements MessageListFragme
|
||||
public void showThread(Account account, String folderName, long threadRootId) {
|
||||
LocalSearch tmpSearch = new LocalSearch();
|
||||
tmpSearch.addAccountUuids(mSearch.getAccountUuids());
|
||||
tmpSearch.and(SEARCHFIELD.THREAD_ROOT, String.valueOf(threadRootId), ATTRIBUTE.EQUALS);
|
||||
tmpSearch.and(Searchfield.THREAD_ROOT, String.valueOf(threadRootId), Attribute.EQUALS);
|
||||
|
||||
MessageListFragment fragment = MessageListFragment.newInstance(tmpSearch, false);
|
||||
addMessageListFragment(fragment);
|
||||
|
@ -71,7 +71,7 @@ import com.fsck.k9.mail.store.StorageManager.StorageProvider;
|
||||
import com.fsck.k9.provider.AttachmentProvider;
|
||||
import com.fsck.k9.search.ConditionsTreeNode;
|
||||
import com.fsck.k9.search.LocalSearch;
|
||||
import com.fsck.k9.search.SearchSpecification.SEARCHFIELD;
|
||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
@ -936,7 +936,7 @@ public class LocalStore extends Store implements Serializable {
|
||||
|
||||
// update some references in the search that have to be bound to this one store
|
||||
for (ConditionsTreeNode node : search.getLeafSet()) {
|
||||
if (node.mCondition.field == SEARCHFIELD.FOLDER) {
|
||||
if (node.mCondition.field == Searchfield.FOLDER) {
|
||||
// TODO find better solution
|
||||
if (isFolderId(node.mCondition.value)) {
|
||||
continue;
|
||||
|
@ -9,8 +9,8 @@ import android.database.Cursor;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import com.fsck.k9.search.SearchSpecification.ATTRIBUTE;
|
||||
import com.fsck.k9.search.SearchSpecification.SEARCHFIELD;
|
||||
import com.fsck.k9.search.SearchSpecification.Attribute;
|
||||
import com.fsck.k9.search.SearchSpecification.Searchfield;
|
||||
import com.fsck.k9.search.SearchSpecification.SearchCondition;
|
||||
|
||||
/**
|
||||
@ -19,12 +19,10 @@ import com.fsck.k9.search.SearchSpecification.SearchCondition;
|
||||
*
|
||||
* TODO removing conditions from the tree
|
||||
* TODO implement NOT as a node again
|
||||
*
|
||||
* @author dzan
|
||||
*/
|
||||
public class ConditionsTreeNode implements Parcelable{
|
||||
public class ConditionsTreeNode implements Parcelable {
|
||||
|
||||
public enum OPERATOR {
|
||||
public enum Operator {
|
||||
AND, OR, CONDITION;
|
||||
}
|
||||
|
||||
@ -36,7 +34,7 @@ public class ConditionsTreeNode implements Parcelable{
|
||||
* If mValue isn't CONDITION then mCondition contains a real
|
||||
* condition, otherwise it's null.
|
||||
*/
|
||||
public OPERATOR mValue;
|
||||
public Operator mValue;
|
||||
public SearchCondition mCondition;
|
||||
|
||||
/*
|
||||
@ -71,7 +69,7 @@ public class ConditionsTreeNode implements Parcelable{
|
||||
// other nodes
|
||||
while (cursor.moveToNext()) {
|
||||
tmp = buildNodeFromRow(cursor);
|
||||
if (tmp.mRightMPTTMarker < stack.peek().mRightMPTTMarker ){
|
||||
if (tmp.mRightMPTTMarker < stack.peek().mRightMPTTMarker) {
|
||||
stack.peek().mLeft = tmp;
|
||||
stack.push(tmp);
|
||||
} else {
|
||||
@ -94,11 +92,11 @@ public class ConditionsTreeNode implements Parcelable{
|
||||
ConditionsTreeNode result = null;
|
||||
SearchCondition condition = null;
|
||||
|
||||
OPERATOR tmpValue = ConditionsTreeNode.OPERATOR.valueOf(cursor.getString(5));
|
||||
Operator tmpValue = ConditionsTreeNode.Operator.valueOf(cursor.getString(5));
|
||||
|
||||
if (tmpValue == OPERATOR.CONDITION) {
|
||||
condition = new SearchCondition(SEARCHFIELD.valueOf(cursor.getString(0)),
|
||||
ATTRIBUTE.valueOf(cursor.getString(2)), cursor.getString(1));
|
||||
if (tmpValue == Operator.CONDITION) {
|
||||
condition = new SearchCondition(Searchfield.valueOf(cursor.getString(0)),
|
||||
Attribute.valueOf(cursor.getString(2)), cursor.getString(1));
|
||||
}
|
||||
|
||||
result = new ConditionsTreeNode(condition);
|
||||
@ -116,10 +114,10 @@ public class ConditionsTreeNode implements Parcelable{
|
||||
public ConditionsTreeNode(SearchCondition condition) {
|
||||
mParent = null;
|
||||
mCondition = condition;
|
||||
mValue = OPERATOR.CONDITION;
|
||||
mValue = Operator.CONDITION;
|
||||
}
|
||||
|
||||
public ConditionsTreeNode(ConditionsTreeNode parent, OPERATOR op) {
|
||||
public ConditionsTreeNode(ConditionsTreeNode parent, Operator op) {
|
||||
mParent = parent;
|
||||
mValue = op;
|
||||
mCondition = null;
|
||||
@ -138,7 +136,7 @@ public class ConditionsTreeNode implements Parcelable{
|
||||
* @throws Exception
|
||||
*/
|
||||
public ConditionsTreeNode and(ConditionsTreeNode expr) throws Exception {
|
||||
return add(expr, OPERATOR.AND);
|
||||
return add(expr, Operator.AND);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -168,7 +166,7 @@ public class ConditionsTreeNode implements Parcelable{
|
||||
* @throws Exception
|
||||
*/
|
||||
public ConditionsTreeNode or(ConditionsTreeNode expr) throws Exception {
|
||||
return add(expr, OPERATOR.OR);
|
||||
return add(expr, Operator.OR);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -244,10 +242,17 @@ public class ConditionsTreeNode implements Parcelable{
|
||||
Stack<ConditionsTreeNode> stack = new Stack<ConditionsTreeNode>();
|
||||
stack.push(this);
|
||||
|
||||
while(!stack.isEmpty()) {
|
||||
ConditionsTreeNode current = stack.pop( );
|
||||
if( current.mLeft != null ) stack.push( current.mLeft );
|
||||
if( current.mRight != null ) stack.push( current.mRight );
|
||||
while (!stack.isEmpty()) {
|
||||
ConditionsTreeNode current = stack.pop();
|
||||
|
||||
if (current.mLeft != null) {
|
||||
stack.push(current.mLeft);
|
||||
}
|
||||
|
||||
if (current.mRight != null) {
|
||||
stack.push(current.mRight);
|
||||
}
|
||||
|
||||
result.add(current);
|
||||
}
|
||||
|
||||
@ -273,7 +278,7 @@ public class ConditionsTreeNode implements Parcelable{
|
||||
* @return New parent node, containing the operator.
|
||||
* @throws Exception Throws when the provided new node does not have a null parent.
|
||||
*/
|
||||
private ConditionsTreeNode add(ConditionsTreeNode node, OPERATOR op) throws Exception{
|
||||
private ConditionsTreeNode add(ConditionsTreeNode node, Operator op) throws Exception {
|
||||
if (node.mParent != null) {
|
||||
throw new Exception("Can only add new expressions from root node down.");
|
||||
}
|
||||
@ -285,8 +290,8 @@ public class ConditionsTreeNode implements Parcelable{
|
||||
if (mParent != null) {
|
||||
mParent.updateChild(this, tmpNode);
|
||||
}
|
||||
this.mParent = tmpNode;
|
||||
|
||||
this.mParent = tmpNode;
|
||||
node.mParent = tmpNode;
|
||||
|
||||
return tmpNode;
|
||||
@ -317,21 +322,21 @@ public class ConditionsTreeNode implements Parcelable{
|
||||
* @return Set of leaves being completed.
|
||||
*/
|
||||
private HashSet<ConditionsTreeNode> getLeafSet(HashSet<ConditionsTreeNode> leafSet) {
|
||||
// if we ended up in a leaf, add ourself and return
|
||||
if (mLeft == null && mRight == null) {
|
||||
// if we ended up in a leaf, add ourself and return
|
||||
leafSet.add(this);
|
||||
return leafSet;
|
||||
// we didn't end up in a leaf
|
||||
} else {
|
||||
if (mLeft != null) {
|
||||
mLeft.getLeafSet(leafSet);
|
||||
}
|
||||
|
||||
if (mRight != null) {
|
||||
mRight.getLeafSet(leafSet);
|
||||
}
|
||||
return leafSet;
|
||||
}
|
||||
|
||||
// we didn't end up in a leaf
|
||||
if (mLeft != null) {
|
||||
mLeft.getLeafSet(leafSet);
|
||||
}
|
||||
|
||||
if (mRight != null) {
|
||||
mRight.getLeafSet(leafSet);
|
||||
}
|
||||
return leafSet;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -343,12 +348,15 @@ public class ConditionsTreeNode implements Parcelable{
|
||||
*/
|
||||
private int applyMPTTLabel(int label) {
|
||||
mLeftMPTTMarker = label;
|
||||
if (mLeft != null){
|
||||
|
||||
if (mLeft != null) {
|
||||
label = mLeft.applyMPTTLabel(label += 1);
|
||||
}
|
||||
if (mRight != null){
|
||||
|
||||
if (mRight != null) {
|
||||
label = mRight.applyMPTTLabel(label += 1);
|
||||
}
|
||||
|
||||
++label;
|
||||
mRightMPTTMarker = label;
|
||||
return label;
|
||||
@ -374,26 +382,31 @@ public class ConditionsTreeNode implements Parcelable{
|
||||
dest.writeParcelable(mRight, flags);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<ConditionsTreeNode> CREATOR
|
||||
= new Parcelable.Creator<ConditionsTreeNode>() {
|
||||
public static final Parcelable.Creator<ConditionsTreeNode> CREATOR =
|
||||
new Parcelable.Creator<ConditionsTreeNode>() {
|
||||
|
||||
@Override
|
||||
public ConditionsTreeNode createFromParcel(Parcel in) {
|
||||
return new ConditionsTreeNode(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ConditionsTreeNode[] newArray(int size) {
|
||||
return new ConditionsTreeNode[size];
|
||||
}
|
||||
};
|
||||
|
||||
private ConditionsTreeNode(Parcel in) {
|
||||
mValue = OPERATOR.values()[in.readInt()];
|
||||
mValue = Operator.values()[in.readInt()];
|
||||
mCondition = in.readParcelable(ConditionsTreeNode.class.getClassLoader());
|
||||
mLeft = in.readParcelable(ConditionsTreeNode.class.getClassLoader());
|
||||
mRight = in.readParcelable(ConditionsTreeNode.class.getClassLoader());
|
||||
mParent = null;
|
||||
|
||||
if (mLeft != null) {
|
||||
mLeft.mParent = this;
|
||||
}
|
||||
|
||||
if (mRight != null) {
|
||||
mRight.mParent = this;
|
||||
}
|
||||
|
@ -12,12 +12,10 @@ import com.fsck.k9.mail.Flag;
|
||||
|
||||
/**
|
||||
* This class represents a local search.
|
||||
|
||||
*
|
||||
* Removing conditions could be done through matching there unique id in the leafset and then
|
||||
* removing them from the tree.
|
||||
*
|
||||
* @author dzan
|
||||
*
|
||||
* TODO implement a complete addAllowedFolder method
|
||||
* TODO conflicting conditions check on add
|
||||
* TODO duplicate condition checking?
|
||||
@ -43,7 +41,7 @@ public class LocalSearch implements SearchSpecification {
|
||||
* Use this only if the search won't be saved. Saved searches need
|
||||
* a name!
|
||||
*/
|
||||
public LocalSearch(){}
|
||||
public LocalSearch() {}
|
||||
|
||||
/**
|
||||
*
|
||||
@ -141,7 +139,7 @@ public class LocalSearch implements SearchSpecification {
|
||||
*
|
||||
* @throws IllegalConditionException
|
||||
*/
|
||||
public void and(SEARCHFIELD field, String value, ATTRIBUTE attribute) {
|
||||
public void and(Searchfield field, String value, Attribute attribute) {
|
||||
and(new SearchCondition(field, attribute, value));
|
||||
}
|
||||
|
||||
@ -226,7 +224,7 @@ public class LocalSearch implements SearchSpecification {
|
||||
public void allRequiredFlags(Flag[] requiredFlags) {
|
||||
if (requiredFlags != null) {
|
||||
for (Flag f : requiredFlags) {
|
||||
and(new SearchCondition(SEARCHFIELD.FLAG, ATTRIBUTE.CONTAINS, f.name()));
|
||||
and(new SearchCondition(Searchfield.FLAG, Attribute.CONTAINS, f.name()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -240,7 +238,7 @@ public class LocalSearch implements SearchSpecification {
|
||||
public void allForbiddenFlags(Flag[] forbiddenFlags) {
|
||||
if (forbiddenFlags != null) {
|
||||
for (Flag f : forbiddenFlags) {
|
||||
and(new SearchCondition(SEARCHFIELD.FLAG, ATTRIBUTE.NOT_CONTAINS, f.name()));
|
||||
and(new SearchCondition(Searchfield.FLAG, Attribute.NOT_CONTAINS, f.name()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -261,7 +259,7 @@ public class LocalSearch implements SearchSpecification {
|
||||
* - do and on root of it & rest of search
|
||||
* - do or between folder nodes
|
||||
*/
|
||||
mConditions = and(new SearchCondition(SEARCHFIELD.FOLDER, ATTRIBUTE.EQUALS, name));
|
||||
mConditions = and(new SearchCondition(Searchfield.FOLDER, Attribute.EQUALS, name));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -272,8 +270,8 @@ public class LocalSearch implements SearchSpecification {
|
||||
public List<String> getFolderNames() {
|
||||
ArrayList<String> results = new ArrayList<String>();
|
||||
for (ConditionsTreeNode node : mLeafSet) {
|
||||
if (node.mCondition.field == SEARCHFIELD.FOLDER
|
||||
&& node.mCondition.attribute == ATTRIBUTE.EQUALS) {
|
||||
if (node.mCondition.field == Searchfield.FOLDER &&
|
||||
node.mCondition.attribute == Attribute.EQUALS) {
|
||||
results.add(node.mCondition.value);
|
||||
}
|
||||
}
|
||||
@ -298,8 +296,8 @@ public class LocalSearch implements SearchSpecification {
|
||||
*/
|
||||
public String getRemoteSearchArguments() {
|
||||
for (ConditionsTreeNode node : getLeafSet()) {
|
||||
if (node.getCondition().field == SEARCHFIELD.SUBJECT
|
||||
|| node.getCondition().field == SEARCHFIELD.SENDER ) {
|
||||
if (node.getCondition().field == Searchfield.SUBJECT ||
|
||||
node.getCondition().field == Searchfield.SENDER ) {
|
||||
return node.getCondition().value;
|
||||
}
|
||||
}
|
||||
@ -311,8 +309,9 @@ public class LocalSearch implements SearchSpecification {
|
||||
*
|
||||
* @return Name of the search.
|
||||
*/
|
||||
@Override
|
||||
public String getName() {
|
||||
return (mName == null ? "" : mName);
|
||||
return (mName == null) ? "" : mName;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -333,7 +332,7 @@ public class LocalSearch implements SearchSpecification {
|
||||
@Override
|
||||
public String[] getAccountUuids() {
|
||||
if (mAccountUuids.size() == 0) {
|
||||
return new String[] {SearchSpecification.ALL_ACCOUNTS};
|
||||
return new String[] { SearchSpecification.ALL_ACCOUNTS };
|
||||
}
|
||||
|
||||
String[] tmp = new String[mAccountUuids.size()];
|
||||
@ -367,12 +366,15 @@ public class LocalSearch implements SearchSpecification {
|
||||
dest.writeParcelable(mConditions, flags);
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<LocalSearch> CREATOR
|
||||
= new Parcelable.Creator<LocalSearch>() {
|
||||
public static final Parcelable.Creator<LocalSearch> CREATOR =
|
||||
new Parcelable.Creator<LocalSearch>() {
|
||||
|
||||
@Override
|
||||
public LocalSearch createFromParcel(Parcel in) {
|
||||
return new LocalSearch(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public LocalSearch[] newArray(int size) {
|
||||
return new LocalSearch[size];
|
||||
}
|
||||
@ -380,7 +382,7 @@ public class LocalSearch implements SearchSpecification {
|
||||
|
||||
public LocalSearch(Parcel in) {
|
||||
mName = in.readString();
|
||||
mPredefined = in.readByte() == 1;
|
||||
mPredefined = (in.readByte() == 1);
|
||||
mAccountUuids.addAll(in.createStringArrayList());
|
||||
mConditions = in.readParcelable(LocalSearch.class.getClassLoader());
|
||||
mLeafSet = mConditions.getLeafSet();
|
||||
|
@ -31,19 +31,21 @@ public class SearchAccount implements BaseAccount {
|
||||
context.getString(R.string.integrated_inbox_detail));
|
||||
}
|
||||
|
||||
private String mEmail = null;
|
||||
private String mDescription = null;
|
||||
private LocalSearch mSearch = null;
|
||||
private String mFakeUuid = null;
|
||||
private String mEmail;
|
||||
private String mDescription;
|
||||
private LocalSearch mSearch;
|
||||
private String mFakeUuid;
|
||||
|
||||
public SearchAccount(LocalSearch search, String description, String email)
|
||||
throws IllegalArgumentException {
|
||||
|
||||
public SearchAccount(LocalSearch search, String description, String email) throws IllegalArgumentException{
|
||||
if (search == null) {
|
||||
throw new IllegalArgumentException("Provided LocalSearch was null");
|
||||
}
|
||||
|
||||
this.mSearch = search;
|
||||
this.mDescription = description;
|
||||
this.mEmail = email;
|
||||
mSearch = search;
|
||||
mDescription = description;
|
||||
mEmail = email;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -70,7 +72,6 @@ public class SearchAccount implements BaseAccount {
|
||||
return mSearch;
|
||||
}
|
||||
|
||||
@Override
|
||||
/*
|
||||
* This will only be used when accessed as an Account. If that
|
||||
* is the case we don't want to return the uuid of a real account since
|
||||
@ -78,8 +79,9 @@ public class SearchAccount implements BaseAccount {
|
||||
* a Search then methods from LocalSearch will be called which do handle
|
||||
* things nice.
|
||||
*/
|
||||
@Override
|
||||
public String getUuid() {
|
||||
if (mFakeUuid == null){
|
||||
if (mFakeUuid == null) {
|
||||
mFakeUuid = UUID.randomUUID().toString();
|
||||
}
|
||||
return mFakeUuid;
|
||||
|
@ -7,8 +7,8 @@ import com.fsck.k9.mail.Flag;
|
||||
* This enum represents filtering parameters used by {@link com.fsck.k9.search.SearchAccount}.
|
||||
*/
|
||||
public enum SearchModifier {
|
||||
FLAGGED(R.string.flagged_modifier, new Flag[]{Flag.FLAGGED}, null),
|
||||
UNREAD(R.string.unread_modifier, null, new Flag[]{Flag.SEEN});
|
||||
FLAGGED(R.string.flagged_modifier, new Flag[] { Flag.FLAGGED }, null),
|
||||
UNREAD(R.string.unread_modifier, null, new Flag[] { Flag.SEEN });
|
||||
|
||||
public final int resId;
|
||||
public final Flag[] requiredFlags;
|
||||
|
@ -34,13 +34,13 @@ public interface SearchSpecification extends Parcelable {
|
||||
///////////////////////////////////////////////////////////////
|
||||
// ATTRIBUTE enum
|
||||
///////////////////////////////////////////////////////////////
|
||||
public enum ATTRIBUTE {
|
||||
public enum Attribute {
|
||||
CONTAINS(false), EQUALS(false), STARTSWITH(false), ENDSWITH(false),
|
||||
NOT_CONTAINS(true), NOT_EQUALS(true), NOT_STARTSWITH(true), NOT_ENDSWITH(true);
|
||||
|
||||
private boolean mNegation;
|
||||
|
||||
private ATTRIBUTE(boolean negation) {
|
||||
private Attribute(boolean negation) {
|
||||
this.mNegation = negation;
|
||||
}
|
||||
|
||||
@ -69,7 +69,7 @@ public interface SearchSpecification extends Parcelable {
|
||||
|
||||
return (mNegation ? " NOT LIKE " : " LIKE ") + queryPart;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////
|
||||
// SEARCHFIELD enum
|
||||
@ -86,7 +86,7 @@ public interface SearchSpecification extends Parcelable {
|
||||
* preview, mime_type
|
||||
*
|
||||
*/
|
||||
public enum SEARCHFIELD {
|
||||
public enum Searchfield {
|
||||
SUBJECT("subject"), DATE("date"), UID("uid"), FLAG("flags"),
|
||||
SENDER("sender_list"), TO("to_list"), CC("cc_list"), FOLDER("folder_id"),
|
||||
BCC("bcc_list"), REPLY_TO("reply_to_list"), MESSAGE("text_content"),
|
||||
@ -94,7 +94,7 @@ public interface SearchSpecification extends Parcelable {
|
||||
|
||||
private String dbName;
|
||||
|
||||
private SEARCHFIELD(String dbName) {
|
||||
private Searchfield(String dbName) {
|
||||
this.dbName = dbName;
|
||||
}
|
||||
|
||||
@ -116,12 +116,12 @@ public interface SearchSpecification extends Parcelable {
|
||||
*
|
||||
* @author dzan
|
||||
*/
|
||||
public class SearchCondition implements Parcelable{
|
||||
public class SearchCondition implements Parcelable {
|
||||
public String value;
|
||||
public ATTRIBUTE attribute;
|
||||
public SEARCHFIELD field;
|
||||
public Attribute attribute;
|
||||
public Searchfield field;
|
||||
|
||||
public SearchCondition(SEARCHFIELD field, ATTRIBUTE attribute, String value) {
|
||||
public SearchCondition(Searchfield field, Attribute attribute, String value) {
|
||||
this.value = value;
|
||||
this.attribute = attribute;
|
||||
this.field = field;
|
||||
@ -129,8 +129,8 @@ public interface SearchSpecification extends Parcelable {
|
||||
|
||||
private SearchCondition(Parcel in) {
|
||||
this.value = in.readString();
|
||||
this.attribute = ATTRIBUTE.values()[in.readInt()];
|
||||
this.field = SEARCHFIELD.values()[in.readInt()];
|
||||
this.attribute = Attribute.values()[in.readInt()];
|
||||
this.field = Searchfield.values()[in.readInt()];
|
||||
}
|
||||
|
||||
public String toHumanString() {
|
||||
@ -146,16 +146,14 @@ public interface SearchSpecification extends Parcelable {
|
||||
public boolean equals(Object o) {
|
||||
if (o instanceof SearchCondition) {
|
||||
SearchCondition tmp = (SearchCondition) o;
|
||||
if (tmp.attribute == attribute
|
||||
&& tmp.value.equals(value)
|
||||
&& tmp.field == field) {
|
||||
if (tmp.attribute == attribute &&
|
||||
tmp.field == field &&
|
||||
tmp.value.equals(value)) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -170,12 +168,15 @@ public interface SearchSpecification extends Parcelable {
|
||||
dest.writeInt(field.ordinal());
|
||||
}
|
||||
|
||||
public static final Parcelable.Creator<SearchCondition> CREATOR
|
||||
= new Parcelable.Creator<SearchCondition>() {
|
||||
public static final Parcelable.Creator<SearchCondition> CREATOR =
|
||||
new Parcelable.Creator<SearchCondition>() {
|
||||
|
||||
@Override
|
||||
public SearchCondition createFromParcel(Parcel in) {
|
||||
return new SearchCondition(in);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SearchCondition[] newArray(int size) {
|
||||
return new SearchCondition[size];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user