@Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

    if (!dualScreen) {
      if (null == onItemClickNewActivity) {
        onItemClickNewActivity = new EnterJsonArticle(this);
      }
      onItemClickNewActivity.onItemClick(parent, view, position, id);

    } else {
      String guid = (String) parent.getItemAtPosition(position);
      if (StringUtil.isEmpty(guid)) return;

      guid = guid.trim();

      int pid = StringUtil.getUrlParameter(guid, "pid");
      int tid = StringUtil.getUrlParameter(guid, "tid");
      int authorid = StringUtil.getUrlParameter(guid, "authorid");
      ArticleContainerFragment f = ArticleContainerFragment.create(tid, pid, authorid);
      FragmentManager fm = getSupportFragmentManager();
      FragmentTransaction ft = fm.beginTransaction();

      ft.replace(R.id.item_detail_container, f);
      Fragment f1 = fm.findFragmentById(R.id.item_list);
      f1.setHasOptionsMenu(false);
      f.setHasOptionsMenu(true);
      ft.commit();

      ListView listview = (ListView) parent;
      Object a = parent.getAdapter();
      TopicListAdapter adapter = null;
      if (a instanceof TopicListAdapter) {
        adapter = (TopicListAdapter) a;
      } else if (a instanceof HeaderViewListAdapter) {
        HeaderViewListAdapter ha = (HeaderViewListAdapter) a;
        adapter = (TopicListAdapter) ha.getWrappedAdapter();
        position -= ha.getHeadersCount();
      }
      adapter.setSelected(position);
      listview.setItemChecked(position, true);
    }
  }
Exemplo n.º 2
0
  @Override
  protected void onClick(View view, int position, long id) {
    if (view.getId() == R.id.footer_content) {
      ImageView iv = (ImageView) view.findViewById(R.id.anim_view);
      iv.setVisibility(View.VISIBLE);
      Anim.refresh(getContext(), iv);

      HeaderViewListAdapter headerAdapter = (HeaderViewListAdapter) this.getAdapter();
      FollowListAdapter followListAdapter = (FollowListAdapter) headerAdapter.getWrappedAdapter();
      followListAdapter.animView = iv;
      followListAdapter.doRefreshFooter();
      return;
    }

    /*
    Thinksns app = (Thinksns) getContext().getApplicationContext();
    User user = (User) this.getItemAtPosition(position);
    Bundle bundle = new Bundle();
    bundle.putInt("uid", user.getUid());
    app.startActivity(getActivityObj(), ThinksnsUserInfo.class, bundle);
          */
  }
  @Override
  public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    String guid = (String) parent.getItemAtPosition(position);
    if (StringUtil.isEmpty(guid)) return;

    guid = guid.trim();

    int pid = StringUtil.getUrlParameter(guid, "pid");
    int tid = StringUtil.getUrlParameter(guid, "tid");
    int authorid = StringUtil.getUrlParameter(guid, "authorid");

    Intent intent = new Intent();
    intent.putExtra("tab", "1");
    intent.putExtra("tid", tid);
    intent.putExtra("pid", pid);
    intent.putExtra("authorid", authorid);
    if (fromreplyactivity) {
      intent.putExtra("fromreplyactivity", 1);
    }
    ListView listview = (ListView) parent;
    Object a = parent.getAdapter();
    TopicListAdapter adapter = null;
    if (a instanceof TopicListAdapter) {
      adapter = (TopicListAdapter) a;
    } else if (a instanceof HeaderViewListAdapter) {
      HeaderViewListAdapter ha = (HeaderViewListAdapter) a;
      adapter = (TopicListAdapter) ha.getWrappedAdapter();
      position -= ha.getHeadersCount();
    }
    adapter.setSelected(position);
    listview.setItemChecked(position, true);

    intent.setClass(activity, PhoneConfiguration.getInstance().articleActivityClass);
    activity.startActivity(intent);
    if (PhoneConfiguration.getInstance().showAnimation)
      activity.overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
  }