Program: 13436
Project: 13436
Buggy source:
private View getListEditorView(String headerText){
  Context themer=new ContextThemeWrapper(getActivity(),R.style.Calypso_SiteSettingsTheme);
  View view=View.inflate(themer,R.layout.list_editor,null);
  ((TextView)view.findViewById(R.id.list_editor_header_text)).setText(headerText);
  mAdapter=null;
  final EmptyViewRecyclerView list=(EmptyViewRecyclerView)view.findViewById(android.R.id.list);
  list.setLayoutManager(new SmoothScrollLinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false,getResources().getInteger(android.R.integer.config_mediumAnimTime)));
  list.setAdapter(getAdapter());
  list.setEmptyView(view.findViewById(R.id.empty_view));
  list.addOnItemTouchListener(new RecyclerViewItemClickListener(getActivity(),list,new RecyclerViewItemClickListener.OnItemClickListener(){
    @Override public void onItemClick(    View view,    int position){
      if (mActionMode != null) {
        getAdapter().toggleItemSelected(position);
        mActionMode.invalidate();
        if (getAdapter().getItemsSelected().size() <= 0) {
          mActionMode.finish();
        }
      }
    }
    @Override public void onLongItemClick(    View view,    int position){
      if (mActionMode == null) {
        if (view.isHapticFeedbackEnabled()) {
          view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
        }
        mDialog.getWindow().getDecorView().startActionMode(new ActionModeCallback());
        getAdapter().setItemSelected(position);
        mActionMode.invalidate();
      }
    }
  }
));
  view.findViewById(R.id.fab_button).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      AlertDialog.Builder builder=new AlertDialog.Builder(getActivity(),R.style.Calypso_AlertDialog);
      final EditText input=new EditText(getActivity());
      WPPrefUtils.layoutAsInput(input);
      input.setWidth(getResources().getDimensionPixelSize(R.dimen.list_editor_input_max_width));
      input.setHint(R.string.site_settings_list_editor_input_hint);
      builder.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int which){
          String entry=input.getText().toString();
          if (!TextUtils.isEmpty(entry) && !mEditingList.contains(entry)) {
            if (mEditingList == mSiteSettings.getJetpackWhitelistKeys() && !isValidIpOrRange(entry)) {
              ToastUtils.showToast(getActivity(),R.string.invalid_ip_or_range);
              return;
            }
            mEditingList.add(entry);
            getAdapter().notifyItemInserted(getAdapter().getItemCount() - 1);
            list.post(new Runnable(){
              @Override public void run(){
                list.smoothScrollToPosition(getAdapter().getItemCount() - 1);
              }
            }
);
            mSiteSettings.saveSettings();
            AnalyticsUtils.trackWithSiteDetails(AnalyticsTracker.Stat.SITE_SETTINGS_ADDED_LIST_ITEM,mSite);
          }
        }
      }
);
      builder.setNegativeButton(R.string.cancel,null);
      final AlertDialog alertDialog=builder.create();
      int spacing=getResources().getDimensionPixelSize(R.dimen.dlp_padding_start);
      alertDialog.setView(input,spacing,spacing,spacing,0);
      alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
      alertDialog.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
      alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener(){
        @Override public void onDismiss(        DialogInterface dialog){
          alertDialog.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_HIDDEN);
        }
      }
);
      alertDialog.show();
      Button positive=alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
      Button negative=alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
      if (positive != null)       WPPrefUtils.layoutAsFlatButton(positive);
      if (negative != null)       WPPrefUtils.layoutAsFlatButton(negative);
    }
  }
);
  return view;
}

Fixed version (ground truth):
private View getListEditorView(String headerText){
  Context themer=new ContextThemeWrapper(getActivity(),R.style.Calypso_SiteSettingsTheme);
  View view=View.inflate(themer,R.layout.list_editor,null);
  ((TextView)view.findViewById(R.id.list_editor_header_text)).setText(headerText);
  mAdapter=null;
  final EmptyViewRecyclerView list=view.findViewById(android.R.id.list);
  list.setLayoutManager(new SmoothScrollLinearLayoutManager(getActivity(),LinearLayoutManager.VERTICAL,false,getResources().getInteger(android.R.integer.config_mediumAnimTime)));
  list.setAdapter(getAdapter());
  list.setEmptyView(view.findViewById(R.id.empty_view));
  list.addOnItemTouchListener(new RecyclerViewItemClickListener(getActivity(),list,new RecyclerViewItemClickListener.OnItemClickListener(){
    @Override public void onItemClick(    View view,    int position){
      if (mActionMode != null) {
        getAdapter().toggleItemSelected(position);
        mActionMode.invalidate();
        if (getAdapter().getItemsSelected().size() <= 0) {
          mActionMode.finish();
        }
      }
    }
    @Override public void onLongItemClick(    View view,    int position){
      if (mActionMode == null) {
        if (view.isHapticFeedbackEnabled()) {
          view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
        }
        mDialog.getWindow().getDecorView().startActionMode(new ActionModeCallback());
        getAdapter().setItemSelected(position);
        mActionMode.invalidate();
      }
    }
  }
));
  view.findViewById(R.id.fab_button).setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      AlertDialog.Builder builder=new AlertDialog.Builder(getActivity(),R.style.Calypso_AlertDialog);
      final EditText input=new EditText(getActivity());
      WPPrefUtils.layoutAsInput(input);
      input.setWidth(getResources().getDimensionPixelSize(R.dimen.list_editor_input_max_width));
      input.setHint(R.string.site_settings_list_editor_input_hint);
      builder.setPositiveButton(android.R.string.ok,new DialogInterface.OnClickListener(){
        @Override public void onClick(        DialogInterface dialog,        int which){
          String entry=input.getText().toString();
          if (!TextUtils.isEmpty(entry) && !mEditingList.contains(entry)) {
            if (mEditingList == mSiteSettings.getJetpackWhitelistKeys() && !isValidIpOrRange(entry)) {
              ToastUtils.showToast(getActivity(),R.string.invalid_ip_or_range);
              return;
            }
            mEditingList.add(entry);
            getAdapter().notifyItemInserted(getAdapter().getItemCount() - 1);
            list.post(new Runnable(){
              @Override public void run(){
                list.smoothScrollToPosition(getAdapter().getItemCount() - 1);
              }
            }
);
            mSiteSettings.saveSettings();
            AnalyticsUtils.trackWithSiteDetails(AnalyticsTracker.Stat.SITE_SETTINGS_ADDED_LIST_ITEM,mSite);
          }
        }
      }
);
      builder.setNegativeButton(R.string.cancel,null);
      final AlertDialog alertDialog=builder.create();
      int spacing=getResources().getDimensionPixelSize(R.dimen.dlp_padding_start);
      alertDialog.setView(input,spacing,spacing,spacing,0);
      alertDialog.requestWindowFeature(Window.FEATURE_NO_TITLE);
      alertDialog.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_VISIBLE);
      alertDialog.setOnDismissListener(new DialogInterface.OnDismissListener(){
        @Override public void onDismiss(        DialogInterface dialog){
          alertDialog.getWindow().setSoftInputMode(LayoutParams.SOFT_INPUT_STATE_HIDDEN);
        }
      }
);
      alertDialog.show();
      Button positive=alertDialog.getButton(DialogInterface.BUTTON_POSITIVE);
      Button negative=alertDialog.getButton(DialogInterface.BUTTON_NEGATIVE);
      if (positive != null)       WPPrefUtils.layoutAsFlatButton(positive);
      if (negative != null)       WPPrefUtils.layoutAsFlatButton(negative);
    }
  }
);
  return view;
}