コード例 #1
0
  private void getImage() {
    ArrayList<String> listImage = new ArrayList<String>();
    String name = CREATURE.getEnumNameForValue(mCreature.getKingdom());
    listImage.add(String.format(ServerConfig.IMAGE_PATH, name, mCreature.getImageId()));
    listImage.add(String.format(ServerConfig.IMAGE_PATH, name, mCreature.getImageId() + "s"));
    listImage.add(String.format(ServerConfig.IMAGE_PATH, name, mCreature.getImageId() + "_1s"));
    listImage.add(String.format(ServerConfig.IMAGE_PATH, name, mCreature.getImageId() + "_2s"));
    listImage.add(String.format(ServerConfig.IMAGE_PATH, name, mCreature.getImageId() + "_3s"));
    HrmService service = new HrmService();
    service.setCallback(
        new CheckUrlCallback() {

          @Override
          public void onSuccess(boolean result) {}

          @Override
          public void onImagesVerify(ArrayList<String> listImages) {
            mCreature.setCreatureImages(listImages);
            final GalleryImageAdapter adapter =
                new GalleryImageAdapter(CreatureActivity.this, mCreature);
            adapter.setListImages((ArrayList<String>) listImages.clone());
            mCreatureDescriptionViewModel.galleryImage.setAdapter(adapter);
            mCreatureDescriptionViewModel.galleryImage.setOnItemClickListener(
                new OnItemClickListener() {

                  @Override
                  public void onItemClick(AdapterView<?> view, View v, int pos, long id) {
                    Intent intent = new Intent();
                    intent.setClass(CreatureActivity.this, ImageViewFlipperActivity.class);
                    Bundle bundle = new Bundle();
                    bundle.putStringArrayList(
                        Common.CREATURE_URL_IMAGES_LIST, adapter.getListImages());
                    bundle.putInt(Common.CREATURE_URL_IMAGES_POSITION, pos);
                    intent.putExtras(bundle);

                    startActivity(intent);
                  }
                });
          }

          @Override
          public void onError() {}
        });
    service.requestVerifyImages(listImage);
    /*
     * mCreature.setCreatureImages(listImage); final GalleryImageAdapter
     * adapter = new GalleryImageAdapter(this, mCreature);
     * adapter.setListImages((ArrayList<String>) listImage.clone());
     * mCreatureDescriptionViewModel.galleryImage.setAdapter(adapter);
     */

  }
コード例 #2
0
  private void initList() {
    String userId = pref.getString(Common.USER_ID, null);
    mListView = aQuery.id(R.id.notification_listView).getListView();
    aQuery.id(R.id.notification_expandLayout).gone();
    aQuery.id(R.id.progressBar1).visible();
    ThreadModel model = new ThreadModel();
    adapter = new NotificationListAdapter(getActivity(), model);
    mListView.setAdapter(adapter);
    HrmService service = new HrmService();
    if (userId != null) {
      service.requestGetNotification(userId);
      service.setCallback(
          new ThreadTaskCallback() {

            @Override
            public void onSuccess(ThreadModel threadModel) {
              adapter.setModel(threadModel);
              aQuery
                  .id(R.id.notification_overall)
                  .text(
                      String.format(
                          getString(R.string.notification_overall),
                          threadModel.countAllNotification()));
              adapter.notifyDataSetChanged();
              aQuery.id(R.id.notification_expandLayout).visible();
              aQuery.id(R.id.progressBar1).gone();
            }

            @Override
            public void onError() {}
          });
    }

    adapter.setCallback(
        new Callback() {

          @Override
          public void onClicked(Thread thread) {
            pref.edit().putString(Common.THREAD_ID, thread.getThread_id()).commit();
            Fragment fragment = new ThreadDetailFragment();
            switchFragment(fragment);
          }
        });
  }
コード例 #3
0
  protected void getCreatureById() {
    HrmService service = new HrmService();
    service.setCallback(
        new Callback() {

          @Override
          public void onGetAllCreaturesDone(CreatureModel creatureModel) {
            setSupportProgressBarIndeterminateVisibility(false);
            Creature creature = creatureModel.get(0);
            mCreatureDescriptionView.setContent(creature);
            mCreature = creatureModel.get(0);
            getImage();
          }

          @Override
          public void onError() {}
        });
    service.requestCreaturesById(mCreatureId);
    setSupportProgressBarIndeterminateVisibility(true);
  }