mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-26 01:28:50 -05:00
Use constant "UUID" for search accounts
This way we can match the account stats to the search accounts when the Accounts activity is restarted.
This commit is contained in:
parent
4ccb1c952a
commit
cf390861d6
@ -1,7 +1,5 @@
|
|||||||
package com.fsck.k9.search;
|
package com.fsck.k9.search;
|
||||||
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
|
||||||
import com.fsck.k9.BaseAccount;
|
import com.fsck.k9.BaseAccount;
|
||||||
@ -43,7 +41,6 @@ public class SearchAccount implements BaseAccount {
|
|||||||
private String mEmail;
|
private String mEmail;
|
||||||
private String mDescription;
|
private String mDescription;
|
||||||
private LocalSearch mSearch;
|
private LocalSearch mSearch;
|
||||||
private String mFakeUuid;
|
|
||||||
|
|
||||||
public SearchAccount(String id, LocalSearch search, String description, String email)
|
public SearchAccount(String id, LocalSearch search, String description, String email)
|
||||||
throws IllegalArgumentException {
|
throws IllegalArgumentException {
|
||||||
@ -86,18 +83,18 @@ public class SearchAccount implements BaseAccount {
|
|||||||
return mSearch;
|
return mSearch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* This will only be used when accessed as an Account. If that
|
* Returns the ID of this {@code SearchAccount} instance.
|
||||||
* is the case we don't want to return the uuid of a real account since
|
*
|
||||||
* this is posing as a fake meta-account. If this object is accesed as
|
* <p>
|
||||||
* a Search then methods from LocalSearch will be called which do handle
|
* This isn't really a UUID. But since we don't expose this value to other apps and we only
|
||||||
* things nice.
|
* use the account UUID as opaque string (e.g. as key in a {@code Map}) we're fine.<br>
|
||||||
|
* Using a constant string is necessary to identify the same search account even when the
|
||||||
|
* corresponding {@link SearchAccount} object has been recreated.
|
||||||
|
* </p>
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String getUuid() {
|
public String getUuid() {
|
||||||
if (mFakeUuid == null) {
|
return mId;
|
||||||
mFakeUuid = UUID.randomUUID().toString();
|
|
||||||
}
|
|
||||||
return mFakeUuid;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user