正在查看: 新暖心缘 v8.1.1 应用的 SelectPositionActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: 新暖心缘 v8.1.1 应用的 SelectPositionActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.luanxingyuan.app.activity;
import android.app.Dialog;
import android.content.Intent;
import android.graphics.Point;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
import android.widget.TextView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import butterknife.BindView;
import butterknife.OnClick;
import com.amap.api.location.AMapLocation;
import com.amap.api.location.AMapLocationClient;
import com.amap.api.location.AMapLocationClientOption;
import com.amap.api.location.AMapLocationListener;
import com.luanxingyuan.app.base.BaseActivity;
import com.luanxingyuan.app.bean.PoiBean;
import com.luanxingyuan.app.bean.SearchPoiBean;
import com.luanxingyuan.app.util.LogUtil;
import com.luanxingyuan.app.util.ToastUtil;
import j2.a;
import java.util.ArrayList;
import java.util.List;
import k6.f0;
import k6.j0;
import m2.e;
import o6.n;
public class SelectPositionActivity extends BaseActivity implements e.a {
private String mCityName;
@BindView
RecyclerView mContentRv;
private f0 mPositionRecyclerAdapter;
class a implements AMapLocationListener {
a() {
}
@Override
public void onLocationChanged(AMapLocation aMapLocation) {
if (aMapLocation == null) {
SelectPositionActivity.this.dismissLoadingDialog();
return;
}
if (aMapLocation.getErrorCode() != 0) {
LogUtil.i("定位失败 :" + aMapLocation.getErrorCode() + ", errInfo:" + aMapLocation.getErrorInfo());
String c8 = n.c(SelectPositionActivity.this.getApplicationContext());
String d8 = n.d(SelectPositionActivity.this.getApplicationContext());
if (TextUtils.isEmpty(c8) || TextUtils.isEmpty(d8) || Double.parseDouble(c8) <= 0.0d || Double.parseDouble(d8) <= 0.0d) {
SelectPositionActivity.this.dismissLoadingDialog();
return;
} else {
SelectPositionActivity.this.startSearch(Double.parseDouble(c8), Double.parseDouble(d8), "");
return;
}
}
double latitude = aMapLocation.getLatitude();
double longitude = aMapLocation.getLongitude();
String cityCode = aMapLocation.getCityCode();
SelectPositionActivity.this.mCityName = aMapLocation.getCity();
if (latitude > 0.0d && longitude > 0.0d) {
SelectPositionActivity.this.startSearch(latitude, longitude, cityCode);
return;
}
String c9 = n.c(SelectPositionActivity.this.getApplicationContext());
String d9 = n.d(SelectPositionActivity.this.getApplicationContext());
if (TextUtils.isEmpty(c9) || TextUtils.isEmpty(d9) || Double.parseDouble(c9) <= 0.0d || Double.parseDouble(d9) <= 0.0d) {
SelectPositionActivity.this.dismissLoadingDialog();
} else {
SelectPositionActivity.this.startSearch(Double.parseDouble(c9), Double.parseDouble(d9), cityCode);
}
}
}
class b implements View.OnClickListener {
final Dialog f6924a;
b(Dialog dialog) {
this.f6924a = dialog;
}
@Override
public void onClick(View view) {
this.f6924a.dismiss();
}
}
class c implements TextWatcher {
final j0 f6926a;
final RecyclerView f6927b;
c(j0 j0Var, RecyclerView recyclerView) {
this.f6926a = j0Var;
this.f6927b = recyclerView;
}
@Override
public void afterTextChanged(Editable editable) {
if (TextUtils.isEmpty(editable) || editable.length() <= 0) {
return;
}
SelectPositionActivity.this.startSearch(editable.toString(), this.f6926a, this.f6927b);
}
@Override
public void beforeTextChanged(CharSequence charSequence, int i8, int i9, int i10) {
}
@Override
public void onTextChanged(CharSequence charSequence, int i8, int i9, int i10) {
}
}
class d implements j0.c {
d() {
}
@Override
public void a(String str) {
if (TextUtils.isEmpty(str)) {
ToastUtil.showToast(SelectPositionActivity.this.getApplicationContext(), 2131821210);
return;
}
Intent intent = new Intent();
intent.putExtra("choose_position", str);
SelectPositionActivity.this.setResult(-1, intent);
SelectPositionActivity.this.finish();
}
}
class e implements Runnable {
final EditText f6930a;
e(EditText editText) {
this.f6930a = editText;
}
@Override
public void run() {
InputMethodManager inputMethodManager;
if (!this.f6930a.requestFocus() || (inputMethodManager = (InputMethodManager) SelectPositionActivity.this.getApplicationContext().getSystemService("input_method")) == null) {
return;
}
inputMethodManager.showSoftInput(this.f6930a, 1);
}
}
class f implements a.InterfaceC0181a {
final String f6932a;
final j0 f6933b;
final RecyclerView f6934c;
f(String str, j0 j0Var, RecyclerView recyclerView) {
this.f6932a = str;
this.f6933b = j0Var;
this.f6934c = recyclerView;
}
@Override
public void a(List<j2.c> list, int i8) {
if (i8 != 1000 || list == null || list.size() <= 0) {
return;
}
ArrayList arrayList = new ArrayList();
for (j2.c cVar : list) {
SearchPoiBean searchPoiBean = new SearchPoiBean();
searchPoiBean.name = cVar.b();
searchPoiBean.address = cVar.a();
searchPoiBean.searchText = this.f6932a;
searchPoiBean.addCity = SelectPositionActivity.this.mCityName;
arrayList.add(searchPoiBean);
}
this.f6933b.e(arrayList);
this.f6934c.setVisibility(0);
}
}
private void initStart() {
this.mPositionRecyclerAdapter = new f0(this);
this.mContentRv.setLayoutManager(new LinearLayoutManager(getApplicationContext()));
this.mContentRv.setAdapter(this.mPositionRecyclerAdapter);
}
private void setDialogView(View view, Dialog dialog) {
((TextView) view.findViewById(2131296454)).setOnClickListener(new b(dialog));
RecyclerView recyclerView = (RecyclerView) view.findViewById(2131296562);
j0 j0Var = new j0(this);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setAdapter(j0Var);
EditText editText = (EditText) view.findViewById(2131297203);
editText.addTextChangedListener(new c(j0Var, recyclerView));
j0Var.f(new d());
showSpan(editText);
}
private void showSearchDialog() {
Dialog dialog = new Dialog(this, 2131886281);
View inflate = LayoutInflater.from(this).inflate(2131493073, (ViewGroup) null);
setDialogView(inflate, dialog);
dialog.setContentView(inflate);
Point point = new Point();
getWindowManager().getDefaultDisplay().getSize(point);
Window window = dialog.getWindow();
if (window != null) {
WindowManager.LayoutParams attributes = window.getAttributes();
attributes.width = point.x;
attributes.height = point.y;
window.setGravity(17);
}
dialog.setCanceledOnTouchOutside(true);
if (isFinishing()) {
return;
}
dialog.show();
}
private void showSpan(EditText editText) {
getWindow().getDecorView().postDelayed(new e(editText), 400L);
}
private void startLocation() {
if (q.c.a(getApplicationContext(), "android.permission.ACCESS_FINE_LOCATION") != 0 && q.c.a(getApplicationContext(), "android.permission.ACCESS_COARSE_LOCATION") != 0) {
ToastUtil.showToast(getApplicationContext(), 2131821059);
return;
}
showLoadingDialog();
AMapLocationClient aMapLocationClient = new AMapLocationClient(getApplicationContext());
AMapLocationClientOption aMapLocationClientOption = new AMapLocationClientOption();
aMapLocationClientOption.setLocationMode(AMapLocationClientOption.AMapLocationMode.Hight_Accuracy);
aMapLocationClientOption.setOnceLocation(true);
aMapLocationClient.setLocationListener(new a());
aMapLocationClient.setLocationOption(aMapLocationClientOption);
aMapLocationClient.startLocation();
}
public void startSearch(double d8, double d9, String str) {
e.b bVar = new e.b("", "餐饮服务|购物服务|生活服务|体育休闲服务|医疗保健服务|住宿服务|风景名胜|商务住宅|政府机构及社会团体|科教文化服务|交通设施服务|公司企业|道路附属设施|地名地址信息|公共设施", str);
bVar.w(20);
bVar.v(0);
m2.e eVar = new m2.e(this, bVar);
eVar.e(this);
eVar.d(new e.c(new g2.b(d8, d9), 1000, true));
eVar.c();
}
@Override
protected View getContentView() {
return inflate(2131492959);
}
@OnClick
public void onClick(View view) {
int id = view.getId();
if (id == 2131296454) {
finish();
return;
}
if (id != 2131296683) {
if (id != 2131297207) {
return;
}
showSearchDialog();
return;
}
String b8 = this.mPositionRecyclerAdapter.b();
if (TextUtils.isEmpty(b8)) {
ToastUtil.showToast(getApplicationContext(), 2131821210);
return;
}
Intent intent = new Intent();
intent.putExtra("choose_position", b8);
setResult(-1, intent);
finish();
}
@Override
protected void onContentAdded() {
needHeader(false);
initStart();
startLocation();
}
@Override
public void onPoiItemSearched(g2.c cVar, int i8) {
}
@Override
public void onPoiSearched(m2.d dVar, int i8) {
ArrayList<g2.c> c8;
dismissLoadingDialog();
if (i8 != 1000 || dVar == null || dVar.d() == null || (c8 = dVar.c()) == null || c8.size() <= 0) {
return;
}
ArrayList arrayList = new ArrayList();
String str = "";
for (g2.c cVar : c8) {
PoiBean poiBean = new PoiBean();
poiBean.title = cVar.f();
poiBean.detail = cVar.e();
poiBean.addCity = cVar.b();
arrayList.add(poiBean);
if (TextUtils.isEmpty(str)) {
str = cVar.b();
}
}
PoiBean poiBean2 = new PoiBean();
poiBean2.isSelected = true;
poiBean2.title = getResources().getString(2131821084);
PoiBean poiBean3 = new PoiBean();
poiBean3.title = str;
arrayList.add(0, poiBean2);
arrayList.add(1, poiBean3);
this.mPositionRecyclerAdapter.c(arrayList);
}
public void startSearch(String str, j0 j0Var, RecyclerView recyclerView) {
j2.b bVar = new j2.b(str, this.mCityName);
bVar.f(true);
j2.a aVar = new j2.a(this, bVar);
aVar.b(new f(str, j0Var, recyclerView));
aVar.a();
}
}