Merge branch 'FBS9600' of http://whychdw@118.89.139.230:10101/r/FBS9600App.git into FBS9600
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <module external.linked.project.id="android" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4"> |
| | | <component name="FacetManager"> |
| | | <facet type="java-gradle" name="Java-Gradle"> |
| | | <configuration> |
| | | <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" /> |
| | | <option name="BUILDABLE" value="false" /> |
| | | </configuration> |
| | | </facet> |
| | | </component> |
| | | <component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_8" inherit-compiler-output="true"> |
| | | <exclude-output /> |
| | | <content url="file://$MODULE_DIR$"> |
| | | <excludeFolder url="file://$MODULE_DIR$/.gradle" /> |
| | | <excludeFolder url="file://$MODULE_DIR$/build" /> |
| | | </content> |
| | | <orderEntry type="inheritedJdk" /> |
| | | <orderEntry type="sourceFolder" forTests="false" /> |
| | | </component> |
| | | <?xml version="1.0" encoding="UTF-8"?>
|
| | | <module external.linked.project.id="android" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
| | | <component name="FacetManager">
|
| | | <facet type="java-gradle" name="Java-Gradle">
|
| | | <configuration>
|
| | | <option name="BUILD_FOLDER_PATH" value="$MODULE_DIR$/build" />
|
| | | <option name="BUILDABLE" value="false" />
|
| | | </configuration>
|
| | | </facet>
|
| | | </component>
|
| | | <component name="NewModuleRootManager" inherit-compiler-output="true">
|
| | | <exclude-output />
|
| | | <content url="file://$MODULE_DIR$">
|
| | | <excludeFolder url="file://$MODULE_DIR$/.gradle" />
|
| | | <excludeFolder url="file://$MODULE_DIR$/build" />
|
| | | </content>
|
| | | <orderEntry type="jdk" jdkName="1.8" jdkType="JavaSDK" />
|
| | | <orderEntry type="sourceFolder" forTests="false" />
|
| | | </component>
|
| | | </module> |
| | |
| | | <manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="io.cordova.hellocordova" xmlns:android="http://schemas.android.com/apk/res/android"> |
| | | <supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" /> |
| | | <uses-permission android:name="android.permission.INTERNET" /> |
| | | |
| | | <!-- 程序自启动权限 --> |
| | | <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> |
| | | |
| | | <application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true"> |
| | | <activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize"> |
| | | <intent-filter android:label="@string/launcher_name"> |
| | |
| | | <category android:name="android.intent.category.LAUNCHER" /> |
| | | </intent-filter> |
| | | </activity> |
| | | |
| | | <!-- 程序自启动广播 --> |
| | | <receiver |
| | | android:name="com.receivers.MyBootReceiver" |
| | | android:enabled="true" |
| | | android:exported="true"> |
| | | <intent-filter android:priority="1000"> |
| | | <action android:name="android.intent.action.BOOT_COMPLETED" /> |
| | | </intent-filter> |
| | | </receiver> |
| | | </application> |
| | | </manifest> |
| | |
| | | for(int i=0;i<allBattDatt.size();i++){
|
| | | BattDataThread battDataThread = allBattDatt.get(i);
|
| | | if(battDataThread.isInstall){
|
| | | List<BattAlarmData> alarmDatas = battDataThread.state.makeAlarmData(battDataThread,alarmParam);
|
| | | if(alarmDatas.size() > 0){
|
| | | //Log.e(TAG, "run: 更新告警条数"+ alarmDatas.size());
|
| | | List<BattAlarmData> alarmDatas = battDataThread.state.makeAlarmData(battDataThread,alarmParam);
|
| | | if(alarmDatas.size() > 0){
|
| | | //Log.e(TAG, "run: 更新告警条数"+ alarmDatas.size());
|
| | |
|
| | | //更新当前告警记录
|
| | | for(int k = 0;k<alarmDatas.size();k++){
|
| | | //Log.e(TAG, "run: "+alarmDatas.get(k) );
|
| | | insertOrUpdateBattAlarmData(dbHelper,alarmDatas.get(k)); //插入或更新当前的告警记录
|
| | | }
|
| | | }
|
| | | for(int k = 0;k<alarmDatas.size();k++){
|
| | | //Log.e(TAG, "run: "+alarmDatas.get(k) );
|
| | | insertOrUpdateBattAlarmData(dbHelper,alarmDatas.get(k)); //插入或更新当前的告警记录
|
| | | }
|
| | | }
|
| | | alarmDatas.clear();
|
| | | }else{
|
| | | //清除未安装电池组的告警记录
|
| | | if(battDataThread.isAlarmClear){
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | sleep(1000);
|
| | | sleep(2000);
|
| | | } catch (Exception e) {
|
| | | e.printStackTrace();
|
| | | }
|
| | |
| | | */
|
| | | public void initBattAlarmParam(DBHelper dbHelper,AlarmParam alarmParam){
|
| | | String str_sql = " SELECT num,alm_id,alm_name,alm_high_coe,alm_low_coe,alm_high_en,alm_low_en " +
|
| | | " FROM tb_alarm_param ";
|
| | | " FROM tb_alarm_param ";
|
| | | boolean flag = false;
|
| | | SQLiteDatabase db = null;
|
| | | try {
|
| | |
| | | //计算总的单体数目
|
| | | public int countMonCount(){
|
| | | //return this.first_monCount+second_monCount+thrid_monCount+fourth_monCount+fifth_monCount;
|
| | | return 24;
|
| | | return 50;
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | private double sysversion; //系统版本(0.1)
|
| | | private int sysstate; //系统状态 0-常规模式 1-内阻模式 2-编址模式
|
| | | private double groupvol; //组端电压(0.1)
|
| | | private double groupcurr; //组端电流(0.1)
|
| | | private float groupvol; //组端电压(0.1)
|
| | | private float groupcurr; //组端电流(0.1)
|
| | | public int battstate; //电池状态 0-浮充 1-放电 2-充电
|
| | | private int currdirection; //电流方向 0-充电 1-放电
|
| | |
|
| | |
| | | this.backup7 = state.backup7;
|
| | | this.backup8 = state.backup8;
|
| | | this.restestcount = state.restestcount; //内阻测试次数
|
| | |
|
| | | this.groupvol = groupvol+(float)Math.random()*10; //随机组端电压
|
| | | this.groupvol = (float)Math.round(groupvol*100)/100;
|
| | | this.groupcurr = groupcurr+(float)Math.random()*5; //随机组端电流
|
| | | this.groupcurr = (float)Math.round(groupcurr*100)/100;
|
| | | }
|
| | |
|
| | | //复制单体电压
|
| | |
| | |
|
| | | sysversion = ComBase.changeShortToDouble(tmpbuf.getShort())/10; //系统版本
|
| | | sysstate = ComBase.changeShortToInt(tmpbuf.getShort()); //系统状态
|
| | | groupvol = ComBase.changeShortToDouble(tmpbuf.getShort())/10; //组端电压
|
| | | groupcurr = ComBase.changeShortToDouble(tmpbuf.getShort())/10; //组端电流
|
| | | groupvol = (float)ComBase.changeShortToDouble(tmpbuf.getShort())/10; //组端电压
|
| | | groupcurr = (float)ComBase.changeShortToDouble(tmpbuf.getShort())/10; //组端电流
|
| | | battstate = ComBase.changeShortToInt(tmpbuf.getShort()); //电池状态
|
| | | currdirection = ComBase.changeShortToInt(tmpbuf.getShort()); //电流方向
|
| | | this.currdirection=1;
|
| | | this.battstate = 1;
|
| | | this.currdirection=0;
|
| | | this.battstate = 2;
|
| | | if(currdirection == 1){
|
| | | groupcurr = groupcurr *(-1); //改变当前电流方向
|
| | | }
|
| | |
| | | return true;
|
| | | }
|
| | |
|
| | | public List<BattAlarmData> makeAlarmData(BattDataThread battDataThread, AlarmParam alarmParam){
|
| | | List<BattAlarmData> alarmDatas = new ArrayList<>();
|
| | | Concentrator_State state = battDataThread.state;
|
| | | public List<BattAlarmData> makeAlarmData(BattDataThread battDataThread, AlarmParam alarmParam){
|
| | | List<BattAlarmData> alarmDatas = new ArrayList<>();
|
| | | Concentrator_State state = battDataThread.state;
|
| | |
|
| | | //判断组端电压告警
|
| | | AlarmParam.AlarmParamCell groupVol_param = alarmParam.alm_GroupVol.CreateAlarmParamCell(battDataThread.battinf);
|
| | | state.groupVol_AlarmData.makeAlarmData(alarmDatas,groupVol_param,state.groupvol);
|
| | | //判断组端电压告警
|
| | | AlarmParam.AlarmParamCell groupVol_param = alarmParam.alm_GroupVol.CreateAlarmParamCell(battDataThread.battinf);
|
| | | state.groupVol_AlarmData.makeAlarmData(alarmDatas,groupVol_param,state.groupvol);
|
| | |
|
| | | //判断电池电流告警
|
| | | AlarmParam.AlarmParamCell battCurr_param = alarmParam.alm_BattCurr.CreateAlarmParamCell(battDataThread.battinf);
|
| | | state.battCurr_AlarmData.makeAlarmData(alarmDatas,battCurr_param,state.groupcurr);
|
| | | //判断电池电流告警
|
| | | AlarmParam.AlarmParamCell battCurr_param = alarmParam.alm_BattCurr.CreateAlarmParamCell(battDataThread.battinf);
|
| | | state.battCurr_AlarmData.makeAlarmData(alarmDatas,battCurr_param,state.groupcurr);
|
| | |
|
| | | //判断单体告警
|
| | | for(int i=0;i<monCount;i++){
|
| | | //判断单体电压告警
|
| | | AlarmParam.AlarmParamCell monVol_param = alarmParam.alm_MonVol.CreateAlarmParamCell(battDataThread.battinf);
|
| | | //判断单体告警
|
| | | for(int i=0;i<monCount;i++){
|
| | | //判断单体电压告警
|
| | | AlarmParam.AlarmParamCell monVol_param = alarmParam.alm_MonVol.CreateAlarmParamCell(battDataThread.battinf);
|
| | | //Log.e(TAG, "makeAlarmData: monvol 告警值hig"+monVol_param.alm_high_coe+"\tlow"+monVol_param.alm_low_coe );
|
| | | state.monVol_AlarmData[i].makeAlarmData(alarmDatas,monVol_param,state.mon_vols[i]);
|
| | |
|
| | | //判断单体温度告警
|
| | | AlarmParam.AlarmParamCell monTmp_param = alarmParam.alm_MonTmp.CreateAlarmParamCell(battDataThread.battinf);
|
| | | state.monTmp_AlarmData[i].makeAlarmData(alarmDatas,monTmp_param,state.mon_tmps[i]);
|
| | | //判断单体温度告警
|
| | | AlarmParam.AlarmParamCell monTmp_param = alarmParam.alm_MonTmp.CreateAlarmParamCell(battDataThread.battinf);
|
| | | state.monTmp_AlarmData[i].makeAlarmData(alarmDatas,monTmp_param,state.mon_tmps[i]);
|
| | |
|
| | | //判断单体内阻告警
|
| | | AlarmParam.AlarmParamCell monRes_param = alarmParam.alm_MonRes.CreateAlarmParamCell(battDataThread.battinf);
|
| | | state.monRes_AlarmData[i].makeAlarmData(alarmDatas,monRes_param,state.mon_ress[i]);
|
| | | //判断单体内阻告警
|
| | | AlarmParam.AlarmParamCell monRes_param = alarmParam.alm_MonRes.CreateAlarmParamCell(battDataThread.battinf);
|
| | | state.monRes_AlarmData[i].makeAlarmData(alarmDatas,monRes_param,state.mon_ress[i]);
|
| | |
|
| | | }
|
| | | return alarmDatas;
|
| | | }
|
| | | }
|
| | | return alarmDatas;
|
| | | }
|
| | |
|
| | | public boolean putMonDataBuffer(ByteBuffer bf,int reg_addr){
|
| | | if(bf.limit() < BYTE_LEN) {
|
| | |
| | | this.sysstate = sysstate;
|
| | | }
|
| | |
|
| | | public void setGroupvol(double groupvol) {
|
| | | public void setGroupvol(float groupvol) {
|
| | | this.groupvol = groupvol;
|
| | | }
|
| | |
|
| | | public void setGroupcurr(double groupcurr) {
|
| | | public void setGroupcurr(float groupcurr) {
|
| | | this.groupcurr = groupcurr;
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.receivers;
|
| | |
|
| | | import android.content.BroadcastReceiver;
|
| | | import android.content.Context;
|
| | | import android.content.Intent;
|
| | |
|
| | | import io.cordova.hellocordova.MainActivity;
|
| | |
|
| | | /**
|
| | | * 开机自启广播接收器
|
| | | */
|
| | | public class MyBootReceiver extends BroadcastReceiver {
|
| | |
|
| | | @Override
|
| | | public void onReceive(Context context, Intent intent) {
|
| | | if (intent.getAction().equals("android.intent.action.BOOT_COMPLETED")) {
|
| | | Intent i = new Intent(context, MainActivity.class);
|
| | | i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
| | | context.startActivity(i);
|
| | | }
|
| | | }
|
| | | }
|
| | |
| | | @Override |
| | | public void run() { |
| | | Log.d(TAG, "run: BattResDataRecordThread start at" + Com.getDateTimeFormat(new Date(),Com.DTF_YMDhms)); |
| | | |
| | | |
| | | while(true){ |
| | | try { |
| | | //Log.e(TAG, "run: "+ battData.isOutTime+"\tlastResTestCount:"+lastResTestCount+"\t count:"+battData.state.getRestestcount()); |
| | |
| | | if(battData.state.monCount >0 && battData.state.mon_ress[battData.state.monCount-1] > 0){ |
| | | //开始记录内阻历史数据 |
| | | int max_test_record_count = queryMaxTestRecordCount(battData.battIndex,dbHelper); //查询当前电池组最大的记录笔数 |
| | | //Log.e(TAG, "run: MAXCOUNT:"+max_test_record_count ); |
| | | Log.e(TAG, "run: MAXCOUNT:"+max_test_record_count ); |
| | | //插入 tb_battresdata_inf 表中 |
| | | insertBattResDataInf(battData.battIndex, battData.state,dbHelper,max_test_record_count); |
| | | |
| | |
| | | lastResTestCount = battData.state.getRestestcount(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | sleep(3000); |
| | | } catch (Exception e) { |
| | |
| | | sql_str_base += "("+battgroupid+","+test_record_count+","+BattDataThread.TESTTYPE_RESTEST+",'"+Com.getDateTimeFormat(new Date(),Com.DTF_YMDhms)+"',"+state.getGroupvol()+","+state.getGroupcurr()+","+(i+1)+","+state.mon_vols[i]+","+state.mon_tmps[i]+","+state.mon_ress[i]+")"; |
| | | } |
| | | SQLiteDatabase db = dbHelper.getWritableDatabase(); |
| | | //Log.e(TAG, "insertBattResDataID: "+sql_str_start+sql_str_base ); |
| | | try { |
| | | db.execSQL(sql_str_start+sql_str_base); |
| | | } catch (SQLException e) { |
| | |
| | | String sql_str = "INSERT INTO tb_battresdata_inf " + |
| | | "(BattGroupId,test_record_count,test_type,test_starttime,record_time,group_vol,test_curr) " + |
| | | "VALUES(" |
| | | + battgroupid+"," |
| | | + test_record_count+"," |
| | | + BattDataThread.TESTTYPE_RESTEST+",'" |
| | | + Com.getDateTimeFormat(new Date(),Com.DTF_YMDhms)+"','" |
| | | + Com.getDateTimeFormat(new Date(),Com.DTF_YMDhms)+"'," |
| | | + state.getGroupvol()+ "," |
| | | + state.getGroupcurr()+"" + |
| | | + battgroupid+"," |
| | | + test_record_count+"," |
| | | + BattDataThread.TESTTYPE_RESTEST+",'" |
| | | + Com.getDateTimeFormat(new Date(),Com.DTF_YMDhms)+"','" |
| | | + Com.getDateTimeFormat(new Date(),Com.DTF_YMDhms)+"'," |
| | | + state.getGroupvol()+ "," |
| | | + state.getGroupcurr()+"" + |
| | | ");"; |
| | | SQLiteDatabase db = dbHelper.getWritableDatabase(); |
| | | try { |
| | | Log.d(TAG, "insertBattResDataInf: "+sql_str); |
| | | //Log.d(TAG, "insertBattResDataInf: "+sql_str); |
| | | db.execSQL(sql_str); |
| | | |
| | | } catch (Exception e) { |
| | |
| | | //记录当前的充放电记录 |
| | | insertBattTestData(dbHelper,battData); |
| | | } |
| | | if(!isRecording && testTimelong < minTestTimeLong){ |
| | | //测试时长小于1分钟的充放电记录删除 |
| | | deleteInvalidTestData(dbHelper,battData); |
| | | } |
| | | battData.state.record_num++; |
| | | isStartRecord = false; |
| | | }else{ |
| | |
| | | // } |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 删除历史指定电池组的指定充放电记录 |
| | | * @param dbHelper |
| | | * @param battData |
| | | */ |
| | | public static void deleteInvalidTestData(DBHelper dbHelper,BattDataThread battData){ |
| | | Concentrator_State state = battData.state; |
| | | //删除tb_batttestdata_inf表中的记录 |
| | | String sql_delbatttDataInf_str = "DELETE FROM tb_batttestdata_inf WHERE BattGroupId = "+battData.battIndex+" AND test_record_count = "+state.test_record_count; |
| | | //删除tb_batttestdata_id表中的记录 |
| | | String sql_delbatttDataId_str = "DELETE FROM tb_batttestdata_"+battData.battIndex+" WHERE test_record_count= "+state.test_record_count; |
| | | SQLiteDatabase db = null; |
| | | try { |
| | | db = dbHelper.getWritableDatabase(); |
| | | db.beginTransaction(); |
| | | db.execSQL(sql_delbatttDataInf_str); |
| | | db.execSQL(sql_delbatttDataId_str); |
| | | db.setTransactionSuccessful(); |
| | | db.endTransaction(); |
| | | } catch (SQLException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | Log.e(TAG, "deleteInvalidTestData:删除测试时长小于1分钟的放电记录 "); |
| | | } |
| | | } |
| | |
| | | //读取电池组充电电池信息
|
| | | @JavascriptInterface
|
| | | public void readBattCharInfo(){
|
| | | List list = new ArrayList();
|
| | | List<HashMap> list = new ArrayList();
|
| | | for(int i=0;i<allBattDatt.size();i++){
|
| | | if(allBattDatt.get(i).state.battstate == Concentrator_State.WORKSTATE_CHARG){
|
| | | list.add(allBattDatt.get(i));
|
| | | if(allBattDatt.get(i).state.battstate == Concentrator_State.WORKSTATE_CHARG && allBattDatt.get(i).isInstall){
|
| | | HashMap map = new HashMap();
|
| | | map.put("state",allBattDatt.get(i).state);
|
| | | map.put("battinf",allBattDatt.get(i).battinf);
|
| | | list.add(map);
|
| | | }
|
| | | }
|
| | | ServiceModel model = new ServiceModel();
|
| | | model.code = 1;
|
| | | model.data = list;
|
| | | //Log.e(TAG, "readBattCharInfo: "+model );
|
| | | ActionUtil.SendCallDataToJS(JS_INTERFACE_NAME,"readBattCharInfo",model,webView, ActionUtil.getGson());
|
| | | }
|
| | |
|
| | |
| | | //Log.e(TAG, "readBattDiscInfo: ##############################"+allBattDatt.size());
|
| | | List<HashMap> list = new ArrayList();
|
| | | for(int i=0;i<allBattDatt.size();i++){
|
| | | if(allBattDatt.get(i).state.battstate == Concentrator_State.WORKSTATE_DISCH){
|
| | | if(allBattDatt.get(i).state.battstate == Concentrator_State.WORKSTATE_DISCH && allBattDatt.get(i).isInstall){
|
| | | HashMap map = new HashMap();
|
| | | map.put("state",allBattDatt.get(i).state);
|
| | | map.put("battinf",allBattDatt.get(i).battinf);
|
| | |
| | | |
| | | package io.cordova.hellocordova; |
| | | |
| | | import android.database.sqlite.SQLiteDatabase; |
| | | import android.graphics.Rect; |
| | | import android.os.Bundle; |
| | | import android.util.Log; |
| | | import android.view.View; |
| | | import android.view.ViewTreeObserver; |
| | | import android.view.WindowManager; |
| | | import android.webkit.WebView; |
| | | |
| | | import com.fgkj.action.JsInterface; |
| | | import com.fgkj.dao.DBHelper; |
| | | import com.fgkj.dao.SQLdm; |
| | | import com.fgkj.dto.Battresdata; |
| | | import com.fgkj.dto.Batttestdata_inf; |
| | | import com.fgkj.service.Battalram_dataService; |
| | | import com.fgkj.service.BattinfService; |
| | | import com.fgkj.service.BattresdataService; |
| | |
| | | { |
| | | public WebView webview; |
| | | public DBHelper dbHelper; |
| | | boolean isShow = false; |
| | | |
| | | @Override |
| | | public void onCreate(Bundle savedInstanceState) |
| | |
| | | |
| | | // Set by <content src="index.html" /> in config.xml |
| | | loadUrl(launchUrl); |
| | | |
| | | |
| | | dbHelper=new DBHelper(this,"fbs9600.db", null, 1); |
| | | |
| | | |
| | | webview = findViewById(appView.getView().getId()); |
| | | // 添加事件 |
| | | webview.addJavascriptInterface(new JsInterface(this, webview,MainActivity.this), JsInterface.JS_INTERFACE_NAME); |
| | | //添加设备通讯相关接口 |
| | | webview.addJavascriptInterface(new FBS9600S_DeviceService(webview,dbHelper), FBS9600S_DeviceService.JS_INTERFACE_NAME); |
| | | //tb_battinf表的操作 |
| | | //tb_battinf表的操作 |
| | | webview.addJavascriptInterface(new BattinfService(webview, dbHelper),BattinfService.BATTINFSERVICE_NAME); |
| | | //tb_batttestdata表的操作 |
| | | webview.addJavascriptInterface(new BatttestdataService(webview, dbHelper),BatttestdataService.BATTTESTDATASERVICE_NAME); |
| | |
| | | webview.addJavascriptInterface(new Battresdata_infService(webview, dbHelper),Battresdata_infService.BATTRESDATA_INFSERVICE_NAME); |
| | | //添加告警接口 |
| | | webview.addJavascriptInterface(new Battalram_dataService(webview,dbHelper),Battalram_dataService.BATTALRAM_DATASERVICE_NAME); |
| | | |
| | | |
| | | //监听键盘显示和隐藏事件 |
| | | this.webview.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { |
| | | @Override |
| | | public void onGlobalLayout() { |
| | | Rect rect = new Rect(); |
| | | webview.getWindowVisibleDisplayFrame(rect); |
| | | int displayHeight = rect.bottom - rect.top; |
| | | int height = webview.getHeight(); |
| | | boolean visible = (double) displayHeight / height < 0.8; |
| | | if (visible) { |
| | | if(!isShow){ |
| | | //隐藏状态栏,并且不显示字体 |
| | | getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); |
| | | Log.e(TAG, "软键盘显示"); |
| | | isShow = true; |
| | | } |
| | | } else { |
| | | isShow = false; |
| | | Log.e(TAG, "软键盘隐藏"); |
| | | hideSystemMenu(); |
| | | } |
| | | } |
| | | }); |
| | | } |
| | | |
| | | @Override |
| | |
| | | dbHelper.close(); |
| | | super.onDestroy(); |
| | | } |
| | | |
| | | /** |
| | | * 隐藏系统菜单栏 |
| | | */ |
| | | public void hideSystemMenu(){ |
| | | int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | |
| | | //布局位于状态栏下方 |
| | | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | |
| | | //全屏 |
| | | View.SYSTEM_UI_FLAG_FULLSCREEN | |
| | | //隐藏导航栏 |
| | | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | |
| | | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; |
| | | uiOptions |= 0x00001000; |
| | | getWindow().getDecorView().setSystemUiVisibility(uiOptions); |
| | | } |
| | | |
| | | |
| | | } |
| | |
| | | <allow-intent href="geo:*" /> |
| | | <allow-intent href="market:*" /> |
| | | <preference name="loglevel" value="DEBUG" /> |
| | | <preference name="Orientation" value="landscape" /> |
| | | <preference name="Fullscreen" value="true" /> |
| | | </widget> |