Skip to content

Commit

Permalink
Replaced Hungarian Notation to kt style
Browse files Browse the repository at this point in the history
  • Loading branch information
neeldoshii committed Jun 18, 2024
1 parent 59de2be commit 2ab7593
Showing 1 changed file with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import org.wordpress.android.util.ToastUtils
import javax.inject.Inject

class AddCategoryFragment : AppCompatDialogFragment() {
private var mSite: SiteModel? = null
private var mBinding: AddCategoryBinding? = null
private var site: SiteModel? = null
private var binding: AddCategoryBinding? = null

@set:Inject
var mTaxonomyStore: TaxonomyStore? = null
Expand All @@ -33,11 +33,11 @@ class AddCategoryFragment : AppCompatDialogFragment() {
MaterialAlertDialogBuilder(ContextThemeWrapper(activity, R.style.PostSettingsTheme))
// Get the layout inflater
val inflater = requireActivity().layoutInflater
mBinding = AddCategoryBinding.inflate(inflater, null, false)
binding = AddCategoryBinding.inflate(inflater, null, false)

loadCategories()

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

Expand All @@ -56,7 +56,7 @@ class AddCategoryFragment : AppCompatDialogFragment() {

@Suppress("Deprecation")
private fun initSite(savedInstanceState: Bundle?) {
mSite = if (savedInstanceState == null) {
site = if (savedInstanceState == null) {
if (arguments != null) {
requireArguments().getSerializable(WordPress.SITE) as SiteModel?
} else {
Expand All @@ -66,7 +66,7 @@ class AddCategoryFragment : AppCompatDialogFragment() {
savedInstanceState.getSerializable(WordPress.SITE) as SiteModel?
}

if (mSite == null) {
if (site == null) {
ToastUtils.showToast(
requireActivity(),
R.string.blog_not_found,
Expand All @@ -77,12 +77,12 @@ class AddCategoryFragment : AppCompatDialogFragment() {
}

private fun addCategory(): Boolean {
val categoryName = mBinding!!.categoryName.text.toString()
val selectedCategory = mBinding!!.parentCategory.selectedItem as CategoryNode
val categoryName = binding!!.categoryName.text.toString()
val selectedCategory = binding!!.parentCategory.selectedItem as CategoryNode
val parentId = selectedCategory.categoryId

if (categoryName.replace(" ".toRegex(), "") == "") {
mBinding!!.categoryName.error = getText(R.string.cat_name_required)
binding!!.categoryName.error = getText(R.string.cat_name_required)
return false
}

Expand All @@ -99,7 +99,7 @@ class AddCategoryFragment : AppCompatDialogFragment() {
private fun loadCategories() {
val rootCategory = CategoryNode.createCategoryTreeFromList(
mTaxonomyStore!!.getCategoriesForSite(
mSite!!
site!!
)
)
val categoryLevels = CategoryNode.getSortedListOfCategoriesFromRoot(rootCategory)
Expand All @@ -111,18 +111,18 @@ class AddCategoryFragment : AppCompatDialogFragment() {
R.layout.categories_row_parent,
categoryLevels
)
mBinding!!.parentCategory.adapter = categoryAdapter
binding!!.parentCategory.adapter = categoryAdapter
}
}

override fun onSaveInstanceState(outState: Bundle) {
super.onSaveInstanceState(outState)
outState.putSerializable(WordPress.SITE, mSite)
outState.putSerializable(WordPress.SITE, site)
}

override fun onDestroy() {
super.onDestroy()
mBinding = null
binding = null
}

companion object {
Expand Down

0 comments on commit 2ab7593

Please sign in to comment.