Пример #1
0
 @Override
 public void run() {
   if (ContextCompat.checkSelfPermission(context, Manifest.permission.INTERNET)
       == PackageManager.PERMISSION_GRANTED) {
     new PatisCloudDataSource(context)
         .loadPatis(
             new DatasourceCallback<List<Acte>>() {
               @Override
               public void onLoad(final List<Acte> result) {
                 postExecutionThread.post(
                     new Runnable() {
                       @Override
                       public void run() {
                         callback.onCallback(result);
                       }
                     });
               }
             });
   } else {
     postExecutionThread.post(
         new Runnable() {
           @Override
           public void run() {
             callback.onCallback(new ArrayList<Acte>());
           }
         });
   }
 }
Пример #2
0
 public PatisRepositoryImpl(Context context) {
   this.context = context;
   threadExecutor = JobExecutor.getInstance();
   postExecutionThread = UIThread.getInstance();
 }