Skip to content

Commit

Permalink
Update AddCategoryFragment.java
Browse files Browse the repository at this point in the history
  • Loading branch information
neeldoshii committed Jun 10, 2024
1 parent 5095884 commit 5f0bbc3
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

public class AddCategoryFragment extends AppCompatDialogFragment {
private SiteModel mSite;
private AddCategoryBinding binding;
private AddCategoryBinding mBinding;

@Inject TaxonomyStore mTaxonomyStore;

Expand All @@ -52,11 +52,11 @@ public Dialog onCreateDialog(Bundle savedInstanceState) {
// Get the layout inflater
LayoutInflater inflater = requireActivity().getLayoutInflater();
//noinspection InflateParams
binding = AddCategoryBinding.inflate(inflater,null,false);
mBinding = AddCategoryBinding.inflate(inflater, null, false);

loadCategories();

builder.setView(binding.getRoot())
builder.setView(mBinding.getRoot())
.setPositiveButton(android.R.string.ok, null)
.setNegativeButton(android.R.string.cancel, null);

Expand Down Expand Up @@ -95,12 +95,12 @@ private void initSite(Bundle savedInstanceState) {
}

private boolean addCategory() {
String categoryName = binding.categoryName.getText().toString();
CategoryNode selectedCategory = (CategoryNode) binding.parentCategory.getSelectedItem();
String categoryName = mBinding.categoryName.getText().toString();
CategoryNode selectedCategory = (CategoryNode) mBinding.parentCategory.getSelectedItem();
long parentId = (selectedCategory != null) ? selectedCategory.getCategoryId() : 0;

if (categoryName.replaceAll(" ", "").equals("")) {
binding.categoryName.setError(getText(R.string.cat_name_required));
mBinding.categoryName.setError(getText(R.string.cat_name_required));
return false;
}

Expand All @@ -121,7 +121,7 @@ private void loadCategories() {
if (categoryLevels.size() > 0) {
ParentCategorySpinnerAdapter categoryAdapter =
new ParentCategorySpinnerAdapter(getActivity(), R.layout.categories_row_parent, categoryLevels);
binding.parentCategory.setAdapter(categoryAdapter);
mBinding.parentCategory.setAdapter(categoryAdapter);
}
}

Expand Down

0 comments on commit 5f0bbc3

Please sign in to comment.