添加服务启动按钮
This commit is contained in:
parent
395674d302
commit
f3577c7e78
@ -1,8 +1,8 @@
|
||||
#Created by .winboll/winboll_app_build.gradle
|
||||
#Fri Mar 21 13:06:16 GMT 2025
|
||||
#Fri Mar 21 13:19:51 GMT 2025
|
||||
stageCount=0
|
||||
libraryProject=
|
||||
baseVersion=1.0
|
||||
publishVersion=1.0.0
|
||||
buildCount=365
|
||||
buildCount=367
|
||||
baseBetaVersion=1.0.1
|
||||
|
@ -33,6 +33,7 @@ import cc.winboll.studio.positions.models.PostionFixModel;
|
||||
import cc.winboll.studio.positions.utils.LocationFusion;
|
||||
import cc.winboll.studio.positions.utils.TimeUtils;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Switch;
|
||||
|
||||
public class PositionsFragment extends Fragment {
|
||||
|
||||
@ -52,6 +53,8 @@ public class PositionsFragment extends Fragment {
|
||||
|
||||
EditText metLockLatitude;
|
||||
EditText metLockLongitude;
|
||||
|
||||
Switch mswTaskService;
|
||||
|
||||
double latitudeWifiLock;
|
||||
double longitudeWifiLock;
|
||||
@ -106,34 +109,21 @@ public class PositionsFragment extends Fragment {
|
||||
|
||||
metLockLatitude = viewMain.findViewById(R.id.locklatitude_et);
|
||||
metLockLongitude = viewMain.findViewById(R.id.locklongitude_et);
|
||||
metLockLatitude.setEnabled(false);
|
||||
metLockLongitude.setEnabled(false);
|
||||
|
||||
// tvWifiLocation = viewMain.findViewById(R.id.wifi_position_tv);
|
||||
// tvGPSLocation = viewMain.findViewById(R.id.gps_position_tv);
|
||||
// tvFuseLocation = viewMain.findViewById(R.id.fuse_position_tv);
|
||||
locationManager = (LocationManager) getActivity().getSystemService(getActivity().LOCATION_SERVICE);
|
||||
|
||||
Button btnLockingPosition = viewMain.findViewById(R.id.locking_position_btn);
|
||||
btnLockingPosition.setOnClickListener(new View.OnClickListener(){
|
||||
@Override
|
||||
public void onClick(View p1) {
|
||||
if (!metLockLatitude.getText().toString().trim().equals("")
|
||||
&& !metLockLongitude.getText().toString().trim().equals("")) {
|
||||
_LocationPhoneGPSLock = new Location("User_Defined_GPS");
|
||||
_LocationPhoneGPSLock.setLatitude(Double.parseDouble(metLockLatitude.getText().toString()));
|
||||
_LocationPhoneGPSLock.setLongitude(Double.parseDouble(metLockLongitude.getText().toString()));
|
||||
ToastUtils.show("定位手动设定位置");
|
||||
} else {
|
||||
Location locationFix = fixGPSLocationFromPostionFixModel(_LocationPhoneGPS);
|
||||
//_LocationPhoneGPSLock = _LocationTX;
|
||||
_LocationPhoneGPSLock = locationFix;
|
||||
ToastUtils.show("定位GPS设定位置");
|
||||
}
|
||||
showLockPostionInfo();
|
||||
//ToastUtils.show(String.format("%s", locationFix.toString()));
|
||||
|
||||
TXMSFragment.moveToLocation(_LocationPhoneGPSLock.getLatitude(), _LocationPhoneGPSLock.getLongitude());
|
||||
}
|
||||
});
|
||||
mswTaskService = viewMain.findViewById(R.id.taskservice_sw);
|
||||
// mswTaskService.setOnClickListener(new View.OnClickListener(){
|
||||
// @Override
|
||||
// public void onClick(View p1) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
|
||||
// 请求GPS定位
|
||||
locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, phoneGPSLocationListener);
|
||||
@ -151,6 +141,25 @@ public class PositionsFragment extends Fragment {
|
||||
|
||||
return viewMain;
|
||||
}
|
||||
|
||||
void moveToCurrentLocation() {
|
||||
if (!metLockLatitude.getText().toString().trim().equals("")
|
||||
&& !metLockLongitude.getText().toString().trim().equals("")) {
|
||||
_LocationPhoneGPSLock = new Location("User_Defined_GPS");
|
||||
_LocationPhoneGPSLock.setLatitude(Double.parseDouble(metLockLatitude.getText().toString()));
|
||||
_LocationPhoneGPSLock.setLongitude(Double.parseDouble(metLockLongitude.getText().toString()));
|
||||
ToastUtils.show("定位手动设定位置");
|
||||
} else {
|
||||
Location locationFix = fixGPSLocationFromPostionFixModel(_LocationPhoneGPS);
|
||||
//_LocationPhoneGPSLock = _LocationTX;
|
||||
_LocationPhoneGPSLock = locationFix;
|
||||
ToastUtils.show("定位GPS设定位置");
|
||||
}
|
||||
showLockPostionInfo();
|
||||
//ToastUtils.show(String.format("%s", locationFix.toString()));
|
||||
|
||||
TXMSFragment.moveToLocation(_LocationPhoneGPSLock.getLatitude(), _LocationPhoneGPSLock.getLongitude());
|
||||
}
|
||||
|
||||
void showLocationPhoneGPS() {
|
||||
if (_LocationPhoneGPS != null) {
|
||||
@ -356,6 +365,9 @@ public class PositionsFragment extends Fragment {
|
||||
// LogUtils.d(TAG, szTemp);
|
||||
showLocationPhoneGPS();
|
||||
updatePostionFixModel();
|
||||
if(mswTaskService.isChecked()) {
|
||||
moveToCurrentLocation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -152,11 +152,11 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
<Switch
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="定位"
|
||||
android:id="@+id/locking_position_btn"/>
|
||||
android:text="启用提醒服务"
|
||||
android:id="@+id/taskservice_sw"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user