还是关于接口(比较复杂的法律法规项)
Activity
搜索页面
package com.avicsafety.dangerous_chemicals;
import java.util.Date;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import com.avicsafety.lib.CustomView.AvicButton;
import com.avicsafety.lib.CustomView.AvicEditText;
import com.avicsafety.lib.CustomView.AvicSelect;
import com.avicsafety.lib.CustomView.AvicSelectAlone;
import com.avicsafety.lib.DateTimePicker.YearMonthPickerDialog;
import com.avicsafety.lib.DateTimePicker.YearMonthPickerDialog.OnYearMonthSetListener;
import com.avicsafety.lib.tools.DialogCreator;
import com.avicsafety.lib.tools.tools;
import com.avicsafety.service.Basis_CityInfoManager;
import android.app.AlertDialog;
import android.app.Dialog;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
@ContentView(R.layout.activity_law_search)
public class LawSearchActivity extends BaseActivity implements OnClickListener {
private Dialog dg_type;
private YearMonthPickerDialog dg_startMonth;
private YearMonthPickerDialog dg_endMonth;
@Override
protected void InitializeComponent() {
// TODO Auto-generated method stub
super.InitializeComponent();
setTitle("法律法规文件搜索");
}
@Override
protected void InitializeData() {
// TODO Auto-generated method stub
super.InitializeData();
}
@Override
protected void InitializeEvent() {
// TODO Auto-generated method stub
super.InitializeEvent();
as_law_type.setOnClickListener(this);
as_start_time.setOnClickListener(this);
as_end_time.setOnClickListener(this);
btn_search.setOnClickListener(this);
}
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
switch(v.getId()){
case R.id.as_law_type:{
if(dg_type==null){
String[] key = this.getResources().getStringArray(R.array.law_type);
dg_type = DialogCreator.multipleChoiceDailog(oThis, key, as_law_type);
}
dg_type.show();
break;
}
case R.id.as_start_time:{
if(dg_startMonth==null){
dg_startMonth = new YearMonthPickerDialog(oThis,new Date().getTime());
dg_startMonth.setOnYearMonthSetListener(new OnYearMonthSetListener(){
@Override
public void OnYearMonthSet(AlertDialog arg0, long arg1, String sdate) {
as_start_time.setText(sdate);
}
});
}
dg_startMonth.show();
break;
}
case R.id.as_end_time: {
if (dg_endMonth == null) {
dg_endMonth = new YearMonthPickerDialog(oThis,new Date().getTime());
dg_endMonth.setOnYearMonthSetListener(new OnYearMonthSetListener(){
@Override
public void OnYearMonthSet(AlertDialog arg0, long arg1, String sdate) {
as_end_time.setText(sdate);
}
});
}
dg_endMonth.show();
break;
}
case R.id.btn_search:{
Bundle bundle = new Bundle();
bundle.putString("law_type", as_law_type.getValue());
bundle.putString("law_name", aet_law_name.getValue());
bundle.putString("law_code", aet_law_code.getValue());
bundle.putString("start_time", as_start_time.getValue());
bundle.putString("end_time", as_end_time.getValue());
bundle.putString("law_keyword", aet_law_keyword.getValue());
tools.startActivity(oThis, LawListActivity.class, bundle);
break;
}
}
}
@ViewInject(R.id.as_law_type)
private AvicSelect as_law_type;
@ViewInject(R.id.aet_law_name)
private AvicEditText aet_law_name;
@ViewInject(R.id.aet_law_code)
private AvicEditText aet_law_code;
@ViewInject(R.id.as_start_time)
private AvicSelectAlone as_start_time;
@ViewInject(R.id.as_end_time)
private AvicSelectAlone as_end_time;
@ViewInject(R.id.aet_law_keyword)
private AvicEditText aet_law_keyword;
@ViewInject(R.id.btn_search)
private AvicButton btn_search;
}
LIST页面
package com.avicsafety.dangerous_chemicals;
import java.util.ArrayList;
import java.util.List;
import org.xutils.http.RequestParams;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import android.app.ProgressDialog;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;
import com.avicsafety.conf.Constants;
import com.avicsafety.interfaces.OnSearchResultListener;
import com.avicsafety.lib.Adapter.CommonAdapter;
import com.avicsafety.lib.Adapter.ViewHolder;
import com.avicsafety.lib.tools.tools;
import com.avicsafety.model.M_Basics_Law;
import com.avicsafety.service.Info_LawManager;
import com.avicsafety.service.LoginManager;
@ContentView(R.layout.activity_law_list)
public class LawListActivity extends BaseActivity {
private CommonAdapter<M_Basics_Law> mAdapter;
private ProgressDialog progressDialog;
private Info_LawManager LawManager;
private List<M_Basics_Law> dataList;// Fragment要显示的内容集合
private String law_type;
private String law_name;
private String law_code;
private String start_time;
private String end_time;
private String law_keyword;
// 初始化组件
@Override
protected void InitializeComponent() {
super.InitializeComponent();
// mFm = getSupportFragmentManager();
setTitle("法律法规");
progressDialog = new ProgressDialog(this);
progressDialog.setCanceledOnTouchOutside(false);
}
// 初始化数据
@Override
protected void InitializeData() {
super.InitializeData();
Bundle bundle = this.getIntent().getExtras();
law_type = bundle.getString("law_type");
law_name = bundle.getString("law_name");
law_code = bundle.getString("law_code");
start_time = bundle.getString("start_time");
end_time = bundle.getString("end_time");
law_keyword = bundle.getString("law_keyword");
dataList = new ArrayList<M_Basics_Law>();
String username =LoginManager.getLoginInfo().getUserName();
String password =LoginManager.getLoginInfo().getPassword();
LawManager = new Info_LawManager();
RequestParams rp = getParams(username, password, "P_Whp_Flfg");
LawManager.searchLaw(rp,new OnSearchResultListener(){
@Override
public void onSuccess(List list) {
progressDialog.dismiss();
refrechPage(list);
}
@Override
public void onFail(String message) {
progressDialog.dismiss();
Toast.makeText(oThis, message, Toast.LENGTH_SHORT).show();
}});
list_view.setAdapter(mAdapter = new CommonAdapter<M_Basics_Law>(
getApplicationContext(), dataList, R.layout.item_law) {
@Override
public void convert(ViewHolder helper, M_Basics_Law item) {
helper.setText(R.id.tv_law_name, item.getTitle());
// helper.setText(R.id.tv_law_type, item.getTitle());
//TODO ADAPTER
}
});
}
@Override
protected void InitializeEvent() {
super.InitializeEvent();
list_view.setOnItemClickListener(new OnItemClickListener(){
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int index,long arg3) {
tools.startActivity(oThis, LawDetailActivity.class, dataList.get(index).getId());
}});
}
// 更新listview页面
private void refrechPage(List<M_Basics_Law> listData) {
// 更新list
dataList = listData;
mAdapter.setmDatas(dataList);
mAdapter.notifyDataSetChanged();
}
// 设置请求服务器的参数
private RequestParams getParams(String username, String password,
String modelClass) {
RequestParams rp = new RequestParams(Constants.PHONE_LEGIS_SEACH);
rp.setConnectTimeout(60000);
rp.addQueryStringParameter("userName", username);
rp.addQueryStringParameter("password", password);
rp.addQueryStringParameter("law_type", law_type);
rp.addQueryStringParameter("law_name", law_name);
rp.addQueryStringParameter("law_code", law_code);
rp.addQueryStringParameter("start_time", start_time);
rp.addQueryStringParameter("end_time", end_time);
rp.addQueryStringParameter("law_keyword", law_keyword);
rp.addQueryStringParameter("classname", "Whp_flfg");
rp.addQueryStringParameter("pagesize", "50");
rp.addQueryStringParameter("pageIndex", "1");
return rp;
}
@ViewInject(R.id.list_view)
private ListView list_view;
}
显示页
package com.avicsafety.dangerous_chemicals;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.xutils.x;
import org.xutils.common.Callback;
import org.xutils.common.Callback.CancelledException;
import org.xutils.http.RequestParams;
import org.xutils.view.annotation.ContentView;
import org.xutils.view.annotation.ViewInject;
import com.avicsafety.conf.Configuration;
import com.avicsafety.conf.Constants;
import com.avicsafety.interfaces.OnGetInfoResultListener;
import com.avicsafety.interfaces.OnSearchResultListener;
import com.avicsafety.lib.CustomView.AvicButton;
import com.avicsafety.lib.CustomView.AvicEditText;
import com.avicsafety.lib.tools.L;
import com.avicsafety.lib.tools.tools;
import com.avicsafety.model.M_Basics_Law;
import com.avicsafety.model.P_Whp_Flfg;
import com.avicsafety.model.P_Whp_Sgal;
import com.avicsafety.service.Info_AccidentCaseManager;
import com.avicsafety.service.Info_LawManager;
import com.avicsafety.service.LoginManager;
import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.support.v4.widget.DrawerLayout;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.LayoutParams;
import android.view.inputmethod.InputMethodManager;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.webkit.WebView.FindListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;
@ContentView(R.layout.activity_law_detail)
public class LawDetailActivity extends BaseActivity{
private String lawId;
private P_Whp_Flfg model;
private Info_LawManager lawManager;
private String header;
private String bodyTemp;
private String body="";
private String footer;
@Override
protected void InitializeComponent() {
// TODO 自动生成的方法存根
super.InitializeComponent();
webView.setWebViewClient(new WebViewClient());
webView.setWebChromeClient(new WebChromeClient());
webView.getSettings().setJavaScriptEnabled(true);
//解决乱码问题
webView.getSettings().setDefaultTextEncodingName("UTF-8");
webView.loadData("", "text/html", "UTF-8");
}
@Override
protected void InitializeData() {
// 显示下载数据的时候的进度条的内容
progressDialog.setMessage(getString(R.string.down_accident_list));
progressDialog.show();
//获取assets文件夹中的html文件
String[] html = this.getAssetsHtml("html/law.html").split(",,,,");
//将html文件分割成三部分,header,bodyTemp,footer
header = html[0];
bodyTemp = html[1];
footer = html[2];
lawManager=new Info_LawManager();
getIntent();
// lawId = (String) intent.getSerializableExtra("enterpriseId");//
// 获取传递过来的法规Id
lawId = tools.getParam(oThis);
String username = LoginManager.getLoginInfo().getUserName();
String password = LoginManager.getLoginInfo().getPassword();
RequestParams rp = new RequestParams(Constants.PHONE_LEGIS_SEACH);
rp.setConnectTimeout(60000);
rp.addQueryStringParameter("userName", username);
rp.addQueryStringParameter("password", password);
rp.addQueryStringParameter("id", lawId);
rp.addQueryStringParameter("classname", "Whp_sgal_content");
x.http().get(rp, new Callback.CommonCallback<String>() {
@Override
public void onCancelled(CancelledException arg0) {}
@Override
public void onError(Throwable arg0, boolean arg1) {
tools.showAlertTip("无法获取服务器资源", oThis);
}
@Override
public void onFinished() {}
@Override
public void onSuccess(String result) {
JSONObject res;
try {
res = new JSONObject(result);
String code = res.getString("Code");
if (code.equals("200")) {
JSONArray datas = res.getJSONArray("Response");
if (datas == null || datas.length() == 0) {
tools.showAlertTip("没数据", oThis);
}else{
List<P_Whp_Flfg> list = getSgDetail(datas);
progressDialog.dismiss();
// model = _model;
// 获取数据成功
int i = 0;
// 循环便利数组(model要从新设置,获取的数据是不对的)
for (Object o : list) {
final int index = i;
model = (P_Whp_Flfg) o;
body += bodyTemp.replace("{{title}}", model.getTitle())
.replace("{{content}}", model.getContent())
.replace("{{index}}", i + "");
// Log.v("",body);
// 动态加载Button按钮
Button btn = new Button(oThis);
btn.setId(index);
btn.setText((index + 1 + "") + model.getTitle());
btn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
jump(index);
}
});
ll_law_detail_chapters.addView(btn);
i++;
body = body.replace("/showImg", Constants.SERVER_ADDR
+ "/showImg");
try {
File file = new File(Configuration.BASE_PATH
+ File.separator + "temp.html");
if (!file.exists()) {
file.createNewFile();
}
writeTxtFile(header + body + footer, file);
Log.v("", file.getAbsolutePath());
// 加载html文件
webView.loadUrl("file:///" + file.getAbsolutePath());
progressDialog.dismiss();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
tools.showAlertTip("获取数据成功", oThis);
}
} else {
tools.showAlertTip("服务器出现错误", oThis);
}
} catch (JSONException e) {
e.printStackTrace();
tools.showAlertTip("数据格式出现错误", oThis);
}
}
});
}
private String getAssetsHtml(String path) {
// 获取assets文件夹中html文件,已输入流的方式读取文件
String txt = "";
try {
InputStream is = oThis.getAssets().open(path);
int size = is.available();
byte[] buffer = new byte[size];
is.read(buffer);
is.close();
txt = new String(buffer);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return txt;
}
// chapters = new String[] { "第一章 总则", "第二章 生产经营单位的安全生产保障",
// "第三章 从业人员的安全生产权利义务", "第四章 安全生产的监督管理", "第五章 生产安全事故的应急救援与调查处理" };
// LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(
// LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
// lp.setMargins(8, 10, 8, 20);
// for (int i = 0; i < chapters.length; i++) {
// final int index = i + 1;
// TextView button = new TextView(oThis);
// button.setId(index);
// button.setText(chapters[i]);
// button.setTextSize(16f);
// // button.setBackground(null);
// button.setLayoutParams(lp);
// // button.setHeight(tools.dip2px(oThis, 50));
// button.setOnClickListener(new OnClickListener() {
// @Override
// public void onClick(View arg0) {
// // TODO Auto-generated method stub
// jump(index);
// }
// });
// ll_law_detail_chapters.addView(button);
// }
@Override
protected void InitializeEvent() {
// TODO Auto-generated method stub
super.InitializeEvent();
btn_law_detail_show.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
drawerLayout.closeDrawer(accident_case_right_layout);
ll_law_detail_search_layer.setVisibility(View.VISIBLE);
}
});
btn_law_detail_find.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
String key = et_law_detail_keyword.getText().toString();
if (key.length() > 0) {
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(oThis.getCurrentFocus()
.getWindowToken(),
InputMethodManager.HIDE_NOT_ALWAYS);
findAllAsync(key);
}
}
});
btn_law_detail_clean.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
// TODO Auto-generated method stub
clearMatches();
ll_law_detail_search_layer.setVisibility(View.GONE);
}
});
}
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.book, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {
case R.id.action_list:
openRightLayout();
break;
}
return super.onOptionsItemSelected(item);
}
// 右边菜单开关事件
public void openRightLayout() {
if (drawerLayout.isDrawerOpen(accident_case_right_layout)) {
drawerLayout.closeDrawer(accident_case_right_layout);
} else {
drawerLayout.openDrawer(accident_case_right_layout);
}
}
public void jump(int n) {
openRightLayout();
webView.loadUrl("javascript:jump(" + n + ")");
}
public static boolean writeTxtFile(String content, File fileName)
throws Exception {
boolean flag = false;
FileOutputStream o = null;
try {
o = new FileOutputStream(fileName);
o.write(content.getBytes("UTF-8"));
o.close();
flag = true;
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
return flag;
}
public void findAllAsync(String searchString) {
if (android.os.Build.VERSION_CODES.JELLY_BEAN <= Build.VERSION.SDK_INT) {
webView.findAllAsync(searchString);
} else {
tools.showAlertTip("系统版本不支持该方法!", oThis);
}
}
public void clearMatches() {
webView.clearMatches();
}
// 设置请求服务器的参数
private RequestParams getParams(String username, String password,
String modelClass) {
RequestParams rp = new RequestParams(Constants.PHONE_LEGIS_SEACH);
rp.setConnectTimeout(60000);
rp.addQueryStringParameter("userName", username);
rp.addQueryStringParameter("password", password);
rp.addQueryStringParameter("id", lawId);
rp.addQueryStringParameter("classname", "Whp_flfg");
return rp;
}
private List getSgDetail(JSONArray datas) throws JSONException{
List<P_Whp_Flfg> list = new ArrayList<P_Whp_Flfg>();
for (int i = 0; i < datas.length(); i++) {
P_Whp_Flfg item = new P_Whp_Flfg();
JSONObject data = datas.getJSONObject(i);
item.setId(data.getString("id"));
item.setContent(data.getString("content"));
item.setCid(data.getString("cid"));
item.setTitle(data.getString("title"));
list.add(item);
}
return list;
}
@ViewInject(R.id.drawerLayout)
private DrawerLayout drawerLayout;// 抽屉布局
@ViewInject(R.id.accident_case_right_layout)
private RelativeLayout accident_case_right_layout;
@ViewInject(R.id.webview)
private WebView webView;
@ViewInject(R.id.ll_law_detail_chapters)
private LinearLayout ll_law_detail_chapters;
@ViewInject(R.id.ll_law_detail_search_layer)
private LinearLayout ll_law_detail_search_layer;
@ViewInject(R.id.et_law_detail_keyword)
private EditText et_law_detail_keyword;
@ViewInject(R.id.btn_law_detail_show)
private AvicButton btn_law_detail_show;
@ViewInject(R.id.btn_law_detail_find)
private AvicButton btn_law_detail_find;
@ViewInject(R.id.btn_law_detail_clean)
private AvicButton btn_law_detail_clean;
}
MODEL
package com.avicsafety.model;
public class P_Whp_Flfg {
private String id;
private String title;
private String cid;
private String content;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCid() {
return cid;
}
public void setCid(String cid) {
this.cid = cid;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
package com.avicsafety.model;
import org.xutils.db.annotation.Column;
import org.xutils.db.annotation.Table;
@Table(name="t_Basics_Law")
public class M_Basics_Law{
@Column(name = "id",isId=true)
private String id;
@Column(name = "title")
private String title;
@Column(name = "cid")
private String cid;
@Column(name = "content")
private String content;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getCid() {
return cid;
}
public void setCid(String cid) {
this.cid = cid;
}
public String getContent() {
return content;
}
public void setContent(String content) {
this.content = content;
}
}
Manager
package com.avicsafety.service;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import org.xutils.x;
import org.xutils.common.Callback;
import org.xutils.common.Callback.CancelledException;
import org.xutils.http.RequestParams;
import com.avicsafety.interfaces.OnGetInfoResultListener;
import com.avicsafety.interfaces.OnSearchResultListener;
import com.avicsafety.lib.tools.L;
import com.avicsafety.lib.tools.tools;
import com.avicsafety.model.M_AccidentItem;
import com.avicsafety.model.M_Basics_Law;
public class Info_LawManager {
OnSearchResultListener SearchResultListener = null;
private List getDataByJSONArray(JSONArray datas) throws JSONException{
List<M_Basics_Law> list = new ArrayList<M_Basics_Law>();
for (int i = 0; i < datas.length(); i++) {
M_Basics_Law item = new M_Basics_Law();
JSONObject data = datas.getJSONObject(i);
item.setId(data.getString("id"));
item.setTitle(data.getString("title"));
list.add(item);
}
return list;
}
public void searchLaw(RequestParams params,final OnSearchResultListener listener) {
// TODO Auto-generated method stub
x.http().get(params, new Callback.CommonCallback<String>() {
@Override
public void onCancelled(CancelledException arg0) {
}
@Override
public void onError(Throwable arg0, boolean arg1) {
listener.onFail("获取数据失败");
}
@Override
public void onFinished() {
}
@Override
public void onSuccess(String result) {
JSONObject res;
try {
//
res = new JSONObject(result);
String code = res.getString("Code");
if (code.equals("200")) {
JSONArray datas = res.getJSONArray("Response");
if (datas == null || datas.length() == 0) {
listener.onFail("没有找到数据");
}else{
List list = getDataByJSONArray(datas);
listener.onSuccess(list);
}
} else {
listener.onFail("获取数据失败");
}
} catch (JSONException e) {
e.printStackTrace();
L.v(e.getMessage());
listener.onFail("服务器出错,请稍后再试");
}
}
});
}
private List getInfoByJSONArray(JSONArray datas) throws JSONException{
List<M_Basics_Law> list = new ArrayList<M_Basics_Law>();
for (int i = 0; i < datas.length(); i++) {
M_Basics_Law item = new M_Basics_Law();
JSONObject data = datas.getJSONObject(i);
item.setId(data.getString("id"));
item.setTitle(data.getString("title"));
item.setCid(data.getString("cid"));
item.setContent(data.getString("content"));
list.add(item);
}
return list;
}
public void getLawInfo(RequestParams params,
final OnGetInfoResultListener<M_Basics_Law> listener) {
// TODO Auto-generated method stub
x.http().get(params, new Callback.CommonCallback<String>() {
@Override
public void onCancelled(CancelledException arg0) {
}
@Override
public void onError(Throwable arg0, boolean arg1) {
listener.onFail("获取数据失败");
}
@Override
public void onFinished() {
}
@Override
public void onSuccess(String result) {
JSONObject res;
try {
res = new JSONObject(result);
String code = res.getString("Code");
if (code.equals("200")) {
JSONArray datas = res.getJSONArray("Response");
if (datas == null || datas.length() == 0) {
if (SearchResultListener != null)
SearchResultListener.onFail("没有找到数据");
}else{
List list = getDataByJSONArray(datas);
if (SearchResultListener != null)
SearchResultListener.onSuccess(list);
}
} else {
// Toast.makeText(oThis, "获取数据失败",
// Toast.LENGTH_SHORT).show();
if (SearchResultListener != null)
SearchResultListener.onFail("获取数据失败");
}
} catch (JSONException e) {
e.printStackTrace();
L.v(e.getMessage());
// Toast.makeText(oThis, "获取数据失败",
// Toast.LENGTH_SHORT).show();
if (SearchResultListener != null)
SearchResultListener.onFail("服务器出错,请稍后再试");
}
}
});
}
}
html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Demo</title>
<link rel="stylesheet" href="https://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="https://cdn.static.runoob.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdn.static.runoob.com/libs/bootstrap/3.3.7/js/bootstrap.min.js"></script>
</head>
<body>
<div class="panel-group" id="accordion">
,,,,
<div id="t{{index}}" class="panel panel-default">
<div class="panel-heading" data-toggle="collapse" data-parent="#accordion" href="#collapse{{index}}">
<h4 class="panel-title">
{{title}}
</h4>
</div>
<div id="collapse{{index}}" class="panel-collapse collapse in">
<div class="panel-body">
{{content}}
</div>
</div>
</div>
,,,,
</div>
<script type="text/javascript">
function collapse(ID, ACTION) {
$("#" + ID).collapse(ACTION);
}
function jump(n) {
//alert(1);
collapse("collapse" + n, "show");
window.location = "#t" + n;
}
</script>
</body>
</html>
XML
搜索页面
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/com.avicsafety.dangerous_chemicals"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
android:orientation="vertical" >
<include layout="@layout/toolbar" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="10dp"
android:orientation="vertical" >
<com.avicsafety.lib.CustomView.AvicSelect
android:id="@+id/as_law_type"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:select_hint="@string/GEN_please_choose"
app:select_lable="分类" />
<com.avicsafety.lib.CustomView.AvicEditText
android:id="@+id/aet_law_name"
android:layout_width="wrap_content"
app:edit_hint=""
app:edit_lable="法律名称"
android:layout_height="wrap_content" />
<com.avicsafety.lib.CustomView.AvicEditText
android:id="@+id/aet_law_code"
android:layout_width="wrap_content"
app:edit_hint=""
app:edit_lable="文号"
android:layout_height="wrap_content" />
<!-- <com.avicsafety.lib.CustomView.AvicSelect -->
<!-- android:id="@+id/as_start_time" -->
<!-- android:layout_width="match_parent" -->
<!-- android:layout_height="wrap_content" -->
<!-- app:select_hint="@string/GEN_please_choose" -->
<!-- app:select_lable="发行时间-开始" /> -->
<!-- <com.avicsafety.lib.CustomView.AvicSelect -->
<!-- android:id="@+id/as_end_time" -->
<!-- android:layout_width="match_parent" -->
<!-- android:layout_height="wrap_content" -->
<!-- app:select_hint="@string/GEN_please_choose" -->
<!-- app:select_lable="发行时间-结束" /> -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="70dp" >
<TextView
android:id="@+id/textView1"
android:layout_width="match_parent"
android:layout_height="30dp"
android:gravity="center_vertical"
android:text="时间:"
android:textColor="#333333"
android:textSize="14sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="40dp"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true" >
<com.avicsafety.lib.CustomView.AvicSelectAlone
android:id="@+id/as_start_time"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="0.4"
android:background="?android:attr/editTextBackground"
app:alone_hint="开始时间" />
<TextView
android:id="@+id/textView3"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_weight="0.1"
android:gravity="center"
android:text="—"
android:textColor="#333333"
android:textSize="24sp" />
<com.avicsafety.lib.CustomView.AvicSelectAlone
android:id="@+id/as_end_time"
android:layout_width="0dp"
android:layout_height="40dp"
android:layout_weight="0.4"
android:background="?android:attr/editTextBackground"
app:alone_hint="结束时间" />
</LinearLayout>
</RelativeLayout>
<com.avicsafety.lib.CustomView.AvicEditText
android:id="@+id/aet_law_keyword"
android:layout_width="wrap_content"
app:edit_hint=""
app:edit_lable="关键字"
android:layout_marginTop="5dp"
android:layout_height="wrap_content" />
<com.avicsafety.lib.CustomView.AvicButton
android:id="@+id/btn_search"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="5dp"
android:text="开始搜索"
android:textColor="@color/white"
app:buttonColor="Blue" />
</LinearLayout>
</LinearLayout>
LIST页面
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<include layout="@layout/toolbar" >
</include>
<ListView
android:id="@+id/list_view"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout>
显示页面
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" xmlns:app="http://schemas.android.com/apk/res/com.avicsafety.dangerous_chemicals">
<include layout="@layout/toolbar" >
</include>
<android.support.v4.widget.DrawerLayout
android:id="@+id/drawerLayout"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<WebView
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<include layout="@layout/layout_right_law_detail" />
</android.support.v4.widget.DrawerLayout>
<LinearLayout
android:id="@+id/ll_law_detail_search_layer"
android:layout_width="match_parent"
android:layout_height="45dp"
android:layout_gravity="bottom"
android:layout_marginTop="-45dp"
android:background="@color/fff"
android:visibility="gone" >
<EditText
android:id="@+id/et_law_detail_keyword"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight=".6"
android:ems="10" >
</EditText>
<com.avicsafety.lib.CustomView.AvicButton
android:id="@+id/btn_law_detail_find"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_margin="1dp"
android:layout_weight=".2"
android:text="查找"
android:textColor="@color/fff"
app:buttonColor="Blue" />
<com.avicsafety.lib.CustomView.AvicButton
android:id="@+id/btn_law_detail_clean"
android:layout_width="wrap_content"
android:layout_height="35dp"
android:layout_margin="1dp"
android:layout_weight=".2"
android:text="清除"
app:buttonColor="White" />
</LinearLayout>
</LinearLayout>
转载于:https://my.oschina.net/ChrisWolfWu/blog/822265
还是关于接口(比较复杂的法律法规项)相关推荐
- LTE信令监测及互联网KQI指标规范v2.1(第一册 跨接口面向业务的测量项和指标定义)
1.1.1 CSFB被叫试呼次数 a) 指标名称:CSFB被叫试呼次数 b) 英文名称:Service.CSFB.MtcEsrMsgCount c) 业务需求:统计CSFB被叫试呼次数. d) ...
- 转贴:[转]所有 OLE api 和接口的目的
转自http://support.microsoft.com/kb/126157/zh-cn http://apps.hi.baidu.com/share/detail/18909481 比较有用,记 ...
- ngx_lua模块中的共享内存字典项API
在ngx_lua模块中使用共享内存字典项相关API的前提条件是已经使用lua_shared_dict命令定义了一个字典项对象,该命令的具体用法为: 语法:lua_shared_dict <nam ...
- COM编程之二 接口
[1]接口 DLL的接口是它所输出的那些函数. C++类的接口是该类的一个成员函数集. COM接口是包含一个函数指针数组的内存结构. 每一个数组元素包含的是一个由组件所实现的函数的地址. 在COM中接 ...
- 快速打造属于你的接口自动化测试框架
1 接口测试 接口测试是对系统或组件之间的接口进行测试,主要是校验数据的交换,传递和控制管理过程,以及相互逻辑依赖关系. 接口自动化相对于UI自动化来说,属于更底层的测试,这样带来的好处就是测试收益更 ...
- Android 8.0 VTS 测试 FAIL 项解决记录
本文是转自https://zhuanlan.zhihu.com/p/28426650 注意:本文基于 Android 8.0 进行分析. 1. 前言 这篇文章所记录的是我自己在 Amlogic 平台上 ...
- 全网最全,接口自动化测试怎么做的?精通接口自动化测试详解
目录:导读 一.前言 二.接口自动化测试的 "能 " 1.接口自动化的目标 2.接口自动化 Case 用例设计原则 3.接口自动化用例定时跑 三.接口自动化测试的 "不能 ...
- 【中间件技术】第二部分 CORBA规范与中间件(4) 编写对象接口
文章目录 4.1 概述 4.1.1 接口与实现的分离 4.1.2 接口定义语言 4.2 `OMG IDL` 的语法与语义 4.2.1 词法规则 4.2.2 模块的声明 4.2.3 类型的声明 1. 基 ...
- 基于vue的后台管理 内容篇 之 代理列表(某一导航项) 前篇
上一篇中已经设置到 点击某一导航项,跳转至对应路由组件页面 这一篇 写组件页面中需要应用到的一些element组件的使用 页面展示 包含的element元素有 el-card, 卡片 el-bread ...
最新文章
- Storm 疑难杂症。
- python序列数据类型_Python 数据类型 之 序列类型
- 基于php校园失物招领,校园失物招领系统的设计.doc
- Windows Server 2012 如何将计算机图标添加到桌面
- .NET下一种简单的调试诊断方法
- 【JavaScript】详解JSON
- 使用GitHub管理代码
- vulhub漏洞复现十七_GhostScript
- 钢绞线的弹性模量的计算方法_钢绞线弹性模量的理论计算及其影响因素分析
- FastAPI获年度第一新兴框架,2021年最受欢迎的TOP 100开发工具出炉
- 采用卡尔曼滤波计算电池SOC
- Javascript DOM readyState 属性
- 智能空气净化器解决方案,飞睿科技无线WiFi芯片模块技术应用
- 强化学习 - Deep RL开源项目总结
- 二阶常系数非齐次线性微分方程待定系数法求特解
- opencore黑苹果教程
- 解决打包APK时候的报错:uses-sdk:minSdkVersion 22 cannot be smaller than version 23 declared in library
- 和小鲜肉相比,老程序员该由哪些优势?
- 【浅谈】main函数的三个参数
- 深度长文:新iPhoneX凭什么卖这么贵?