Android仿抖音评论列表

1628820214838.gif

BottomSheetDialogFragment是可以上下滑动退出的dialogFragment,里面就是behavior起到了作用,感兴趣的可以去了解了解,我这里记录一下写过的demo。仔细观察抖音的评论列表,它底部的请输入框其实是个Textview,点击后才弹出输入的dialog弹窗,如果不这样做,会有一个问题,就是列表往下滑的时候,底部的布局并没有跟着移动。当然,我们也能做一个recycleview的底部条目为输入框,这里我采取了点击弹出真正的对话框的方式。好,下面直接上代码。

评论列表

列表fragment

public class CommendMsgDialogFragment extends BottomSheetDialogFragment {


    private RecyclerView mRecyclerView;
    private CommendAdapter mCommendAdapter;
    private FragmentCommendMsgDialogBinding mBinding;
    private String mUniquekey;
    private CommendInputDialogFragment mCommendInputDialog;

    public CommendMsgDialogFragment() {
        // Required empty public constructor
    }

    public static CommendMsgDialogFragment newInstance(String uniquekey) {
        CommendMsgDialogFragment fragment = new CommendMsgDialogFragment();
        Bundle args = new Bundle();
        args.putString("uniquekey",uniquekey);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //设置背景透明,才能显示出layout中诸如圆角的布局,否则会有白色底(框)
        setStyle(BottomSheetDialogFragment.STYLE_NORMAL, R.style.CustomBottomSheetDialogTheme);
        if (getArguments() != null) {
            mUniquekey = getArguments().getString("uniquekey");
            mUniquekey = "c322b12d56a3125e73e7b2978ff846c0";
        }
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        mBinding = DataBindingUtil.inflate(getLayoutInflater(), R.layout.fragment_commend_msg_dialog, container, false);
        return mBinding.getRoot();
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        Window window = getDialog().getWindow();
        window.requestFeature(Window.FEATURE_NO_TITLE);
        super.onActivityCreated(savedInstanceState);
        //设置背景为透明
        window.setWindowAnimations(R.style.AnimBottom);
        window.setBackgroundDrawable(ContextCompat.getDrawable(getContext(), android.R.color.transparent));
        //去除阴影
        window.setGravity(Gravity.BOTTOM);
        WindowManager.LayoutParams layoutParams = window.getAttributes();
        layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
        layoutParams.dimAmount = 0.1f;
        window.setAttributes(layoutParams);
        getDialog().setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                if(mOnDisMissCallBack != null){
                    mOnDisMissCallBack.onDismiss();
                }
                dismissAllowingStateLoss();
            }
        });
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        mRecyclerView = mBinding.mBottomSheet;
        mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        mCommendAdapter = new CommendAdapter();
        mRecyclerView.setAdapter(mCommendAdapter);
        mBinding.mTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showInputDialog();
            }
        });
        mBinding.mTvSend.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                savePost();
            }
        });
        initData();
    }

    private void showInputDialog() {
        if(mCommendInputDialog == null){
            mCommendInputDialog = CommendInputDialogFragment.newInstance(mUniquekey,mBinding.mTextView.getText().toString());
            mCommendInputDialog.setOnDisMissCallBack(new CommendInputDialogFragment.OnDisMissCallBack() {
                @Override
                public void onDismiss() {
                    mCommendInputDialog = null;
                }

                @Override
                public void saveCommend() {
                    savePost();
                }

                @Override
                public void onCommendTextChanged(String contend) {
                    mBinding.mTextView.setText(contend);
                }
            });
            mCommendInputDialog.show(getChildFragmentManager(),mCommendInputDialog.getTag());
        }
    }

    /**
     * 根据key值获取他的所有评论,按时间排序
     */
    private void initData() {
        if (BmobUser.isLogin()) {
            BmobQuery<CommentBean> query = new BmobQuery<>();
            query.addWhereEqualTo("uniquekey", mUniquekey);
            query.order("-updatedAt");
            //包含作者信息
            query.include("user");
            query.findObjects(new FindListener<CommentBean>() {
                @Override
                public void done(List<CommentBean> object, BmobException e) {
                    if (e == null) {
                        mCommendAdapter.refreshList(object);
                    } else {
                        Toast.makeText(App.getInstance(), "请求失败:"+e.getMessage(), Toast.LENGTH_SHORT).show();
                    }
                }

            });
        } else {
            Toast.makeText(App.getInstance(), "请先登录~", Toast.LENGTH_SHORT).show();
        }
    }

    /**
     * 添加一对一关联,当前用户发布帖子
     */
    private void savePost() {
        String content = mBinding.mTextView.getText().toString();
        if (TextUtils.isEmpty(content)) {
            Toast.makeText(App.getInstance(), "内容不能为空", Toast.LENGTH_SHORT).show();
            return;
        }
        if (BmobUser.isLogin()) {
            CommentBean post = new CommentBean();
            post.setContent(content);
            post.setUniquekey(mUniquekey);
            //添加一对一关联,用户关联帖子
            post.setUser(BmobUser.getCurrentUser(User.class));
            post.save(new SaveListener<String>() {
                @Override
                public void done(String s, BmobException e) {
                    if (e == null) {
                        Toast.makeText(App.getInstance(), "评论成功~", Toast.LENGTH_SHORT).show();
                    } else {
                        Toast.makeText(App.getInstance(), "评论失败:" + e.getMessage(), Toast.LENGTH_SHORT).show();
                    }
                }
            });
        } else {
            Toast.makeText(App.getInstance(), "请先登录~", Toast.LENGTH_SHORT).show();
        }
    }

    public interface OnDisMissCallBack{
        void onDismiss();
    }
    private OnDisMissCallBack mOnDisMissCallBack;

    public void setOnDisMissCallBack(OnDisMissCallBack mOnDisMissCallBack) {
        this.mOnDisMissCallBack = mOnDisMissCallBack;
    }
}

这里的initData方法是数据源,我这里用的是bmbo第三方sdk,他可以把数据存到他们的数据库中,并且可以用sql代码查询,少量的数据是免费的,适合学生党来写毕业论文。
然后是布局

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:fitsSystemWindows="true">

    <data>

    </data>

    <androidx.constraintlayout.widget.ConstraintLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:context=".fragments.dialogfragments.CommendMsgDialogFragment">

        <androidx.recyclerview.widget.RecyclerView
            android:id="@+id/mBottomSheet"
            android:layout_width="match_parent"
            android:layout_height="400dp"
            android:orientation="vertical"
            app:behavior_hideable="true"
            app:behavior_peekHeight="66dp"
            android:paddingBottom="50dp"
            app:layout_behavior="@string/bottom_sheet_behavior"
            android:background="@drawable/bg_round15_top_white"
            app:layout_constraintTop_toTopOf="parent"></androidx.recyclerview.widget.RecyclerView>
        <RelativeLayout
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="@drawable/storke_line_1dp_dcdcdc"
            android:layout_gravity="bottom"
            app:layout_constraintBottom_toBottomOf="parent">

            <TextView
                android:id="@+id/mTvSend"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="发送"
                android:textSize="16sp"
                android:textColor="@color/write"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:paddingLeft="15dp"
                android:paddingRight="15dp"
                android:layout_alignParentRight="true"
                android:layout_marginRight="15dp"
                android:layout_centerVertical="true"
                android:background="@drawable/send_commend_bg" />

            <TextView
                android:id="@+id/mTextView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minHeight="35dp"
                android:background="@drawable/et_search_bg"
                android:layout_toLeftOf="@id/mTvSend"
                android:layout_marginRight="15dp"
                android:layout_centerVertical="true"
                android:layout_marginLeft="15dp"
                android:text=""
                android:gravity="center_vertical"
                android:hint="发个评论,说不定能火"
                android:paddingTop="3dp"
                android:paddingBottom="3dp"
                android:maxLines="2"
                android:paddingLeft="10dp"
                android:paddingRight="10dp"
                android:textColor="@color/ff333333"
                android:textSize="14sp" />
        </RelativeLayout>
    </androidx.constraintlayout.widget.ConstraintLayout>
</layout>

adapter代码

public class CommendAdapter extends RecyclerView.Adapter<CommendAdapter.ViewHolder> {
    private List<CommentBean> list = new ArrayList<>();
    @NonNull
    @Override
    public ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.commend_item_layout, parent, false);
        CommendItemLayoutBinding bind = DataBindingUtil.bind(view);
        return new ViewHolder(bind);
    }

    @Override
    public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
        CommentBean commentBean = list.get(position);
        if(commentBean != null){
            if(commentBean.getUser().getAvatar() != null){
                ImageLoader.getInstance().loadCircleImage(holder.mBinding.mIvHead.getContext(),
                        commentBean.getUser().getAvatar().getUrl(),R.mipmap.default_head_img,holder.mBinding.mIvHead);
            }
            holder.mBinding.mTvNickName.setText(commentBean.getUser().getNickname());
            holder.mBinding.mTvContent.setText(commentBean.getContent());
        }
    }

    @Override
    public int getItemCount() {
        return list.size();
    }

    public void refreshList(List<CommentBean> object) {
        this.list.clear();
        this.list.addAll(object);
        notifyDataSetChanged();
    }


    public class ViewHolder extends RecyclerView.ViewHolder {
        CommendItemLayoutBinding mBinding;
        public ViewHolder(@NonNull View itemView) {
            super(itemView);
        }
        public ViewHolder(@NonNull CommendItemLayoutBinding bind) {
            super(bind.getRoot());
            mBinding = bind;
        }
    }
}

然后是条目布局

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <data>

    </data>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:paddingLeft="10dp"
        android:paddingRight="10dp"
        android:paddingTop="10dp"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:orientation="horizontal">

            <ImageView
                android:id="@+id/mIvHead"
                android:layout_width="50dp"
                android:layout_height="50dp"
                android:src="@mipmap/default_head_img" />

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="5dp"
                android:orientation="vertical">

                <TextView
                    android:id="@+id/mTvNickName"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text="昵称"
                    android:textColor="@color/ff333333"
                    android:textSize="18sp" />

                <TextView
                    android:id="@+id/mTvContent"
                    android:layout_width="wrap_content"
                    android:layout_height="wrap_content"
                    android:text=""
                    android:textColor="@color/ff949494"
                    android:textSize="14sp"
                    android:layout_marginTop="5dp" />
            </LinearLayout>
        </LinearLayout>

        <View
            android:layout_width="match_parent"
            android:layout_height="0.5dp"
            android:layout_marginTop="10dp"
            android:layout_marginBottom="10dp"
            android:background="@color/f5f5f5" />
    </LinearLayout>
</layout>

很简单的布局
好当我们点击底部的输入框时,弹出真正的输入弹窗。

mBinding.mTextView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showInputDialog();
            }
        });
private void showInputDialog() {
        if(mCommendInputDialog == null){
            mCommendInputDialog = CommendInputDialogFragment.newInstance(mUniquekey,mBinding.mTextView.getText().toString());
            mCommendInputDialog.setOnDisMissCallBack(new CommendInputDialogFragment.OnDisMissCallBack() {
                @Override
                public void onDismiss() {
                    mCommendInputDialog = null;
                }

                @Override
                public void saveCommend() {
                    savePost();
                }

                @Override
                public void onCommendTextChanged(String contend) {
                    mBinding.mTextView.setText(contend);
                }
            });
            mCommendInputDialog.show(getChildFragmentManager(),mCommendInputDialog.getTag());
        }
    }

接下来上输入框弹窗的代码

输入框

public class CommendInputDialogFragment extends DialogFragment {

    private FragmentCommendInputDialogBinding mBinding;
    private int mAllowableErrorHeight;

    public CommendInputDialogFragment() {
        // Required empty public constructor
    }

    private String mUniquekey;
    private String mContent;
    private int mLastDiff = 0;
    public static final String UNIQUEKEY = "uniquekey";
    public static final String CONTENT = "content";

    public static CommendInputDialogFragment newInstance(String uniquekey,String content) {
        CommendInputDialogFragment fragment = new CommendInputDialogFragment();
        Bundle args = new Bundle();
        args.putString(UNIQUEKEY, uniquekey);
        args.putString(CONTENT, content);
        fragment.setArguments(args);
        return fragment;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        if (getArguments() != null) {
            mUniquekey = getArguments().getString(UNIQUEKEY);
            mUniquekey = "c322b12d56a3125e73e7b2978ff846c0";
            mContent = getArguments().getString(CONTENT);
        }
    }

    @Override
    public void onActivityCreated(@Nullable Bundle savedInstanceState) {
        Window window = getDialog().getWindow();
        super.onActivityCreated(savedInstanceState);
        getDialog().setCancelable(true);
        getDialog().setCanceledOnTouchOutside(true);
        //设置背景为透明
        window.setWindowAnimations(R.style.AnimBottom);
        window.setBackgroundDrawable(ContextCompat.getDrawable(getContext(), android.R.color.transparent));
        //去除阴影
        window.setGravity(Gravity.BOTTOM);
        WindowManager.LayoutParams layoutParams = window.getAttributes();
        layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
        layoutParams.height = ViewGroup.LayoutParams.WRAP_CONTENT;
        layoutParams.dimAmount = 0.5f;
        window.setAttributes(layoutParams);
        window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE|WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
        getDialog().setOnDismissListener(new DialogInterface.OnDismissListener() {
            @Override
            public void onDismiss(DialogInterface dialog) {
                dismissDialog();
            }
        });

    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        mBinding = DataBindingUtil.bind(inflater.inflate(R.layout.fragment_commend_input_dialog, container, false));
        return mBinding.getRoot();
    }

    @Override
    public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
        super.onViewCreated(view, savedInstanceState);
        mBinding.mTvSend.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                String content = mBinding.mEditText.getText().toString();
                if (TextUtils.isEmpty(content)) {
                    Toast.makeText(App.getInstance(), "内容不能为空", Toast.LENGTH_SHORT).show();
                    return;
                }
                if (mOnDisMissCallBack != null) {
                    mOnDisMissCallBack.saveCommend();
                }
                dismissDialog();
            }
        });
        mBinding.mEditText.setFocusable(true);
        mBinding.mEditText.setFocusableInTouchMode(true);
        mBinding.mEditText.requestFocus();
        mBinding.mEditText.postDelayed(new Runnable() {
            @Override
            public void run() {
                InputMethodManager imm = (InputMethodManager) getContext()
                        .getSystemService(Context.INPUT_METHOD_SERVICE);
                imm.toggleSoftInput(0, InputMethodManager.SHOW_FORCED);
                Rect r = new Rect();
                //获取当前界面可视部分
                getActivity().getWindow().getDecorView().getRootView().getWindowVisibleDisplayFrame(r);
                //获取屏幕的高度
                int screenHeight = getActivity().getWindow().getDecorView().getRootView().getHeight();

                //此处就是用来获取键盘的高度的, 在键盘没有弹出的时候 此高度为0 键盘弹出的时候为一个正数
                mAllowableErrorHeight = screenHeight - r.bottom;
                setOnKeyBordListener();
            }
        },100);
        mBinding.mEditText.addTextChangedListener(new TextWatcher() {
            @Override
            public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            }

            @Override
            public void onTextChanged(CharSequence s, int start, int before, int count) {
                String content = mBinding.mEditText.getText().toString();
                if(mOnDisMissCallBack != null){
                    mOnDisMissCallBack.onCommendTextChanged(content);
                }
            }

            @Override
            public void afterTextChanged(Editable s) {

            }
        });
        //设置已经填过的文字,以及移动光标
        mBinding.mEditText.setText(mContent);
        if(!TextUtils.isEmpty(mContent) && mContent.length() > 0){
            mBinding.mEditText.setSelection(mContent.length());
        }
    }

    private void setOnKeyBordListener() {
        getActivity().getWindow().getDecorView().addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
            @Override
            public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
                try {
                    Rect r = new Rect();
                    //获取当前界面可视部分
                    getActivity().getWindow().getDecorView().getRootView().getWindowVisibleDisplayFrame(r);
                    //获取屏幕的高度
                    int screenHeight = getActivity().getWindow().getDecorView().getRootView().getHeight();

                    //此处就是用来获取键盘的高度的, 在键盘没有弹出的时候 此高度为0 键盘弹出的时候为一个正数
                    int heightDifference = screenHeight - r.bottom;
                    if (heightDifference > mAllowableErrorHeight && mLastDiff >= 0) {
                        //开软键盘
                    } else {
                        //关闭软键盘
                        dismissDialog();
                    }
                    mLastDiff = heightDifference;
                }catch (Exception e){
                    e.printStackTrace();
                }
            }
        });
//        mBinding.mRoot.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
//            @Override
//            public void onLayoutChange(View view, int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7) {
//                Rect r = new Rect();
//                //获取当前界面可视部分
//                getActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(r);
//                //获取屏幕的高度
//                int screenHeight = getActivity().getWindow().getDecorView().getRootView().getHeight();
//
//                //此处就是用来获取键盘的高度的, 在键盘没有弹出的时候 此高度为0 键盘弹出的时候为一个正数
//                int heightDifference = screenHeight - r.bottom;
//                if (heightDifference <= mAllowableErrorHeight && mLastDiff >= 0) {
//                    //开软键盘
//                } else {
//                    //关闭软键盘
//                    dismissDialog();
//                }
//                Log.d("yanjin","heightDifference = "+heightDifference+" mLastDiff="+mLastDiff);
//                mLastDiff = heightDifference;
//            }
//        });
    }

    private void dismissDialog() {
        if (mOnDisMissCallBack != null) {
            mOnDisMissCallBack.onDismiss();
        }
        dismissAllowingStateLoss();
    }

    @Override
    public void dismiss() {
        super.dismiss();
        mLastDiff = 0;
    }

    public interface OnDisMissCallBack {
        void onDismiss();
        void saveCommend();
        void onCommendTextChanged(String contend);
    }

    private OnDisMissCallBack mOnDisMissCallBack;

    public void setOnDisMissCallBack(OnDisMissCallBack mOnDisMissCallBack) {
        this.mOnDisMissCallBack = mOnDisMissCallBack;
    }
}

布局

<?xml version="1.0" encoding="utf-8"?>
<layout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools">

    <data>

    </data>

    <FrameLayout
        android:id="@+id/mRoot"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        tools:context=".adapter.CommendInputDialogFragment">

        <RelativeLayout
            android:id="@+id/rldlgview"
            android:layout_width="match_parent"
            android:layout_height="50dp"
            android:background="@drawable/storke_line_1dp_dcdcdc">

            <TextView
                android:id="@+id/mTvSend"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="发送"
                android:textSize="16sp"
                android:textColor="@color/write"
                android:paddingTop="5dp"
                android:paddingBottom="5dp"
                android:paddingLeft="15dp"
                android:paddingRight="15dp"
                android:layout_alignParentRight="true"
                android:layout_marginRight="15dp"
                android:layout_centerVertical="true"
                android:background="@drawable/send_commend_bg" />

            <EditText
                android:id="@+id/mEditText"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:minHeight="35dp"
                android:background="@drawable/et_search_bg"
                android:layout_toLeftOf="@id/mTvSend"
                android:layout_marginRight="15dp"
                android:layout_centerVertical="true"
                android:layout_marginLeft="15dp"
                android:text=""
                android:hint="发个评论,说不定能火"
                android:paddingTop="3dp"
                android:paddingBottom="3dp"
                android:maxLines="2"
                android:gravity="center_vertical"
                android:paddingLeft="10dp"
                android:paddingRight="10dp"
                android:textColor="@color/ff333333"
                android:textSize="14sp" />
        </RelativeLayout>

    </FrameLayout>
</layout>

仔细观察抖音,他是点击弹窗外部,隐藏dialog和软键盘、点击物理返回键隐藏dialog、点击软键盘的收起按钮隐藏dialog。这三点很重要

//解决点击弹窗外部,隐藏dialog和软键盘
getDialog().setCanceledOnTouchOutside(true);

而点击物理返回键隐藏dialog、点击软键盘的收起按钮隐藏dialog这两个其实都只要监听软键盘隐藏就可以了,那怎么做呢?看下面的代码。

private void setOnKeyBordListener() {
        mBinding.rldlgview.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {
            @Override
            public void onLayoutChange(View view, int i, int i1, int i2, int i3, int i4, int i5, int i6, int i7) {
                Rect r = new Rect();
                //获取当前界面可视部分
                getActivity().getWindow().getDecorView().getWindowVisibleDisplayFrame(r);
                //获取屏幕的高度
                int screenHeight = getActivity().getWindow().getDecorView().getRootView().getHeight();
                //此处就是用来获取键盘的高度的, 在键盘没有弹出的时候 此高度为0 键盘弹出的时候为一个正数
                int heightDifference = screenHeight - r.bottom;

                if (heightDifference <= 0 && mLastDiff >= 0) {
                    //开软键盘
                } else {
                    //关闭软键盘
                    dismissDialog();
                }
                mLastDiff = heightDifference;
            }
        });
    }

好,写完收工。
哦,对了怎么调起弹窗呢?看如下代码即可:

if(mCommendMsgDialogFragment == null){
                mCommendMsgDialogFragment = CommendMsgDialogFragment.newInstance(uniquekey);
                mCommendMsgDialogFragment.setOnDisMissCallBack(new CommendMsgDialogFragment.OnDisMissCallBack() {
                    @Override
                    public void onDismiss() {
                        mCommendMsgDialogFragment = null;
                    }
                });
                mCommendMsgDialogFragment.show(getSupportFragmentManager(), mCommendMsgDialogFragment.getTag());
            }

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,013评论 6 481
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,205评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 152,370评论 0 342
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,168评论 1 278
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,153评论 5 371
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,954评论 1 283
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,271评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,916评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,382评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,877评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,989评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,624评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,209评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,199评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,418评论 1 260
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,401评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,700评论 2 345

推荐阅读更多精彩内容