|
|
@ -1,11 +1,16 @@
|
|
|
|
package com.example.stlink.activitys.fragmentChild.activityTeaHome;
|
|
|
|
package com.example.stlink.activitys.fragmentChild.activityTeaHome;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import android.Manifest;
|
|
|
|
import android.content.Intent;
|
|
|
|
import android.content.Intent;
|
|
|
|
|
|
|
|
import android.content.pm.PackageManager;
|
|
|
|
import android.graphics.Bitmap;
|
|
|
|
import android.graphics.Bitmap;
|
|
|
|
|
|
|
|
import android.location.LocationManager;
|
|
|
|
|
|
|
|
import android.net.Uri;
|
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Build;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Bundle;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.Handler;
|
|
|
|
import android.os.Message;
|
|
|
|
import android.os.Message;
|
|
|
|
|
|
|
|
import android.provider.Settings;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.text.TextUtils;
|
|
|
|
import android.view.View;
|
|
|
|
import android.view.View;
|
|
|
|
import android.widget.ImageView;
|
|
|
|
import android.widget.ImageView;
|
|
|
@ -19,6 +24,7 @@ import androidx.annotation.Nullable;
|
|
|
|
import androidx.annotation.RequiresApi;
|
|
|
|
import androidx.annotation.RequiresApi;
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
import androidx.appcompat.app.AppCompatActivity;
|
|
|
|
import androidx.appcompat.widget.AppCompatButton;
|
|
|
|
import androidx.appcompat.widget.AppCompatButton;
|
|
|
|
|
|
|
|
import androidx.core.content.ContextCompat;
|
|
|
|
|
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
|
import com.example.stlink.R;
|
|
|
|
import com.example.stlink.R;
|
|
|
@ -234,11 +240,28 @@ public class CreateSign extends AppCompatActivity {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
//定位
|
|
|
|
//定位
|
|
|
|
etLocation.setOnClickListener(v -> {
|
|
|
|
etLocation.setOnClickListener(v -> {
|
|
|
|
Intent intent = new Intent(CreateSign.this, MapActivity.class);
|
|
|
|
|
|
|
|
intent.putExtras(getIntent().getExtras());
|
|
|
|
|
|
|
|
intentActivityResultLauncher.launch(intent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// etLocation.setText("定位");
|
|
|
|
LocationManager lm = (LocationManager) getSystemService(LOCATION_SERVICE);
|
|
|
|
|
|
|
|
boolean ok = lm.isProviderEnabled(LocationManager.GPS_PROVIDER);
|
|
|
|
|
|
|
|
if (ok) {//开了定位服务
|
|
|
|
|
|
|
|
if (ContextCompat.checkSelfPermission(CreateSign.this, Manifest.permission.ACCESS_FINE_LOCATION)
|
|
|
|
|
|
|
|
== PackageManager.PERMISSION_GRANTED) { //有权限
|
|
|
|
|
|
|
|
Intent intent = new Intent(CreateSign.this, MapActivity.class);
|
|
|
|
|
|
|
|
intent.putExtras(getIntent().getExtras());
|
|
|
|
|
|
|
|
intentActivityResultLauncher.launch(intent);
|
|
|
|
|
|
|
|
} else { // 跳转到授予定位权限界面
|
|
|
|
|
|
|
|
Toast.makeText(CreateSign.this, "需要授予定位权限", Toast.LENGTH_SHORT).show();
|
|
|
|
|
|
|
|
Intent intent = new Intent();
|
|
|
|
|
|
|
|
intent.setAction(android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS);
|
|
|
|
|
|
|
|
intent.setData(Uri.parse("package:" + this.getPackageName()));
|
|
|
|
|
|
|
|
startActivity(intent);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
Toast.makeText(CreateSign.this, "系统检测到未开启GPS定位服务", Toast.LENGTH_SHORT).show();
|
|
|
|
|
|
|
|
Intent intent = new Intent();
|
|
|
|
|
|
|
|
intent.setAction(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
|
|
|
|
|
|
|
|
startActivity(intent);
|
|
|
|
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
//保存按钮
|
|
|
|
//保存按钮
|
|
|
|
abBtSave.setOnClickListener(v -> {
|
|
|
|
abBtSave.setOnClickListener(v -> {
|
|
|
|