51 lines
2.5 KiB
Java
51 lines
2.5 KiB
Java
package com.yizhuan.erban.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.yizhuan.erban.R;
|
|
import com.yizhuan.xchat_android_library.utils.NetworkUtils;
|
|
import com.yizhuan.xchat_android_library.utils.ResUtil;
|
|
|
|
|
|
public class EmptyViewHelper {
|
|
|
|
public static View createEmptyTextView(Context context, String text) {
|
|
if (!NetworkUtils.isNetworkAvailable(context)) text = ResUtil.getString(R.string.erban_common_emptyviewhelper_01);
|
|
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 createEmptyTextViewHeight(Context context, String text) {
|
|
if (!NetworkUtils.isNetworkAvailable(context)) text = ResUtil.getString(R.string.erban_common_emptyviewhelper_01);
|
|
View view = LayoutInflater.from(context).inflate(R.layout.layout_wrap_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 createEmptyTextViewNoImage(Context context, String text) {
|
|
if (!NetworkUtils.isNetworkAvailable(context)) text = ResUtil.getString(R.string.erban_common_emptyviewhelper_01);
|
|
View view = LayoutInflater.from(context).inflate(R.layout.layout_text_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 = ResUtil.getString(R.string.erban_common_emptyviewhelper_02);
|
|
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;
|
|
}
|
|
|
|
}
|