Пример #1
0
 @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);
             }
           });
 }
Пример #2
0
 @Override
 public void setShowOfflineMode(String account, String group, ShowOfflineMode showOfflineMode) {
   GroupConfiguration configuration = groupConfigurations.get(account, group);
   if (configuration == null) {
     configuration = new GroupConfiguration();
     groupConfigurations.put(account, group, configuration);
   }
   configuration.setShowOfflineMode(showOfflineMode);
   requestToWriteGroup(
       account, group, configuration.isExpanded(), configuration.getShowOfflineMode());
 }
Пример #3
0
 @Override
 public void onAccountRemoved(AccountItem accountItem) {
   groupConfigurations.clear(accountItem.getAccount());
 }
Пример #4
0
 @Override
 public ShowOfflineMode getShowOfflineMode(String account, String group) {
   GroupConfiguration configuration = groupConfigurations.get(account, group);
   if (configuration == null) return ShowOfflineMode.normal;
   return configuration.getShowOfflineMode();
 }
Пример #5
0
 @Override
 public boolean isExpanded(String account, String group) {
   GroupConfiguration configuration = groupConfigurations.get(account, group);
   if (configuration == null) return true;
   return configuration.isExpanded();
 }