private void configToolBar(Toolbar tb) {
   LinearLayout.LayoutParams lp = (LinearLayout.LayoutParams) tb.getLayoutParams();
   lp.setMargins(0, ViewUtils.getStatusBarHeight(getActivity()), 0, 0);
   tb.setLayoutParams(lp);
   tb.setNavigationOnClickListener(
       new View.OnClickListener() {
         @Override
         public void onClick(View view) {
           dismiss(null, null);
         }
       });
 }
Beispiel #2
0
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    Resources res = getResources();
    ViewUtils.setRecyclerViewGridDefaults(
        getActivity(),
        mRecyclerView,
        res.getInteger(R.integer.upload_num_columns),
        res.getDimensionPixelSize(R.dimen.grid_padding));
    ViewUtils.setEmptyText(mMultiView, R.id.emptyMessage, R.string.upload_empty_message);
    new ItemTouchHelper(mSimpleItemTouchCallback).attachToRecyclerView(mRecyclerView);

    if (savedInstanceState != null && savedInstanceState.containsKey(KEY_SAVED_ITEMS)) {
      List<Upload> uploads = savedInstanceState.getParcelableArrayList(KEY_SAVED_ITEMS);
      mAdapter = new UploadPhotoAdapter(getActivity(), uploads, this);
      mRecyclerView.setAdapter(mAdapter);
      mMultiView.setViewState(MultiStateView.VIEW_STATE_CONTENT);
      if (mListener != null) mListener.onPhotoAdded();
    } else {
      handleArgs(getArguments());
    }
  }