配置调整

master
hwf452 10 months ago
parent 6fb1d34e46
commit 97921218b4

@ -327,12 +327,6 @@
android:screenOrientation="portrait" android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden|adjustPan" /> android:windowSoftInputMode="stateHidden|adjustPan" />
<service
android:name="com.bjzc.yfdxj.bleUtil.BluetoothLeService"
android:exported="false"
android:enabled="true" />
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileProvider" android:authorities="${applicationId}.fileProvider"

@ -265,9 +265,11 @@ public class LoginActivity extends BaseActivity {
SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy年MM月dd日"); SimpleDateFormat sdFormat = new SimpleDateFormat("yyyy年MM月dd日");
Date date = sdFormat.parse(lastLoginDate); Date date = sdFormat.parse(lastLoginDate);
Calendar calendarOne = Calendar.getInstance(); Calendar calendarOne = Calendar.getInstance();
calendarOne.setTime(date); if(date!=null){
if (!Calendar.getInstance().after(calendarOne)) { calendarOne.setTime(date);
return true; if (!Calendar.getInstance().after(calendarOne)) {
return true;
}
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();

@ -84,7 +84,7 @@ public class MainActivity extends BaseActivity3 {
//private int[] imageId = {R.mipmap.icon6, R.mipmap.icon11, R.mipmap.icon_dxj, R.mipmap.icon13}; //private int[] imageId = {R.mipmap.icon6, R.mipmap.icon11, R.mipmap.icon_dxj, R.mipmap.icon13};
//private int[] colors = {R.drawable.radius_e3, R.drawable.radius_a4, R.drawable.radius_a1, R.drawable.radius_b1}; //private int[] colors = {R.drawable.radius_e3, R.drawable.radius_a4, R.drawable.radius_a1, R.drawable.radius_b1};
private long exitTime = 0; private long exitTime = 0;
private BluetoothLeService mBluetoothLeService; //private BluetoothLeService mBluetoothLeService;
public static final int REQUEST_CHECK_TEMPERATURE = 1; public static final int REQUEST_CHECK_TEMPERATURE = 1;
public static final int REQUEST_CHECK_VIBRATION = 2; public static final int REQUEST_CHECK_VIBRATION = 2;
private String userID; private String userID;
@ -284,8 +284,8 @@ public class MainActivity extends BaseActivity3 {
colors.add(R.drawable.radius_c6); colors.add(R.drawable.radius_c6);
setAdapter(); setAdapter();
Intent gattServiceIntent = new Intent(this, BluetoothLeService.class); // Intent gattServiceIntent = new Intent(this, BluetoothLeService.class);
bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE); // bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);
String username = (String) SPUtils.get(MainActivity.this, Contans.USERNAME, String.valueOf("")); String username = (String) SPUtils.get(MainActivity.this, Contans.USERNAME, String.valueOf(""));
if (username != null) { if (username != null) {
tvLoginUser.setText("登录用户:" + username); tvLoginUser.setText("登录用户:" + username);
@ -432,17 +432,17 @@ public class MainActivity extends BaseActivity3 {
return super.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, event);
} }
private final ServiceConnection mServiceConnection = new ServiceConnection() { // private final ServiceConnection mServiceConnection = new ServiceConnection() {
@Override // @Override
public void onServiceConnected(ComponentName componentName, IBinder service) { // public void onServiceConnected(ComponentName componentName, IBinder service) {
mBluetoothLeService = ((BluetoothLeService.LocalBinder) service).getService(); // mBluetoothLeService = ((BluetoothLeService.LocalBinder) service).getService();
} // }
//
@Override // @Override
public void onServiceDisconnected(ComponentName componentName) { // public void onServiceDisconnected(ComponentName componentName) {
mBluetoothLeService = null; // mBluetoothLeService = null;
} // }
}; // };
@Override @Override
protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) { protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
@ -578,7 +578,6 @@ public class MainActivity extends BaseActivity3 {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@Override @Override
@ -609,11 +608,6 @@ public class MainActivity extends BaseActivity3 {
@Override @Override
public void onDestroy() { public void onDestroy() {
if(mBluetoothLeService!=null){
mBluetoothLeService.disconnect();
mBluetoothLeService.close();
}
unbindService(mServiceConnection);
if(flashUtil!=null){ if(flashUtil!=null){
flashUtil.finishFlashUtils(); flashUtil.finishFlashUtils();
} }
@ -624,8 +618,6 @@ public class MainActivity extends BaseActivity3 {
if(timer!=null){ if(timer!=null){
timer.cancel(); timer.cancel();
} }
Intent intent = new Intent(this, BluetoothLeService.class);
stopService(intent);
// 注销广播接收器 // 注销广播接收器
LocalBroadcastManager.getInstance(this).unregisterReceiver(myReceiver); LocalBroadcastManager.getInstance(this).unregisterReceiver(myReceiver);

@ -19,6 +19,7 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.bjzc.yfdxj.DBModel.Dqgz; import com.bjzc.yfdxj.DBModel.Dqgz;
import com.bjzc.yfdxj.R; import com.bjzc.yfdxj.R;
import com.bjzc.yfdxj.base.BaseActivity3; import com.bjzc.yfdxj.base.BaseActivity3;
import com.bjzc.yfdxj.bleUtil.BlueTestInfoActivity;
import com.bjzc.yfdxj.bleUtil.BluetoothLeService; import com.bjzc.yfdxj.bleUtil.BluetoothLeService;
import com.bjzc.yfdxj.contans.Contans; import com.bjzc.yfdxj.contans.Contans;
import com.bjzc.yfdxj.utils.SPUtils; import com.bjzc.yfdxj.utils.SPUtils;
@ -106,7 +107,8 @@ public class DqgzCheckActivity extends BaseActivity3 {
} }
}); });
registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter()); LocalBroadcastManager.getInstance(DqgzCheckActivity.this).registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter());
Bundle bundle = DqgzCheckActivity.this.getIntent().getExtras(); Bundle bundle = DqgzCheckActivity.this.getIntent().getExtras();
if (bundle != null) { if (bundle != null) {
isEdit = bundle.getBoolean("edit"); isEdit = bundle.getBoolean("edit");
@ -342,7 +344,8 @@ public class DqgzCheckActivity extends BaseActivity3 {
@Override @Override
protected void onDestroy() { protected void onDestroy() {
unregisterReceiver(mGattUpdateReceiver); // 注销广播接收器
LocalBroadcastManager.getInstance(this).unregisterReceiver(mGattUpdateReceiver);
super.onDestroy(); super.onDestroy();
} }

@ -25,6 +25,7 @@ import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.bjzc.yfdxj.DBModel.QYDDATABean; import com.bjzc.yfdxj.DBModel.QYDDATABean;
import com.bjzc.yfdxj.R; import com.bjzc.yfdxj.R;
import com.bjzc.yfdxj.activity.regular.DqgzCheckActivity;
import com.bjzc.yfdxj.adapter.MyFragmentAdapter; import com.bjzc.yfdxj.adapter.MyFragmentAdapter;
import com.bjzc.yfdxj.base.BaseActivity3; import com.bjzc.yfdxj.base.BaseActivity3;
import com.bjzc.yfdxj.bean.SetSbModel; import com.bjzc.yfdxj.bean.SetSbModel;
@ -137,7 +138,8 @@ public class SbxdjcjsbActivity extends BaseActivity3 {
} }
}); });
registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter());
LocalBroadcastManager.getInstance(SbxdjcjsbActivity.this).registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter());
sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Bundle bundle = SbxdjcjsbActivity.this.getIntent().getExtras(); Bundle bundle = SbxdjcjsbActivity.this.getIntent().getExtras();
if (bundle != null) { if (bundle != null) {
@ -284,7 +286,8 @@ public class SbxdjcjsbActivity extends BaseActivity3 {
@Override @Override
protected void onDestroy() { protected void onDestroy() {
unregisterReceiver(mGattUpdateReceiver); // 注销广播接收器
LocalBroadcastManager.getInstance(this).unregisterReceiver(mGattUpdateReceiver);
super.onDestroy(); super.onDestroy();
} }
} }

@ -62,7 +62,7 @@ public class XjMainActivity extends BaseActivity3 {
Intent intent = new Intent(Contans.ACTION_PROFESSIONCHANGE); Intent intent = new Intent(Contans.ACTION_PROFESSIONCHANGE);
intent.putExtra("professionId",profession.getZyid()); intent.putExtra("professionId",profession.getZyid());
//专业选择改变发送广播,刷新任务下载页面 //专业选择改变发送广播,刷新任务下载页面
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);; LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
} }
} }
}); });

@ -29,6 +29,7 @@ import android.widget.TextView;
import android.widget.Toast; import android.widget.Toast;
import com.bjzc.yfdxj.R; import com.bjzc.yfdxj.R;
import com.bjzc.yfdxj.activity.regular.DqgzCheckActivity;
import com.bjzc.yfdxj.base.BaseActivity3; import com.bjzc.yfdxj.base.BaseActivity3;
import com.google.gson.Gson; import com.google.gson.Gson;
@ -37,6 +38,7 @@ import java.util.ArrayList;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.core.app.ActivityCompat; import androidx.core.app.ActivityCompat;
import androidx.core.content.ContextCompat; import androidx.core.content.ContextCompat;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
public class BlueTestInfoActivity extends BaseActivity3 { public class BlueTestInfoActivity extends BaseActivity3 {
@ -96,7 +98,7 @@ public class BlueTestInfoActivity extends BaseActivity3 {
return; return;
} }
setAdapter(); setAdapter();
registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter()); LocalBroadcastManager.getInstance(BlueTestInfoActivity.this).registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter());
Intent gattServiceIntent = new Intent(BlueTestInfoActivity.this, BluetoothLeService.class); Intent gattServiceIntent = new Intent(BlueTestInfoActivity.this, BluetoothLeService.class);
bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE); bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);
initconn = true; initconn = true;
@ -245,7 +247,8 @@ public class BlueTestInfoActivity extends BaseActivity3 {
if (initconn) { if (initconn) {
if (!mConnected) mBluetoothLeService.connect(mDeviceAddress); if (!mConnected) mBluetoothLeService.connect(mDeviceAddress);
} else { } else {
registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter()); //registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter());
LocalBroadcastManager.getInstance(BlueTestInfoActivity.this).registerReceiver(mGattUpdateReceiver, makeGattUpdateIntentFilter());
Intent gattServiceIntent = new Intent(BlueTestInfoActivity.this, BluetoothLeService.class); Intent gattServiceIntent = new Intent(BlueTestInfoActivity.this, BluetoothLeService.class);
bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE); bindService(gattServiceIntent, mServiceConnection, BIND_AUTO_CREATE);
initconn = true; initconn = true;
@ -400,7 +403,8 @@ public class BlueTestInfoActivity extends BaseActivity3 {
scanLeDevice(false); scanLeDevice(false);
mLeDeviceListAdapter.clear(); mLeDeviceListAdapter.clear();
unbindService(mServiceConnection); unbindService(mServiceConnection);
unregisterReceiver(mGattUpdateReceiver); // 注销广播接收器
LocalBroadcastManager.getInstance(this).unregisterReceiver(mGattUpdateReceiver);
super.onDestroy(); super.onDestroy();
} }

@ -103,7 +103,7 @@ public class BluetoothLeService extends Service {
private void broadcastUpdate(final String action) { private void broadcastUpdate(final String action) {
final Intent intent = new Intent(action); final Intent intent = new Intent(action);
LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent);; LocalBroadcastManager.getInstance(getApplicationContext()).sendBroadcast(intent);
} }
//收到数据后,触发广播 //收到数据后,触发广播

@ -7,13 +7,10 @@ import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.util.TypedValue; import android.util.TypedValue;
import android.widget.TextView; import android.widget.TextView;
import com.bjzc.yfdxj.R;
import com.zhy.autolayout.AutoLayoutInfo; import com.zhy.autolayout.AutoLayoutInfo;
import com.zhy.autolayout.utils.AutoLayoutHelper; import com.zhy.autolayout.utils.AutoLayoutHelper;
import com.zhy.autolayout.utils.AutoUtils; import com.zhy.autolayout.utils.AutoUtils;
import com.zhy.autolayout.utils.DimenUtils; import com.zhy.autolayout.utils.DimenUtils;
import java.lang.reflect.Field; import java.lang.reflect.Field;
/** /**

@ -7,10 +7,8 @@ pluginManagement {
includeGroupByRegex("androidx.*") includeGroupByRegex("androidx.*")
} }
} }
//google()
mavenCentral() mavenCentral()
gradlePluginPortal() gradlePluginPortal()
jcenter()
} }
} }
dependencyResolutionManagement { dependencyResolutionManagement {
@ -18,7 +16,6 @@ dependencyResolutionManagement {
repositories { repositories {
google() google()
mavenCentral() mavenCentral()
jcenter()
maven {url "https://jitpack.io"} maven {url "https://jitpack.io"}
//maven {url 'https://maven.google.com'} //maven {url 'https://maven.google.com'}
} }

Loading…
Cancel
Save