Ejemplo n.º 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;
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 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();
 }
Ejemplo n.º 4
0
 @Override
 protected void onSuccess(ActionContext<? extends Application> context) {
   if (statistics != null) {
     StorageStatisticsDialogHandler.start(context.getActivity(), statistics);
   }
 }