From ae5ab11867f5c55dc232a53be99a60d5adff3b7e Mon Sep 17 00:00:00 2001 From: weikaiyun Date: Thu, 10 Sep 2020 18:12:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/build.gradle | 4 ++-- .../com/common/weikaiyun/demo/ui/DemoActivity.kt | 4 ++-- .../com/common/weikaiyun/demo/ui/DemoFragment1.kt | 4 ++-- .../com/common/weikaiyun/demo/ui/DemoFragment2.kt | 3 ++- .../com/common/weikaiyun/demo/ui/DemoFragment3.kt | 4 ++-- .../com/common/weikaiyun/demo/ui/DemoFragment4.kt | 4 ++-- .../com/common/weikaiyun/demo/ui/DemoFragment5.kt | 4 ++-- .../{SupportActivity.java => BaseActivity.java} | 14 +++++++------- .../{SupportFragment.java => BaseFragment.java} | 6 +++--- 9 files changed, 24 insertions(+), 23 deletions(-) rename fragmentation/src/main/java/com/weikaiyun/fragmentation/{SupportActivity.java => BaseActivity.java} (91%) rename fragmentation/src/main/java/com/weikaiyun/fragmentation/{SupportFragment.java => BaseFragment.java} (98%) diff --git a/app/build.gradle b/app/build.gradle index adcfacd..63f0782 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -49,8 +49,8 @@ kapt { dependencies { implementation fileTree(dir: 'libs', include: ['*.jar']) - //implementation project(':fragmentation') - implementation 'com.github.weikaiyun:EasyFragmentation:1.0.5' + implementation project(':fragmentation') + //implementation 'com.github.weikaiyun:EasyFragmentation:1.0.5' implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${versions.kotlin}" implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:${versions.kotlinx_coroutines}" diff --git a/app/src/main/java/com/common/weikaiyun/demo/ui/DemoActivity.kt b/app/src/main/java/com/common/weikaiyun/demo/ui/DemoActivity.kt index ff553bb..bdff4c9 100644 --- a/app/src/main/java/com/common/weikaiyun/demo/ui/DemoActivity.kt +++ b/app/src/main/java/com/common/weikaiyun/demo/ui/DemoActivity.kt @@ -8,9 +8,9 @@ import androidx.lifecycle.lifecycleScope import com.common.weikaiyun.R import com.common.weikaiyun.demo.db.User import com.common.weikaiyun.demo.viewmodel.UserViewModel -import com.weikaiyun.fragmentation.SupportActivity +import com.weikaiyun.fragmentation.BaseActivity -class DemoActivity : SupportActivity() { +class DemoActivity : BaseActivity() { override fun getContentViewID(): Int = R.layout.activity_demo diff --git a/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment1.kt b/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment1.kt index a394a4e..7f9fe35 100644 --- a/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment1.kt +++ b/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment1.kt @@ -4,11 +4,11 @@ import android.os.Bundle import android.view.View import com.common.weikaiyun.R import com.common.weikaiyun.util.trigger -import com.weikaiyun.fragmentation.SupportFragment +import com.weikaiyun.fragmentation.BaseFragment import com.weikaiyun.fragmentation.fragmentargument.argument import kotlinx.android.synthetic.main.fragment_demo.* -class DemoFragment1 : SupportFragment() { +class DemoFragment1 : BaseFragment() { private var param1: Int by argument() private var param2: String by argument() companion object { diff --git a/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment2.kt b/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment2.kt index 5241b36..de61703 100644 --- a/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment2.kt +++ b/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment2.kt @@ -4,10 +4,11 @@ import android.os.Bundle import android.view.View import com.common.weikaiyun.R import com.common.weikaiyun.util.trigger +import com.weikaiyun.fragmentation.BaseFragment import com.weikaiyun.fragmentation.fragmentargument.argument import kotlinx.android.synthetic.main.fragment_demo.* -class DemoFragment2: com.weikaiyun.fragmentation.SupportFragment() { +class DemoFragment2: BaseFragment() { private var param1: Int by argument() private var param2: String by argument() companion object { diff --git a/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment3.kt b/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment3.kt index 3799268..e2870ff 100644 --- a/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment3.kt +++ b/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment3.kt @@ -4,11 +4,11 @@ import android.os.Bundle import android.view.View import com.common.weikaiyun.R import com.common.weikaiyun.util.trigger -import com.weikaiyun.fragmentation.SupportFragment +import com.weikaiyun.fragmentation.BaseFragment import com.weikaiyun.fragmentation.fragmentargument.argument import kotlinx.android.synthetic.main.fragment_demo.* -class DemoFragment3: SupportFragment() { +class DemoFragment3: BaseFragment() { private var param1: Int by argument() private var param2: String by argument() companion object { diff --git a/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment4.kt b/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment4.kt index 8b8c9a4..ab290a3 100644 --- a/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment4.kt +++ b/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment4.kt @@ -4,11 +4,11 @@ import android.os.Bundle import android.view.View import com.common.weikaiyun.R import com.common.weikaiyun.util.trigger -import com.weikaiyun.fragmentation.SupportFragment +import com.weikaiyun.fragmentation.BaseFragment import com.weikaiyun.fragmentation.fragmentargument.argument import kotlinx.android.synthetic.main.fragment_demo4.* -class DemoFragment4: SupportFragment() { +class DemoFragment4: BaseFragment() { private var param1: Int by argument() private var param2: String by argument() private var param3: String by argument() diff --git a/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment5.kt b/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment5.kt index 172129f..a54e03b 100644 --- a/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment5.kt +++ b/app/src/main/java/com/common/weikaiyun/demo/ui/DemoFragment5.kt @@ -3,11 +3,11 @@ package com.common.weikaiyun.demo.ui import android.os.Bundle import android.view.View import com.common.weikaiyun.R -import com.weikaiyun.fragmentation.SupportFragment +import com.weikaiyun.fragmentation.BaseFragment import com.weikaiyun.fragmentation.fragmentargument.argument import kotlinx.android.synthetic.main.fragment_demo.* -class DemoFragment5: SupportFragment() { +class DemoFragment5: BaseFragment() { private var param1: Int by argument() private var param2: String by argument() companion object { diff --git a/fragmentation/src/main/java/com/weikaiyun/fragmentation/SupportActivity.java b/fragmentation/src/main/java/com/weikaiyun/fragmentation/BaseActivity.java similarity index 91% rename from fragmentation/src/main/java/com/weikaiyun/fragmentation/SupportActivity.java rename to fragmentation/src/main/java/com/weikaiyun/fragmentation/BaseActivity.java index 98f462c..6b94a79 100644 --- a/fragmentation/src/main/java/com/weikaiyun/fragmentation/SupportActivity.java +++ b/fragmentation/src/main/java/com/weikaiyun/fragmentation/BaseActivity.java @@ -13,7 +13,7 @@ * {@link ISupportActivity} and * {@link AppCompatActivity} APIs. */ -abstract public class SupportActivity extends AppCompatActivity implements ISupportActivity { +abstract public class BaseActivity extends AppCompatActivity implements ISupportActivity { final SupportActivityDelegate mDelegate = new SupportActivityDelegate(this); private boolean isLoaded; @@ -147,14 +147,14 @@ public void showHideFragment(ISupportFragment showFragment, ISupportFragment hid } /** - * It is recommended to use {@link SupportFragment#start(ISupportFragment)}. + * It is recommended to use {@link BaseFragment#start(ISupportFragment)}. */ public void start(ISupportFragment toFragment) { mDelegate.start(toFragment); } /** - * It is recommended to use {@link SupportFragment#start(ISupportFragment, int)}. + * It is recommended to use {@link BaseFragment#start(ISupportFragment, int)}. * * @param launchMode Similar to Activity's LaunchMode. */ @@ -163,7 +163,7 @@ public void start(ISupportFragment toFragment, @ISupportFragment.LaunchMode int } /** - * It is recommended to use {@link SupportFragment#startForResult(ISupportFragment, int)}. + * It is recommended to use {@link BaseFragment#startForResult(ISupportFragment, int)}. * Launch an fragment for which you would like a result when it popped. */ public void startForResult(ISupportFragment toFragment, int requestCode) { @@ -171,7 +171,7 @@ public void startForResult(ISupportFragment toFragment, int requestCode) { } /** - * It is recommended to use {@link SupportFragment#startWithPop(ISupportFragment)}. + * It is recommended to use {@link BaseFragment#startWithPop(ISupportFragment)}. * Start the target Fragment and pop itself */ public void startWithPop(ISupportFragment toFragment) { @@ -179,7 +179,7 @@ public void startWithPop(ISupportFragment toFragment) { } /** - * It is recommended to use {@link SupportFragment#startWithPopTo(ISupportFragment, Class, boolean)}. + * It is recommended to use {@link BaseFragment#startWithPopTo(ISupportFragment, Class, boolean)}. * * @see #popTo(Class, boolean) * + @@ -192,7 +192,7 @@ public void startWithPopTo(ISupportFragment toFragment, Class targetFragmentC } /** - * It is recommended to use {@link SupportFragment#replaceFragment(ISupportFragment)}. + * It is recommended to use {@link BaseFragment#replaceFragment(ISupportFragment)}. */ public void replaceFragment(ISupportFragment toFragment) { mDelegate.replaceFragment(toFragment); diff --git a/fragmentation/src/main/java/com/weikaiyun/fragmentation/SupportFragment.java b/fragmentation/src/main/java/com/weikaiyun/fragmentation/BaseFragment.java similarity index 98% rename from fragmentation/src/main/java/com/weikaiyun/fragmentation/SupportFragment.java rename to fragmentation/src/main/java/com/weikaiyun/fragmentation/BaseFragment.java index cbbaa45..ff1fcfc 100644 --- a/fragmentation/src/main/java/com/weikaiyun/fragmentation/SupportFragment.java +++ b/fragmentation/src/main/java/com/weikaiyun/fragmentation/BaseFragment.java @@ -19,9 +19,9 @@ * {@link ISupportFragment} and * {@link Fragment} APIs. */ -abstract public class SupportFragment extends Fragment implements ISupportFragment { +abstract public class BaseFragment extends Fragment implements ISupportFragment { final SupportFragmentDelegate mDelegate = new SupportFragmentDelegate(this); - protected SupportActivity _mActivity; + protected BaseActivity _mActivity; private boolean isLoaded; @@ -44,7 +44,7 @@ public ExtraTransaction extraTransaction() { public void onAttach(Context context) { super.onAttach(context); mDelegate.onAttach(context); - _mActivity = (SupportActivity) mDelegate.getActivity(); + _mActivity = (BaseActivity) mDelegate.getActivity(); } @Override