Skip to content

Commit b42df9f

Browse files
committed
see o1/31 log
1 parent f9cd67c commit b42df9f

File tree

2 files changed

+17
-21
lines changed

2 files changed

+17
-21
lines changed

utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/feature/fragment/ChildFragment.kt

+17-15
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ import android.view.View
66
import android.widget.TextView
77
import com.blankj.lib.base.BaseFragment
88
import com.blankj.utilcode.pkg.R
9+
import com.blankj.utilcode.pkg.helper.DialogHelper
910
import com.blankj.utilcode.util.FragmentUtils
1011
import com.blankj.utilcode.util.LogUtils
12+
import com.blankj.utilcode.util.SpanUtils
1113
import java.util.*
1214

1315
/**
@@ -20,8 +22,6 @@ import java.util.*
2022
*/
2123
class 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-
+ "\ntopInStack: " + FragmentUtils.getSimpleName(FragmentUtils.getTopInStack(fragmentManager!!))
51-
+ "\ntopShow: " + FragmentUtils.getSimpleName(FragmentUtils.getTopShow(fragmentManager!!))
52-
+ "\ntopShowInStack: " + 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;

utilcode/pkg/src/main/res/layout/fragment_child.xml

-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,6 @@
77
android:orientation="vertical"
88
android:padding="@dimen/spacing_16">
99

10-
<TextView
11-
android:id="@+id/fragmentRootAboutTv"
12-
style="@style/TextStyle"
13-
android:layout_width="match_parent"
14-
android:layout_height="wrap_content" />
15-
1610
<Button
1711
android:id="@+id/fragmentRootShowAboutBtn"
1812
style="@style/WideBtnStyle"

0 commit comments

Comments
 (0)