From 779dd8e471a5d8ec8139ad0b759fa5218710bbf6 Mon Sep 17 00:00:00 2001 From: snpmyn Date: Wed, 3 Feb 2021 11:14:55 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=8B=A5=E5=B9=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +++++----- .../java/fragmentation/base/BaseBackFragment.java | 12 ++++++------ .../main/java/fragmentation/base/BaseFragment.java | 9 +++++---- .../zhihu/fragment/fourth/ZhiHuFourthFragment.java | 2 +- .../fragment/second/other/ZhiHuDetailFragment.java | 2 +- .../second/other/ZhiHuModifyDetailFragment.java | 2 +- build.gradle | 2 +- eventbusactivityscope/build.gradle | 2 +- fragmentationcore/build.gradle | 2 +- .../java/fragmentation/SupportActivityDelegate.java | 4 ++-- .../src/main/java/fragmentation/SupportHelper.java | 6 ++++-- .../java/fragmentation/debug/DebugStackDelegate.java | 4 +--- 12 files changed, 29 insertions(+), 28 deletions(-) diff --git a/README.md b/README.md index 3608c2c..bc3a954 100644 --- a/README.md +++ b/README.md @@ -25,9 +25,9 @@ |:-:|:-:| | 示例app | implementation project(path: ':fragmentation') | | 示例app | implementation project(path: ':eventbusactivityscope') | -| 一方库FragmentationCore | api 'com.github.snpmyn.Util:*utilone*:v0.0.1.2X'(避重)| +| 一方库FragmentationCore | api 'com.github.snpmyn.Util:*utilone*:v0.0.1.3X'(避重)| | 一方库Fragmentation | api project(path: ':fragmentationcore') | -| 一方库EventbusActivityScope | implementation 'com.github.snpmyn.Util:*utilone*:v0.0.1.2X' | +| 一方库EventbusActivityScope | implementation 'com.github.snpmyn.Util:*utilone*:v0.0.1.3X' | | 一方库EventbusActivityScope | implementation 'org.greenrobot:eventbus:3.1.1' | | 二方库Util-示例app | implementation project(path: ':utilone') | | 二方库Util-示例app | implementation project(path: ':utiltwo') | @@ -69,7 +69,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.1.1' + classpath 'com.android.tools.build:gradle:4.1.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files @@ -107,8 +107,8 @@ android { } dependencies { - implementation 'com.github.snpmyn.SmartFragment:fragmentation:v0.0.1.2X' - implementation 'com.github.snpmyn.SmartFragment:eventbusactivityscope:v0.0.1.2X' + implementation 'com.github.snpmyn.SmartFragment:fragmentation:v0.0.1.3X' + implementation 'com.github.snpmyn.SmartFragment:eventbusactivityscope:v0.0.1.3X' } ``` diff --git a/app/src/main/java/fragmentation/base/BaseBackFragment.java b/app/src/main/java/fragmentation/base/BaseBackFragment.java index b825600..1eac81e 100644 --- a/app/src/main/java/fragmentation/base/BaseBackFragment.java +++ b/app/src/main/java/fragmentation/base/BaseBackFragment.java @@ -11,7 +11,6 @@ import com.google.android.material.appbar.MaterialToolbar; import com.zsp.fragmentation.SupportFragment; -import com.zsp.smartfragment.R; import butterknife.ButterKnife; import butterknife.Unbinder; @@ -140,13 +139,14 @@ public void onDetach() { abstract int layoutResId(); /** - * 初始ToolbarNavigation + * 初始 MaterialToolbarNavigation * - * @param materialToolbar MaterialToolbar + * @param materialToolbar materialToolbar + * @param resId 资源 ID */ - protected void stepToolbarNavigation(MaterialToolbar materialToolbar) { - materialToolbar.setNavigationIcon(R.drawable.back); - materialToolbar.setNavigationOnClickListener(v -> fragmentationSupportActivity.onBackPressed()); + protected void stepMaterialToolbarNavigation(MaterialToolbar materialToolbar, int resId) { + materialToolbar.setNavigationIcon(resId); + materialToolbar.setNavigationOnClickListener(view -> fragmentationSupportActivity.onBackPressed()); } /** diff --git a/app/src/main/java/fragmentation/base/BaseFragment.java b/app/src/main/java/fragmentation/base/BaseFragment.java index 5643147..9f042b5 100644 --- a/app/src/main/java/fragmentation/base/BaseFragment.java +++ b/app/src/main/java/fragmentation/base/BaseFragment.java @@ -188,12 +188,13 @@ public void onDetach() { protected abstract int layoutResId(); /** - * 初始ToolbarNavigation + * 初始 MaterialToolbarNavigation * - * @param materialToolbar toolbar + * @param materialToolbar materialToolbar + * @param resId 资源 ID */ - protected void stepToolbarNavigation(MaterialToolbar materialToolbar) { - materialToolbar.setNavigationIcon(R.drawable.back); + protected void stepMaterialToolbarNavigation(MaterialToolbar materialToolbar, int resId) { + materialToolbar.setNavigationIcon(resId); materialToolbar.setNavigationOnClickListener(view -> fragmentationSupportActivity.onBackPressed()); } diff --git a/app/src/main/java/fragmentation/zhihu/fragment/fourth/ZhiHuFourthFragment.java b/app/src/main/java/fragmentation/zhihu/fragment/fourth/ZhiHuFourthFragment.java index 210b552..b6b0920 100644 --- a/app/src/main/java/fragmentation/zhihu/fragment/fourth/ZhiHuFourthFragment.java +++ b/app/src/main/java/fragmentation/zhihu/fragment/fourth/ZhiHuFourthFragment.java @@ -51,7 +51,7 @@ protected void eventBusRegister() { @Override protected void stepUi(View view) { MaterialToolbar materialToolbar = view.findViewById(R.id.zhiHuFragmentFourthMt); - stepToolbarNavigation(materialToolbar); + stepMaterialToolbarNavigation(materialToolbar, R.drawable.back); } /** diff --git a/app/src/main/java/fragmentation/zhihu/fragment/second/other/ZhiHuDetailFragment.java b/app/src/main/java/fragmentation/zhihu/fragment/second/other/ZhiHuDetailFragment.java index 5e7805a..67ef9a3 100644 --- a/app/src/main/java/fragmentation/zhihu/fragment/second/other/ZhiHuDetailFragment.java +++ b/app/src/main/java/fragmentation/zhihu/fragment/second/other/ZhiHuDetailFragment.java @@ -94,7 +94,7 @@ protected void eventBusRegister() { @Override protected void stepUi(View view) { materialToolbar.setTitle(mTitle); - stepToolbarNavigation(materialToolbar); + stepMaterialToolbarNavigation(materialToolbar, R.drawable.back); } /** diff --git a/app/src/main/java/fragmentation/zhihu/fragment/second/other/ZhiHuModifyDetailFragment.java b/app/src/main/java/fragmentation/zhihu/fragment/second/other/ZhiHuModifyDetailFragment.java index e1f0377..9a9c15b 100644 --- a/app/src/main/java/fragmentation/zhihu/fragment/second/other/ZhiHuModifyDetailFragment.java +++ b/app/src/main/java/fragmentation/zhihu/fragment/second/other/ZhiHuModifyDetailFragment.java @@ -89,7 +89,7 @@ protected void eventBusRegister() { @Override protected void stepUi(View view) { toolbarMt.setTitle(getString(R.string.testStartForResult)); - stepToolbarNavigation(toolbarMt); + stepMaterialToolbarNavigation(toolbarMt, R.drawable.back); zhiHuModifyDetailEtInput.setText(mTitle); } diff --git a/build.gradle b/build.gradle index 839ea64..c4e10dd 100644 --- a/build.gradle +++ b/build.gradle @@ -8,7 +8,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:4.1.1' + classpath 'com.android.tools.build:gradle:4.1.2' // NOTE: Do not place your application dependencies here; they belong // in the individual module build.gradle files diff --git a/eventbusactivityscope/build.gradle b/eventbusactivityscope/build.gradle index 0adea22..029ec3f 100644 --- a/eventbusactivityscope/build.gradle +++ b/eventbusactivityscope/build.gradle @@ -28,7 +28,7 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.2.0' /*自带*/ - implementation 'com.github.snpmyn.Util:utilone:v0.0.1.2X' + implementation 'com.github.snpmyn.Util:utilone:v0.0.1.3X' /*util*/ implementation 'org.greenrobot:eventbus:3.1.1' /*eventbus*/ diff --git a/fragmentationcore/build.gradle b/fragmentationcore/build.gradle index 6d78af2..e3b3ed0 100644 --- a/fragmentationcore/build.gradle +++ b/fragmentationcore/build.gradle @@ -30,6 +30,6 @@ dependencies { implementation 'androidx.appcompat:appcompat:1.2.0' /*自带*/ - api 'com.github.snpmyn.Util:utilone:v0.0.1.2X' + api 'com.github.snpmyn.Util:utilone:v0.0.1.3X' /*util*/ } diff --git a/fragmentationcore/src/main/java/fragmentation/SupportActivityDelegate.java b/fragmentationcore/src/main/java/fragmentation/SupportActivityDelegate.java index 15ab9d3..84752b3 100644 --- a/fragmentationcore/src/main/java/fragmentation/SupportActivityDelegate.java +++ b/fragmentationcore/src/main/java/fragmentation/SupportActivityDelegate.java @@ -143,8 +143,8 @@ void showFragmentStackHierarchyView() { *

* 调试用。 */ - void logFragmentStackHierarchy(String tag) { - mDebugStackDelegate.logFragmentRecords(tag); + void logFragmentStackHierarchy() { + mDebugStackDelegate.logFragmentRecords(); } /** diff --git a/fragmentationcore/src/main/java/fragmentation/SupportHelper.java b/fragmentationcore/src/main/java/fragmentation/SupportHelper.java index 208c432..da851c4 100644 --- a/fragmentationcore/src/main/java/fragmentation/SupportHelper.java +++ b/fragmentationcore/src/main/java/fragmentation/SupportHelper.java @@ -63,6 +63,7 @@ static void hideSoftInput(View view) { /** * 显栈视图对话框 + *

* 调试用。 */ public static void showFragmentStackHierarchyView(ISupportActivity support) { @@ -71,10 +72,11 @@ public static void showFragmentStackHierarchyView(ISupportActivity support) { /** * 显栈视图日志 + *

* 调试用。 */ - public static void logFragmentStackHierarchy(ISupportActivity support, String tag) { - support.getSupportDelegate().logFragmentStackHierarchy(tag); + public static void logFragmentStackHierarchy(ISupportActivity support) { + support.getSupportDelegate().logFragmentStackHierarchy(); } /** diff --git a/fragmentationcore/src/main/java/fragmentation/debug/DebugStackDelegate.java b/fragmentationcore/src/main/java/fragmentation/debug/DebugStackDelegate.java index 32f85e8..e7fa916 100644 --- a/fragmentationcore/src/main/java/fragmentation/debug/DebugStackDelegate.java +++ b/fragmentationcore/src/main/java/fragmentation/debug/DebugStackDelegate.java @@ -131,10 +131,8 @@ public void showFragmentStackHierarchyView() { * 调试相关 *

* Log形式打印栈视图。 - * - * @param tag tag */ - public void logFragmentRecords(String tag) { + public void logFragmentRecords() { List fragmentRecordList = getFragmentRecords(); if (fragmentRecordList == null) { return;