Commit 07b4b57f authored by zhang_z's avatar zhang_z

emptyView;

parent b50ebd43
package com.xingdata.zzdpos.ui.settle.fragment; package com.xingdata.zzdpos.ui.settle.fragment;
import android.annotation.SuppressLint;
import android.support.v7.widget.LinearLayoutManager; import android.support.v7.widget.LinearLayoutManager;
import android.view.View;
import android.widget.TextView;
import com.xingdata.zzdpos.C; import com.xingdata.zzdpos.C;
import com.xingdata.zzdpos.R; import com.xingdata.zzdpos.R;
...@@ -25,10 +28,16 @@ public class VipFragment extends BaseFragment<SettlePresenter, FragmentSettleVip ...@@ -25,10 +28,16 @@ public class VipFragment extends BaseFragment<SettlePresenter, FragmentSettleVip
@Override @Override
public void initView() { public void initView() {
mViewBinding.setEmpty(true);
mVipAdapter = new VipAdapter(); mVipAdapter = new VipAdapter();
mViewBinding.rlVip.setAdapter(mVipAdapter); mViewBinding.rlVip.setAdapter(mVipAdapter);
mViewBinding.rlVip.setLayoutManager(new LinearLayoutManager(mContext)); mViewBinding.rlVip.setLayoutManager(new LinearLayoutManager(mContext));
@SuppressLint("InflateParams") View emptyView = getLayoutInflater().inflate(R.layout.view_empty, null);
((TextView) emptyView.findViewById(R.id.tv_empty)).setText(R.string.settle_vip_search_empty);
mVipAdapter.setEmptyView(emptyView);
mVipAdapter.setOnItemClickListener((adapter, view, position) -> { mVipAdapter.setOnItemClickListener((adapter, view, position) -> {
mPresenter.selectVip(mVipAdapter.getData().get(position)); mPresenter.selectVip(mVipAdapter.getData().get(position));
this.pop(); this.pop();
...@@ -45,6 +54,7 @@ public class VipFragment extends BaseFragment<SettlePresenter, FragmentSettleVip ...@@ -45,6 +54,7 @@ public class VipFragment extends BaseFragment<SettlePresenter, FragmentSettleVip
* @param vips 会员列表 * @param vips 会员列表
*/ */
public void loadVips(List<Vip> vips) { public void loadVips(List<Vip> vips) {
mViewBinding.setEmpty(vips.size() == 0);
mVipAdapter.setNewData(vips); mVipAdapter.setNewData(vips);
} }
......
...@@ -2,6 +2,16 @@ ...@@ -2,6 +2,16 @@
<layout xmlns:android="http://schemas.android.com/apk/res/android" <layout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
<data>
<import type="android.view.View" />
<variable
name="empty"
type="boolean" />
</data>
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
...@@ -43,11 +53,19 @@ ...@@ -43,11 +53,19 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width" android:layout_height="@dimen/all_line_width"
android:layout_marginBottom="@dimen/all_margin" android:layout_marginBottom="@dimen/all_margin"
android:background="@color/gray_huanggai"
android:visibility="@{empty?View.GONE:View.VISIBLE}" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:background="@color/gray_huanggai" /> android:background="@color/gray_huanggai" />
<android.support.v7.widget.RecyclerView <android.support.v7.widget.RecyclerView
android:id="@+id/rl_vip" android:id="@+id/rl_vip"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" /> android:layout_height="match_parent" />
</LinearLayout> </LinearLayout>
</layout> </layout>
\ No newline at end of file
...@@ -93,7 +93,11 @@ ...@@ -93,7 +93,11 @@
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toBottomOf="parent" /> app:layout_constraintTop_toBottomOf="parent" />
<View
android:layout_width="match_parent"
android:layout_height="@dimen/all_line_width"
android:background="@color/gray_huanggai"
app:layout_constraintBottom_toBottomOf="parent" />
</android.support.constraint.ConstraintLayout> </android.support.constraint.ConstraintLayout>
</layout> </layout>
......
...@@ -12,11 +12,10 @@ ...@@ -12,11 +12,10 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawablePadding="@dimen/all_margin" android:drawablePadding="@dimen/all_margin"
android:drawableTop="@mipmap/icon_things_null" android:drawableTop="@mipmap/nong"
android:gravity="center" android:gravity="center"
android:lineSpacingExtra="@dimen/all_padding" android:lineSpacingExtra="@dimen/all_padding"
android:text="@string/empty_other_select" android:textColor="@color/gray_huanggai"
android:textColor="@color/white_half" android:textSize="@dimen/all_text_size" />
android:textSize="@dimen/all_text_size_big" />
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -524,6 +524,7 @@ ...@@ -524,6 +524,7 @@
<!--支付里的Vip--> <!--支付里的Vip-->
<string name="settle_vip_search_hint">请输入会员手机号</string> <string name="settle_vip_search_hint">请输入会员手机号</string>
<string name="settle_vip_search_empty">请输入会员手机号进行搜索~</string>
<string name="settle_vip_none">不需要会员</string> <string name="settle_vip_none">不需要会员</string>
...@@ -562,5 +563,4 @@ ...@@ -562,5 +563,4 @@
<string name="statistics_todayVipAdd_hint">今日新增会员</string> <string name="statistics_todayVipAdd_hint">今日新增会员</string>
</resources> </resources>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment