Commit 0aad7314 by weijiguang

init commit

parents

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
.idea
\ No newline at end of file
apply plugin: 'com.android.application'
android {
compileSdkVersion 28
buildToolsVersion "28.0.3"
useLibrary 'org.apache.http.legacy'
defaultConfig {
applicationId "com.boco.bbs"
minSdkVersion 17
targetSdkVersion 28
}
signingConfigs {
release {
keyAlias 'boco'
keyPassword '123456'
storeFile file('../boco.keystore')
storePassword '123456'
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
packagingOptions {
exclude 'META-INF/README.txt'
exclude 'android/README.txt'
exclude 'android/LICENSE.txt'
exclude 'core/README.txt'
exclude 'core/LICENSE.txt'
}
lintOptions {
abortOnError false
}
}
dependencies {
compile project(':bocowidget')
compile project(':bocoactivityjar')
implementation group: 'com.android.support', name: 'support-v4', version: '28.0.0'
compile 'com.google.code.gson:gson:2.8.0'
compile files('libs/IndoorscapeAlbumPlugin.jar')
compile files('libs/afinal_0.5.1_bin.jar')
compile files('libs/baidumapapi_base_v4_0_0.jar')
compile files('libs/baidumapapi_cloud_v4_0_0.jar')
compile files('libs/baidumapapi_map_v4_0_0.jar')
compile files('libs/baidumapapi_radar_v4_0_0.jar')
compile files('libs/baidumapapi_search_v4_0_0.jar')
compile files('libs/baidumapapi_util_v4_0_0.jar')
compile files('libs/basejar.jar')
compile files('libs/bocojar.jar')
compile files('libs/commons-logging-1.1.3.jar')
compile files('libs/locSDK_6.13.jar')
}
<?xml version="1.0" encoding="utf-8"?>
<lint>
</lint>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.boco.bbs"
android:versionCode="101"
android:versionName="2.1" >
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
<uses-permission android:name="com.android.launcher.permission.READ_SETTINGS" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.WRITE_SETTINGS" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.RECEIVE_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RESTART_PACKAGES"/>
<uses-permission android:name="android.permission.KILL_BACKGROUND_PROCESSES"/>
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
<uses-permission android:name="android.permission.BROADCAST_PACKAGE_REMOVED" />
<uses-permission android:name="android.permission.BROADCAST_PACKAGE_ADDED" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true" >
<uses-library android:name="org.apache.http.legacy" android:required="false" />
<activity
android:name=".A0_MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
</intent-filter>
</activity>
<activity
android:name=".A1_selectActivity"
android:label="@string/title_activity_a1_select" >
</activity>
<service
android:name=".service.LogService"
android:enabled="true" >
</service>
<activity
android:name=".A2_currentCaseActivity"
android:label="@string/title_activity_a2_current_case" >
</activity>
<activity
android:name=".Common_showMsgActivity"
android:label="@string/title_activity_a1_show_msg" >
</activity>
<activity
android:name=".A3_RegulationsActivity"
android:label="@string/title_activity_a3__regulations" >
</activity>
<activity
android:name=".DownloadActivity"
android:label="@string/title_activity_download" >
</activity>
</application>
</manifest>
package com.boco.bbs;
import java.util.HashMap;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.boco.basejar.utils.CommonUtils.IUI;
import com.boco.bbs.service.LogService;
import com.boco.bbs.utils.Utils;
import com.boco.bbs.R;
import com.boco.utils.DBUtil;
import com.boco.utils.JsonError;
import android.Manifest;
import android.app.AlertDialog.Builder;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnKeyListener;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.os.Build;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v4.app.ActivityCompat;
import android.support.v4.content.ContextCompat;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.Window;
import android.view.animation.AlphaAnimation;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;
public class A0_MainActivity extends BaseOrmLiteActivity implements IUI{
private static final int MY_PERMISSION_REQUEST_CODE = 10000;
private Bundle commonData;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_main);
if (Build.VERSION.SDK_INT >= 23) { //此处做动态权限申请
String[] permissions = new String[]{
Manifest.permission.READ_PHONE_STATE,
Manifest.permission.CAMERA,
Manifest.permission.ACCESS_FINE_LOCATION,
Manifest.permission.ACCESS_COARSE_LOCATION,
Manifest.permission.WRITE_EXTERNAL_STORAGE,
Manifest.permission.READ_EXTERNAL_STORAGE,
Manifest.permission.CALL_PHONE,
Manifest.permission.READ_SMS,
Manifest.permission.RECEIVE_SMS
};
boolean request = this.checkPermissionAllGranted(permissions);
if (request) { //权限同意
startAcitvity();
} else { //缺少权限,进行权限申请
ActivityCompat.requestPermissions(this, permissions, MY_PERMISSION_REQUEST_CODE);
return;//
}
} else { //低于23 不需要特殊处理
startAcitvity();
}
}
private boolean checkPermissionAllGranted(String[] permissions) {
for (String permission : permissions) {
if (ContextCompat.checkSelfPermission(this, permission) != PackageManager.PERMISSION_GRANTED) {
// 只要有一个权限没有被授予, 则直接返回 false
return false;
}
}
return true;
}
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == MY_PERMISSION_REQUEST_CODE) {
for(int i=0;i<permissions.length;i++) {
String perm = permissions[i];
Log.d("MY_PERMISSION","MY_PERMISSION_REQUEST_CODE:" + perm + "=" + grantResults[i]);
}
boolean isAllGranted = true;
// 判断是否所有的权限都已经授予了
for (int grant : grantResults) {
if (grant != PackageManager.PERMISSION_GRANTED) {
isAllGranted = false;
break;
}
}
if (isAllGranted) { // 如果所有的权限都授予了, 则执行备份代码
startAcitvity();
} else { // 弹出对话框告诉用户需要权限的原因, 并引导用户去应用权限管理中手动打开权限按钮
openAppDetails();
}
}
}
private void openAppDetails() {
Toast.makeText(this,"未获取到全部权限",Toast.LENGTH_LONG).show();
this.finish();
}
private void startAcitvity() {
new Thread() {
@Override
public void run() {
// 把网络访问的代码放在这里
checkVersionRemote();
}
}.start();
//startLogService();
initData();
}
public void goTorecommendCase(View v){
Intent intent = new Intent(A0_MainActivity.this,A1_selectActivity.class);
startActivity(intent);
}
public void goTocurrentCase(View v){
Intent intent = new Intent(A0_MainActivity.this,A2_currentCaseActivity.class);
startActivity(intent);
}
public void goToRegulations(View v){
Intent intent = new Intent(A0_MainActivity.this,A3_RegulationsActivity.class);
startActivity(intent);
}
public void goBack(View v){
finish();
}
/**
* 启动日志服务
*
*/
private void startLogService(){
Intent intent = new Intent(A0_MainActivity.this,LogService.class);
startService(intent);
}
/**
* 停止日志服务
*
*/
private void stopLogService(){
Intent intent = new Intent(A0_MainActivity.this,LogService.class);
stopService(intent);
}
private void initData(){
commonData = getIntent().getBundleExtra("commonData");
DBUtil.saveBoolean(this, "isAdmin", commonData.getBoolean("isAdmin"));
DBUtil.saveBoolean(this, "isDev", commonData.getBoolean("isDev"));
DBUtil.saveString(this, "JSESSIONID", commonData.getString("JSESSIONID"));
DBUtil.saveString(this, "userId", (commonData.getString("userId") == null ? "" : commonData.getString("userId")));
DBUtil.saveString(this, "deptname", (commonData.getString("deptname") == null ? "" : commonData.getString("deptname")));
DBUtil.saveString(this, "username", (commonData.getString("username") == null ? "" : commonData.getString("username")));
DBUtil.saveString(this, "deptid", (commonData.getString("deptid") == null ? "" : commonData.getString("deptid")));
DBUtil.saveString(this, "mobile", (commonData.getString("mobile") == null ? "" : commonData.getString("mobile")));
DBUtil.saveString(this, "postUrl", "http://"+commonData.getString("netIP").trim()+":"+commonData.getString("netPort")+"/"+commonData.getString("serverName"));
//System.out.println("----->>>postUrl = " + getString("postUrl"));
TextView localTextView = (TextView)findViewById(R.id.userLab);
StringBuilder localStringBuilder = new StringBuilder("欢迎:");
String str1 = getString("username");
String str2 = localStringBuilder+str1;
localTextView.setText(str2);
}
//升级
private void checkVersionRemote(){
PackageManager manager = this.getPackageManager();
PackageInfo info;
try {
info = manager.getPackageInfo(this.getPackageName(), 0);
String version = info.versionName;
HashMap<String,String> prM = new HashMap<String,String>();
prM.put("type", "android");
prM.put("method", "getCheckVersion");
prM.put("v2tag", "true");
prM.put("appName", info.packageName);
prM.put("appVersion", version);
try {
String kk = super.httpRequestNoThread(A0_MainActivity.this, prM,getString("postUrl") + "/android/androidAction.do?");
JSONArray array = new JSONArray(kk);
JSONObject obj = null;
try {
obj = Utils.parseJson(array.get(1).toString());
} catch (JsonError e) {
e.printStackTrace();
}
System.out.println("----->>> obj = " + obj);
if(obj.get("status").equals("true")){
showSelectDialog(this,"提示!","该应用有新版本,请升级后进入!");
}
} catch (JSONException e) {
Log.e("InspectCrowdfunding.Main", "JSONException:"+e.getMessage());
} catch (Exception e){
Log.e("InspectCrowdfunding.Main", "异常:"+e.getMessage());
}
} catch (NameNotFoundException e) {
Log.e("InspectCrowdfunding.Main", "NameNotFoundException:"+e.getMessage());
}
}
private void showSelectDialog(Context context, String title,String text) {
if (context != null) {
Builder alertBuilder = new Builder(context);
alertBuilder.setIcon(R.drawable.info_48);
alertBuilder.setTitle(title);
alertBuilder.setMessage(text);
alertBuilder.setPositiveButton("确定", new OnClickListener() {
@Override
public void onClick(DialogInterface arg0, int arg1) {
finish();
}
});
alertBuilder.setCancelable(false);
alertBuilder.setOnKeyListener(onKeyListener);
alertBuilder.show();
}
}
private OnKeyListener onKeyListener = new OnKeyListener() {
@Override
public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN) {
finish();
}
return false;
}
};
@Override
public void refreshPage(Object... arg0) {
}
@Override
protected void onDestroy() {
super.onDestroy();
stopLogService();
}
}
package com.boco.bbs;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
import com.boco.basejar.utils.CommonUtils.IUI;
import com.boco.bbs.R;
import com.boco.bbs.model.TitleModel;
import com.boco.bbs.service.BBSService;
import com.boco.bbs.utils.Utils;
import com.boco.utils.JsonError;
public class A1_selectActivity extends BaseOrmLiteActivity implements
IUI, Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
public ArrayList<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
public ListView lv;
private String path = "";
BBSService bBSService;
private Mybaseadapter list_item;
HashMap<String, String> paramsMaps = new HashMap<String, String>();
@Override
public void onCreate(Bundle savedInstanceState ) {
super.onCreate(this,savedInstanceState);
//取消标题栏
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_a1_select);
path = getString("postUrl") + "/android/BBS.do";
initPage();
}
private void initPage(){
list.clear();
//查询推荐案例
selectRecommendMsg();
//展示到listview
lv = (ListView)findViewById(R.id.recommendCase);
list_item = new Mybaseadapter();
lv.setAdapter(list_item);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view, int position,
long id) {
System.out.println(list.get(position));
//Toast.makeText(A1_selectActivity.this, list.get(position).toString(), Toast.LENGTH_SHORT).show();
Intent intent = new Intent(A1_selectActivity.this, Common_showMsgActivity.class);
intent.putExtra("id", list.get(position).get("ID").toString());
startActivity(intent);
}
});
}
//查询推荐案例
public void selectRecommendMsg(){
paramsMaps.clear();
paramsMaps.put("method", "selectRecommendMsg");
paramsMaps.put("type", "android");
paramsMaps.put("num", "5");
//请求经典案例
System.out.println(path);
super.httpRequest(A1_selectActivity.this,paramsMaps,path);
}
@Override
public void refreshPage(Object... arg0) {
// TODO Auto-generated method stub
//System.out.println("----->>>CreateOrderActivity refreshPage = " + arg0[0]);
final String returnValue = arg0[0].toString();
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
if (null != returnValue && !"".equals(returnValue)) {
if ("selectRecommendMsg".equals(paramsMaps
.get("method"))) {
JSONArray array;
try {
array = new JSONArray(returnValue);
JSONObject jsonObject = Utils.parseJson(array
.get(0).toString());
JSONArray list1= jsonObject.getJSONArray("list1");
for(int i=0;i<list1.length();i++){
Map<String, Object> map = new HashMap<String, Object>();
JSONObject obj = list1.getJSONObject(i);
String id = obj.getString("ID");
String author = obj.getString("AUTHOR");
String title = obj.getString("TITLE");
String profession = obj.getString("PROFESSION");
String city = obj.getString("CITY");
//添加点
map.put("ID", id);
map.put("AUTHOR",author);
map.put("TITLE",title);
map.put("PROFESSION", profession);
map.put("CITY", city);
list.add(map);
}
handler.sendEmptyMessageDelayed(1, 100);
}catch(JSONException e){
Log.e("TAG", e.getMessage());
e.printStackTrace();
} catch (JsonError e) {
e.printStackTrace();
}
}
}
}
});
}
public Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case 1:
list_item.notifyDataSetChanged();
break;
}
}
};
//listview适配器
public class Mybaseadapter extends BaseAdapter {
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = new ViewHolder();
if (convertView == null) {
convertView = getLayoutInflater().inflate(R.layout.listview_item,null);
//添加点
viewHolder.Title = (TextView) convertView.findViewById(R.id.title);
viewHolder.Profession = (TextView) convertView.findViewById(R.id.profession);
viewHolder.Author = (TextView) convertView.findViewById(R.id.author);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
//添加点
viewHolder.Title.setText(list.get(position).get("TITLE").toString());
viewHolder.Author.setText("作者:"+list.get(position).get("AUTHOR").toString());
viewHolder.Profession.setText("专业:"+list.get(position).get("PROFESSION").toString()+"\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000"+"地市:"+list.get(position).get("CITY"));
return convertView;
}
}
final static class ViewHolder {
//添加点
TextView Department;
TextView Author;
TextView Title;
TextView Profession;
}
}
package com.boco.bbs;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.boco.basejar.utils.CommonUtils.IUI;
import com.boco.bbs.service.BBSService;
import com.boco.bbs.utils.Utils;
import com.boco.utils.JsonError;
import com.boco.bbs.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
public class A2_currentCaseActivity extends BaseOrmLiteActivity implements
IUI, Serializable {
/**
*
*/
private static final long serialVersionUID = 1L;
public ArrayList<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
public ListView lv;
private String path = "";
BBSService bBSService;
private Mybaseadapter list_item;
HashMap<String, String> paramsMaps = new HashMap<String, String>();
@Override
public void onCreate(Bundle savedInstanceState ) {
super.onCreate(this,savedInstanceState);
//取消标题栏
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_a1_select);
path = getString("postUrl") + "/android/BBS.do";
initPage();
}
private void initPage(){
list.clear();
//查询推荐案例
selectCurrentMsg();
//展示到listview
lv = (ListView)findViewById(R.id.recommendCase);
list_item = new Mybaseadapter();
lv.setAdapter(list_item);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view, int position,
long id) {
System.out.println(list.get(position));
//Toast.makeText(A2_currentCaseActivity.this, list.get(position).toString(), Toast.LENGTH_SHORT).show();
Intent intent = new Intent(A2_currentCaseActivity.this, Common_showMsgActivity.class);
intent.putExtra("id", list.get(position).get("ID").toString());
startActivity(intent);
}
});
}
//查询当前案例
public void selectCurrentMsg(){
paramsMaps.clear();
paramsMaps.put("method", "selectCurrentMsg");
paramsMaps.put("type", "android");
paramsMaps.put("num", "5");
//请求经典案例
System.out.println(path);
super.httpRequest(A2_currentCaseActivity.this,paramsMaps,path);
}
@Override
public void refreshPage(Object... arg0) {
// TODO Auto-generated method stub
System.out.println("----->>>CreateOrderActivity refreshPage = " + arg0[0]);
final String returnValue = arg0[0].toString();
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
if (null != returnValue && !"".equals(returnValue)) {
if ("selectCurrentMsg".equals(paramsMaps
.get("method"))) {
JSONArray array;
try {
array = new JSONArray(returnValue);
JSONObject jsonObject = Utils.parseJson(array
.get(0).toString());
JSONArray list1= jsonObject.getJSONArray("list1");
for(int i=0;i<list1.length();i++){
Map<String, Object> map = new HashMap<String, Object>();
JSONObject obj = list1.getJSONObject(i);
String id = obj.getString("ID");
String author = obj.getString("AUTHOR");
String title = obj.getString("TITLE");
String profession = obj.getString("PROFESSION");
String city = obj.getString("CITY");
//添加点
map.put("ID", id);
map.put("AUTHOR",author);
map.put("TITLE",title);
map.put("PROFESSION", profession);
map.put("CITY", city);
list.add(map);
}
handler.sendEmptyMessageDelayed(1, 100);
}catch(JSONException e){
Log.e("TAG", e.getMessage());
e.printStackTrace();
} catch (JsonError e) {
e.printStackTrace();
}
}
}
}
});
}
public Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case 1:
list_item.notifyDataSetChanged();
break;
}
}
};
//listview适配器
public class Mybaseadapter extends BaseAdapter {
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = new ViewHolder();
if (convertView == null) {
convertView = getLayoutInflater().inflate(R.layout.listview_item,null);
//添加点
viewHolder.Title = (TextView) convertView.findViewById(R.id.title);
viewHolder.Profession = (TextView) convertView.findViewById(R.id.profession);
viewHolder.Author = (TextView) convertView.findViewById(R.id.author);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
//添加点
viewHolder.Title.setText(list.get(position).get("TITLE").toString());
viewHolder.Author.setText("作者:"+list.get(position).get("AUTHOR").toString());
viewHolder.Profession.setText("专业:"+list.get(position).get("PROFESSION").toString()+"\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000"+"地市:"+list.get(position).get("CITY"));
return convertView;
}
}
final static class ViewHolder {
//添加点
TextView Department;
TextView Author;
TextView Title;
TextView Profession;
}
}
package com.boco.bbs;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.boco.basejar.utils.CommonUtils.IUI;
import com.boco.bbs.service.BBSService;
import com.boco.bbs.utils.Utils;
import com.boco.utils.JsonError;
import com.boco.bbs.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
public class A3_RegulationsActivity extends BaseOrmLiteActivity implements
IUI, Serializable {
private static final long serialVersionUID = 1L;
public ArrayList<Map<String, Object>> list = new ArrayList<Map<String, Object>>();
public ListView lv;
private String path = "";
BBSService bBSService;
private Mybaseadapter list_item;
HashMap<String, String> paramsMaps = new HashMap<String, String>();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//取消标题栏
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_a3__regulations);
path = getString("postUrl") + "/android/BBS.do";
initPage();
}
private void initPage(){
list.clear();
//查询规章制度
selectRegulations();
//展示到listview
lv = (ListView)findViewById(R.id.Regulations);
list_item = new Mybaseadapter();
lv.setAdapter(list_item);
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View view, int position,
long id) {
System.out.println(list.get(position));
//Toast.makeText(A3_RegulationsActivity.this, list.get(position).toString(), Toast.LENGTH_SHORT).show();
Intent intent = new Intent(A3_RegulationsActivity.this, Common_showMsgActivity.class);
intent.putExtra("id", list.get(position).get("ID").toString());
startActivity(intent);
}
});
}
//查询推荐案例
public void selectRegulations(){
paramsMaps.clear();
paramsMaps.put("method", "selectRegulationsMsg");
paramsMaps.put("type", "android");
paramsMaps.put("num", "5");
//请求经典案例
System.out.println(path);
super.httpRequest(A3_RegulationsActivity.this,paramsMaps,path);
}
@Override
public void refreshPage(Object... arg0) {
// TODO Auto-generated method stub
System.out.println("----->>>CreateOrderActivity refreshPage = " + arg0[0]);
final String returnValue = arg0[0].toString();
runOnUiThread(new Runnable() {
@Override
public void run() {
// TODO Auto-generated method stub
if (null != returnValue && !"".equals(returnValue)) {
if ("selectRegulationsMsg".equals(paramsMaps
.get("method"))) {
JSONArray array;
try {
array = new JSONArray(returnValue);
JSONObject jsonObject = Utils.parseJson(array
.get(0).toString());
JSONArray list1= jsonObject.getJSONArray("list1");
for(int i=0;i<list1.length();i++){
Map<String, Object> map = new HashMap<String, Object>();
JSONObject obj = list1.getJSONObject(i);
String id = obj.getString("ID");
String author = obj.getString("AUTHOR");
String title = obj.getString("TITLE");
String profession = obj.getString("PROFESSION");
String areaname = obj.getString("AREANAME");
//添加点
map.put("ID", id);
map.put("AUTHOR",author);
map.put("TITLE",title);
map.put("PROFESSION", profession);
map.put("AREANAME",areaname);
list.add(map);
}
handler.sendEmptyMessageDelayed(1, 100);
}catch(JSONException e){
Log.e("TAG", e.getMessage());
e.printStackTrace();
} catch (JsonError e) {
e.printStackTrace();
}
}
}
}
});
}
public Handler handler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch (msg.what) {
case 1:
list_item.notifyDataSetChanged();
break;
}
}
};
//listview适配器
public class Mybaseadapter extends BaseAdapter {
@Override
public int getCount() {
return list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = new ViewHolder();
if (convertView == null) {
convertView = getLayoutInflater().inflate(R.layout.listview_item,null);
//添加点
viewHolder.Title = (TextView) convertView.findViewById(R.id.title);
viewHolder.Profession = (TextView) convertView.findViewById(R.id.profession);
viewHolder.Author = (TextView) convertView.findViewById(R.id.author);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
//添加点
viewHolder.Title.setText(list.get(position).get("TITLE").toString());
viewHolder.Author.setText("作者:"+list.get(position).get("AUTHOR").toString());
viewHolder.Profession.setText("专业:"+list.get(position).get("PROFESSION").toString()+"\u3000\u3000\u3000\u3000\u3000\u3000\u3000\u3000"+"地市:"+list.get(position).get("AREANAME"));
return convertView;
}
}
final static class ViewHolder {
//添加点
TextView Department;
TextView Author;
TextView Title;
TextView Profession;
}
}
package com.boco.bbs;
import java.io.Serializable;
import java.util.HashMap;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.boco.basejar.utils.CommonUtils.IUI;
import com.boco.bbs.adapter.MyExtendableListViewAdapter;
import com.boco.bbs.utils.Utils;
import com.boco.utils.JsonError;
import com.boco.bbs.R;
import android.annotation.SuppressLint;
import android.app.Activity;
import android.app.DownloadManager;
import android.app.ExpandableListActivity;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.webkit.URLUtil;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ExpandableListView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;
public class Common_showMsgActivity extends BaseOrmLiteActivity implements
IUI, Serializable {
private static final long serialVersionUID = 1L;
HashMap<String, String> paramsMaps = new HashMap<String, String>();
private String path = "";
private TextView titleView,cityView,departmentView,authorView,phonenumberView,professionView,synopsisView;
private Button button,buttonpl;
private LinearLayout mLayout;
private EditText mEdit;
private ExpandableListView expandableListView;
public String[] groupString = {"1","2","3","4"};
public String[][]childString = {{"11","12","13"},{"21","22","23"},{"31","32","33"},{"41","42","43"}};
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.activity_a1_show_msg);
path = getString("postUrl") + "/android/BBS.do";
System.out.println(path);
initData();
initPage();
expandableListView.setAdapter(new MyExtendableListViewAdapter());
//设置分组的监听
expandableListView.setOnGroupClickListener(new ExpandableListView.OnGroupClickListener() {
@Override
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
Toast.makeText(getApplicationContext(), groupString[groupPosition], Toast.LENGTH_SHORT).show();
return false;
}
});
//设置子项布局监听
expandableListView.setOnChildClickListener(new ExpandableListView.OnChildClickListener() {
@Override
public boolean onChildClick(ExpandableListView parent, View v, int groupPosition, int childPosition, long id) {
Toast.makeText(getApplicationContext(), childString[groupPosition][childPosition], Toast.LENGTH_SHORT).show();
return true;
}
});
}
private void initData(){
titleView = (TextView) findViewById(R.id.title);
cityView = (TextView) findViewById(R.id.city);
departmentView = (TextView) findViewById(R.id.department);
authorView = (TextView) findViewById(R.id.author);
phonenumberView = (TextView) findViewById(R.id.phonenum);
professionView = (TextView) findViewById(R.id.profession);
synopsisView = (TextView) findViewById(R.id.synopsis);
button = (Button)findViewById(R.id.buttonDownload);
buttonpl = (Button)findViewById(R.id.comment);
mLayout = (LinearLayout) findViewById(R.id.layout);
mEdit = (EditText) findViewById(R.id.et_discuss);
expandableListView = (ExpandableListView)findViewById(R.id.expend_list);
}
private void initPage(){
selectarctleMsg();
}
public void selectarctleMsg(){
Intent intent = getIntent();
paramsMaps.clear();
paramsMaps.put("method", "selectArctleMsg");
paramsMaps.put("type", "android");
paramsMaps.put("id", intent.getStringExtra("id"));
//请求经典案例
super.httpRequest(Common_showMsgActivity.this,paramsMaps,path);
}
@Override
public void refreshPage(Object... arg0) {
// TODO Auto-generated method stub
System.out.println("----->>>CreateOrderActivity refreshPage = " + arg0[0]);
final String returnValue = arg0[0].toString();
runOnUiThread(new Runnable() {
@Override
public void run() {
try {
JSONArray array= new JSONArray(returnValue);
JSONObject jsonObject = Utils.parseJson(array
.get(0).toString());
titleView.setText(jsonObject.getString("TITLE"));
cityView.setText(jsonObject.getString("AREANAME"));
departmentView.setText(jsonObject.getString("DEPARTMENT"));
authorView.setText(jsonObject.getString("AUTHOR"));
phonenumberView.setText(jsonObject.getString("PHONENUMBER"));
professionView.setText(jsonObject.getString("PROFESSION"));
synopsisView.setText(jsonObject.getString("SYNOPSIS"));
//如果没有文件则将下载按钮隐藏
if(jsonObject.getString("ATTACHMENTNAME")=="null"){
button.setVisibility(View.INVISIBLE);
}
button.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
JSONArray array;
try {
array = new JSONArray(returnValue);
JSONObject jsonObject = Utils.parseJson(array
.get(0).toString());
// Intent intent = new Intent();
// intent.setAction("android.intent.action.VIEW");
String url = getString("postUrl")+"/accessories/tawCommonsAccessoriesConfigs.do;jsessionid="+jsonObject.getString("sessionid")+"?method=download&id="+jsonObject.getString("ATTACHMENTID")+"&filelist=%"+jsonObject.getString("ATTACHMENTNAME")+"%27";
Uri content_url = Uri.parse(url);
System.out.println(content_url);
String s = jsonObject.getString("ATTACHMENTNAME");
s = s.substring(s.indexOf("."));
downloadBySystem(url,jsonObject.get("TITLE")+s,null);
// intent.setData(content_url);
// startActivity(intent);
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonError e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (JsonError e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
}
@SuppressLint("NewApi")
private void downloadBySystem(String url, String contentDisposition, String mimeType) {
// 指定下载地址
DownloadManager.Request request = new DownloadManager.Request(Uri.parse(url));
// 允许媒体扫描,根据下载的文件类型被加入相册、音乐等媒体库
request.allowScanningByMediaScanner();
// 设置通知的显示类型,下载进行时和完成后显示通知
request.setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
// 设置通知栏的标题,如果不设置,默认使用文件名
// request.setTitle("This is title");
// 设置通知栏的描述
// request.setDescription("This is description");
// 允许在计费流量下下载
request.setAllowedOverMetered(false);
// 允许该记录在下载管理界面可见
request.setVisibleInDownloadsUi(false);
// 允许漫游时下载
request.setAllowedOverRoaming(true);
// 允许下载的网路类型
request.setAllowedNetworkTypes(DownloadManager.Request.NETWORK_WIFI);
// 设置下载文件保存的路径和文件名
String fileName = contentDisposition;
request.setDestinationInExternalPublicDir(Environment.DIRECTORY_DOWNLOADS, fileName);
// 另外可选一下方法,自定义下载路径
// request.setDestinationUri()
// request.setDestinationInExternalFilesDir()
final DownloadManager downloadManager = (DownloadManager) getSystemService(DOWNLOAD_SERVICE);
// 添加一个下载任务
long downloadId = downloadManager.enqueue(request);
}
public void onButtonClick(View view){
switch (view.getId()){
case R.id.comment:
ShowKeyboard();
buttonpl.setVisibility(View.GONE);
break;
case R.id.tv_confirm:
hideKeyboard();
break;
case R.id.relativeLayout:
hideKeyboard();
break;
case R.id.expend_list:
hideKeyboard();
break;
}
}
//显示布局与键盘
private void ShowKeyboard(){
mLayout.setVisibility(View.VISIBLE);//显示布局
InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mEdit.setFocusable(true);
mEdit.setFocusableInTouchMode(true);
mEdit.requestFocus();
imm.showSoftInput(mEdit, 0);
imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
}
//隐藏键盘与布局
private void hideKeyboard(){
mLayout.setVisibility(View.GONE);//隐藏布局
mEdit.setText("");//清空输入
buttonpl.setVisibility(View.VISIBLE);
View view = getWindow().peekDecorView();
if (view != null) {
InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.hideSoftInputFromWindow(view.getWindowToken(), 0);
}
}
// 捕获返回键的方法
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
//隐藏键盘与布局
hideKeyboard();
return true;
}
}
package com.boco.bbs;
import android.app.Activity;
import android.os.Bundle;
import com.boco.bbs.R;
public class DownloadActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_download);
}
}
package com.boco.bbs.adapter;
import com.boco.bbs.R;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.TextView;
public class MyExtendableListViewAdapter extends BaseExpandableListAdapter {
private Context mcontext;
/*public MyExtendableListViewAdapter(String[] groupString,String[][] childString){
}*/
public String[] groupString = {"1", "2", "3", "4"};
public String[][] childString = {
{"11", "12", "13", "14"},
{"21", "22", "23", "24"},
{"31", "32", "33", "34"},
{"41", "42", "43", "44"}
};
@Override
// 获取分组的个数
public int getGroupCount() {
return groupString.length;
}
//获取指定分组中的子选项的个数
@Override
public int getChildrenCount(int groupPosition) {
return childString[groupPosition].length;
}
// 获取指定的分组数据
@Override
public Object getGroup(int groupPosition) {
return groupString[groupPosition];
}
//获取指定分组中的指定子选项数据
@Override
public Object getChild(int groupPosition, int childPosition) {
return childString[groupPosition][childPosition];
}
//获取指定分组的ID, 这个ID必须是唯一的
@Override
public long getGroupId(int groupPosition) {
return groupPosition;
}
//获取子选项的ID, 这个ID必须是唯一的
@Override
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
//分组和子选项是否持有稳定的ID, 就是说底层数据的改变会不会影响到它们
@Override
public boolean hasStableIds() {
return true;
}
/**
*
* 获取显示指定组的视图对象
*
* @param groupPosition 组位置
* @param isExpanded 该组是展开状态还是伸缩状态
* @param convertView 重用已有的视图对象
* @param parent 返回的视图对象始终依附于的视图组
*/
// 获取显示指定分组的视图
@Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
GroupViewHolder groupViewHolder;
if (convertView == null){
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.partent_item,parent,false);
groupViewHolder = new GroupViewHolder();
groupViewHolder.tvTitle = (TextView)convertView.findViewById(R.id.label_group_normal);
convertView.setTag(groupViewHolder);
}else {
groupViewHolder = (GroupViewHolder)convertView.getTag();
}
groupViewHolder.tvTitle.setText(groupString[groupPosition]);
return convertView;
}
/**
*
* 获取一个视图对象,显示指定组中的指定子元素数据。
*
* @param groupPosition 组位置
* @param childPosition 子元素位置
* @param isLastChild 子元素是否处于组中的最后一个
* @param convertView 重用已有的视图(View)对象
* @param parent 返回的视图(View)对象始终依附于的视图组
* @return
* @see android.widget.ExpandableListAdapter#getChildView(int, int, boolean, android.view.View,
* android.view.ViewGroup)
*/
//取得显示给定分组给定子位置的数据用的视图
@Override
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) {
ChildViewHolder childViewHolder;
if (convertView==null){
convertView = LayoutInflater.from(parent.getContext()).inflate(R.layout.child_item,parent,false);
childViewHolder = new ChildViewHolder();
childViewHolder.tvTitle = (TextView)convertView.findViewById(R.id.expand_child);
convertView.setTag(childViewHolder);
}else {
childViewHolder = (ChildViewHolder) convertView.getTag();
}
childViewHolder.tvTitle.setText(childString[groupPosition][childPosition]);
return convertView;
}
//指定位置上的子元素是否可选中
@Override
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
static class GroupViewHolder {
TextView tvTitle;
}
static class ChildViewHolder {
TextView tvTitle;
}
}
package com.boco.bbs.db;
import java.sql.SQLException;
import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import com.boco.basejar.utils.CommonConstants;
import com.boco.basejar.model.BOCOModel.UpdateFile;
import com.boco.basejar.utils.BocoLog;
import com.boco.basejar.utils.DBUtil;
import com.boco.bbs.model.TitleModel;
import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper;
import com.j256.ormlite.dao.Dao;
import com.j256.ormlite.support.ConnectionSource;
import com.j256.ormlite.table.TableUtils;
/**
* 数据库操作类
*
* @author lee
*/
public class DBHelper extends OrmLiteSqliteOpenHelper {
String TAG = "TAG";
public static final String DATABASE_NAME = "crow.db";
public static final int DATABASE_VERSION = 4;
private Dao<UpdateFile, Integer> UpdateFileDao = null;
private Dao<TitleModel, Integer> TaskModelDao = null;
boolean isDev;
public DBHelper(Context context) {
// 创建数据库
super(context, DATABASE_NAME, null, DATABASE_VERSION);
isDev = DBUtil.getBoolean(context, CommonConstants.COMMON_SETTING,"isDev");
BocoLog.i(isDev, TAG, "new DataHelper");
}
/**
* 创建表结构
*/
@Override
public void onCreate(SQLiteDatabase db, ConnectionSource connectionSource) {
try {
createTable(db, connectionSource);
} catch (Exception e) {
BocoLog.e(isDev, DBHelper.class.getName(), "创建数据库失败", e);
e.printStackTrace();
}
}
public void createTable(SQLiteDatabase db, ConnectionSource connectionSource) {
BocoLog.i(isDev, TAG, "DataHelper createTable");
try {
int t = TableUtils.createTable(connectionSource, UpdateFile.class);
int y = TableUtils.createTable(connectionSource, TitleModel.class);
} catch (SQLException e) {
BocoLog.e(isDev, DBHelper.class.getName(), "创建数据库失败", e);
e.printStackTrace();
}
}
/**
* 当表结构发生变化时,修改表结构
*/
@Override
public void onUpgrade(SQLiteDatabase db, ConnectionSource connectionSource,int arg2, int arg3) {
BocoLog.i(isDev, TAG, "DataHelper onUpgrade");
try {
dropTable(db, connectionSource, null);
onCreate(db, connectionSource);
} catch (Exception e) {
BocoLog.e(isDev, DBHelper.class.getName(), "更新数据库失败", e);
e.printStackTrace();
}
}
public void dropTable(SQLiteDatabase db, ConnectionSource connectionSource,String model) {
try {
if (null == model) {
TableUtils.dropTable(connectionSource, UpdateFile.class, true);
}
if (null != model && "UpdateFile".equals(model)) {
TableUtils.dropTable(connectionSource, UpdateFile.class, true);
}
if (null != model && "TaskModel".equals(model)) {
TableUtils.dropTable(connectionSource, TitleModel.class, true);
}
} catch (SQLException e) {
BocoLog.e(isDev, DBHelper.class.getName(), "更新数据库失败", e);
e.printStackTrace();
}
}
/**
* 关闭
*/
@Override
public void close() {
BocoLog.i(isDev, TAG, "DataHelper close");
super.close();
}
public Dao<UpdateFile, Integer> getUpdateFileDao() throws SQLException {
if (UpdateFileDao == null) {
UpdateFileDao = getDao(UpdateFile.class);
}
return UpdateFileDao;
}
public Dao<TitleModel, Integer> getTaskModelDao() throws SQLException {
if (TaskModelDao == null) {
TaskModelDao = getDao(TitleModel.class);
}
return TaskModelDao;
}
}
\ No newline at end of file
package com.boco.bbs.exception;
/**
* @author lee
*/
public class JsonError extends Throwable {
private static final long serialVersionUID = 1L;
private int mErrorCode = 0;
private String mErrorType;
public JsonError(String message) {
super(message);
}
public JsonError(String message, String type, int code) {
super(message);
mErrorType = type;
mErrorCode = code;
}
public int getErrorCode() {
return mErrorCode;
}
public String getErrorType() {
return mErrorType;
}
}
package com.boco.bbs.model;
import java.io.Serializable;
/**
* 待办工单实体类
*
* @author 李信念
*
*/
public class OrderModel implements Serializable{
/**
*
*/
private static final long serialVersionUID = 1L;
// 主键
public String id;
// 工单流程ID
public String processInstanceId;
// 工单名称
public String theme;
// 上报日期
public String reportedString;
// 上报人
public String reportedUserId;
// 上报人部门
public String reportedDeptId;
// 上报人电话
public String reportedPhoneNum;
// 专业
public String specialty;
// 资源类型
public String resourceType;
// 问题类型
public String questionType;
// 市
public String city;
// 县
public String county;
// 乡镇
public String town;
// 街道
public String street;
// 描述
public String reportedDescribe;
// 定位地址
public String locatedAddress;
// 资源名称
public String resourceName;
// 是否我方资源
public String isOurResources;
// 是否现场施工作业
public String isSiteOperation;
// 紧急程度
public String degree;
// 重要程度
public String importance;
// 有效性
public String validity;
// 是否隐患
public String isHidden;
// 是否处理完成
public String isHandleComplete;
// 综合调度人
public String dispatcher;
// 现场核实人
public String checker;
// 隐患处理人
public String handlePerson;
// 状态
public Integer state;
// 归档时间
public String archiveTime;
// 处理方式标识(隐患处理、预检预修、抢修)
public String hiddenHandledFlag;
// 合算积分标识
public String integral;
// 派发的子流程的工单号
public String subProcessInstanceId;
// 正在运行中的任务id
public String taskId;
// 受理人
public String assignee;
// 工单所处环节
public String taskDefKey;
// 环节的名称
public String taskDefKeyName;
// 是否隐患
public String isHiddenDanger;
// 是否建设
public String isBuild;
// 是否线路隐患
public String isLineHiddenDanger;
// 派发的流程标识:0抢修;1本地网
public String autoSendProcess;
// 现场核实描述
public String siteCheckRemark;
// 子流程派单人
public String subSendUserId;
// 现场核实提交时间
public String siteCheckString;
public String handleDescribe;// 工单处理描述
public String isFinish;// 是否处理完成
public String turnSendString;// 转派时间
//手机端时间显示--start
public String androidReportedDate ;
public String androidArchiveTime;
public String androidSiteCheckDate;
public String androidTurnSendDate;
public String androidReportedDeptId;
public String androidSpecialty;
public String androidResourceType;
public String androidQuestionType;
public String androidCity;
public String androidCounty;
public String androidDegree;
public String androidImportance;
public String androidValidity;
public String androidIsOurResources;
public String androidIsSiteOperation;
//手机端时间显示--end
}
package com.boco.bbs.model;
/**
* Created by moos on 2018/4/20.
*/
public class ReplyDetailBean {
private String nickName;
private String userLogo;
private int id;
private String commentId;
private String content;
private String status;
private String createDate;
public ReplyDetailBean(String nickName, String content) {
this.nickName = nickName;
this.content = content;
}
public void setNickName(String nickName) {
this.nickName = nickName;
}
public String getNickName() {
return nickName;
}
public void setUserLogo(String userLogo) {
this.userLogo = userLogo;
}
public String getUserLogo() {
return userLogo;
}
public void setId(int id) {
this.id = id;
}
public int getId() {
return id;
}
public void setCommentId(String commentId) {
this.commentId = commentId;
}
public String getCommentId() {
return commentId;
}
public void setContent(String content) {
this.content = content;
}
public String getContent() {
return content;
}
public void setStatus(String status) {
this.status = status;
}
public String getStatus() {
return status;
}
public void setCreateDate(String createDate) {
this.createDate = createDate;
}
public String getCreateDate() {
return createDate;
}
}
package com.boco.bbs.model;
public class TawSystemArea {
public Integer id;
public String areaname;
public String leaf;
public String areaid;
public String parentAreaid;
public Integer ordercode;
public String remark;
public String areacode;
public String oldAreaName;
public String capital;
}
package com.boco.bbs.model;
import com.j256.ormlite.field.DatabaseField;
public class TitleModel {
/** 主键 */
@DatabaseField(id = true, generatedId = false)
public String id;
/** 文章标题 */
@DatabaseField
public String title;
/** 市 */
@DatabaseField
public String city;
/** 部门 */
@DatabaseField
public String department;
/** 作者*/
@DatabaseField
public String author;
/** 电话号码*/
@DatabaseField
public String phonenumber;
/** 专业*/
@DatabaseField
public String profession;
/** 简介*/
@DatabaseField
public String synopsis;
/** 附件名称*/
@DatabaseField
public String attachmentname;
/** 附件数量*/
@DatabaseField
public String attachmentsnum;
/** 创建时间*/
@DatabaseField
public String createtime;
/** 状态*/
@DatabaseField
public String state;
/** 是否是管理*/
@DatabaseField
public String isadmin;
/** 管理员打分*/
@DatabaseField
public String scoreadmin;
/** 登录账号*/
@DatabaseField
public String loginid;
/** 更新时间*/
@DatabaseField
public String updatetime;
/** 附件id*/
@DatabaseField
public String processinstanceid;
}
package com.boco.bbs.service;
import java.util.ArrayList;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
import com.boco.bbs.model.TitleModel;
import com.boco.bbs.utils.Utils;
import com.boco.utils.JsonError;
public class BBSService {
public ArrayList<TitleModel>showTitleJsonToMap(String json){
ArrayList<TitleModel> titlelist = new ArrayList<TitleModel>();
try {
JSONObject obj = null;
if (null != json && !"".equals(json)) {
JSONArray array = new JSONArray(json);
for (int i = 0; i < array.length(); i++) {
try {
obj = Utils.parseJson(array.get(i).toString());
TitleModel titleModel = linkEquipmentListPutJsonValueToMap(obj);
titlelist.add(titleModel);
} catch (JsonError e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
return titlelist;
} else
return null;
} catch (JSONException e) {
e.printStackTrace();
return null;
}
}
public TitleModel linkEquipmentListPutJsonValueToMap(JSONObject obj) throws Exception{
// TODO Auto-generated method stub
TitleModel titleModel = new TitleModel();
titleModel.id=Utils.getJsonObjToString(obj, "id");
titleModel.author=Utils.getJsonObjToString(obj, "author");
titleModel.title=Utils.getJsonObjToString(obj, "title");
return titleModel;
}
public ArrayList<TitleModel> showtitleListJsonValueToMap(String json) {
ArrayList<TitleModel> titlelist = new ArrayList<TitleModel>();
try {
JSONObject obj = null;
if (null != json && !"".equals(json)) {
JSONArray array = new JSONArray(json);
for (int i = 0; i < array.length(); i++) {
try {
obj = Utils.parseJson(array.get(i).toString());
TitleModel titleModel = linkEquipmentListPutJsonValueToMap(obj);
titlelist.add(titleModel);
} catch (JsonError e) {
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
return titlelist;
} else
return null;
} catch (JSONException e) {
e.printStackTrace();
return null;
}
}
}
package com.boco.bbs.utils;
import android.app.ProgressDialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Window;
import android.widget.TextView;
/**
*
* @author 李信念
*
*/
public class AppProgressDialog extends ProgressDialog {
private TextView tv;
public String str_tv;
public AppProgressDialog(Context context) {
super(context);
this.setCanceledOnTouchOutside(false); // 点击其他地方不消失 按返回键消失
// this.setCancelable(false); // 按返回键也不起作用 不消失
}
/*@Override
protected void onCreate(Bundle savedInstanceState) {
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
setContentView(R.layout.app_dialog);
}*/
/*@Override
public void onStart() {
super.onStart();
tv = (TextView) this.findViewById(R.id.show_tv);
if (!"".equals(str_tv)) {
tv.setText(str_tv);
}else{
tv.setText("数据加载中...");
}
}*/
}
package com.boco.bbs.utils;
import java.lang.ref.SoftReference;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.SystemClock;
public class AsyncImageLoader3 {
// 为了加快速度,在内存中开启缓存(主要应用于重复图片较多时,或者同一个图片要多次被访问,比如在ListView时来回滚动)
public Map<String, SoftReference<Drawable>> imageCache = new HashMap<String, SoftReference<Drawable>>();
private ExecutorService executorService = Executors.newFixedThreadPool(5); // 固定五个线程来执行任务
private final Handler handler = new Handler();
/**
*
* @param imageUrl
* 图像url地址
* @param callback
* 回调接口
* @return 返回内存中缓存的图像,第一次加载返回null
*/
public Drawable loadDrawable(final String imageUrl,final ImageCallback callback) {
// 如果缓存过就从缓存中取出数据
if (imageCache.containsKey(imageUrl)) {
SoftReference<Drawable> softReference = imageCache.get(imageUrl);
if (softReference.get() != null) {
return softReference.get();
}
}
// 缓存中没有图像,则从网络上取出数据,并将取出的数据缓存到内存中
executorService.submit(new Runnable() {
public void run() {
try {
final Drawable drawable = loadImageFromUrl(imageUrl);
imageCache.put(imageUrl, new SoftReference<Drawable>(drawable));
handler.post(new Runnable() {
public void run() {
callback.imageLoaded(drawable);
}
});
} catch (Exception e) {
throw new RuntimeException(e);
}
}
});
return null;
}
// 从网络上取数据方法
protected Drawable loadImageFromUrl(String imageUrl) {
try {
// 测试时,模拟网络延时,实际时这行代码不能有
SystemClock.sleep(2000);
return Drawable.createFromStream(new URL(imageUrl).openStream(),"image.png");
} catch (Exception e) {
throw new RuntimeException(e);
}
}
// 对外界开放的回调接口
public interface ImageCallback {
// 注意 此方法是用来设置目标对象的图像资源
public void imageLoaded(Drawable imageDrawable);
}
}
\ No newline at end of file
package com.boco.bbs.utils;
import java.io.File;
import android.os.Environment;
public class CommonData {
public final static String IMG_PATH_SDCARD_DIR = Environment
.getExternalStorageDirectory().getAbsolutePath()
+ File.separator
+ "boco" + File.separator + "crowdfunding";
}
package com.boco.bbs.utils;
import android.content.Context;
import android.os.Environment;
import android.util.Base64;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
public class FileUtil
{
static String TAG = "FileUtil";
public static String imageFilePath = Environment.getExternalStorageDirectory() + "/partnertemp/partner_imag";
public static String imageFilePathMore = Environment.getExternalStorageDirectory() + "/partnertemp/partner_imag_more";
public static String imageFilePathTemp = Environment.getExternalStorageDirectory() + "/partnertemp/partner_imag_temp";
public static String audioFilePath = Environment.getExternalStorageDirectory() + "/partnertemp/partner_audio";
public static String audioFilePathTemp = Environment.getExternalStorageDirectory() + "/partnertemp/partner_audio_temp";
public static void delFile(File file)
{
if (file.exists())
file.delete();
}
// public static boolean upFile(Context context, String url, HashMap<String, String> requestParams, String postData)
// {
// byte[] b = SocketHttpRequester.post(context, url, requestParams, postData, "utf-8");
// String returnValue = "";
// try {
// returnValue = new String(b, "utf-8");
// } catch (UnsupportedEncodingException e) {
// e.printStackTrace();
// }
// return returnValue.contains("true");
// }
public static List<PartnerImage> getAllTempFiles(String path, String id)
{
File file = new File(path);
if (file == null)
file.mkdir();
File[] fileArray = file.listFiles();
List returnList = new ArrayList();
if (fileArray != null)
for (int i = 0; i < fileArray.length; ++i) {
File imageFile = new File(fileArray[i].getPath());
if ((!(imageFile.isDirectory())) &&
(imageFile.getName().endsWith(".png"))) {
PartnerImage image;
String fileName = imageFile.getName();
String[] tempNameArray = fileName.split("\\#");
if (id != null) {
boolean b = (tempNameArray != null) && (tempNameArray.length > 2) && (id.equals(tempNameArray[1]));
if (b) {
image = new PartnerImage();
image.name = fileName;
image.path = imageFile.getPath();
returnList.add(image);
}
} else {
image = new PartnerImage();
image.name = fileName;
image.path = imageFile.getPath();
returnList.add(image);
}
}
}
return returnList;
}
public static String convertImageDataToBASE64(String filePath)
{
try
{
if ((filePath == null) || (filePath == ""))
return "";
File file = new File(filePath);
if (!(file.exists())) {
return "";
}
FileInputStream in = new FileInputStream(filePath);
byte[] data = getByte(in);
in.close();
if (data != null) {
String imageString = Base64.encodeToString(data, 0);
return imageString;
}
return "";
}
catch (FileNotFoundException e)
{
e.printStackTrace();
return "";
}
catch (IOException e) {
e.printStackTrace(); }
return "";
}
public static byte[] getByte(InputStream in)
{
if (in == null)
return null;
int sumSize = 0;
List totalBytes = new ArrayList();
byte[] buffer = new byte[1024];
int length = -1;
try {
while ((length = in.read(buffer)) != -1) {
sumSize += length;
byte[] tmp = new byte[length];
System.arraycopy(buffer, 0, tmp, 0, length);
totalBytes.add(tmp);
}
byte[] data = new byte[sumSize];
int start = 0;
for (Iterator localIterator = totalBytes.iterator(); localIterator.hasNext(); ) { byte[] tmp = (byte[])localIterator.next();
System.arraycopy(tmp, 0, data, start, tmp.length);
start += tmp.length;
}
return data;
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}
\ No newline at end of file
package com.boco.bbs.utils;
//package com.boco.inspectcrowdfunding.utils;
//
//import java.io.File;
//import java.io.IOException;
//import java.net.HttpURLConnection;
//import java.util.ArrayList;
//import java.util.List;
//import java.util.Map;
//
//import org.apache.http.HttpEntity;
//import org.apache.http.HttpResponse;
//import org.apache.http.NameValuePair;
//import org.apache.http.client.ClientProtocolException;
//import org.apache.http.client.HttpClient;
//import org.apache.http.client.entity.UrlEncodedFormEntity;
//import org.apache.http.client.methods.HttpPost;
//import org.apache.http.entity.mime.MultipartEntityBuilder;
//import org.apache.http.impl.client.DefaultHttpClient;
//import org.apache.http.message.BasicNameValuePair;
//import org.apache.http.util.EntityUtils;
//
//public class HttpUtils {
// /**
// *
// * @param path
// * http路径
// * @param params
// * 模拟表单数据
// * @param encoding
// * 编码方式
// * @return
// * @throws IOException
// * ,Exception
// * @throws ClientProtocolException
// */
// public static String httpPostMethod(String path,Map<String, Object> params, String encoding)
// throws ClientProtocolException, IOException, Exception {
// String result = "";
// // 1.获得一个相当于浏览器对象的HttpClient,使用这个接口的实现类来创建对象,DefaultHttpClient
// HttpClient httpClient = new DefaultHttpClient();
// try {
//
// // 为httpPost设置路径
// HttpPost request = new HttpPost(path);
//
// // 2.为请求设置参数,也是直接要上传到服务器上的参数
//
// List<NameValuePair> parameters = new ArrayList<NameValuePair>();
// if (params != null && !params.isEmpty()) {
// for (Map.Entry<String, Object> entry : params.entrySet()) {
// NameValuePair nameValuePair = new BasicNameValuePair(
// entry.getKey(), entry.getValue().toString());
// parameters.add(nameValuePair);
// }
// }
//
// HttpEntity entity = new UrlEncodedFormEntity(parameters, encoding);
//
// request.setEntity(entity);
//
// // 3.执行请求
// HttpResponse response = httpClient.execute(request);
// // 4.通过返回码来判断请求是否成功
// System.out.println("----->>>请求码 = "
// + response.getStatusLine().getStatusCode());
// if (response.getStatusLine().getStatusCode() == HttpURLConnection.HTTP_OK) {
// System.out.println("----->>>请求服务器成功 <<<----- ");
// result = EntityUtils.toString(response.getEntity(), encoding);
// } else {
// result = "REQUEST_ERROR";
// }
// return result;
// } catch (ClientProtocolException cpe) {
// throw cpe;
// } catch (IOException ioe) {
// throw ioe;
// } catch (Exception e) {
// throw e;
// } finally {
// httpClient.getConnectionManager().shutdown();
// }
//
// }
//
// /**
// * 返回服务器路径
// */
// public String getPath() {
//
// return "";
// }
//
// /**
// * 上传图片
// *
// * @throws Exception
// */
// public static String httpPostImage(String path, File file,
// Map<String, Object> params) throws Exception {
// String result = "";
// // HttpClient httpClient = HttpClients.createDefault();
// HttpClient httpClient = new DefaultHttpClient();
// try {
//
// HttpPost httppost = new HttpPost(path);
// MultipartEntityBuilder mEntityBuilder = MultipartEntityBuilder
// .create();
// // 提交文件
// mEntityBuilder.addBinaryBody("file", file);
// if (params != null && !params.isEmpty()) {
// for (Map.Entry<String, Object> entry : params.entrySet()) {
// mEntityBuilder.addTextBody(entry.getKey(), entry.getValue()
// .toString());
// }
// }
// httppost.setEntity(mEntityBuilder.build());
// HttpResponse response = httpClient.execute(httppost);
// HttpEntity resEntity = response.getEntity();
// System.out.println("响应码 = "
// + response.getStatusLine().getStatusCode());
// if (resEntity != null) {
// result = EntityUtils.toString(resEntity);
// System.out.println("图片提交返回结果 = " + result);
//
// }
// return result;
//
// } catch (Exception e) {
// e.printStackTrace();
// throw e;
// } finally {
// httpClient.getConnectionManager().shutdown();
// }
//
// }
//
//}
package com.boco.bbs.utils;
public class InspectConstant {
// public static String SETTING_ACTIVITY_FILENAME = "A3_InspectPlanLineSetActivity";
}
package com.boco.bbs.utils;
public class PartnerImage
{
public String name;
public String path;
public PartnerImage()
{
}
public PartnerImage(int res, String name)
{
this.name = name;
}
}
\ No newline at end of file
package com.boco.bbs.utils;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class StringUtils {
/**
* 定义分割常量
* #用于list中每个元素间的分割
* |用于map中每一个kv对间的分割
* =用于map中key与value间的分割
*/
private static final String SEP1 = ",";
private static final String SEP2 = "|";
private static final String SEP3 = "=";
private static final String SEP4 = ";";
/**
* List转换String
*
* @param list 需要转换的List
* @return String 转换后的字符串
*/
public static String ListToString(List<?> list) {
StringBuffer sb = new StringBuffer();
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
if (list.get(i) == null || list.get(i) == "") {
continue;
}
// 如果值是list类型则调用自己
if (list.get(i) instanceof List) {
sb.append(ListToString((List<?>) list.get(i)));
sb.append(SEP1);
} else if (list.get(i) instanceof Map) {
sb.append(MapToString((Map<?, ?>) list.get(i)));
sb.append(SEP1);
} else {
sb.append(list.get(i));
sb.append(SEP1);
}
}
}
return "L" + sb.toString();
}
/**
* Map转换String
*
* @param map 需要转换的Map
* @return String 转换后的字符串
*/
public static String MapToString(Map<?, ?> map) {
StringBuffer sb = new StringBuffer();
// 遍历map
for (Object obj : map.keySet()) {
if (obj == null) {
continue;
}
Object key = obj;
Object value = map.get(key);
if (value instanceof List<?>) {
sb.append(key.toString() + SEP1 + ListToString((List<?>) value));
sb.append(SEP2);
} else if (value instanceof Map<?, ?>) {
sb.append(key.toString() + SEP1 + MapToString((Map<?, ?>) value));
sb.append(SEP2);
} else {
if (value == null) {
sb.append(key.toString() + SEP3 + "0");
sb.append(SEP2);
} else {
sb.append(key.toString() + SEP3 + value.toString());
sb.append(SEP2);
}
}
}
return "M" + sb.toString();
}
/**
* String转换Map
*
* @param mapText 需要转换的字符串
* @return Map<?,?>
*/
public static Map<String, Object> StringToMap(String mapText) {
if (mapText == null || mapText.equals("")) {
return null;
}
mapText = mapText.substring(1);
Map<String, Object> map = new HashMap<String, Object>();
String[] text = mapText.split("\\" + SEP2); // 转换为数组
for (String str : text) {
String[] keyText = str.split(SEP3); // 转换key与value的数组
if (keyText.length < 1) {
continue;
}
String key = keyText[0]; // key
String value = keyText[1]; // value
if (value.charAt(0) == 'M') {
Map<?, ?> map1 = StringToMap(value);
map.put(key, map1);
} else if (value.charAt(0) == 'L') {
List<?> list = StringToList(value);
map.put(key, list);
} else {
map.put(key, value);
}
}
return map;
}
/**
* String转换List
*
* @param listText 需要转换的文本
* @return List<?>
*/
public static List<Object> StringToList(String listText) {
if (listText == null || listText.equals("")) {
return null;
}
listText = listText.substring(1);
List<Object> list = new ArrayList<Object>();
String[] text = listText.split("\\" + SEP1);
String listStr = "";
boolean flag = false;
for (String str : text) {
if (!str.equals("")) {
if (str.charAt(0) == 'M') {
Map<?, ?> map = StringToMap(str);
list.add(map);
} else if (str.charAt(0) == 'L' || flag) {
flag = true;
listStr += str + SEP1;
} else {
list.add(str);
}
}
if (str.equals("")) {
flag = false;
List<?> lists = StringToList(listStr);
list.add(lists);
}
}
return list;
}
}
\ No newline at end of file
package com.boco.bbs.utils;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.lang.ref.SoftReference;
import java.net.URL;
import java.util.HashMap;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.os.Environment;
import android.os.Handler;
import android.util.Log;
public class SyncImageLoader {
private Object lock = new Object();
private boolean mAllowLoad = true;
private boolean firstLoad = true;
private int mStartLoadLimit = 0;
private int mStopLoadLimit = 0;
final Handler handler = new Handler();
private HashMap<String, SoftReference<Drawable>> imageCache = new HashMap<String, SoftReference<Drawable>>();
public interface OnImageLoadListener {
public void onImageLoad(Integer t, Drawable drawable);
public void onError(Integer t);
}
public void setLoadLimit(int startLoadLimit, int stopLoadLimit) {
if (startLoadLimit > stopLoadLimit) {
return;
}
mStartLoadLimit = startLoadLimit;
mStopLoadLimit = stopLoadLimit;
}
public void restore() {
mAllowLoad = true;
firstLoad = true;
}
public void lock() {
mAllowLoad = false;
firstLoad = false;
}
public void unlock() {
mAllowLoad = true;
synchronized (lock) {
lock.notifyAll();
}
}
public void loadImage(Integer t, String imageUrl,
OnImageLoadListener listener, String author1) {
final OnImageLoadListener mListener = listener;
final String mImageUrl = imageUrl;
final Integer mt = t;
final String author = author1;
new Thread(new Runnable() {
@Override
public void run() {
if (!mAllowLoad) {
synchronized (lock) {
try {
lock.wait();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
if (mAllowLoad && firstLoad) {
loadImage(mImageUrl, mt, mListener, author);
}
if (mAllowLoad && mt <= mStopLoadLimit && mt >= mStartLoadLimit) {
loadImage(mImageUrl, mt, mListener, author);
}
}
}).start();
}
private void loadImage(final String mImageUrl, final Integer mt,
final OnImageLoadListener mListener, final String author) {
if (imageCache.containsKey(mImageUrl)) {
SoftReference<Drawable> softReference = imageCache.get(mImageUrl);
final Drawable d = softReference.get();
if (d != null) {
handler.post(new Runnable() {
@Override
public void run() {
if (mAllowLoad) {
mListener.onImageLoad(mt, d);
}
}
});
return;
}
}
try {
final Drawable d = loadImageFromUrl(mImageUrl, author);
if (d != null) {
imageCache.put(mImageUrl, new SoftReference<Drawable>(d));
}
handler.post(new Runnable() {
@Override
public void run() {
if (mAllowLoad) {
mListener.onImageLoad(mt, d);
}
}
});
} catch (IOException e) {
handler.post(new Runnable() {
@Override
public void run() {
mListener.onError(mt);
}
});
e.printStackTrace();
}
}
public static Drawable compressDrable(String path) {
BitmapFactory.Options opt = new BitmapFactory.Options();
opt.inPreferredConfig = Bitmap.Config.RGB_565;
opt.inSampleSize = 30; //width,hight设为原来的十分一
opt.inPurgeable = true;
opt.inInputShareable = true; // 获取资源图片
// InputStream is = context.getResources().openRawResource(resId);
Drawable drawable = null;
try {
File file = new File(path);
InputStream inputStream = null;
inputStream = new FileInputStream(file);
drawable = new BitmapDrawable(BitmapFactory.decodeStream(inputStream, null, opt));
inputStream.close();
} catch (FileNotFoundException e) {
Log.e("SyncImageLoader.compressDrable", e.getMessage());
} catch (IOException e) {
Log.e("SyncImageLoader.compressDrable", e.getMessage());
}
return drawable;
}
public static Drawable loadImageFromUrl(String url, String author)
throws IOException {
// 是否SD卡可用
if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
return compressDrable(url);
}
// SD卡不可用则直接加载使用
else {
URL m = new URL(url);
InputStream i = (InputStream) m.getContent();
Drawable d = Drawable.createFromStream(i, "src");
return d;
}
}
}
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/button_search_bg_normal" android:state_window_focused="false"/>
<item android:drawable="@drawable/button_search_bg_press" android:state_focused="true"/>
<item android:drawable="@drawable/button_search_bg_press" android:state_pressed="true"/>
<item android:drawable="@drawable/button_search_bg_normal"/>
</selector>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment