コード例 #1
0
 @Override
 public void call(String type) {
   switch (type) {
     case Type.Request:
       launchAlarm();
       try {
         Request request = getRequest();
         saveRequest(request);
         publishRequestUpdate(request);
         launchActivityWithRequest(MainActivity.class, MainActivity.EXTRA_REQUEST, request);
       } catch (Exception e) {
         e.printStackTrace();
       }
       break;
     case Type.Incoming:
     case Type.Quoting:
     case Type.QuoteAccepted:
     case Type.Working:
     case Type.Rating:
     case Type.Finished:
     case Type.Cancelled:
     case Type.Rejected:
     case Type.Failed:
       try {
         Job job = getJob();
         saveJob(job);
         publishJobUpdate(job);
         launchActivityWithJob(MainActivity.class, MainActivity.EXTRA_JOB, job);
       } catch (Exception e) {
         e.printStackTrace();
       }
       break;
     case Type.Location:
       try {
         Job job = mLab.getJob();
         job.setLastLocation(getLocation());
         saveJob(job);
       } catch (Exception e) {
         e.printStackTrace();
       }
       break;
     case Type.Request_Cancelled:
       stopAlarm();
       deleteRequest();
       publishRequestUpdate(null);
       break;
   }
 }
コード例 #2
0
 protected void saveRequest(Request request) {
   mLab.setRequest(request).saveRequest();
 }
コード例 #3
0
 protected void deleteRequest() {
   mLab.deleteRequest();
 }
コード例 #4
0
 protected void saveJob(Job job) {
   mLab.setJob(job).saveJob();
 }