@@ -6,8 +6,10 @@ import android.view.View
66import android.widget.TextView
77import com.blankj.lib.base.BaseFragment
88import com.blankj.utilcode.pkg.R
9+ import com.blankj.utilcode.pkg.helper.DialogHelper
910import com.blankj.utilcode.util.FragmentUtils
1011import com.blankj.utilcode.util.LogUtils
12+ import com.blankj.utilcode.util.SpanUtils
1113import java.util.*
1214
1315/* *
@@ -20,8 +22,6 @@ import java.util.*
2022 */
2123class ChildFragment : BaseFragment (), FragmentUtils.OnBackClickListener {
2224
23- private var tvAboutFragment: TextView ? = null
24-
2525 override fun initData (bundle : Bundle ? ) {
2626
2727 }
@@ -35,28 +35,30 @@ class ChildFragment : BaseFragment(), FragmentUtils.OnBackClickListener {
3535 FragmentUtils .setBackgroundColor(this , Color .rgb(random.nextInt(256 ), random.nextInt(256 ), random.nextInt(256 )))
3636 findViewById<View >(R .id.fragmentRootShowAboutBtn).setOnClickListener(this )
3737 findViewById<View >(R .id.btn_pop).setOnClickListener(this )
38- tvAboutFragment = findViewById(R .id.fragmentRootAboutTv)
3938 }
4039
4140 override fun doBusiness () {
4241
4342 }
4443
4544 override fun onWidgetClick (view : View ) {
46- tvAboutFragment!! .text = " "
4745 val i = view.id
4846 if (i == R .id.fragmentRootShowAboutBtn) {
49- tvAboutFragment!! .text = (" top: " + FragmentUtils .getSimpleName(FragmentUtils .getTop(fragmentManager!! ))
50- + " \n topInStack: " + FragmentUtils .getSimpleName(FragmentUtils .getTopInStack(fragmentManager!! ))
51- + " \n topShow: " + FragmentUtils .getSimpleName(FragmentUtils .getTopShow(fragmentManager!! ))
52- + " \n topShowInStack: " + FragmentUtils .getSimpleName(FragmentUtils .getTopShowInStack(fragmentManager!! ))
53- + " \n ---all of fragments---\n "
54- + FragmentUtils .getAllFragments(fragmentManager!! ).toString()
55- + " \n ----------------------\n\n "
56- + " ---stack top---\n "
57- + FragmentUtils .getAllFragmentsInStack(fragmentManager!! ).toString()
58- + " \n ---stack bottom---\n\n " )
59-
47+ DialogHelper .showFragmentDialog(
48+ SpanUtils ().appendLine(" top: " + FragmentUtils .getSimpleName(FragmentUtils .getTop(fragmentManager!! )))
49+ .appendLine(" topInStack: " + FragmentUtils .getSimpleName(FragmentUtils .getTopInStack(fragmentManager!! )))
50+ .appendLine(" topShow: " + FragmentUtils .getSimpleName(FragmentUtils .getTopShow(fragmentManager!! )))
51+ .appendLine(" topShowInStack: " + FragmentUtils .getSimpleName(FragmentUtils .getTopShowInStack(fragmentManager!! )))
52+ .appendLine()
53+ .appendLine(" ---all of fragments---" )
54+ .appendLine(FragmentUtils .getAllFragments(fragmentManager!! ).toString())
55+ .appendLine(" ----------------------" )
56+ .appendLine()
57+ .appendLine(" ---stack top---" )
58+ .appendLine(FragmentUtils .getAllFragmentsInStack(fragmentManager!! ).toString())
59+ .appendLine(" ---stack bottom---" )
60+ .create()
61+ )
6062 // case R.id.btn_pop:
6163 // FragmentUtils.popFragment(getFragmentManager());
6264 // break;
0 commit comments