Ejemplo n.º 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);
             }
           });
 }
Ejemplo n.º 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());
 }
Ejemplo n.º 3
0
 @Override
 public void onAccountRemoved(AccountItem accountItem) {
   groupConfigurations.clear(accountItem.getAccount());
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 5
0
 @Override
 public boolean isExpanded(String account, String group) {
   GroupConfiguration configuration = groupConfigurations.get(account, group);
   if (configuration == null) return true;
   return configuration.isExpanded();
 }