Skip to content

Commit

Permalink
[setting]: Fix ActivityExt
Browse files Browse the repository at this point in the history
  • Loading branch information
kez-lab committed Dec 30, 2023
1 parent 2237689 commit 14acbfb
Showing 1 changed file with 4 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,32 +1,11 @@
package com.hmh.hamyeonham.common.activity

import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.Fragment
import androidx.fragment.app.commit

fun AppCompatActivity.showLoading() {
supportFragmentManager.commit(allowStateLoss = true) {
add(LoadingProgressIndicator.newInstance(), LoadingProgressIndicator.TAG)
}
}

fun AppCompatActivity.hideLoading() {
supportFragmentManager.findFragmentByTag(LoadingProgressIndicator.TAG)?.let { fragment ->
supportFragmentManager.commit(allowStateLoss = true) {
remove(fragment)
}
}
}

fun AppCompatActivity.showError() {
supportFragmentManager.commit(allowStateLoss = true) {
add(ErrorFullScreenDialogFragment.newInstance(), ErrorFullScreenDialogFragment.TAG)
}
}

fun AppCompatActivity.hideError() {
supportFragmentManager.findFragmentByTag(ErrorFullScreenDialogFragment.TAG)?.let { fragment ->
supportFragmentManager.commit(allowStateLoss = true) {
remove(fragment)
}
fun AppCompatActivity.replaceFragment(containerViewId: Int, fragment: Fragment) {
supportFragmentManager.commit {
replace(containerViewId, fragment)
}
}

0 comments on commit 14acbfb

Please sign in to comment.