Esempio n. 1
0
 private void loadItems() {
   loading = true;
   WebRequestBuilder wrb = new WebRequestBuilder(getContext());
   WebRequest wr =
       wrb.getItemsRequest(
           getContext(),
           currentPage,
           PreferenceFacade.getInstance().getItemsPerPage(getContext()));
   assister.runWebRequest(
       new Handler.Callback() {
         @Override
         public boolean handleMessage(Message msg) {
           if (ServiceProcessorMessageUtil.isSuccessful(msg)) {
             Items newItems = ServiceProcessorMessageUtil.getCastedPayLoad(msg);
             adapter.addAll(newItems.getItems());
             currentPage++;
             loading = false;
             return true;
           }
           return false;
         }
       },
       wr,
       new ItemsProcessor());
 }
Esempio n. 2
0
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   if (requestCode == INTENT_REQUESTCODE_IMAGEPICK && resultCode == Activity.RESULT_OK) {
     List<String> paths = data.getStringArrayListExtra(Define.INTENT_PATH);
     WebRequestBuilder wrb = new WebRequestBuilder(getContext());
     assister.runWebRequest(
         new Handler.Callback() {
           @Override
           public boolean handleMessage(Message msg) {
             return false;
           }
         },
         wrb.getNewItemRequest(null, false, paths.toArray(new String[paths.size()])),
         new ItemsProcessor());
   }
 }