private void initializeUserVariableAdapter() { Sprite currentSprite = ProjectManager.getInstance().getCurrentSprite(); Project currentProject = ProjectManager.getInstance().getCurrentProject(); UserVariablesContainer userVariableContainer = currentProject.getUserVariables(); adapter = userVariableContainer.createUserVariableAdapter(getActivity(), currentSprite); setListAdapter(adapter); adapter.setOnCheckedChangeListener(this); adapter.setOnListItemClickListener(this); }
@Override public void onDestroyActionMode(ActionMode mode) { UserVariablesContainer userVariablesContainer = ProjectManager.getInstance().getCurrentProject().getUserVariables(); if (!adapter.isEmpty()) { for (UserVariable var : adapter.getCheckedUserVariables()) { userVariablesContainer.deleteUserVariableByName(var.getName()); } } adapter.notifyDataSetChanged(); getActivity().sendBroadcast(new Intent(ScriptActivity.ACTION_VARIABLE_DELETED)); adapter.setSelectMode(ListView.CHOICE_MODE_NONE); contextActionMode = null; inContextMode = false; getActivity().findViewById(R.id.bottom_bar).setVisibility(View.VISIBLE); }