mirror of
https://github.com/moparisthebest/k-9
synced 2024-12-25 00:58: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;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.fsck.k9.BaseAccount;
|
||||
@ -43,7 +41,6 @@ public class SearchAccount implements BaseAccount {
|
||||
private String mEmail;
|
||||
private String mDescription;
|
||||
private LocalSearch mSearch;
|
||||
private String mFakeUuid;
|
||||
|
||||
public SearchAccount(String id, LocalSearch search, String description, String email)
|
||||
throws IllegalArgumentException {
|
||||
@ -86,18 +83,18 @@ public class SearchAccount implements BaseAccount {
|
||||
return mSearch;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
* this is posing as a fake meta-account. If this object is accesed as
|
||||
* a Search then methods from LocalSearch will be called which do handle
|
||||
* things nice.
|
||||
/**
|
||||
* Returns the ID of this {@code SearchAccount} instance.
|
||||
*
|
||||
* <p>
|
||||
* This isn't really a UUID. But since we don't expose this value to other apps and we only
|
||||
* 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
|
||||
public String getUuid() {
|
||||
if (mFakeUuid == null) {
|
||||
mFakeUuid = UUID.randomUUID().toString();
|
||||
}
|
||||
return mFakeUuid;
|
||||
return mId;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user