Skip to content

Commit

Permalink
refactor: some ktLint changes
Browse files Browse the repository at this point in the history
  • Loading branch information
joragua committed Oct 18, 2024
1 parent e16bc95 commit 868992a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ class ManageAccountsAdapter(

fun getItem(position: Int) = accountItemsList[position]

private fun updateQuota (quotaText: TextView, quotaBar: ProgressBar, userQuota: UserQuota){
private fun updateQuota(quotaText: TextView, quotaBar: ProgressBar, userQuota: UserQuota) {
when {
userQuota.available < 0 -> {
quotaBar.visibility = View.GONE
quotaText.text = DisplayUtils.bytesToHumanReadable(userQuota.used, context)
}

userQuota.state == EXCEEDED_STATE -> {
quotaBar.run{
quotaBar.run {
progress = 100
progressTintList = ColorStateList.valueOf(resources.getColor(R.color.quota_exceeded))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ class ManageAccountsDialogFragment : DialogFragment(), ManageAccountsAdapter.Acc
private lateinit var accountListAdapter: ManageAccountsAdapter
private var currentAccount: Account? = null

private val manageAccountsViewModel: ManageAccountsViewModel by viewModel()

private lateinit var dialogView: View
private lateinit var parentActivity: ToolbarActivity

private val manageAccountsViewModel: ManageAccountsViewModel by viewModel()

override fun onStart() {
super.onStart()

Expand Down Expand Up @@ -243,14 +243,14 @@ class ManageAccountsDialogFragment : DialogFragment(), ManageAccountsAdapter.Acc
}

collectLatestLifecycleFlow(manageAccountsViewModel.userQuotas) { listUserQuotas ->
if (listUserQuotas.isNotEmpty()){
if (listUserQuotas.isNotEmpty()) {
// hide the progress bar and show manage accounts dialog
val indeterminateProgressBar = dialogView.findViewById<ProgressBar>(R.id.indeterminate_progress_bar)
indeterminateProgressBar.visibility = View.GONE
val manageAccountsLayout = dialogView.findViewById<LinearLayout>(R.id.manage_accounts_layout)
manageAccountsLayout.visibility = View.VISIBLE

accountListAdapter = ManageAccountsAdapter(requireContext(),this)
accountListAdapter = ManageAccountsAdapter(requireContext(), this)
accountListAdapter.submitAccountList(accountList = getAccountListItems())

val recyclerView = dialogView.findViewById<RecyclerView>(R.id.account_list_recycler_view)
Expand All @@ -275,7 +275,7 @@ class ManageAccountsDialogFragment : DialogFragment(), ManageAccountsAdapter.Acc

collectLatestLifecycleFlow(manageAccountsViewModel.userQuotas) { userQuotasList ->
accountList.forEach { account ->
val userQuota = userQuotasList.firstOrNull{ userQuota -> userQuota.accountName == account.name }
val userQuota = userQuotasList.firstOrNull { userQuota -> userQuota.accountName == account.name }
provisionalAccountList.add(ManageAccountsAdapter.AccountRecyclerItem.AccountItem(account, userQuota))
}

Expand All @@ -299,4 +299,5 @@ class ManageAccountsDialogFragment : DialogFragment(), ManageAccountsAdapter.Acc
return ManageAccountsDialogFragment().apply { arguments = args }
}
}

}

0 comments on commit 868992a

Please sign in to comment.