Skip to content

Instantly share code, notes, and snippets.

@showsky
Last active December 22, 2015 03:09
Show Gist options
  • Save showsky/6408728 to your computer and use it in GitHub Desktop.
Save showsky/6408728 to your computer and use it in GitHub Desktop.
/*
* NOTICE NETWORK RUN
*/
public void removeUser(int uid) {
Device device = StorageCache.getInstance().getDevice();
int nextUID = -1;
if (Api.getInstance().unbind(device.secretCode, device.did, uid)) {
Logger.d(TAG, "Success remove user: ", String.valueOf(uid));
if (StorageCache.getInstance().getHiatoryUID() == uid) {
if (size() >= 2)
nextUID = StorageCache.getInstance().getUIDLinkedList().getNextUID(uid);
}
StorageCache.getInstance().getUIDLinkedList().remove(new Integer(uid));
StorageCache.getInstance().saveUIDS();
remove(uid);
StorageCache.getInstance().saveData();
} else {
Logger.e(TAG, "Error remove user: ", String.valueOf(uid));
}
// if delete same history uid, then switch user mode
if (nextUID != -1) {
MiiiTV.getInstance().getMessageService().setMenuUID(nextUID);
StorageCache.getInstance().setHistoryUID(nextUID);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment