@Override public boolean onCreateActionMode(ActionMode actionMode, Menu menu) { showFab(false); MenuInflater inflater = actionMode.getMenuInflater(); inflater.inflate(R.menu.menu_edit, menu); mListener.onLockDrawer(true); return true; }
@Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { MenuInflater inflater = mode.getMenuInflater(); inflater.inflate(R.menu.menu_remove, menu); showFab(false); mActionModeDestroyed = false; mFromMenu = false; mListener.onLockDrawer(true); return true; }
protected void saveCategory() { if (mCategoryId <= AccountManager.DEFAULT_CATEGORY_ID) { mCategoryId = AccountManager.getInstance().addCategory(mCategoryIcon, mCategoryName); } else { AccountManager.getInstance().setCategory(mCategoryId, mCategoryName, mCategoryIcon); } Application.showToast(getActivity(), R.string.category_saved, Toast.LENGTH_SHORT); mAdapter.moveData(mCategoryId); mListener.onCategorySaved(); }
@Override public void onItemClick(AdapterView<?> parent, View view, int pos, long id) { if (mSelectionMode || mIsEditing) { onItemLongClick(parent, view, pos, id); return; } if (mListener != null) { mListener.onSelect((int) id); } }
@Override public void onDestroyActionMode(ActionMode actionMode) { mActionMode = null; mIsEditing = false; mSelectionMode = false; mCategoryEditView.setVisibility(View.GONE); updateData(mCategoryId); showFab(true); mListener.onLockDrawer(false); }
@Override public void onDestroyActionMode(ActionMode mode) { showFab(true); mActionModeDestroyed = true; if (!mFromMenu) { reset(); } mActionMode = null; mListener.onLockDrawer(false); }
private void save() { String name = mNameEditText.getText().toString(); AccountManager.Account account = getAccount(); account.setName(name); int categoryId = Application.getSortedCategoryIds()[mPosition]; account.setCategory(categoryId); if (mAccountId < 0) { AccountManager.getInstance().addAccount(categoryId, account); if (mListener != null) { mListener.onSave(categoryId); } } else { AccountManager.getInstance().setAccount(mAccountId, account); if (mListener != null) { mListener.onSaveChanged( mAccountId, categoryId, mOldCategoryId, name.equals(account.getAccountName())); } } getActivity().onBackPressed(); }
@Override public void onClick(View view) { switch (view.getId()) { case R.id.fab: if (mListener != null) { mListener.onEdit(mCategoryId, -1); } break; case R.id.category_icon: new IconSetter() .setInitImage(mCategoryIcon) .setListener( new IconSetter.OnIconChosen() { @Override public void onChosen(int id) { mCategoryIcon = id; mCategoryIconView.setImageResource(Application.getThemedIcons()[mCategoryIcon]); } }) .show(getFragmentManager(), "set_icon"); break; } }
@Override public void onCreate(Bundle savedInstanceState) { if (savedInstanceState == null) { int categoryId = getArguments().getInt(C.CATEGORY, AccountManager.DEFAULT_CATEGORY_ID); mPosition = 0; int[] allIds = Application.getSortedCategoryIds(); for (int i = 0; i < allIds.length; ++i) { if (categoryId == allIds[i]) { mPosition = i; break; } } mAccountId = getArguments().getInt(C.ACCOUNT, -1); mOldCategoryId = categoryId; } else { mAccountId = savedInstanceState.getInt(C.ACCOUNT); mOldCategoryId = savedInstanceState.getInt(C.CATEGORY); mPosition = savedInstanceState.getInt("Category_Position"); } mSavable = false; mNameOk = false; mListener.onLockDrawer(true); super.onCreate(savedInstanceState); }
@Override public void onDetach() { super.onDetach(); mListener.onLockDrawer(false); }