1.定位的修改
This commit is contained in:
@@ -47,6 +47,7 @@ logger = "2.2.0"
|
|||||||
loggingInterceptorVersion = "3.10.0"
|
loggingInterceptorVersion = "3.10.0"
|
||||||
multidex = "2.0.1"
|
multidex = "2.0.1"
|
||||||
ossAndroidSdkVersion = "2.9.21"
|
ossAndroidSdkVersion = "2.9.21"
|
||||||
|
permissionx = "1.7.1"
|
||||||
persistentcookiejar = "v1.0.1"
|
persistentcookiejar = "v1.0.1"
|
||||||
picture_libraryVersion = "v2.6.0"
|
picture_libraryVersion = "v2.6.0"
|
||||||
reactivexRxjava = "2.2.21"
|
reactivexRxjava = "2.2.21"
|
||||||
@@ -125,6 +126,7 @@ logger = { module = "com.orhanobut:logger", version.ref = "logger" }
|
|||||||
multidex = { module = "androidx.multidex:multidex", version.ref = "multidex" }
|
multidex = { module = "androidx.multidex:multidex", version.ref = "multidex" }
|
||||||
#numberprogressbar-library = { module = "com.daimajia.numberprogressbar:library", version.ref = "libraryVersion" }
|
#numberprogressbar-library = { module = "com.daimajia.numberprogressbar:library", version.ref = "libraryVersion" }
|
||||||
okhttp3-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "loggingInterceptorVersion" }
|
okhttp3-logging-interceptor = { module = "com.squareup.okhttp3:logging-interceptor", version.ref = "loggingInterceptorVersion" }
|
||||||
|
permissionx = { module = "com.guolindev.permissionx:permissionx", version.ref = "permissionx" }
|
||||||
persistentcookiejar = { module = "com.github.franmontiel:PersistentCookieJar", version.ref = "persistentcookiejar" }
|
persistentcookiejar = { module = "com.github.franmontiel:PersistentCookieJar", version.ref = "persistentcookiejar" }
|
||||||
#pictureselector-picture_library = { module = "com.github.LuckSiege.PictureSelector:picture_library", version.ref = "picture_libraryVersion" }
|
#pictureselector-picture_library = { module = "com.github.LuckSiege.PictureSelector:picture_library", version.ref = "picture_libraryVersion" }
|
||||||
reactivex-rxjava = { module = "io.reactivex.rxjava2:rxjava", version.ref = "reactivexRxjava" }
|
reactivex-rxjava = { module = "io.reactivex.rxjava2:rxjava", version.ref = "reactivexRxjava" }
|
||||||
|
|||||||
@@ -207,6 +207,8 @@ dependencies {
|
|||||||
|
|
||||||
api 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5'
|
api 'org.eclipse.paho:org.eclipse.paho.client.mqttv3:1.2.5'
|
||||||
api 'io.github.mayzs:paho.mqtt.android:1.2.1'
|
api 'io.github.mayzs:paho.mqtt.android:1.2.1'
|
||||||
|
|
||||||
|
|
||||||
// room数据库
|
// room数据库
|
||||||
// def room_version = "2.5.0"
|
// def room_version = "2.5.0"
|
||||||
// implementation "androidx.room:room-runtime:$room_version"
|
// implementation "androidx.room:room-runtime:$room_version"
|
||||||
|
|||||||
@@ -62,7 +62,6 @@
|
|||||||
app:layout_constraintTop_toBottomOf="@+id/tv_gz" />
|
app:layout_constraintTop_toBottomOf="@+id/tv_gz" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/tv_time1"
|
android:id="@+id/tv_time1"
|
||||||
android:layout_width="@dimen/dp_18"
|
android:layout_width="@dimen/dp_18"
|
||||||
android:layout_height="@dimen/dp_28"
|
android:layout_height="@dimen/dp_28"
|
||||||
@@ -77,7 +76,6 @@
|
|||||||
tools:text="1" />
|
tools:text="1" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/tv_time2"
|
android:id="@+id/tv_time2"
|
||||||
android:layout_width="@dimen/dp_18"
|
android:layout_width="@dimen/dp_18"
|
||||||
android:layout_height="@dimen/dp_28"
|
android:layout_height="@dimen/dp_28"
|
||||||
@@ -92,7 +90,6 @@
|
|||||||
tools:text="3" />
|
tools:text="3" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/tv_time_m"
|
android:id="@+id/tv_time_m"
|
||||||
android:layout_width="@dimen/dp_18"
|
android:layout_width="@dimen/dp_18"
|
||||||
android:layout_height="@dimen/dp_28"
|
android:layout_height="@dimen/dp_28"
|
||||||
@@ -112,7 +109,6 @@
|
|||||||
android:layout_marginStart="@dimen/dp_5"
|
android:layout_marginStart="@dimen/dp_5"
|
||||||
android:background="@mipmap/time_b"
|
android:background="@mipmap/time_b"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:visibility="gone"
|
|
||||||
android:textColor="#00F3D3"
|
android:textColor="#00F3D3"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/tv_bd"
|
app:layout_constraintBottom_toBottomOf="@+id/tv_bd"
|
||||||
@@ -121,7 +117,6 @@
|
|||||||
tools:text="1" />
|
tools:text="1" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/tv_time4"
|
android:id="@+id/tv_time4"
|
||||||
android:layout_width="@dimen/dp_18"
|
android:layout_width="@dimen/dp_18"
|
||||||
android:layout_height="@dimen/dp_28"
|
android:layout_height="@dimen/dp_28"
|
||||||
@@ -133,162 +128,16 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="@+id/tv_bd"
|
app:layout_constraintBottom_toBottomOf="@+id/tv_bd"
|
||||||
app:layout_constraintStart_toEndOf="@+id/tv_time3"
|
app:layout_constraintStart_toEndOf="@+id/tv_time3"
|
||||||
app:layout_constraintTop_toTopOf="@+id/tv_bd"
|
app:layout_constraintTop_toTopOf="@+id/tv_bd"
|
||||||
|
|
||||||
|
|
||||||
tools:text="8" />
|
tools:text="8" />
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_marginTop="@dimen/dp_5"
|
|
||||||
android:layout_marginLeft="@dimen/dp_15"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_jc"
|
|
||||||
app:layout_constraintLeft_toRightOf="@+id/tv_time4"
|
|
||||||
android:id="@+id/gift_l4"
|
|
||||||
android:layout_width="@dimen/dp_56"
|
|
||||||
android:layout_height="@dimen/dp_73"
|
|
||||||
android:orientation="vertical"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<com.xscm.moduleutil.widget.GifAvatarOvalView
|
|
||||||
android:id="@+id/iv_homeowner_bg"
|
|
||||||
android:background="@color/_000000"
|
|
||||||
android:layout_width="@dimen/dp_40"
|
|
||||||
android:layout_height="@dimen/dp_58"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/gift_l4"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/gift_l4"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/gift_l4"
|
|
||||||
android:layout_marginTop="@dimen/dp_2"
|
|
||||||
android:scaleType="fitCenter"/>
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:layout_width="@dimen/dp_60"
|
|
||||||
android:layout_height="@dimen/dp_58"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/gift_l4"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/gift_l4"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/gift_l4"
|
|
||||||
android:layout_marginBottom="@dimen/dp_2"
|
|
||||||
android:src="@mipmap/xlh_image"
|
|
||||||
android:scaleType="fitCenter"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
|
|
||||||
android:id="@+id/tv_homeowner_name"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="@dimen/dp_14"
|
|
||||||
app:layout_constraintStart_toStartOf="@+id/gift_l4"
|
|
||||||
app:layout_constraintEnd_toEndOf="@+id/gift_l4"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/gift_l4"
|
|
||||||
tools:text="时尚的金针菇"
|
|
||||||
android:gravity="center"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/sp_10"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_35"
|
|
||||||
android:background="@drawable/bg_round_corner"
|
|
||||||
android:text="房主"
|
|
||||||
android:textColor="#FFE554"
|
|
||||||
android:textSize="@dimen/sp_12"
|
|
||||||
app:layout_constraintLeft_toLeftOf="@+id/iv_homeowner_bg"
|
|
||||||
app:layout_constraintRight_toRightOf="@+id/iv_homeowner_bg"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/iv_homeowner_bg" />
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:visibility="gone"
|
|
||||||
|
|
||||||
android:layout_marginTop="@dimen/dp_21"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
android:layout_marginLeft="@dimen/dp_40"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_homeowner_name"
|
|
||||||
android:id="@+id/gift_l5"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<com.xscm.moduleutil.widget.GifAvatarOvalView
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
android:background="@color/read_dot_bg"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
android:id="@+id/iv_lucky_person"
|
|
||||||
android:layout_width="@dimen/dp_64"
|
|
||||||
android:layout_height="@dimen/dp_80"
|
|
||||||
android:layout_marginTop="@dimen/dp_2"
|
|
||||||
android:scaleType="fitCenter"/>
|
|
||||||
<ImageView
|
|
||||||
app:layout_constraintRight_toRightOf="@+id/iv_lucky_person"
|
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/iv_lucky_person"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/iv_lucky_person"
|
|
||||||
app:layout_constraintLeft_toLeftOf="@+id/iv_lucky_person"
|
|
||||||
android:layout_width="@dimen/dp_94"
|
|
||||||
android:layout_height="@dimen/dp_90"
|
|
||||||
android:layout_marginBottom="@dimen/dp_2"
|
|
||||||
android:src="@mipmap/xlh_image"
|
|
||||||
android:scaleType="fitCenter"/>
|
|
||||||
<TextView
|
|
||||||
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="@dimen/dp_65"
|
|
||||||
android:background="@drawable/bg_round_corner"
|
|
||||||
android:text="幸运者"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/sp_12"
|
|
||||||
app:layout_constraintLeft_toLeftOf="@+id/iv_lucky_person"
|
|
||||||
app:layout_constraintRight_toRightOf="@+id/iv_lucky_person"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/iv_lucky_person" />
|
|
||||||
<TextView
|
|
||||||
android:layout_marginTop="@dimen/dp_23"
|
|
||||||
android:text="烟花易冷"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:gravity="center"
|
|
||||||
app:layout_constraintRight_toRightOf="@+id/iv_lucky_person"
|
|
||||||
app:layout_constraintLeft_toLeftOf="@+id/iv_lucky_person"
|
|
||||||
app:layout_constraintTop_toBottomOf="@+id/iv_lucky_person"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"/>
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
app:layout_constraintRight_toLeftOf="@+id/tv_gz"
|
|
||||||
app:layout_constraintTop_toTopOf="@+id/iv_homeowner_bg"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_marginRight="@dimen/dp_46"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_iv_bg"
|
|
||||||
android:layout_width="@dimen/dp_36"
|
|
||||||
android:layout_height="@dimen/dp_36"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:src="@mipmap/ic_launcher"
|
|
||||||
android:scaleType="fitCenter"/>
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/iv_bg"
|
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:layout_width="@dimen/dp_48"
|
|
||||||
android:background="@mipmap/xlh_g_2"
|
|
||||||
android:layout_height="@dimen/dp_60"/>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
||||||
|
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
|
||||||
android:visibility="gone"
|
|
||||||
android:id="@+id/cl_gift"
|
android:id="@+id/cl_gift"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="@dimen/dp_195"
|
android:layout_height="@dimen/dp_195"
|
||||||
android:layout_marginTop="@dimen/dp_10"
|
android:layout_marginTop="@dimen/dp_10"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
android:background="@mipmap/tour_zj_bj"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/tv_bd">
|
app:layout_constraintTop_toBottomOf="@+id/tv_bd">
|
||||||
|
|
||||||
@@ -432,7 +281,7 @@
|
|||||||
android:layout_marginBottom="@dimen/dp_15"
|
android:layout_marginBottom="@dimen/dp_15"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/gift_l5"
|
app:layout_constraintTop_toBottomOf="@+id/cl_gift"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/exchange_layout"
|
app:layout_constraintBottom_toTopOf="@+id/exchange_layout"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
@@ -464,6 +313,7 @@
|
|||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="@+id/exchange_layout"
|
app:layout_constraintTop_toTopOf="@+id/exchange_layout"
|
||||||
app:layout_constraintBottom_toBottomOf="@+id/exchange_layout"
|
app:layout_constraintBottom_toBottomOf="@+id/exchange_layout"
|
||||||
|
android:visibility="gone"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<View
|
<View
|
||||||
|
|||||||
@@ -60,5 +60,7 @@ dependencies {
|
|||||||
implementation (libs.arouter.api.v150)
|
implementation (libs.arouter.api.v150)
|
||||||
//annotationProcessor
|
//annotationProcessor
|
||||||
annotationProcessor libs.arouter.compiler
|
annotationProcessor libs.arouter.compiler
|
||||||
|
implementation libs.permissionx
|
||||||
|
|
||||||
}
|
}
|
||||||
apply plugin: 'com.alibaba.arouter' // ⚠️ 添加这一行
|
apply plugin: 'com.alibaba.arouter' // ⚠️ 添加这一行
|
||||||
@@ -1,6 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<!-- 前台定位权限 -->
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
|
||||||
|
<!-- 后台定位权限(Android 10+) -->
|
||||||
|
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
|
||||||
<application
|
<application
|
||||||
>
|
>
|
||||||
|
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import android.view.KeyEvent;
|
|||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.animation.Animation;
|
import android.view.animation.Animation;
|
||||||
import android.view.animation.AnimationUtils;
|
import android.view.animation.AnimationUtils;
|
||||||
|
import android.widget.Toast;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
@@ -36,6 +37,12 @@ import com.example.modulenews.fragment.NewsFragment;
|
|||||||
import com.example.moduleroom.activity.RoomActivity;
|
import com.example.moduleroom.activity.RoomActivity;
|
||||||
import com.example.modulevocal.fragment.VocalRangeFragment;
|
import com.example.modulevocal.fragment.VocalRangeFragment;
|
||||||
import com.example.modulevoice.fragment.VoiceFragment;
|
import com.example.modulevoice.fragment.VoiceFragment;
|
||||||
|
import com.permissionx.guolindev.PermissionX;
|
||||||
|
import com.permissionx.guolindev.callback.ExplainReasonCallback;
|
||||||
|
import com.permissionx.guolindev.callback.ForwardToSettingsCallback;
|
||||||
|
import com.permissionx.guolindev.callback.RequestCallback;
|
||||||
|
import com.permissionx.guolindev.request.ExplainScope;
|
||||||
|
import com.permissionx.guolindev.request.ForwardScope;
|
||||||
import com.xscm.modulemain.R;
|
import com.xscm.modulemain.R;
|
||||||
import com.xscm.modulemain.contacts.HomeContacts;
|
import com.xscm.modulemain.contacts.HomeContacts;
|
||||||
import com.xscm.modulemain.databinding.ActivityMainBinding;
|
import com.xscm.modulemain.databinding.ActivityMainBinding;
|
||||||
@@ -553,8 +560,49 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
MvpPre.getMyInfo(SpUtil.getUserId() + "");//获取首充是否需要展示
|
MvpPre.getMyInfo(SpUtil.getUserId() + "");//获取首充是否需要展示
|
||||||
|
|
||||||
// mBinding.ivShouchl.setVisibility(View.VISIBLE);
|
// mBinding.ivShouchl.setVisibility(View.VISIBLE);
|
||||||
LogUtils.e("@@@1","开始定位", "描述:", "");
|
|
||||||
initLocation();
|
|
||||||
|
// 请求GPS相关权限(精确位置+可选的后台权限)
|
||||||
|
requestGpsPermissions();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void requestGpsPermissions() {
|
||||||
|
PermissionX.init(this)
|
||||||
|
// 请求精确位置权限(包含GPS定位能力)
|
||||||
|
.permissions(
|
||||||
|
Manifest.permission.ACCESS_FINE_LOCATION,
|
||||||
|
// 如需后台使用GPS,添加此权限(Android 10+)
|
||||||
|
Manifest.permission.ACCESS_BACKGROUND_LOCATION
|
||||||
|
).explainReasonBeforeRequest()
|
||||||
|
.onExplainRequestReason(new ExplainReasonCallback() {
|
||||||
|
@Override
|
||||||
|
public void onExplainReason(ExplainScope scope, List<String> deniedList) {
|
||||||
|
String message = "需要GPS权限以获取您的精确位置,用于导航/定位功能";
|
||||||
|
// 若包含后台权限,补充说明
|
||||||
|
|
||||||
|
scope.showRequestReasonDialog(deniedList, message, "确定", "取消");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 权限被永久拒绝时,引导至设置页面
|
||||||
|
.onForwardToSettings(new ForwardToSettingsCallback() {
|
||||||
|
@Override
|
||||||
|
public void onForwardToSettings(ForwardScope scope, List<String> deniedList) {
|
||||||
|
scope.showForwardToSettingsDialog(deniedList, "GPS权限被拒绝,无法使用定位功能,请去设置开启", "去设置", "取消");
|
||||||
|
}
|
||||||
|
})
|
||||||
|
// 权限请求结果回调
|
||||||
|
.request(new RequestCallback() {
|
||||||
|
@Override
|
||||||
|
public void onResult(boolean allGranted, List<String> grantedList, List<String> deniedList) {
|
||||||
|
if (allGranted) {
|
||||||
|
// Toast.makeText(MainActivity.this, "GPS权限已授予,可开始定位", Toast.LENGTH_SHORT).show();
|
||||||
|
initLocation(); // 启动GPS定位逻辑
|
||||||
|
} else {
|
||||||
|
Toast.makeText(MainActivity.this, "GPS权限被拒绝,无法使用定位功能", Toast.LENGTH_SHORT).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||||
@@ -629,18 +677,19 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
|
|
||||||
|
|
||||||
private String city1;
|
private String city1;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLocationReceived(double latitude, double longitude, String city) {
|
public void onLocationReceived(double latitude, double longitude, String city) {
|
||||||
LogUtils.e("当前位置:" + city);
|
LogUtils.e("当前位置:" + city);
|
||||||
city1 = city;
|
city1 = city;
|
||||||
EventBus.getDefault().post(city1);
|
EventBus.getDefault().post(city1);
|
||||||
LogUtils.e("@@@1","开始定位", "描述:","当前位置"+city);
|
LogUtils.e("@@@1", "开始定位", "描述:", "当前位置" + city);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onFailed(String errorMessage) {
|
public void onFailed(String errorMessage) {
|
||||||
|
|
||||||
LogUtils.e("@@@1","开始定位", "描述:","失败");
|
LogUtils.e("@@@1", "开始定位", "描述:", "失败");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -874,18 +923,9 @@ public class MainActivity extends BaseMvpActivity<HomePresenter, ActivityMainBin
|
|||||||
private SystemLocationProvider locationProvider;
|
private SystemLocationProvider locationProvider;
|
||||||
|
|
||||||
private void initLocation() {
|
private void initLocation() {
|
||||||
if (ContextCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) {
|
// 在Activity或Fragment中调用
|
||||||
|
|
||||||
|
|
||||||
// 请求定位权限
|
|
||||||
ActivityCompat.requestPermissions(
|
|
||||||
(Activity) this,
|
|
||||||
new String[]{
|
|
||||||
android.Manifest.permission.ACCESS_FINE_LOCATION,
|
|
||||||
Manifest.permission.ACCESS_COARSE_LOCATION
|
|
||||||
},
|
|
||||||
1001 // 自定义常量,比如 1001
|
|
||||||
);
|
|
||||||
}
|
|
||||||
locationProvider = new SystemLocationProvider();
|
locationProvider = new SystemLocationProvider();
|
||||||
|
|
||||||
// 请求一次性的位置信息
|
// 请求一次性的位置信息
|
||||||
|
|||||||
@@ -0,0 +1,258 @@
|
|||||||
|
//package com.example.moduleroom.view;
|
||||||
|
//import android.content.Context;
|
||||||
|
//import android.graphics.drawable.Drawable;
|
||||||
|
//import android.util.AttributeSet;
|
||||||
|
//import android.view.View;
|
||||||
|
//import android.view.animation.Animation;
|
||||||
|
//import android.view.animation.RotateAnimation;
|
||||||
|
//import android.widget.Button;
|
||||||
|
//import android.widget.ImageView;
|
||||||
|
//import android.widget.LinearLayout;
|
||||||
|
//import android.widget.RelativeLayout;
|
||||||
|
//import android.widget.TextView;
|
||||||
|
//
|
||||||
|
//import androidx.annotation.Nullable;
|
||||||
|
//
|
||||||
|
//import com.example.moduleroom.R;
|
||||||
|
//
|
||||||
|
//public class QXMeetGiftView extends RelativeLayout {
|
||||||
|
//
|
||||||
|
// private TextView giftNameLabel;
|
||||||
|
// private ImageView giftPriceBgView;
|
||||||
|
// private Button giftCoin;
|
||||||
|
// private ImageView bgImageView;
|
||||||
|
// private ImageView giftBgImageView;
|
||||||
|
// private ImageView giftImageView;
|
||||||
|
//
|
||||||
|
// private boolean isLockGift;
|
||||||
|
// private Object model; // 这里用 Object 代替 QXDrawGiftModel
|
||||||
|
//
|
||||||
|
// public QXMeetGiftView(Context context) {
|
||||||
|
// super(context);
|
||||||
|
// initSubviews(context);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public QXMeetGiftView(Context context, @Nullable AttributeSet attrs) {
|
||||||
|
// super(context, attrs);
|
||||||
|
// initSubviews(context);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public QXMeetGiftView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
||||||
|
// super(context, attrs, defStyleAttr);
|
||||||
|
// initSubviews(context);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// private void initSubviews(Context context) {
|
||||||
|
// // 创建背景图片视图
|
||||||
|
// bgImageView = new ImageView(context);
|
||||||
|
// bgImageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||||
|
// bgImageView.setImageResource(R.drawable.ac_left_gift_bg);
|
||||||
|
// LayoutParams bgParams = new LayoutParams(
|
||||||
|
// LayoutParams.MATCH_PARENT,
|
||||||
|
// LayoutParams.MATCH_PARENT
|
||||||
|
// );
|
||||||
|
// bgParams.addRule(ALIGN_PARENT_TOP);
|
||||||
|
// bgParams.addRule(ALIGN_PARENT_LEFT);
|
||||||
|
// bgParams.addRule(ALIGN_PARENT_RIGHT);
|
||||||
|
// bgParams.bottomMargin = dpToPx(19); // 底部偏移-19
|
||||||
|
// addView(bgImageView, bgParams);
|
||||||
|
//
|
||||||
|
// // 创建礼物背景光效视图
|
||||||
|
// giftBgImageView = new ImageView(context);
|
||||||
|
// giftBgImageView.setScaleType(ImageView.ScaleType.FIT_XY);
|
||||||
|
// giftBgImageView.setImageResource(R.drawable.ac_lock_gift_light_bg);
|
||||||
|
// giftBgImageView.setVisibility(View.GONE); // 初始隐藏
|
||||||
|
// LayoutParams giftBgParams = new LayoutParams(
|
||||||
|
// LayoutParams.MATCH_PARENT,
|
||||||
|
// LayoutParams.MATCH_PARENT
|
||||||
|
// );
|
||||||
|
// giftBgParams.addRule(ALIGN_PARENT_TOP);
|
||||||
|
// giftBgParams.addRule(ALIGN_PARENT_LEFT);
|
||||||
|
// giftBgParams.addRule(ALIGN_PARENT_RIGHT);
|
||||||
|
// giftBgParams.bottomMargin = dpToPx(19);
|
||||||
|
// addView(giftBgImageView, giftBgParams);
|
||||||
|
//
|
||||||
|
// // 创建礼物图片视图
|
||||||
|
// giftImageView = new ImageView(context);
|
||||||
|
// giftImageView.setScaleType(ImageView.ScaleType.FIT_CENTER);
|
||||||
|
// LayoutParams giftImageParams = new LayoutParams(
|
||||||
|
// LayoutParams.MATCH_PARENT,
|
||||||
|
// LayoutParams.WRAP_CONTENT
|
||||||
|
// );
|
||||||
|
// giftImageParams.addRule(CENTER_IN_PARENT);
|
||||||
|
// giftImageParams.setMargins(dpToPx(6), dpToPx(6), dpToPx(6), 0);
|
||||||
|
// addView(giftImageView, giftImageParams);
|
||||||
|
//
|
||||||
|
// // 创建价格背景视图
|
||||||
|
// giftPriceBgView = new ImageView(context);
|
||||||
|
// giftPriceBgView.setImageResource(R.drawable.ac_meet_gift_name_bg);
|
||||||
|
// LayoutParams priceBgParams = new LayoutParams(
|
||||||
|
// LayoutParams.MATCH_PARENT,
|
||||||
|
// dpToPx(15)
|
||||||
|
// );
|
||||||
|
// priceBgParams.addRule(ALIGN_PARENT_BOTTOM);
|
||||||
|
// priceBgParams.bottomMargin = dpToPx(15); // 在名称标签上方
|
||||||
|
// addView(giftPriceBgView, priceBgParams);
|
||||||
|
//
|
||||||
|
// // 创建金币按钮
|
||||||
|
// giftCoin = new Button(context);
|
||||||
|
// giftCoin.setTextColor(0xFFC7BF62);
|
||||||
|
// // 设置按钮图标
|
||||||
|
// Drawable coinDrawable = getResources().getDrawable(R.drawable.sky_item_coin);
|
||||||
|
// coinDrawable.setBounds(0, 0, dpToPx(12), dpToPx(12));
|
||||||
|
// giftCoin.setCompoundDrawables(coinDrawable, null, null, null);
|
||||||
|
// giftCoin.setTextSize(10);
|
||||||
|
// giftCoin.setBackgroundColor(0x00000000); // 透明背景
|
||||||
|
// LayoutParams coinParams = new LayoutParams(
|
||||||
|
// LayoutParams.WRAP_CONTENT,
|
||||||
|
// LayoutParams.WRAP_CONTENT
|
||||||
|
// );
|
||||||
|
// coinParams.addRule(CENTER_IN_PARENT, TRUE);
|
||||||
|
// addView(giftCoin, coinParams);
|
||||||
|
//
|
||||||
|
// // 创建礼物名称标签
|
||||||
|
// giftNameLabel = new TextView(context);
|
||||||
|
// giftNameLabel.setTextColor(0xFFFFFFFF);
|
||||||
|
// giftNameLabel.setTextSize(12);
|
||||||
|
// giftNameLabel.setGravity(android.view.Gravity.CENTER);
|
||||||
|
// LayoutParams nameParams = new LayoutParams(
|
||||||
|
// LayoutParams.MATCH_PARENT,
|
||||||
|
// dpToPx(15)
|
||||||
|
// );
|
||||||
|
// nameParams.addRule(ALIGN_PARENT_BOTTOM);
|
||||||
|
// addView(giftNameLabel, nameParams);
|
||||||
|
//
|
||||||
|
// // 调整视图层级
|
||||||
|
// bringChildToFront(giftPriceBgView);
|
||||||
|
// bringChildToFront(giftCoin);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setIsLockGift(boolean isLockGift) {
|
||||||
|
// this.isLockGift = isLockGift;
|
||||||
|
//
|
||||||
|
// // 设置背景图片
|
||||||
|
// int bgResource = isLockGift ?
|
||||||
|
// R.drawable.ac_lock_gift_bg : R.drawable.ac_meet_gift_name_bg;
|
||||||
|
// bgImageView.setImageResource(bgResource);
|
||||||
|
//
|
||||||
|
// // 显示/隐藏光效背景
|
||||||
|
// giftBgImageView.setVisibility(isLockGift ? View.VISIBLE : View.GONE);
|
||||||
|
//
|
||||||
|
// if (isLockGift) {
|
||||||
|
// // 重新设置礼物图片的约束
|
||||||
|
// LayoutParams params = (LayoutParams) giftImageView.getLayoutParams();
|
||||||
|
// params.width = scaleWidth(62);
|
||||||
|
// params.height = scaleWidth(62);
|
||||||
|
// params.addRule(CENTER_IN_PARENT);
|
||||||
|
// params.setMargins(0, 0, 0, 0);
|
||||||
|
// giftImageView.setLayoutParams(params);
|
||||||
|
// } else {
|
||||||
|
// // 恢复原始约束
|
||||||
|
// LayoutParams params = (LayoutParams) giftImageView.getLayoutParams();
|
||||||
|
// params.width = LayoutParams.MATCH_PARENT;
|
||||||
|
// params.height = LayoutParams.WRAP_CONTENT;
|
||||||
|
// params.addRule(CENTER_IN_PARENT);
|
||||||
|
// params.setMargins(dpToPx(6), dpToPx(6), dpToPx(6), 0);
|
||||||
|
// giftImageView.setLayoutParams(params);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void setModel(Object model) {
|
||||||
|
// this.model = model;
|
||||||
|
// // 这里需要根据您的 QXDrawGiftModel 类来实现具体逻辑
|
||||||
|
// /*
|
||||||
|
// if (model instanceof QXDrawGiftModel) {
|
||||||
|
// QXDrawGiftModel giftModel = (QXDrawGiftModel) model;
|
||||||
|
//
|
||||||
|
// // 使用图片加载库加载图片
|
||||||
|
// // Glide.with(getContext()).load(giftModel.getBaseImage()).into(giftImageView);
|
||||||
|
//
|
||||||
|
// giftNameLabel.setText(giftModel.getGiftName());
|
||||||
|
// giftCoin.setText(giftModel.getGiftPrice());
|
||||||
|
// }
|
||||||
|
// */
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void startAnimation() {
|
||||||
|
// // 礼物图片顺时针旋转动画
|
||||||
|
// RotateAnimation rotateAnimation = new RotateAnimation(
|
||||||
|
// 0, 360, // 从 0 度旋转到 360 度
|
||||||
|
// Animation.RELATIVE_TO_SELF, 0.5f,
|
||||||
|
// Animation.RELATIVE_TO_SELF, 0.5f
|
||||||
|
// );
|
||||||
|
// rotateAnimation.setDuration(3000); // 3 秒
|
||||||
|
// rotateAnimation.setRepeatCount(Animation.INFINITE);
|
||||||
|
// rotateAnimation.setRepeatMode(Animation.RESTART);
|
||||||
|
// rotateAnimation.setInterpolator(getContext(), android.R.anim.linear_interpolator);
|
||||||
|
// giftImageView.startAnimation(rotateAnimation);
|
||||||
|
//
|
||||||
|
// // 光效背景逆时针旋转动画
|
||||||
|
// RotateAnimation rotateAnimation1 = new RotateAnimation(
|
||||||
|
// 0, -360, // 从 0 度旋转到 -360 度
|
||||||
|
// Animation.RELATIVE_TO_SELF, 0.5f,
|
||||||
|
// Animation.RELATIVE_TO_SELF, 0.5f
|
||||||
|
// );
|
||||||
|
// rotateAnimation1.setDuration(3000); // 3 秒
|
||||||
|
// rotateAnimation1.setRepeatCount(Animation.INFINITE);
|
||||||
|
// rotateAnimation1.setRepeatMode(Animation.RESTART);
|
||||||
|
// rotateAnimation1.setInterpolator(getContext(), android.R.anim.linear_interpolator);
|
||||||
|
// giftBgImageView.startAnimation(rotateAnimation1);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void resetAnimation() {
|
||||||
|
// giftImageView.clearAnimation();
|
||||||
|
// giftBgImageView.clearAnimation();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public void stopAnimation() {
|
||||||
|
// giftImageView.clearAnimation();
|
||||||
|
// giftBgImageView.clearAnimation();
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 辅助方法:dp 转 px
|
||||||
|
// private int dpToPx(int dp) {
|
||||||
|
// float density = getResources().getDisplayMetrics().density;
|
||||||
|
// return Math.round(dp * density);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // 缩放宽度方法(对应 ScaleWidth)
|
||||||
|
// private int scaleWidth(int value) {
|
||||||
|
// // 这里需要根据您的缩放逻辑实现
|
||||||
|
// // 通常可以根据屏幕密度进行缩放
|
||||||
|
// float scale = getResources().getDisplayMetrics().density;
|
||||||
|
// return (int) (value * scale);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// // Getter 方法
|
||||||
|
// public TextView getGiftNameLabel() {
|
||||||
|
// return giftNameLabel;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public ImageView getGiftPriceBgView() {
|
||||||
|
// return giftPriceBgView;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Button getGiftCoin() {
|
||||||
|
// return giftCoin;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public ImageView getBgImageView() {
|
||||||
|
// return bgImageView;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public ImageView getGiftBgImageView() {
|
||||||
|
// return giftBgImageView;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public ImageView getGiftImageView() {
|
||||||
|
// return giftImageView;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public boolean isLockGift() {
|
||||||
|
// return isLockGift;
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// public Object getModel() {
|
||||||
|
// return model;
|
||||||
|
// }
|
||||||
|
//}
|
||||||
@@ -520,33 +520,6 @@
|
|||||||
</com.xscm.moduleutil.widget.DropViewRoom>
|
</com.xscm.moduleutil.widget.DropViewRoom>
|
||||||
|
|
||||||
|
|
||||||
<com.xscm.moduleutil.view.FashionAvatarView
|
|
||||||
android:layout_marginTop="@dimen/dp_200"
|
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:id="@+id/fashionAvatar"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
app:avatarUrl="https://tmd.xscmmidi.site/data/avatar/head_pic.png"
|
|
||||||
app:avatarRadius="60dp"
|
|
||||||
app:avatarBorderWidth="3dp"
|
|
||||||
app:avatarBorderColor="#FFD700"
|
|
||||||
|
|
||||||
app:tagText="房主"
|
|
||||||
app:tagTextColor="#FFFFFF"
|
|
||||||
app:tagTextSize="12sp"
|
|
||||||
app:tagBackgroundColor="#FFA500"
|
|
||||||
app:tagCornerRadius="4dp"
|
|
||||||
app:tagPadding="4dp"
|
|
||||||
|
|
||||||
app:bottomText="时尚的金针菇"
|
|
||||||
app:bottomTextColor="#FFFFFF"
|
|
||||||
app:bottomTextSize="14sp"
|
|
||||||
app:bottomTextOffsetY="10dp"
|
|
||||||
|
|
||||||
app:heartIcon="@mipmap/xlh_image"
|
|
||||||
app:heartCount="6"
|
|
||||||
app:heartSize="16dp" />
|
|
||||||
<com.xscm.moduleutil.widget.floatingView.Floa
|
<com.xscm.moduleutil.widget.floatingView.Floa
|
||||||
android:id="@+id/flaoat"
|
android:id="@+id/flaoat"
|
||||||
android:layout_width="@dimen/dp_240"
|
android:layout_width="@dimen/dp_240"
|
||||||
|
|||||||
Reference in New Issue
Block a user