From 6a96a04a4b8ee0aaef60596dd43465a6126c6326 Mon Sep 17 00:00:00 2001 From: puy <> Date: Mon, 19 Aug 2019 21:03:28 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E5=8D=87=E7=BA=A7fragmentation?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.gradle b/conf.gradle index 64a69a8..7e0ad6e 100644 --- a/conf.gradle +++ b/conf.gradle @@ -86,7 +86,7 @@ ext { "scalablevideoview" : 'com.yqritc:android-scalablevideoview:1.0.4', "mqttv3" : 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0', "SmartRefreshLayout" : 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-18', - "fragmentation" : 'me.yokeyword:fragmentation:1.3.7', + "fragmentation" : 'com.github.puyang1017:Fragmentation:1.3.8', "facebookrebound" : 'com.facebook.rebound:rebound:0.3.8', ] From 51fb9a10441055b3cd29f006bb18b980c7a660c2 Mon Sep 17 00:00:00 2001 From: puy <> Date: Mon, 19 Aug 2019 21:06:18 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E4=B8=8A=E4=BC=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- puymvpjava/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/puymvpjava/build.gradle b/puymvpjava/build.gradle index 34879f1..e731696 100644 --- a/puymvpjava/build.gradle +++ b/puymvpjava/build.gradle @@ -34,7 +34,7 @@ dependencies { api fileTree(include: ['*.jar'], dir: 'libs') api 'androidx.appcompat:appcompat:1.0.2' api 'com.google.android.material:material:1.0.0' - api 'androidx.annotation:annotation:1.0.0' + api 'androidx.annotation:annotation:1.1.0' api rootProject.ext.dependencies["xrecyclerview"] api rootProject.ext.dependencies["butterknife"] annotationProcessor rootProject.ext.dependencies["butterknife-apt"] From 3165f7cd10a8af288dccf52dc357b1f57593e509 Mon Sep 17 00:00:00 2001 From: puy <> Date: Mon, 19 Aug 2019 21:48:34 +0800 Subject: [PATCH 3/4] =?UTF-8?q?fragmentX=E5=85=BC=E5=AE=B9androidx?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- conf.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf.gradle b/conf.gradle index 7e0ad6e..df6ddff 100644 --- a/conf.gradle +++ b/conf.gradle @@ -86,7 +86,7 @@ ext { "scalablevideoview" : 'com.yqritc:android-scalablevideoview:1.0.4', "mqttv3" : 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.0', "SmartRefreshLayout" : 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-18', - "fragmentation" : 'com.github.puyang1017:Fragmentation:1.3.8', + "fragmentation" : 'com.github.puyang1017:Fragmentation:2.0.0', "facebookrebound" : 'com.facebook.rebound:rebound:0.3.8', ] From c3f858e7897e3ee0006168d689b113726907f20b Mon Sep 17 00:00:00 2001 From: puy <> Date: Mon, 19 Aug 2019 21:58:03 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BE=A7=E6=BB=91?= =?UTF-8?q?=E8=BF=94=E5=9B=9Efragment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../puymvpjava/mvp/XBackFragmentation.java | 163 ++++++++++++++++++ 1 file changed, 163 insertions(+) create mode 100644 puymvpjava/src/main/java/com/android/puy/puymvpjava/mvp/XBackFragmentation.java diff --git a/puymvpjava/src/main/java/com/android/puy/puymvpjava/mvp/XBackFragmentation.java b/puymvpjava/src/main/java/com/android/puy/puymvpjava/mvp/XBackFragmentation.java new file mode 100644 index 0000000..9016494 --- /dev/null +++ b/puymvpjava/src/main/java/com/android/puy/puymvpjava/mvp/XBackFragmentation.java @@ -0,0 +1,163 @@ +package com.android.puy.puymvpjava.mvp; + +import android.app.Activity; +import android.content.Context; +import android.graphics.Color; +import android.os.Bundle; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import androidx.annotation.Nullable; +import butterknife.Unbinder; +import com.android.puy.puymvpjava.XDroidConf; +import com.android.puy.puymvpjava.customs.material.MaterialRippleLayout; +import com.android.puy.puymvpjava.event.BusProvider; +import com.android.puy.puymvpjava.kit.KnifeKit; +import com.tbruyelle.rxpermissions2.RxPermissions; +import me.yokeyword.fragmentation_swipeback.SwipeBackFragment; +import org.greenrobot.eventbus.EventBus; + + +public abstract class XBackFragmentation

extends SwipeBackFragment implements IView

{ + + private VDelegate vDelegate; + private P p; + protected Activity context; + private View rootView; + protected LayoutInflater layoutInflater; + + private RxPermissions rxPermissions; + + private Unbinder unbinder; + + + @Nullable + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + layoutInflater = inflater; + if (rootView == null && getLayoutId() > 0) { + rootView = inflater.inflate(getLayoutId(), null); + bindUI(rootView); + } else { + ViewGroup viewGroup = (ViewGroup) rootView.getParent(); + if (viewGroup != null) { + viewGroup.removeView(rootView); + } + } + return rootView; + } + + + @Override + public void onActivityCreated(@Nullable Bundle savedInstanceState) { + super.onActivityCreated(savedInstanceState); + if (useRxBus()) { + BusProvider.getBus().register(this); + } + if (useEventBus()) { + EventBus.getDefault().register(this); + } + bindEvent(); + initData(savedInstanceState); + } + + @Override + public void bindUI(View rootView) { + unbinder = KnifeKit.bind(this, rootView); + } + + protected VDelegate getvDelegate() { + if (vDelegate == null) { + vDelegate = VDelegateBase.create(context); + } + return vDelegate; + } + + protected P getP() { + if (p == null) { + p = newP(); + if (p != null) { + p.attachV(this); + } + } + return p; + } + + @Override + public void onAttach(Context context) { + super.onAttach(context); + if (context instanceof Activity) { + this.context = (Activity) context; + } + } + + @Override + public void onDetach() { + super.onDetach(); + context = null; + } + + @Override + public boolean useEventBus() { + return false; + } + + @Override + public boolean useRxBus() { + return false; + } + + + @Override + public void onDestroyView() { + super.onDestroyView(); + if (useRxBus()) { + BusProvider.getBus().unregister(this); + } + if (useEventBus()) { + EventBus.getDefault().unregister(this); + } + if (getP() != null) { + getP().detachV(); + } + getvDelegate().destory(); + + p = null; + vDelegate = null; + } + + protected RxPermissions getRxPermissions() { + rxPermissions = new RxPermissions(getActivity()); + rxPermissions.setLogging(XDroidConf.DEV); + return rxPermissions; + } + + @Override + public int getOptionsMenuId() { + return 0; + } + + @Override + public void bindEvent() { + + } + + public void setMaterialRipple(View... views) { + for (View view : views) { + MaterialRippleLayout.on(view) + .rippleColor(Color.BLACK) + .create(); + } + } + + @Override + public void onSupportVisible() { + super.onSupportVisible(); + //在onSupportVisible实现沉浸式 + initImmersionBar(); + } + + public void initImmersionBar() { + } + +}