use of com.xabber.android.data.entity.NestedMap in project xabber-android by redsolution.
the class GroupManager method onLoad.
@Override
public void onLoad() {
final NestedMap<GroupConfiguration> groupConfigurations = new NestedMap<GroupConfiguration>();
Cursor cursor = GroupTable.getInstance().list();
try {
if (cursor.moveToFirst()) {
do {
GroupConfiguration rosterConfiguration = new GroupConfiguration();
rosterConfiguration.setExpanded(GroupTable.isExpanded(cursor));
rosterConfiguration.setShowOfflineMode(GroupTable.getShowOfflineMode(cursor));
groupConfigurations.put(GroupTable.getAccount(cursor), GroupTable.getGroup(cursor), rosterConfiguration);
} while (cursor.moveToNext());
}
} finally {
cursor.close();
}
Application.getInstance().runOnUiThread(new Runnable() {
@Override
public void run() {
onLoaded(groupConfigurations);
}
});
}
use of com.xabber.android.data.entity.NestedMap in project xabber-android by redsolution.
the class ChatManager method onLoad.
@Override
public void onLoad() {
final Set<BaseEntity> privateChats = new HashSet<BaseEntity>();
final NestedMap<Boolean> notifyVisible = new NestedMap<Boolean>();
final NestedMap<ShowMessageTextInNotification> showText = new NestedMap<>();
final NestedMap<Boolean> makeVibro = new NestedMap<Boolean>();
final NestedMap<Uri> sounds = new NestedMap<Uri>();
final NestedMap<Boolean> suppress100 = new NestedMap<Boolean>();
Cursor cursor;
cursor = PrivateChatTable.getInstance().list();
try {
if (cursor.moveToFirst()) {
do {
privateChats.add(new BaseEntity(PrivateChatTable.getAccount(cursor), PrivateChatTable.getUser(cursor)));
} while (cursor.moveToNext());
}
} finally {
cursor.close();
}
cursor = NotifyVisibleTable.getInstance().list();
try {
if (cursor.moveToFirst()) {
do {
notifyVisible.put(NotifyVisibleTable.getAccount(cursor), NotifyVisibleTable.getUser(cursor), NotifyVisibleTable.getValue(cursor));
} while (cursor.moveToNext());
}
} finally {
cursor.close();
}
cursor = ShowTextTable.getInstance().list();
try {
if (cursor.moveToFirst()) {
do {
showText.put(ShowTextTable.getAccount(cursor), ShowTextTable.getUser(cursor), ShowTextTable.getValue(cursor));
} while (cursor.moveToNext());
}
} finally {
cursor.close();
}
cursor = VibroTable.getInstance().list();
try {
if (cursor.moveToFirst()) {
do {
makeVibro.put(VibroTable.getAccount(cursor), VibroTable.getUser(cursor), VibroTable.getValue(cursor));
} while (cursor.moveToNext());
}
} finally {
cursor.close();
}
cursor = SoundTable.getInstance().list();
try {
if (cursor.moveToFirst()) {
do {
sounds.put(SoundTable.getAccount(cursor), SoundTable.getUser(cursor), SoundTable.getValue(cursor));
} while (cursor.moveToNext());
}
} finally {
cursor.close();
}
cursor = Suppress100Table.getInstance().list();
try {
if (cursor.moveToFirst()) {
do {
makeVibro.put(Suppress100Table.getAccount(cursor), Suppress100Table.getUser(cursor), Suppress100Table.getValue(cursor));
} while (cursor.moveToNext());
}
} finally {
cursor.close();
}
Application.getInstance().runOnUiThread(new Runnable() {
@Override
public void run() {
onLoaded(privateChats, notifyVisible, showText, makeVibro, sounds, suppress100);
}
});
}
Aggregations