예제 #1
0
 @Override
 public boolean onFired(ActionContext<? extends Application> context) {
   if (context.getApp().checkInternetAvailableAndRequired(context.getActivity())) {
     try {
       final SyncService service = syncServiceProxy.getService();
       if (service != null) {
         doSync(context, service);
       }
     } catch (IllegalStateException ex) {
       cancelSync(context);
     }
   }
   return true;
 }
예제 #2
0
 @Override
 protected void asyncPerform(ActionContext<? extends Application> context) throws Throwable {
   final Application app = context.getApp();
   statistics =
       new StorageStatisticsCollector(
               app.getDbHelper().getReadOnlyDatabase(),
               app.getSettings().getDatabaseStorageProvider(),
               app.getSettings().getContentStorageProvider())
           .getStorageStatistics();
 }
예제 #3
0
 protected void cancelSync(final ActionContext<? extends Application> context) {
   DialogFactory.buildYesNoDialog(
           context.getActivity(),
           R.string.sync_title,
           R.string.sync_cancel_confirmation,
           new DialogInterface.OnClickListener() {
             @Override
             public void onClick(DialogInterface dialogInterface, int i) {
               final SyncService service = context.getApp().getSyncService().getService();
               if (service != null) {
                 service.cancelSync();
               }
             }
           })
       .show();
 }
예제 #4
0
 @Override
 protected void onSuccess(ActionContext<? extends Application> context) {
   if (statistics != null) {
     StorageStatisticsDialogHandler.start(context.getActivity(), statistics);
   }
 }