Esempio n. 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();
    }
  }
Esempio n. 2
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);
 }
Esempio n. 3
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);
  }
Esempio n. 4
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();
   }
 }