34 lines
1.4 KiB
Java
34 lines
1.4 KiB
Java
package com.mango.moshen.common;
|
|
|
|
import android.content.Context;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.widget.ImageView;
|
|
import android.widget.TextView;
|
|
|
|
import com.mango.moshen.R;
|
|
import com.mango.xchat_android_library.utils.NetworkUtils;
|
|
|
|
|
|
public class EmptyViewHelper {
|
|
|
|
public static View createEmptyView(Context context, String text) {
|
|
if (!NetworkUtils.isNetworkAvailable(context)) text = "网络异常,请检查网络再试~";
|
|
View view = LayoutInflater.from(context).inflate(R.layout.layout_ktv_empty, null);
|
|
view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
|
((TextView) view.findViewById(R.id.tv_hint)).setText(text);
|
|
return view;
|
|
}
|
|
|
|
public static View createDarkEmptyView(Context context, String text) {
|
|
if (!NetworkUtils.isNetworkAvailable(context)) text = "网络异常,请检查网络再试~";
|
|
View view = LayoutInflater.from(context).inflate(R.layout.layout_ktv_empty, null);
|
|
view.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
|
|
((TextView) view.findViewById(R.id.tv_hint)).setText(text);
|
|
((ImageView) view.findViewById(R.id.iv_status)).setImageResource(R.drawable.empty_content_dark);
|
|
return view;
|
|
}
|
|
|
|
}
|