示例#1
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);
  }
示例#2
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();
    }
  }
示例#3
0
  private void requestDatas() {
    showLoading();
    GlobalRes.getInstance()
        .getBeans()
        .setCurrentClassNo(GlobalRes.getInstance().getBeans().getCurrentMyClassNo());
    new TaskReqSecretGetMembers(
        0,
        new CallbackNoticeView<Void, Boolean>() {

          @Override
          public void refreshView(int tag, Boolean result) {
            hideLoading();
            if (null == result || !result) {
              refreshListView.onRefreshComplete2();
              return;
            }
            if (null != result && result) {
              refreshDatas(GlobalRes.getInstance().getBeans().getMemberData().getMembers());
            }
          }

          @Override
          public void onProgressUpdate(int tag, Void[] values) {}
        });
  }
示例#4
0
 @Override
 public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
   // TODO Auto-generated method stub
   GlobalRes.getInstance()
       .getBeans()
       .setCurrentFriendNo(((ClassMemberData) adapter.getItem(position - 1)).getUserNo());
   GlobalRes.getInstance()
       .getBeans()
       .setCurrentFriendName(((ClassMemberData) adapter.getItem(position - 1)).getName());
   AtySecretDetails.startAty(getActivity());
 }
示例#5
0
 private void showUnlockDialog1() {
   String str =
       "您现在还拥有钥匙*"
           + GlobalRes.getInstance().getBeans().getLoginData().getInfoData().getKeyNum()
           + ",解锁本课程需要 钥匙*1,是否解锁?";
   unlockDialog1 = new DialogUnlockFragment(callback1, str, "", 0);
   unlockDialog1.showDialog(getSupportFragmentManager());
 }
示例#6
0
 public FragmentType5_2() {
   super();
   List<EntityResType5> type5s =
       GlobalRes.getInstance().getBeans().getCurrentType4Data().getType5s();
   data1 = type5s.get(2);
   data2 = type5s.get(7);
   data3 = type5s.get(9);
   data4 = type5s.get(3);
 }
示例#7
0
 @Override
 protected void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   CacheBeans beans = GlobalRes.getInstance().getBeans();
   if (beans.getCurrentType4Data() != null) {
     beans.getCurrentType4Data().refreshStar();
     adapter.notifyDataSetChanged();
   }
 }
示例#8
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);
 }
 @Override
 protected Boolean doInBackground(Object... params) {
   if (ConfigConstants.DEBUG_NO_SERVER) {
     return true;
   }
   RestResult result =
       HttpReqFactory.getServerResultByToken(
           RestResult.class,
           ConfigConstants.BLACKLIST_CREATE,
           new HttpReqFactory.ReqParam("attentionNo", params[0]));
   if (null != result && result.getCode() == RestResult.C_SUCCESS) {
     DaoAttentionDataCache dao = new DaoAttentionDataCache();
     List<AttentionData> datas = dao.getList(GlobalRes.getInstance().getBeans().getLoginName());
     for (int j = 0; j < datas.size(); j++) {
       if (datas.get(j).getUserNo().longValue() == ((Long) params[0]).longValue()) {
         dao.delete(GlobalRes.getInstance().getBeans().getLoginName(), datas.get(j).getUserNo());
         break;
       }
     }
     return true;
   }
   return false;
 }
示例#10
0
 @Override
 protected Boolean doInBackground(Void... params) {
   if (ConfigConstants.DEBUG_NO_SERVER) {
     return true;
   }
   RestResult result =
       HttpReqFactory.getServerResultByToken(
           RestResult.class,
           ConfigConstants.ATTENTION_CANCEL_URL,
           new HttpReqFactory.ReqParam(
               "attentionNo", GlobalRes.getInstance().getBeans().getCurrentUserNo()));
   if (null != result && result.getCode() == RestResult.C_SUCCESS) {
     return true;
   }
   return false;
 }
示例#11
0
 protected void refreshData() {
   // 检测type2s 数据是否已加载
   EntityResType2 t2 = null;
   List<EntityResType2> unfinishedType2s = new ArrayList<EntityResType2>();
   for (String key : GlobalResTypes.ALL_TYPE2S_MAP.keySet()) {
     t2 = GlobalResTypes.ALL_TYPE2S_MAP.get(key);
     if (!t2.isFinished()) unfinishedType2s.add(t2);
   }
   if (unfinishedType2s.size() > 0) {
     allDownloadType2Size = unfinishedType2s.size();
     showLoading(getString(R.string.loaddingTip2));
     GlobalResTypes.getInstance().setCallBackType2(callbackResDownload2);
     for (EntityResType2 entityResType2 : unfinishedType2s) {
       GlobalResTypes.getInstance().startDownload(entityResType2);
     }
     return;
   }
   String userLessonType1 = GlobalRes.getInstance().getBeans().getDefaultLessonId();
   EntityResType1 type1 = null;
   for (String key : GlobalResTypes.ALL_TYPE1S_MAP.keySet()) {
     type1 = GlobalResTypes.ALL_TYPE1S_MAP.get(key);
     if (type1.isBase() && !type1.getId().equals(userLessonType1)) {
       continue;
     }
     entitys.add(type1);
     for (EntityResType2 type2 : type1.getType2s()) {
       entitys.add(type2);
       for (EntityResType4 type4 : type2.getType4s()) {
         entitys.add(type4);
       }
     }
   }
   try {
     mAdapter = new AdapterSimpleTree(lvDownloads, this, entitys, 1);
     mAdapter.setOnTreeNodeClickListener(this);
     mAdapter.setCallback(this);
   } catch (Exception e) {
     e.printStackTrace();
   }
   lvDownloads.setAdapter(mAdapter);
 }
示例#12
0
 public void onRefreshView() {
   CacheBeans beans = GlobalRes.getInstance().getBeans();
   Type5Data type5_1 = beans.getUnlockDatas().getType5s().get(data1.getId());
   Type5Data type5_2 = beans.getUnlockDatas().getType5s().get(data2.getId());
   Type5Data type5_3 = beans.getUnlockDatas().getType5s().get(data3.getId());
   Type5Data type5_4 = beans.getUnlockDatas().getType5s().get(data4.getId());
   refreshModule(
       type5_1,
       imgLock1,
       imgStart1,
       rbStar1,
       imgModule1,
       R.drawable.icon_lessontype5_3,
       R.drawable.icon_lessontype5_3_2,
       R.drawable.icon_lessontype5_3_3);
   refreshModule(
       type5_2,
       imgLock2,
       imgStart2,
       rbStar2,
       imgModule2,
       R.drawable.icon_lessontype5_4,
       R.drawable.icon_lessontype5_4_2,
       R.drawable.icon_lessontype5_4_3);
   refreshModule(
       type5_3,
       imgLock3,
       imgStart3,
       rbStar3,
       imgModule3,
       R.drawable.icon_lessontype5_5,
       R.drawable.icon_lessontype5_5_2,
       R.drawable.icon_lessontype5_5_3);
   refreshLine(type5_1, imgLine1);
   refreshLine(type5_2, imgLine2);
   refreshLine(type5_3, imgLine3);
   refreshLine(type5_4, imgLine4);
 }
  /** 书中详细解释该方法 */
  @Override
  public View getView(final int position, View convertView, ViewGroup parent) {
    PersonalRanklistViewHolder holder;
    if (null == convertView) {
      convertView = mInflater.inflate(R.layout.item_personal_ranklist, null, true);
      holder = new PersonalRanklistViewHolder();
      //			convertView.findViewById(R.id.rlRanklistItem).setOnTouchListener(new OnTouchListener() {
      //
      //				@Override
      //				public boolean onTouch(View v, MotionEvent event) {
      //					return false;
      //				}
      //			});

      holder.imgHead1 = (CircleImageView) convertView.findViewById(R.id.imgHead1);
      holder.imgHead2 = (CircleImageView) convertView.findViewById(R.id.imgHead2);
      holder.txtNo = (TextView) convertView.findViewById(R.id.txtNo);
      holder.imgNo = (ImageView) convertView.findViewById(R.id.imgNo);
      holder.txtName1 = (TextView) convertView.findViewById(R.id.txtName1);
      holder.txtName2 = (TextView) convertView.findViewById(R.id.txtName2);
      holder.txtScore1 = (TextView) convertView.findViewById(R.id.txtScore1);
      holder.txtScore2 = (TextView) convertView.findViewById(R.id.txtScore2);
      convertView.setTag(holder);
    } else {
      holder = (PersonalRanklistViewHolder) convertView.getTag();
    }
    LastWeekDedicateData entity = datas.get(position);
    holder.txtNo.setVisibility(View.INVISIBLE);
    holder.imgNo.setVisibility(View.INVISIBLE);
    holder.imgHead1.setVisibility(View.GONE);
    holder.imgHead2.setVisibility(View.GONE);
    holder.txtScore1.setVisibility(View.GONE);
    holder.txtScore2.setVisibility(View.GONE);
    holder.txtName1.setVisibility(View.GONE);
    holder.txtName2.setVisibility(View.GONE);

    TextView txtName = null;
    CircleImageView imgHead = null;
    TextView txtScore = null;

    if (null != entity.getNo()) {
      if (entity.getNo().intValue() <= 0 || entity.getNo().intValue() >= 4) {
        convertView.findViewById(R.id.rlRanklistItem).setBackgroundColor(0xfff7f7f7);
        holder.txtNo.setVisibility(View.VISIBLE);
        txtName = holder.txtName2;
        imgHead = holder.imgHead2;
        txtScore = holder.txtScore2;
        if (entity.getNo().intValue() <= 0) {
          holder.txtNo.setText(R.string.noRanking);
        } else {
          holder.txtNo.setText(entity.getNo().toString());
        }
      } else {
        switch (entity.getNo().intValue()) {
          case 1:
            holder.imgNo.setImageResource(R.drawable.icon_ranklist_no1);
            break;
          case 2:
            holder.imgNo.setImageResource(R.drawable.icon_ranklist_no2);
            break;
          case 3:
            holder.imgNo.setImageResource(R.drawable.icon_ranklist_no3);
            break;
        }
        convertView.findViewById(R.id.rlRanklistItem).setBackgroundColor(0xffffffff);
        holder.imgNo.setVisibility(View.VISIBLE);
        txtName = holder.txtName1;
        imgHead = holder.imgHead1;
        txtScore = holder.txtScore1;
      }
    }
    if (null != entity.getNo()) {
      holder.txtNo.setText(entity.getNo().toString());
    }
    imgHead.setVisibility(View.VISIBLE);
    txtScore.setVisibility(View.VISIBLE);
    txtName.setVisibility(View.VISIBLE);

    if (!TextUtils.isEmpty(entity.getName())) {
      txtName.setText(entity.getName().toString());
    }
    if (null != entity.getScore()) {
      txtScore.setText(entity.getScore().toString());
    }
    if (!TextUtils.isEmpty(entity.getHeadUrl())) {
      GlobalRes.getInstance()
          .displayBitmap(new GlobalRes.DisplayBitmapParam(entity.getHeadUrl(), imgHead));
    } else {
      imgHead.clear();
    }
    return convertView;
  }