3.2.1
This commit is contained in:
parent
278b795190
commit
8a03631c5e
@ -34,8 +34,8 @@ android {
|
||||
applicationId "com.arpa.hndahesudintocctmsdriver"
|
||||
minSdkVersion 22
|
||||
targetSdkVersion 30
|
||||
versionCode 51
|
||||
versionName "3.2.0"
|
||||
versionCode 52
|
||||
versionName "3.2.1"
|
||||
flavorDimensions "CHANNEL_VALUE"
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
javaCompileOptions {
|
||||
|
@ -2,6 +2,7 @@ package com.arpa.hndahesudintocctmsdriver.ui.business;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
@ -9,6 +10,15 @@ import android.widget.Toast;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.services.core.AMapException;
|
||||
import com.amap.api.services.core.LatLonPoint;
|
||||
import com.amap.api.services.core.PoiItem;
|
||||
import com.amap.api.services.core.SuggestionCity;
|
||||
import com.amap.api.services.poisearch.PoiResult;
|
||||
import com.amap.api.services.poisearch.PoiSearch;
|
||||
import com.arpa.hndahesudintocctmsdriver.util.alert.ToastUtil;
|
||||
import com.dahe.mylibrary.utils.ImageLoader;
|
||||
import com.dahe.mylibrary.utils.ToastUtils;
|
||||
import com.google.gson.Gson;
|
||||
import com.arpa.hndahesudintocctmsdriver.R;
|
||||
import com.arpa.hndahesudintocctmsdriver.bean.BusinessBean;
|
||||
@ -39,7 +49,7 @@ import okhttp3.Response;
|
||||
* @date 2021/9/6 9:59
|
||||
* @description:
|
||||
*/
|
||||
public class BusinessActivity extends BaseActivity {
|
||||
public class BusinessActivity extends BaseActivity implements PoiSearch.OnPoiSearchListener {
|
||||
|
||||
private BaseRecyclerView business_type;
|
||||
private BaseRecyclerView business_list;
|
||||
@ -51,6 +61,9 @@ public class BusinessActivity extends BaseActivity {
|
||||
private CustomDialog customDialog;
|
||||
private int sum = 0;
|
||||
private String type = "餐饮";
|
||||
private PoiSearch.Query query;
|
||||
private List<PoiItem> poiItems;// poi数据
|
||||
|
||||
@Override
|
||||
public void msgMethod(Message m) {
|
||||
super.msgMethod(m);
|
||||
@ -69,7 +82,21 @@ public class BusinessActivity extends BaseActivity {
|
||||
break;
|
||||
case LocationGDUtil.RES:
|
||||
address.setText(ld.getAddress());
|
||||
new BusinessRequest().GetBusinessList(con,hd,ld.getLongitude()+"",ld.getLatitude()+"",type);
|
||||
// new BusinessRequest().GetBusinessList(con,hd,ld.getLongitude()+"",ld.getLatitude()+"",type);
|
||||
|
||||
try {
|
||||
customDialog.dismiss();
|
||||
LatLonPoint lp = new LatLonPoint(ld.getLatitude(), ld.getLongitude());
|
||||
PoiSearch poiSearch = new PoiSearch(this, query);
|
||||
poiSearch.setOnPoiSearchListener(this);
|
||||
poiSearch.setBound(new PoiSearch.SearchBound(lp, 5000, true));//
|
||||
// 设置搜索区域为以lp点为圆心,其周围5000米范围
|
||||
poiSearch.searchPOIAsyn();// 异步搜索
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
break;
|
||||
case 2:
|
||||
BusinessBean.DataDTO bds = gson.fromJson((String) m.obj, BusinessBean.DataDTO.class);
|
||||
@ -112,9 +139,13 @@ public class BusinessActivity extends BaseActivity {
|
||||
customDialog.show();
|
||||
ld = new LocationGDUtil(con, hd);
|
||||
ld.onCreate();
|
||||
|
||||
changeType(type);
|
||||
|
||||
}
|
||||
|
||||
List<Object> list_type = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void initView(Object obj) {
|
||||
super.initView(obj);
|
||||
@ -132,11 +163,52 @@ public class BusinessActivity extends BaseActivity {
|
||||
bbs = new ArrayList<>();
|
||||
customDialog = new CustomDialog(con, "正在切换...");
|
||||
customDialog.show();
|
||||
new BusinessRequest().GetBusinessList(con,hd,ld.getLongitude()+"",ld.getLatitude()+"",m.getType_name());
|
||||
changeType(m.getType_name());
|
||||
// new BusinessRequest().GetBusinessList(con,hd,ld.getLongitude()+"",ld.getLatitude()+"",m.getType_name());
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPoiSearched(PoiResult poiResult, int i) {
|
||||
if (poiResult != null && poiResult.getQuery() != null) {// 搜索poi的结果
|
||||
poiItems = poiResult.getPois();// 当搜索不到poiitem数据时,会返回含有搜索关键字的城市信息
|
||||
if (poiItems != null && poiItems.size() > 0) {
|
||||
initBusListDel();
|
||||
} else {
|
||||
ToastUtils.showToast(con, "对不起,没有搜索到相关数据!");
|
||||
}
|
||||
} else {
|
||||
ToastUtils.showToast(con, "对不起,没有搜索到相关数据!");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPoiItemSearched(PoiItem poiItem, int i) {
|
||||
System.out.println(poiItem);
|
||||
}
|
||||
|
||||
private void changeType(String type) {
|
||||
query = new PoiSearch.Query(type, "", "");
|
||||
query.setExtensions("all");
|
||||
query.setPageSize(20);// 设置每页最多返回多少条poiitem
|
||||
query.setPageNum(0);// 设置查第一页
|
||||
|
||||
if (ld.getLatitude() != 0) {
|
||||
try {
|
||||
|
||||
LatLonPoint lp = new LatLonPoint(ld.getLatitude(), ld.getLongitude());
|
||||
PoiSearch poiSearch = new PoiSearch(this, query);
|
||||
poiSearch.setOnPoiSearchListener(this);
|
||||
poiSearch.setBound(new PoiSearch.SearchBound(lp, 5000, true));//
|
||||
// 设置搜索区域为以lp点为圆心,其周围5000米范围
|
||||
poiSearch.searchPOIAsyn();// 异步搜索
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void forGetBusDel() {
|
||||
customDialog.dismiss();
|
||||
//business_list.remo
|
||||
@ -150,15 +222,29 @@ public class BusinessActivity extends BaseActivity {
|
||||
|
||||
|
||||
public void initBusListDel() {
|
||||
customDialog.dismiss();
|
||||
//开始渲染
|
||||
business_list.createV(con,bbs,R.layout.item_business_list).setOnItemViewListener((position, o, v) -> {
|
||||
BusinessBean.DataDTO bd= (BusinessBean.DataDTO) o;
|
||||
v.setOnClickListener(v1 -> {
|
||||
business_list.createV(con, poiItems, R.layout.item_business_list).setOnItemViewListener((position, o, v) -> {
|
||||
PoiItem bd = (PoiItem) o;
|
||||
ImageView img = v.findViewById(R.id.photo_url);
|
||||
TextView name = v.findViewById(R.id.name);
|
||||
TextView address = v.findViewById(R.id.address);
|
||||
TextView taste = v.findViewById(R.id.taste);
|
||||
|
||||
if (bd.getPhotos().size() > 0 && !TextUtils.isEmpty(bd.getPhotos().get(0).getUrl())) {
|
||||
ImageLoader.getInstance().loadRoundImage(con, bd.getPhotos().get(0).getUrl(), 10, img);
|
||||
}
|
||||
|
||||
name.setText(bd.getTitle());
|
||||
address.setText(bd.getSnippet());
|
||||
taste.setText(bd.getTel());
|
||||
|
||||
// v.setOnClickListener(v1 -> {
|
||||
// Intent in=new Intent(con, WebActivity.class);
|
||||
// in.putExtra("url",bd.getBusiness_url());
|
||||
// in.putExtra("title",bd.getName());
|
||||
// startActivity(in);
|
||||
});
|
||||
// });
|
||||
});
|
||||
}
|
||||
|
||||
@ -201,7 +287,6 @@ public class BusinessActivity extends BaseActivity {
|
||||
}
|
||||
|
||||
|
||||
|
||||
class Model {
|
||||
private String type_name;
|
||||
private int type_img;
|
||||
|
@ -468,7 +468,7 @@ public class HomeFragment extends BaseFragment {
|
||||
case 0:
|
||||
//startActivity(new Intent(con, OrderListActivity.class));
|
||||
PermissionX.init(getActivity())
|
||||
.permissions(Manifest.permission.ACCESS_BACKGROUND_LOCATION)
|
||||
.permissions(Manifest.permission.ACCESS_FINE_LOCATION)
|
||||
.request((allGranted, grantedList, deniedList) -> {
|
||||
if (allGranted) {
|
||||
Intent in = new Intent(con, BusinessActivity.class);
|
||||
|
@ -22,6 +22,7 @@
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:orientation="vertical">
|
||||
<LinearLayout
|
||||
android:layout_marginTop="@dimen/dp_7"
|
||||
@ -37,10 +38,11 @@
|
||||
android:id="@+id/name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:singleLine="true"
|
||||
android:textSize="@dimen/sp_13" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_marginTop="@dimen/dp_7"
|
||||
android:layout_marginTop="@dimen/dp_18"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
@ -51,12 +53,13 @@
|
||||
android:text="店铺地址:"/>
|
||||
<TextView
|
||||
android:id="@+id/address"
|
||||
android:singleLine="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/sp_13" />
|
||||
</LinearLayout>
|
||||
<LinearLayout
|
||||
android:layout_marginTop="@dimen/dp_7"
|
||||
android:layout_marginTop="@dimen/dp_18"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
@ -64,13 +67,15 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/sp_13"
|
||||
android:text="口味:"/>
|
||||
android:text="联系方式:"/>
|
||||
<TextView
|
||||
android:id="@+id/taste"
|
||||
android:singleLine="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/sp_13" />
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/sp_13"
|
||||
@ -81,6 +86,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/sp_13" />
|
||||
<TextView
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/sp_13"
|
||||
|
Loading…
Reference in New Issue
Block a user