本文整理汇总了Java中com.soomla.data.KeyValueStorage.setValue方法的典型用法代码示例。如果您正苦于以下问题:Java KeyValueStorage.setValue方法的具体用法?Java KeyValueStorage.setValue怎么用?Java KeyValueStorage.setValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.soomla.data.KeyValueStorage
的用法示例。
在下文中一共展示了KeyValueStorage.setValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gotOAuthAccessToken
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
/**
* Called when OAuth authentication has been finalized and an Access
* Token and Access Token Secret have been provided
*
* @param accessToken The access token to use to do REST calls
*/
@Override
public void gotOAuthAccessToken(AccessToken accessToken) {
SoomlaUtils.LogDebug(TAG, "login/onComplete");
twitter.setOAuthAccessToken(accessToken);
// Keep in storage for logging in without web-authentication
KeyValueStorage.setValue(getTwitterStorageKey(TWITTER_OAUTH_TOKEN), accessToken.getToken());
KeyValueStorage.setValue(getTwitterStorageKey(TWITTER_OAUTH_SECRET), accessToken.getTokenSecret());
// Keep screen name since Twitter4J does not have it when
// logging in using authenticated tokens
KeyValueStorage.setValue(getTwitterStorageKey(TWITTER_SCREEN_NAME), accessToken.getScreenName());
twitterScreenName = accessToken.getScreenName();
RefLoginListener.success(RefProvider);
clearListener(ACTION_LOGIN);
}
示例2: setOpen
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
public static void setOpen(String gateId, boolean open, boolean notify) {
String key = keyGateOpen(gateId);
if (open) {
KeyValueStorage.setValue(key, "yes");
if (notify) {
BusProvider.getInstance().post(new GateOpenedEvent(gateId));
}
} else {
KeyValueStorage.deleteKeyValue(key);
if (notify) {
BusProvider.getInstance().post(new GateClosedEvent(gateId));
}
}
}
示例3: setCompleted
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
public static void setCompleted(String missionId, boolean completed, boolean notify) {
int total = getTimesCompleted(missionId) + (completed ? 1 : -1);
if (total < 0) {
total = 0;
}
String key = keyMissionTimesCompleted(missionId);
KeyValueStorage.setValue(key, String.valueOf(total));
if (notify) {
if (completed) {
BusProvider.getInstance().post(new MissionCompletedEvent(missionId));
} else {
BusProvider.getInstance().post(new MissionCompletionRevokedEvent(missionId));
}
}
}
示例4: setUserProfile
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
/**
* Persists the given user profile to the device storage, and adds the
* ability to suppress related events
*
* @param userProfile the user profile to save
* @param notify should an event regarding the save be fired
*/
public static void setUserProfile(UserProfile userProfile, boolean notify) {
String userProfileJSON = userProfile.toJSONObject().toString();
String key = keyUserProfile(userProfile.getProvider());
KeyValueStorage.setValue(key, userProfileJSON);
if (notify) {
BusProvider.getInstance().post(new UserProfileUpdatedEvent(userProfile));
}
}
示例5: setLoggedInForProvider
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
private void setLoggedInForProvider(IProvider.Provider provider, boolean value) {
String key = getLoggedInStorageKeyForProvider(provider);
if (value) {
KeyValueStorage.setValue(key, "true");
} else {
KeyValueStorage.deleteKeyValue(key);
}
}
示例6: configVerifyPurchases
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
@Override
public void configVerifyPurchases(Map<String, Object> config) {
KeyValueStorage.deleteKeyValue(VERIFY_PURCHASES_KEY);
KeyValueStorage.deleteKeyValue(VERIFY_CLIENT_ID_KEY);
KeyValueStorage.deleteKeyValue(VERIFY_CLIENT_SECRET_KEY);
KeyValueStorage.deleteKeyValue(VERIFY_REFRESH_TOKEN_KEY);
if (config != null) {
try {
checkStringConfigItem(config, "clientId");
checkStringConfigItem(config, "clientSecret");
checkStringConfigItem(config, "refreshToken");
} catch (IllegalArgumentException e) {
SoomlaUtils.LogError(TAG, e.getMessage());
return;
}
Boolean verifyOnServerFailure = (Boolean) config.get("verifyOnServerFailure");
if (verifyOnServerFailure == null) {
verifyOnServerFailure = false;
}
KeyValueStorage.setValue(VERIFY_CLIENT_ID_KEY, (String) config.get("clientId"));
KeyValueStorage.setValue(VERIFY_CLIENT_SECRET_KEY, (String) config.get("clientSecret"));
KeyValueStorage.setValue(VERIFY_REFRESH_TOKEN_KEY, (String) config.get("refreshToken"));
KeyValueStorage.setValue(VERIFY_ON_SERVER_FAILURE, verifyOnServerFailure.toString());
KeyValueStorage.setValue(VERIFY_PURCHASES_KEY, "yes");
}
}
示例7: setLatestScore
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
public static void setLatestScore(String scoreId, double latest, boolean notify) {
String key = keyLatestScore(scoreId);
String val = String.valueOf(latest);
KeyValueStorage.setValue(key, val);
if (notify) {
BusProvider.getInstance().post(new LatestScoreChangedEvent(scoreId));
}
}
示例8: setRecordScore
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
/**
* Sets a new record for the given score.
*
* @param scoreId the id of the score who's record to change
* @param record the new record value
*/
public static void setRecordScore(String scoreId, double record, boolean notify) {
String key = keyRecordScore(scoreId);
String val = String.valueOf(record);
KeyValueStorage.setValue(key, val);
if (notify) {
BusProvider.getInstance().post(new ScoreRecordChangedEvent(scoreId));
}
}
示例9: setCompleted
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
public static void setCompleted(String worldId, boolean completed, boolean notify) {
String key = keyWorldCompleted(worldId);
if (completed) {
KeyValueStorage.setValue(key, "yes");
if (notify) {
BusProvider.getInstance().post(new WorldCompletedEvent(worldId));
}
} else {
KeyValueStorage.deleteKeyValue(key);
}
}
示例10: setReward
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
public static void setReward(String worldId, String rewardId, boolean notify) {
String key = keyReward(worldId);
if (!TextUtils.isEmpty(rewardId)) {
KeyValueStorage.setValue(key, rewardId);
} else {
KeyValueStorage.deleteKeyValue(key);
}
if (notify) {
// Notify world was assigned a reward
BusProvider.getInstance().post(new WorldAssignedRewardEvent(worldId));
}
}
示例11: setLastCompletedInnerWorld
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
public static void setLastCompletedInnerWorld(String worldId, String innerWorldId, boolean notify) {
String key = keyLastCompletedInnerWorld(worldId);
if (!TextUtils.isEmpty(innerWorldId)) {
KeyValueStorage.setValue(key, innerWorldId);
} else {
KeyValueStorage.deleteKeyValue(key);
}
if (notify) {
// Notify world had inner level complete
BusProvider.getInstance().post(new LastCompletedInnerWorldChanged(worldId, innerWorldId));
}
}
示例12: setLastDurationMillis
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
/**
* Level Duration *
*/
public static void setLastDurationMillis(String levelId, long duration) {
String key = keyLastDuration(levelId);
String val = String.valueOf(duration);
KeyValueStorage.setValue(key, val);
}
示例13: setAccessToken
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
public void setAccessToken(String token) {
KeyValueStorage.setValue(VERIFY_ACCESS_TOKEN_KEY, token);
}
示例14: setTimesCompleted
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
public static void setTimesCompleted(String missionId, int timesCompleted) {
String key = keyMissionTimesCompleted(missionId);
KeyValueStorage.setValue(key, String.valueOf(timesCompleted));
}
示例15: setSlowestDurationMillis
import com.soomla.data.KeyValueStorage; //导入方法依赖的package包/类
public static void setSlowestDurationMillis(String levelId, long duration) {
String key = keySlowestDuration(levelId);
String val = String.valueOf(duration);
KeyValueStorage.setValue(key, val);
}