|
@@ -0,0 +1,76 @@
|
|
|
|
|
+package com.mgtech.base_library.base;
|
|
|
|
|
+
|
|
|
|
|
+import android.content.Context;
|
|
|
|
|
+import android.os.Bundle;
|
|
|
|
|
+import android.view.LayoutInflater;
|
|
|
|
|
+import android.view.View;
|
|
|
|
|
+import android.view.ViewGroup;
|
|
|
|
|
+
|
|
|
|
|
+import androidx.annotation.NonNull;
|
|
|
|
|
+import androidx.annotation.Nullable;
|
|
|
|
|
+
|
|
|
|
|
+import com.alibaba.android.arouter.launcher.ARouter;
|
|
|
|
|
+import com.google.android.material.bottomsheet.BottomSheetDialogFragment;
|
|
|
|
|
+
|
|
|
|
|
+import butterknife.ButterKnife;
|
|
|
|
|
+import butterknife.Unbinder;
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @ProjectName: BaseLibrary
|
|
|
|
|
+ * @Package: com.mgtech.base_library.base
|
|
|
|
|
+ * @ClassName: BaseBottomSheetDialogFragment
|
|
|
|
|
+ * @Description: 底部弹窗
|
|
|
|
|
+ * @Author: niusongtao
|
|
|
|
|
+ * @CreateDate: 2020/7/31 8:52
|
|
|
|
|
+ * @UpdateUser: 更新者:niusongtao
|
|
|
|
|
+ * @UpdateDate: 2020/7/31 8:52
|
|
|
|
|
+ * @UpdateRemark: 更新说明:
|
|
|
|
|
+ * @Version: 1.0
|
|
|
|
|
+ */
|
|
|
|
|
+public abstract class BaseBottomSheetDialogFragment extends BottomSheetDialogFragment {
|
|
|
|
|
+ public final String TAG = getClass().getSimpleName();
|
|
|
|
|
+ protected BaseActivity mActivity;
|
|
|
|
|
+ protected View mRootView;
|
|
|
|
|
+ protected Unbinder mBinder;
|
|
|
|
|
+
|
|
|
|
|
+ protected abstract int initLayoutId();
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ protected abstract void initView();
|
|
|
|
|
+
|
|
|
|
|
+ protected abstract void initData();
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onAttach(Context context) {
|
|
|
|
|
+ super.onAttach(context);
|
|
|
|
|
+ mActivity = (BaseActivity) context;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onCreate(@Nullable Bundle savedInstanceState) {
|
|
|
|
|
+ super.onCreate(savedInstanceState);
|
|
|
|
|
+ ARouter.getInstance().inject(this);
|
|
|
|
|
+ initData();
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Nullable
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
|
|
|
+
|
|
|
|
|
+ mRootView = inflater.inflate(initLayoutId(), container, false);
|
|
|
|
|
+ mBinder = ButterKnife.bind(this, mRootView);
|
|
|
|
|
+ initView();
|
|
|
|
|
+ return mRootView;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
|
|
|
|
+ super.onViewCreated(view, savedInstanceState);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public void onDestroyView() {
|
|
|
|
|
+ mBinder.unbind();
|
|
|
|
|
+ super.onDestroyView();
|
|
|
|
|
+ }
|
|
|
|
|
+}
|