예제 #1
0
  @AfterViews
  protected void initViews() {
    adapter.setOnAktorItemClickListener(this);

    recyclerViewAktor.setAdapter(adapter);
    recyclerViewAktor.setLayoutManager(new GridLayoutManager(getActivity(), 2));

    performGetAktorList();
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    setRetainInstance(true);
    final MainActivity activity = (MainActivity) getActivity();
    adapter = activity.getAdapter();
    newses = activity.getNewses();

    if (savedInstanceState != null) {

      mCurCheckPosition = savedInstanceState.getInt("curChoice", 0);

      Log.e("save", String.valueOf(newses.size()));
    }

    final DescriptionFragment descriptionFragment = new DescriptionFragment();
    View rootView = inflater.inflate(R.layout.fragment_recyclerview, container, false);
    final FragmentActivity c = (FragmentActivity) getActivity();
    //        adapter = new ListNewsAdapter(newses, c);
    mRecycler = (SuperRecyclerView) rootView.findViewById(R.id.list);
    mRecycler.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRecycler.setAdapter(adapter);

    View detailsFrame = getActivity().findViewById(R.id.details);
    mDualPane = detailsFrame != null && detailsFrame.getVisibility() == View.VISIBLE;

    if (mDualPane) {
      getDetails(mCurCheckPosition);
    }

    mRecycler.addOnItemTouchListener(
        new RecyclerUtils.RecyclerItemClickListener(
            activity,
            new RecyclerUtils.RecyclerItemClickListener.OnItemClickListener() {
              @Override
              public void onItemClick(View view, int position) {

                getDetails(position);

                Log.e("onclick", String.valueOf(mCurCheckPosition));
                //

              }
            }));

    return rootView;
  }
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_black_room);
    initBar();

    base_uri = getIntent().getStringExtra("base_uri");
    ArrayList<User> users = getIntent().getParcelableArrayListExtra("blackUsers");

    recyclerView = (SuperRecyclerView) findViewById(R.id.recyclerView);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setRefreshingColorResources(
        android.R.color.holo_orange_light,
        android.R.color.holo_blue_light,
        android.R.color.holo_green_light,
        android.R.color.holo_red_light);
    memberAdapter = new MemberAdapter(this, base_uri);
    memberAdapter.setHasStableIds(true);
    recyclerView.setAdapter(memberAdapter);
    memberAdapter.addMember(users);
  }