|
|
|
@ -1,15 +1,19 @@ |
|
|
|
package com.qhclh.ytzh.index.planorder; |
|
|
|
|
|
|
|
import android.content.DialogInterface; |
|
|
|
import android.support.v7.app.AlertDialog; |
|
|
|
import android.support.v7.widget.Toolbar; |
|
|
|
import android.view.View; |
|
|
|
import android.widget.AdapterView; |
|
|
|
import android.widget.ListView; |
|
|
|
import android.widget.TextView; |
|
|
|
|
|
|
|
import com.qhclh.ytzh.R; |
|
|
|
import com.qhclh.ytzh.base.BaseActivity; |
|
|
|
import com.qhclh.ytzh.bean.WarningBean; |
|
|
|
import com.qhclh.ytzh.bean.NewsBean; |
|
|
|
|
|
|
|
import org.litepal.crud.DataSupport; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import butterknife.BindView; |
|
|
|
@ -26,9 +30,10 @@ public class WarningActivity extends BaseActivity{ |
|
|
|
@BindView(R.id.lv_warning) |
|
|
|
ListView lv_warning; |
|
|
|
|
|
|
|
private List<WarningBean> warningBeanList; |
|
|
|
private WarningAdapter warningAdapter; |
|
|
|
private String type; |
|
|
|
|
|
|
|
private List<NewsBean> newsBeanList; |
|
|
|
@Override |
|
|
|
protected int setLayoutId() { |
|
|
|
return R.layout.act_warning; |
|
|
|
@ -56,17 +61,40 @@ public class WarningActivity extends BaseActivity{ |
|
|
|
}else if ("04".equals(type)){ |
|
|
|
tv_toolbar_title.setText("胴体验收"); |
|
|
|
} |
|
|
|
warningBeanList = new ArrayList<>(); |
|
|
|
for (int i=0;i<8;i++){ |
|
|
|
warningBeanList.add(new WarningBean(i,"https://www.baidu.com/img/bd_logo1.png","asagggggggggggwwwwwwwwwwwwwaa"+i,"adf")); |
|
|
|
} |
|
|
|
|
|
|
|
warningAdapter = new WarningAdapter(this,warningBeanList); |
|
|
|
lv_warning.setAdapter(warningAdapter); |
|
|
|
getDatas(); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected void initOper() { |
|
|
|
lv_warning.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() { |
|
|
|
@Override |
|
|
|
public boolean onItemLongClick(AdapterView<?> adapterView, View view, int i, final long l) { |
|
|
|
new AlertDialog.Builder(WarningActivity.this) |
|
|
|
.setTitle("是否删除") |
|
|
|
.setIcon(R.mipmap.ic_launcher) |
|
|
|
.setPositiveButton("确定", new DialogInterface.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialogInterface, int i) { |
|
|
|
DataSupport.delete(NewsBean.class, l); |
|
|
|
getDatas(); |
|
|
|
} |
|
|
|
}) |
|
|
|
.setNegativeButton("取消", new DialogInterface.OnClickListener() { |
|
|
|
@Override |
|
|
|
public void onClick(DialogInterface dialogInterface, int i) { |
|
|
|
dialogInterface.dismiss(); |
|
|
|
} |
|
|
|
}) |
|
|
|
.show(); |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
private void getDatas(){ |
|
|
|
newsBeanList = DataSupport.select("id", "url", "title", "content", "time", "type","red").where("type = ?",type).order("time desc").find(NewsBean.class); |
|
|
|
warningAdapter = new WarningAdapter(this,newsBeanList); |
|
|
|
lv_warning.setAdapter(warningAdapter); |
|
|
|
} |
|
|
|
} |