722 lines
32 KiB
Java
722 lines
32 KiB
Java
package cn.shangyu.gdxzExpert.activity;
|
|
|
|
import static cn.shangyu.gdxzExpert.utils.StringUtil.ReplaceLike;
|
|
import static cn.shangyu.gdxzExpert.utils.StringUtil.fenGetYuanFormat1;
|
|
import static cn.shangyu.gdxzExpert.utils.UIUtils.getContext;
|
|
import static cn.shangyu.gdxzExpert.utils.Url.getCourseIndexSearch;
|
|
|
|
import android.content.Context;
|
|
import android.content.Intent;
|
|
import android.graphics.Color;
|
|
import android.graphics.Paint;
|
|
import android.os.Bundle;
|
|
import android.os.Handler;
|
|
import android.os.Looper;
|
|
import android.os.Message;
|
|
import android.text.Html;
|
|
import android.view.Gravity;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.inputmethod.InputMethodManager;
|
|
import android.widget.AdapterView;
|
|
import android.widget.BaseExpandableListAdapter;
|
|
import android.widget.EditText;
|
|
import android.widget.ExpandableListView;
|
|
import android.widget.ImageView;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.TextView;
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
import androidx.appcompat.widget.Toolbar;
|
|
|
|
import com.google.gson.Gson;
|
|
import com.gyf.immersionbar.ImmersionBar;
|
|
import com.lidroid.xutils.util.LogUtils;
|
|
import com.nostra13.universalimageloader.core.ImageLoader;
|
|
|
|
import java.io.InputStream;
|
|
import java.io.OutputStream;
|
|
import java.io.Serializable;
|
|
import java.net.HttpURLConnection;
|
|
import java.net.URL;
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import cn.shangyu.gdxzExpert.R;
|
|
import cn.shangyu.gdxzExpert.bean.CourseIndexSearchBean;
|
|
import cn.shangyu.gdxzExpert.bean.TimestampBean;
|
|
import cn.shangyu.gdxzExpert.http.HttpHelper;
|
|
import cn.shangyu.gdxzExpert.polyvplayer.CourseDetailPolyvPlayerActivity;
|
|
import cn.shangyu.gdxzExpert.report.CommUtil;
|
|
import cn.shangyu.gdxzExpert.report.ReportService;
|
|
import cn.shangyu.gdxzExpert.report.reportBean;
|
|
import cn.shangyu.gdxzExpert.utils.Constant;
|
|
import cn.shangyu.gdxzExpert.utils.GsonTools;
|
|
import cn.shangyu.gdxzExpert.utils.ImageOptions;
|
|
import cn.shangyu.gdxzExpert.utils.LogUtil;
|
|
import cn.shangyu.gdxzExpert.utils.SharePrefUtil;
|
|
import cn.shangyu.gdxzExpert.utils.SignUtil;
|
|
import cn.shangyu.gdxzExpert.utils.StreamTool;
|
|
import cn.shangyu.gdxzExpert.utils.StringUtil;
|
|
import cn.shangyu.gdxzExpert.utils.ToastUtil;
|
|
import cn.shangyu.gdxzExpert.utils.UIUtils;
|
|
import cn.shangyu.gdxzExpert.utils.UpdateVersionUtils;
|
|
import cn.shangyu.gdxzExpert.utils.Url;
|
|
import cn.shangyu.gdxzExpert.widget.CircularRectangle;
|
|
import cn.shangyu.gdxzExpert.widget.CommentExpandableListView;
|
|
import cn.shangyu.gdxzExpert.widget.WordWrapView;
|
|
|
|
public class SearchClassActivity extends AppCompatActivity implements AdapterView.OnItemClickListener {
|
|
private TextView tv_public_ser;
|
|
private EditText tv_top_search;
|
|
private ImageView top_back;
|
|
private LinearLayout ll_empty;
|
|
private String searchStr;
|
|
|
|
CommentExpandableListView expandableListView;
|
|
List<CourseIndexSearchBean.SearchBean> data=new ArrayList<>();
|
|
public static final int GETINDEXSEARCH= 101;
|
|
private SearchExpandAdapter adapter;
|
|
Toolbar mToolbar;
|
|
|
|
@Override
|
|
protected void onCreate(Bundle savedInstanceState) {
|
|
super.onCreate(savedInstanceState);
|
|
setContentView(R.layout.activity_search_class);
|
|
mToolbar=findViewById(R.id.toolbar);
|
|
ImmersionBar.with(this).keyboardEnable(true).statusBarDarkFont(true).titleBar(mToolbar).init();
|
|
tv_public_ser=findViewById(R.id.tv_public_ser);
|
|
tv_top_search = (EditText) findViewById(R.id.tv_top_search);
|
|
top_back=findViewById(R.id.top_back);
|
|
|
|
ll_empty=findViewById(R.id.ll_empty);
|
|
expandableListView = findViewById(R.id.search_expandableListView);
|
|
top_back.setOnClickListener(new View.OnClickListener() {
|
|
@Override
|
|
public void onClick(View v) {
|
|
finish();
|
|
}
|
|
});
|
|
tv_public_ser.setOnClickListener(new View.OnClickListener() {
|
|
@Override
|
|
public void onClick(View v) {
|
|
searchStr = tv_top_search.getText().toString().trim();
|
|
if (StringUtil.isEmpty(searchStr)) {
|
|
ToastUtil.showMessage("请输入搜索内容");
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
needreport("精品课");
|
|
View view = getWindow().peekDecorView();
|
|
if (view != null) {
|
|
InputMethodManager inputmanger = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
|
|
inputmanger.hideSoftInputFromWindow(view.getWindowToken(), 0);
|
|
}
|
|
search(searchStr);
|
|
}
|
|
}
|
|
});
|
|
|
|
}
|
|
private void initExpandableListView()
|
|
{
|
|
expandableListView.setGroupIndicator(null);
|
|
adapter=new SearchExpandAdapter(this,data);
|
|
expandableListView.setAdapter(adapter);
|
|
if(data!=null&&data.size()>0)
|
|
{
|
|
|
|
for(int i=0;i<data.size();i++)
|
|
{
|
|
expandableListView.expandGroup(i);
|
|
}
|
|
|
|
}
|
|
|
|
expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
|
|
@Override
|
|
public boolean onGroupClick(ExpandableListView expandableListView, View view, int groupPosition, long l) {
|
|
|
|
Intent intent=new Intent(SearchClassActivity.this, CourseDetailPolyvPlayerActivity.class);
|
|
intent.putExtra("excellentcourse_id",data.get(groupPosition).getId()+"");
|
|
startActivity(intent);
|
|
|
|
return true;
|
|
}
|
|
});
|
|
|
|
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
|
|
@Override
|
|
public boolean onChildClick(ExpandableListView expandableListView, View view, int groupPosition, int childPosition, long l) {
|
|
Intent intent=new Intent(SearchClassActivity.this, CourseDetailPolyvPlayerActivity.class);
|
|
intent.putExtra("excellentcourse_id",data.get(groupPosition).getId()+"");
|
|
intent.putExtra("opencontents",data.get(groupPosition).getSearch_second_list().get(childPosition).getExcellentcourse_first_title_id());
|
|
intent.putExtra("openid",data.get(groupPosition).getSearch_second_list().get(childPosition).getId());
|
|
startActivity(intent);
|
|
|
|
return false;
|
|
}
|
|
});
|
|
|
|
expandableListView.setOnGroupExpandListener(new ExpandableListView.OnGroupExpandListener() {
|
|
@Override
|
|
public void onGroupExpand(int groupPosition) {
|
|
//toast("展开第"+groupPosition+"个分组");
|
|
|
|
}
|
|
});
|
|
}
|
|
private void search(String title)
|
|
{
|
|
|
|
Map<String, String> param = new HashMap<>();
|
|
param.put("title",title);
|
|
sendJsonPostParamtoNetSignMD5(getCourseIndexSearch,param,GETINDEXSEARCH);
|
|
}
|
|
CourseIndexSearchBean courseIndexSearchBean;
|
|
@Override
|
|
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
|
|
|
|
}
|
|
private Handler handler=new Handler(){
|
|
|
|
@Override
|
|
public void handleMessage(Message msg) {
|
|
switch (msg.what)
|
|
{
|
|
case GETINDEXSEARCH:
|
|
String str=(String) msg.obj;
|
|
courseIndexSearchBean= GsonTools.fromGsonToBean(str, CourseIndexSearchBean.class);
|
|
if("200".equals(courseIndexSearchBean.getCode())&&
|
|
courseIndexSearchBean.getData()!=null&&courseIndexSearchBean.getData().size()>0)
|
|
{
|
|
data.clear();
|
|
data.addAll(courseIndexSearchBean.getData());
|
|
ll_empty.setVisibility(View.GONE);
|
|
|
|
|
|
if (adapter == null) {
|
|
initExpandableListView();
|
|
|
|
} else {
|
|
adapter.refresh(expandableListView,data);
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
ll_empty.setVisibility(View.VISIBLE);
|
|
// ToastUtil.showToast(courseIndexSearchBean.getMessage()+"");
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
}
|
|
};
|
|
|
|
/**
|
|
* 2018.6.14加密请求(患者端)
|
|
*/
|
|
public void sendJsonPostParamtoNetSignMD5(final String postUrl,
|
|
final Map<String, String> param, final int callType) {
|
|
param.put("user_uuid", SharePrefUtil.getString(getContext(), "uuid", ""));
|
|
param.put("client_type", "A");
|
|
param.put("version", UpdateVersionUtils.getVersionName());
|
|
LogUtils.e("user_uuid+version = " + SharePrefUtil.getString(getContext(), "uuid", "") + "," + UpdateVersionUtils.getVersionName());
|
|
new Thread(new Runnable() {
|
|
private HttpHelper.HttpResult httpResult;
|
|
private String result1;
|
|
|
|
@Override
|
|
public void run() {
|
|
// TODO Auto-generated method stub
|
|
|
|
try {
|
|
httpResult = HttpHelper.post(Url.getTimestamp, null);
|
|
if (httpResult != null) {
|
|
result1 = httpResult.getString();
|
|
// LogUtils.e(result);
|
|
TimestampBean bean = GsonTools.fromGsonToBean(result1, TimestampBean.class);
|
|
param.put("timestamp", bean.getTimestamp());
|
|
LogUtils.e("timestamp = " + bean.getTimestamp());
|
|
|
|
String encoding = "UTF-8";
|
|
Gson gson = new Gson();
|
|
String params = gson.toJson(param);
|
|
LogUtil.i("params = " + params.toString());
|
|
byte[] data;
|
|
String sign = SignUtil.getSign(param);
|
|
data = params.getBytes(encoding);
|
|
URL url = new URL(postUrl);
|
|
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
|
|
conn.setRequestMethod("POST");
|
|
conn.setDoOutput(true);
|
|
conn.setRequestProperty("Content-Type", "application/json");
|
|
conn.setRequestProperty("sign", sign);
|
|
conn.setRequestProperty("Content-Length", String.valueOf(data.length));
|
|
conn.setConnectTimeout(5 * 1000);
|
|
OutputStream outStream = conn.getOutputStream();
|
|
outStream.write(data);
|
|
outStream.flush();
|
|
outStream.close();
|
|
if (conn.getResponseCode() == 200) {
|
|
InputStream inStream = conn.getInputStream();
|
|
String result = new String(StreamTool.readInputStream(inStream), "UTF-8");
|
|
Message message = new Message();
|
|
message.what = callType;
|
|
message.obj = new String(result);
|
|
handler.sendMessage(message);
|
|
} else {
|
|
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
//ToastUtil.showMessage("提交失败,请重试");
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
}
|
|
|
|
}
|
|
}).start();
|
|
}
|
|
|
|
|
|
public class SearchExpandAdapter extends BaseExpandableListAdapter
|
|
{
|
|
Context context;
|
|
List<CourseIndexSearchBean.SearchBean> beanList;
|
|
public SearchExpandAdapter(Context context, List<CourseIndexSearchBean.SearchBean> beanList) {
|
|
this.context=context;
|
|
this.beanList=beanList;
|
|
|
|
}
|
|
private Handler handler = new Handler(Looper.getMainLooper()){
|
|
@Override
|
|
public void handleMessage(Message msg) {
|
|
notifyDataSetChanged();//更新数据
|
|
super.handleMessage(msg);
|
|
}
|
|
};
|
|
|
|
|
|
/*供外界更新数据的方法*/
|
|
public void refresh(CommentExpandableListView mExpandableListView, List<CourseIndexSearchBean.SearchBean> list){
|
|
handler.sendMessage(new Message());
|
|
//必须重新伸缩之后才能更新数据
|
|
for (int i = 0; i < list.size(); i++) {
|
|
mExpandableListView.collapseGroup(i);
|
|
}
|
|
for (int i = 0; i < list.size(); i++) {
|
|
mExpandableListView.expandGroup(i);
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public int getGroupCount() {
|
|
return beanList.size();
|
|
}
|
|
|
|
@Override
|
|
public int getChildrenCount(int groupPosition) {
|
|
if(beanList.get(groupPosition).getSearch_second_list()!=null&&
|
|
beanList.get(groupPosition).getSearch_second_list().size()>0)
|
|
return beanList.get(groupPosition).getSearch_second_list().size();
|
|
else
|
|
return 0;
|
|
}
|
|
|
|
@Override
|
|
public Object getGroup(int groupPosition) {
|
|
return beanList.get(groupPosition);
|
|
}
|
|
|
|
@Override
|
|
public Object getChild(int groupPosition, int childPosition) {
|
|
return beanList.get(groupPosition).getSearch_second_list().get(childPosition);
|
|
}
|
|
|
|
@Override
|
|
public long getGroupId(int groupPosition) {
|
|
return groupPosition;
|
|
}
|
|
|
|
@Override
|
|
public long getChildId(int groupPosition, int childPosition) {
|
|
return getCombinedChildId(groupPosition, childPosition);
|
|
}
|
|
|
|
@Override
|
|
public boolean hasStableIds() {
|
|
return true;
|
|
}
|
|
|
|
@Override
|
|
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
|
|
GroupHolder groupHolder;
|
|
|
|
if(convertView == null){
|
|
convertView = LayoutInflater.from(context).inflate(R.layout.course_jing_item_1, parent, false);
|
|
groupHolder = new GroupHolder(convertView);
|
|
convertView.setTag(groupHolder);
|
|
}else {
|
|
groupHolder = (GroupHolder) convertView.getTag();
|
|
}
|
|
ImageLoader.getInstance().displayImage(
|
|
beanList.get(groupPosition).getIndex_img(),
|
|
groupHolder.im_j,
|
|
ImageOptions.getImageOptions(R.drawable.default_news_iv));
|
|
if(!StringUtil.isEmpty(beanList.get(groupPosition).getStudy_num())&&Integer.valueOf(beanList.get(groupPosition).getStudy_num())>4)
|
|
{
|
|
groupHolder.tv_j.setVisibility(View.VISIBLE);
|
|
}
|
|
else
|
|
{
|
|
groupHolder.tv_j.setVisibility(View.GONE);
|
|
}
|
|
groupHolder.tv_j.setText(beanList.get(groupPosition).getStudy_num()+"人学");
|
|
// groupHolder.tv_n.setText(Html.fromHtml(beanList.get(groupPosition).getTitle()));
|
|
groupHolder.tv_n.setText(Html.fromHtml(ReplaceLike(beanList.get(groupPosition).getTitle(),searchStr)));
|
|
groupHolder.l_tag.removeAllViews();
|
|
if(!StringUtil.isEmpty(beanList.get(groupPosition).getTags()))
|
|
{
|
|
String[]tags=beanList.get(groupPosition).getTags().split(",");
|
|
for(String tag:tags)
|
|
{
|
|
// LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
|
|
// LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
|
// params.setMargins(0, 0, 20, 0);
|
|
TextView textView=new TextView(context);
|
|
textView.setText(tag);
|
|
textView.setTextColor(Color.parseColor("#666666"));
|
|
textView.setTextSize(11);
|
|
textView.setGravity(Gravity.CENTER);
|
|
textView.setPadding(8,1,8,1);
|
|
textView.setBackground(context.getResources().getDrawable(R.drawable.tag_bg));
|
|
// textView.setLayoutParams(params);
|
|
groupHolder.l_tag.addView(textView);
|
|
}
|
|
}
|
|
|
|
|
|
// if(beanList.get(groupPosition).getSpecial_type_name()!=null)
|
|
// {
|
|
// switch (beanList.get(groupPosition).getSpecial_type_name()+"") {
|
|
//
|
|
// case "福利课堂":
|
|
// groupHolder.tv_yh.setText("奖励"+beanList.get(groupPosition).getFuli_bon()+"积分");
|
|
// groupHolder.tv_yh.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_pr.setVisibility(View.GONE);
|
|
// groupHolder.tv_pr0.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_pr0.setText(fenGetYuanFormat1(beanList.get(groupPosition).getDiscount_price()));
|
|
//
|
|
//
|
|
//
|
|
// break;
|
|
// case "学完返现":
|
|
// if(StringUtil.isEmpty(beanList.get(groupPosition).getBack_bon())||
|
|
// Integer.valueOf(beanList.get(groupPosition).getBack_bon())<0.1)
|
|
// {
|
|
// groupHolder.tv_yh.setVisibility(View.GONE);
|
|
// }
|
|
// else
|
|
// {
|
|
// groupHolder.tv_yh.setVisibility(View.VISIBLE);
|
|
// }
|
|
// groupHolder.tv_yh.setText("返"+beanList.get(groupPosition).getBack_bon()+"积分");
|
|
//// groupHolder.tv_yh.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_pr.setVisibility(View.GONE);
|
|
// groupHolder.tv_pr0.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_pr0.setText(fenGetYuanFormat1(beanList.get(groupPosition).getAccount()));
|
|
// break;
|
|
// default:
|
|
//// case "为您推荐":
|
|
//// case "精品小课":
|
|
// if(!StringUtil.isEmpty(beanList.get(groupPosition).getDiscount_price()))
|
|
// {
|
|
//
|
|
// groupHolder.tv_pr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getDiscount_price()));
|
|
// if(!StringUtil.isEmpty(beanList.get(groupPosition).getDiscount_type()))
|
|
// {
|
|
// switch (beanList.get(groupPosition).getDiscount_type())
|
|
// {
|
|
// case "0":
|
|
// break;
|
|
// case "1":
|
|
// groupHolder.tv_yh.setText("永久优惠");
|
|
// groupHolder.tv_yh.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_ppr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getAccount()));
|
|
//
|
|
// break;
|
|
// case "2":
|
|
// groupHolder.tv_yh.setText("限时优惠");
|
|
// groupHolder.tv_yh.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_ppr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getAccount()));
|
|
// break;
|
|
// }
|
|
// }
|
|
//
|
|
// groupHolder.tv_ppr.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
|
// }
|
|
// else
|
|
// {
|
|
//
|
|
// groupHolder.tv_pr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getAccount()));
|
|
// }
|
|
// break;
|
|
// }
|
|
// }
|
|
switch (beanList.get(groupPosition).getSpecial_type_name()+"") {
|
|
|
|
case "福利课堂":
|
|
groupHolder.tv_b.setText("奖励"+beanList.get(groupPosition).getFuli_bon()+"积分");
|
|
groupHolder.tv_b.setVisibility(View.VISIBLE);
|
|
groupHolder.tv_ppr.setVisibility(View.GONE);
|
|
groupHolder.tv_yh.setVisibility(View.GONE);
|
|
if(!StringUtil.isEmpty(beanList.get(groupPosition).getDiscount_price()))
|
|
{
|
|
groupHolder.tv_pr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getDiscount_price()));
|
|
// if(!StringUtil.isEmpty(beanList.get(groupPosition).getDiscount_type()))
|
|
// {
|
|
// switch (beanList.get(groupPosition).getDiscount_type())
|
|
// {
|
|
// case "0":
|
|
// groupHolder.tv_yh.setVisibility(View.GONE);
|
|
// groupHolder.tv_ppr.setVisibility(View.GONE);
|
|
// break;
|
|
// case "1":
|
|
// groupHolder.tv_yh.setText("永久优惠");
|
|
// groupHolder.tv_yh.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_ppr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getAccount()));
|
|
// groupHolder.tv_ppr.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
|
// break;
|
|
// case "2":
|
|
// groupHolder.tv_yh.setText("限时优惠");
|
|
// groupHolder.tv_yh.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_ppr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getAccount()));
|
|
// groupHolder.tv_ppr.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
|
// break;
|
|
// }
|
|
// }
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
groupHolder.tv_pr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getAccount()));
|
|
// groupHolder.tv_yh.setVisibility(View.GONE);
|
|
// groupHolder.tv_ppr.setVisibility(View.GONE);
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
case "学完返现":
|
|
if(StringUtil.isEmpty(beanList.get(groupPosition).getBack_bon())||
|
|
Integer.valueOf(beanList.get(groupPosition).getBack_bon())<0.1)
|
|
{
|
|
groupHolder.tv_b.setVisibility(View.GONE);
|
|
}
|
|
else
|
|
{
|
|
groupHolder.tv_b.setVisibility(View.VISIBLE);
|
|
}
|
|
groupHolder.tv_b.setText("返"+beanList.get(groupPosition).getBack_bon()+"积分");
|
|
groupHolder.tv_ppr.setVisibility(View.GONE);
|
|
groupHolder.tv_yh.setVisibility(View.GONE);
|
|
if(!StringUtil.isEmpty(beanList.get(groupPosition).getDiscount_price()))
|
|
{
|
|
groupHolder.tv_pr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getDiscount_price()));
|
|
// if(!StringUtil.isEmpty(beanList.get(groupPosition).getDiscount_type()))
|
|
// {
|
|
// switch (beanList.get(groupPosition).getDiscount_type())
|
|
// {
|
|
// case "0":
|
|
// groupHolder.tv_yh.setVisibility(View.GONE);
|
|
// groupHolder.tv_ppr.setVisibility(View.GONE);
|
|
// break;
|
|
// case "1":
|
|
// groupHolder.tv_yh.setText("永久优惠");
|
|
// groupHolder.tv_yh.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_ppr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getAccount()));
|
|
// groupHolder.tv_ppr.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
|
//
|
|
// break;
|
|
// case "2":
|
|
// groupHolder.tv_yh.setText("限时优惠");
|
|
// groupHolder.tv_yh.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_ppr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getAccount()));
|
|
// groupHolder.tv_ppr.setVisibility(View.VISIBLE);
|
|
// groupHolder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
|
// break;
|
|
// }
|
|
// }
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
groupHolder.tv_pr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getAccount()));
|
|
// groupHolder.tv_yh.setVisibility(View.GONE);
|
|
// groupHolder.tv_ppr.setVisibility(View.GONE);
|
|
|
|
}
|
|
break;
|
|
default:
|
|
groupHolder.tv_b.setVisibility(View.GONE);
|
|
if(!StringUtil.isEmpty(beanList.get(groupPosition).getDiscount_price()))
|
|
{
|
|
groupHolder.tv_pr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getDiscount_price()));
|
|
if(!StringUtil.isEmpty(beanList.get(groupPosition).getDiscount_type()))
|
|
{
|
|
switch (beanList.get(groupPosition).getDiscount_type())
|
|
{
|
|
case "0":
|
|
groupHolder.tv_yh.setVisibility(View.GONE);
|
|
groupHolder.tv_ppr.setVisibility(View.GONE);
|
|
break;
|
|
case "1":
|
|
groupHolder.tv_yh.setText("永久优惠");
|
|
groupHolder.tv_yh.setVisibility(View.VISIBLE);
|
|
groupHolder.tv_ppr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getAccount()));
|
|
groupHolder.tv_ppr.setVisibility(View.VISIBLE);
|
|
groupHolder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
|
|
|
break;
|
|
case "2":
|
|
groupHolder.tv_yh.setText("限时优惠");
|
|
groupHolder.tv_yh.setVisibility(View.VISIBLE);
|
|
groupHolder.tv_ppr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getAccount()));
|
|
groupHolder.tv_ppr.setVisibility(View.VISIBLE);
|
|
groupHolder.tv_ppr.getPaint().setFlags(Paint.STRIKE_THRU_TEXT_FLAG );
|
|
break;
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
else
|
|
{
|
|
groupHolder.tv_pr.setText(fenGetYuanFormat1(beanList.get(groupPosition).getAccount()));
|
|
groupHolder.tv_yh.setVisibility(View.GONE);
|
|
groupHolder.tv_ppr.setVisibility(View.GONE);
|
|
|
|
}
|
|
break;
|
|
}
|
|
|
|
|
|
return convertView;
|
|
}
|
|
|
|
@Override
|
|
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
|
|
ChildHolder childHolder;
|
|
if(convertView == null){
|
|
convertView = LayoutInflater.from(context).inflate(R.layout.second_search_item, parent, false);
|
|
childHolder = new ChildHolder(convertView);
|
|
convertView.setTag(childHolder);
|
|
}else {
|
|
childHolder = (ChildHolder) convertView.getTag();
|
|
}
|
|
if(isLastChild&&groupPosition!=getGroupCount()-1)
|
|
{
|
|
childHolder.line.setVisibility(View.VISIBLE);
|
|
}
|
|
else
|
|
{
|
|
childHolder.line.setVisibility(View.GONE);
|
|
}
|
|
childHolder.tv_n.setText(Html.fromHtml(ReplaceLike(beanList.get(groupPosition).getSearch_second_list().get(childPosition).getTitle(),searchStr)
|
|
));
|
|
return convertView;
|
|
}
|
|
|
|
@Override
|
|
public boolean isChildSelectable(int groupPosition, int childPosition) {
|
|
return true;
|
|
}
|
|
}
|
|
public class ChildHolder
|
|
{
|
|
TextView tv_n;
|
|
RelativeLayout line;
|
|
|
|
public ChildHolder(View view)
|
|
{
|
|
tv_n=view.findViewById(R.id.tv_n);
|
|
line=view.findViewById(R.id.line);
|
|
}
|
|
|
|
}
|
|
public class GroupHolder
|
|
{
|
|
|
|
CircularRectangle im_j;
|
|
TextView tv_j;
|
|
TextView tv_n;
|
|
WordWrapView l_tag;
|
|
RelativeLayout l_c;
|
|
TextView tv_yh;
|
|
TextView tv_pr,tv_pr0;
|
|
TextView tv_ppr;
|
|
TextView tv_b;
|
|
public GroupHolder(View view)
|
|
{
|
|
im_j = view.findViewById(R.id.im_j);
|
|
tv_j = view.findViewById(R.id.tv_j);
|
|
tv_n=view.findViewById(R.id.tv_n);
|
|
l_tag=view.findViewById(R.id.l_tag);
|
|
tv_yh=view.findViewById(R.id.tv_yh);
|
|
tv_pr=view.findViewById(R.id.tv_pr);
|
|
tv_ppr=view.findViewById(R.id.tv_ppr);
|
|
tv_b=view.findViewById(R.id.tv_b);
|
|
l_c=view.findViewById(R.id.l_c);
|
|
tv_pr0=view.findViewById(R.id.tv_pr0);
|
|
}
|
|
|
|
}
|
|
|
|
@Override
|
|
protected void onDestroy() {
|
|
super.onDestroy();
|
|
adapter=null;
|
|
}
|
|
private void needreport(String belong)
|
|
{
|
|
List<reportBean> reportBeans=new ArrayList<>();
|
|
reportBean rbens=new reportBean();
|
|
rbens.setUser_id(Constant.Report_userId);
|
|
rbens.setApp_key(Constant.Repotr_app_key);
|
|
rbens.setOs(CommUtil.Repotr_os);
|
|
rbens.setDevice(CommUtil.getDeviceName());
|
|
rbens.setDevice_type(CommUtil.getDeviceType());
|
|
rbens.setApp_version(CommUtil.getVersionName());
|
|
rbens.setNetwork_carrier(CommUtil.getCarrierName);
|
|
rbens.setNetwork_type(CommUtil.getCurrentNetworkType(UIUtils.getContext()));
|
|
rbens.setEvent_nickname("search");
|
|
rbens.setBelong(belong);
|
|
rbens.setCreate_date(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()));
|
|
reportBeans.add(rbens);
|
|
startReport(reportBeans);
|
|
}
|
|
public void startReport(List<reportBean> list)
|
|
{
|
|
Intent intent = new Intent(SearchClassActivity.this, ReportService.class);
|
|
intent.putExtra("report_list", (Serializable) list);
|
|
intent.putExtra("report_token", Constant.Repotr_token);
|
|
startService(intent);
|
|
}
|
|
} |