示例#1
0
  private void refreshView() {
    if (getBeans().getCurrentType4Datas() == null) return;
    txtKeyNum.setText(
        !TextUtils.isEmpty(getBeans().getLoginData().getInfoData().getKeyNum().toString())
            ? getBeans().getLoginData().getInfoData().getKeyNum().toString()
            : "0");
    adapter.getDatas().clear();
    adapter.getDatas().addAll(getBeans().getCurrentType4Datas());
    adapter.notifyDataSetChanged();

    boolean goOn = getIntent().getBooleanExtra("goOn", false);
    if (goOn) {
      int position = 0;
      for (EntityResType4 type4 : getBeans().getCurrentType4Datas()) {
        if (!type4.getId().equals(GlobalRes.getInstance().getBeans().getLastType4Id())) {
          position++;
          continue;
        }
        lv.setSelection(position);
        startLesson(position, true);
        break;
      }
    }
    lessonTips =
        GlobalRes.getInstance().getBeans().getLoginData().getSettingsData().getLessonTips();
    if (lessonTips.getKeyTip().equals("0")) {
      showTip();
    }
  }
示例#2
0
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    EntityResType4 entity = adapter.getDatas().get(position);
    if (null == entity) {
      return;
    }
    Type4Data type4 =
        GlobalRes.getInstance().getBeans().getUnlockDatas().getType4s().get(entity.getId());
    Type2Data type2 =
        GlobalRes.getInstance()
            .getBeans()
            .getUnlockDatas()
            .getType2s()
            .get(GlobalRes.getInstance().getBeans().getCurrentType2Id());

    if (null == type4) {
      if (UnlockType.auto.equals(type2.getUnlockType())) {
        Toast.makeText(this, R.string.lessonTip2, Toast.LENGTH_LONG).show();
        return;
      }
      if (GlobalRes.getInstance().getBeans().getLoginData().getInfoData().getKeyNum() == 0) {
        showUnlockDialog();
        return;
      }
      type4Id = entity.getId();
      showUnlockDialog1();
      //			unlockLesson(entity.getId(), position);
      //			Toast.makeText(this, R.string.lessonTip2, Toast.LENGTH_LONG).show();
      return;
    }
    startLesson(position, false);
  }
示例#3
0
 private void startLesson(int position, boolean goOn) {
   CacheBeans beans = GlobalRes.getInstance().getBeans();
   EntityResType4 type4 = adapter.getItem(position);
   beans.setCurrentType4Data(type4);
   beans.setCurrentType4Id(type4.getId());
   adapter.onSelected(position);
   Intent i = new Intent(this, AtyType5s.class);
   i.putExtra("goOn", goOn);
   startActivityForResult(i, 0);
 }
示例#4
0
 @Override
 public void onClick(Node node, int position) {
   if (!node.isLeaf()) {
     return;
   }
   if (node.isDownloadAll()) {
     EntityResType2 type2 = GlobalResTypes.ALL_TYPE2S_MAP.get(node.getParent().getId());
     List<EntityResType4> entitys = type2.getType4s();
     if (null != entitys) {
       if (node.isClickedDownloadAll()) {
         node.setClickedDownloadAll(false);
         refreshDownloadName(node);
         for (EntityResType4 entity : entitys) {
           node = mAdapter.getAllNodeMap().get(entity.getId());
           if (node.getStatus() == INode.STATUS_START
               || node.getStatus() == INode.STATUS_WAIT
               || node.getStatus() == INode.STATUS_CONNECTING) {
             node.setStatus(INode.STATUS_STOP);
             entity.setStatus(INode.STATUS_STOP);
             setViewData(node);
           }
         }
         GlobalResTypes.getInstance().stopAllQueueDownload();
         return;
       }
       node.setClickedDownloadAll(true);
       refreshDownloadName(node);
       for (EntityResType4 entity : entitys) {
         node = mAdapter.getAllNodeMap().get(entity.getId());
         if (node.getStatus() == INode.STATUS_NORMAL || node.getStatus() == INode.STATUS_STOP) {
           entity.setStatus(INode.STATUS_CONNECTING);
           node.setStatus(INode.STATUS_CONNECTING);
           setViewData(node);
           GlobalResTypes.getInstance().startDownload(node.getId());
         }
       }
     }
     return;
   }
   switch (node.getStatus()) {
     case INode.STATUS_NORMAL:
     case INode.STATUS_STOP:
       node.setStatus(INode.STATUS_CONNECTING);
       setViewData(node);
       GlobalResTypes.getInstance().startDownload(node.getId());
       break;
     case INode.STATUS_START:
       node.setStatus(INode.STATUS_STOP);
       setViewData(node);
       GlobalResTypes.getInstance().stopDownload(node.getId());
       break;
   }
 }