| | |
| | | import android.content.Context; |
| | | import android.content.Intent; |
| | | import android.content.res.Resources; |
| | | import android.graphics.drawable.Drawable; |
| | | import android.os.Bundle; |
| | | import android.text.TextUtils; |
| | | import android.util.Log; |
| | | import android.util.Pair; |
| | | import android.view.LayoutInflater; |
| | | import android.view.View; |
| | | import android.view.ViewGroup; |
| | |
| | | |
| | | import androidx.annotation.NonNull; |
| | | import androidx.annotation.Nullable; |
| | | import androidx.core.content.ContextCompat; |
| | | import androidx.lifecycle.Observer; |
| | | |
| | | import com.dayu.pipirrapp.MyApplication; |
| | |
| | | import com.dayu.pipirrapp.utils.WebViewUtils; |
| | | import com.dayu.pipirrapp.view.ConfirmDialog; |
| | | import com.dayu.pipirrapp.view.TipUtil; |
| | | import com.example.expand_button.ExpandButton; |
| | | import com.hjq.permissions.OnPermissionCallback; |
| | | import com.hjq.permissions.Permission; |
| | | import com.hjq.permissions.XXPermissions; |
| | |
| | | import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers; |
| | | import io.reactivex.rxjava3.disposables.CompositeDisposable; |
| | | import io.reactivex.rxjava3.schedulers.Schedulers; |
| | | import kotlin.Triple; |
| | | |
| | | /** |
| | | * author: zuo |
| | |
| | | Intent issue = new Intent(MapFragment.this.getActivity(), AddIssueActivity.class); |
| | | MapFragment.this.getActivity().startActivity(issue); |
| | | }); |
| | | binding.expandButton.setLegendsArray(new Triple<>( |
| | | ContextCompat.getDrawable(requireContext(), R.drawable.marker_blue), |
| | | ContextCompat.getDrawable(requireContext(), R.drawable.marker_unselected), |
| | | "取水口" |
| | | ), |
| | | new Triple<>( |
| | | ContextCompat.getDrawable(requireContext(), R.drawable.divide_home_blue), |
| | | ContextCompat.getDrawable(requireContext(), R.drawable.divide_home_unselected), |
| | | "分水房" |
| | | )); |
| | | binding.expandButton.setOnLegendItemClickListener((position, isSelected) -> { |
| | | switch (position) { |
| | | case 0: |
| | | showMarkers(isSelected); |
| | | break; |
| | | case 1: |
| | | showDivideMarkers(isSelected); |
| | | break; |
| | | |
| | | |
| | | } |
| | | }); |
| | | } |
| | | |
| | | /** |
| | |
| | | mWebView.restoreState(savedInstanceState); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 显示或隐藏地图上的取水口 |
| | | * |
| | | * @param isShow |
| | | */ |
| | | private void showMarkers(boolean isShow) { |
| | | if (isShow) { |
| | | mWebView.evaluateJavascript("javascript:showAllWaterIntakes()", value -> { |
| | | }); |
| | | } else { |
| | | mWebView.evaluateJavascript("javascript:hideAllWaterIntakes()", value -> { |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 显示或隐藏地图上的分水房 |
| | | * |
| | | * @param isShow |
| | | */ |
| | | private void showDivideMarkers(boolean isShow) { |
| | | if (isShow) { |
| | | mWebView.evaluateJavascript("javascript:showAllDivides()", value -> { |
| | | }); |
| | | } else { |
| | | mWebView.evaluateJavascript("javascript:hideAllDivides()", value -> { |
| | | }); |
| | | } |
| | | } |
| | | |
| | | } |