@@ -6,8 +6,10 @@ import android.view.View
6
6
import android.widget.TextView
7
7
import com.blankj.lib.base.BaseFragment
8
8
import com.blankj.utilcode.pkg.R
9
+ import com.blankj.utilcode.pkg.helper.DialogHelper
9
10
import com.blankj.utilcode.util.FragmentUtils
10
11
import com.blankj.utilcode.util.LogUtils
12
+ import com.blankj.utilcode.util.SpanUtils
11
13
import java.util.*
12
14
13
15
/* *
@@ -20,8 +22,6 @@ import java.util.*
20
22
*/
21
23
class ChildFragment : BaseFragment (), FragmentUtils.OnBackClickListener {
22
24
23
- private var tvAboutFragment: TextView ? = null
24
-
25
25
override fun initData (bundle : Bundle ? ) {
26
26
27
27
}
@@ -35,28 +35,30 @@ class ChildFragment : BaseFragment(), FragmentUtils.OnBackClickListener {
35
35
FragmentUtils .setBackgroundColor(this , Color .rgb(random.nextInt(256 ), random.nextInt(256 ), random.nextInt(256 )))
36
36
findViewById<View >(R .id.fragmentRootShowAboutBtn).setOnClickListener(this )
37
37
findViewById<View >(R .id.btn_pop).setOnClickListener(this )
38
- tvAboutFragment = findViewById(R .id.fragmentRootAboutTv)
39
38
}
40
39
41
40
override fun doBusiness () {
42
41
43
42
}
44
43
45
44
override fun onWidgetClick (view : View ) {
46
- tvAboutFragment!! .text = " "
47
45
val i = view.id
48
46
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
+ )
60
62
// case R.id.btn_pop:
61
63
// FragmentUtils.popFragment(getFragmentManager());
62
64
// break;
0 commit comments