Browse Source

首页需求开发完成

huyuguo 5 years ago
parent
commit
3e0eed8d96

+ 26 - 5
app/src/main/java/com/electric/chargingpile/activity/MainMapActivity.java

15
import android.database.sqlite.SQLiteDatabase;
15
import android.database.sqlite.SQLiteDatabase;
16
import android.graphics.Bitmap;
16
import android.graphics.Bitmap;
17
import android.graphics.BitmapFactory;
17
import android.graphics.BitmapFactory;
18
import android.graphics.Point;
18
import android.graphics.drawable.BitmapDrawable;
19
import android.graphics.drawable.BitmapDrawable;
19
import android.graphics.drawable.Drawable;
20
import android.graphics.drawable.Drawable;
20
import android.media.Image;
21
import android.media.Image;
115
import com.electric.chargingpile.util.LoadingDialog;
116
import com.electric.chargingpile.util.LoadingDialog;
116
import com.electric.chargingpile.util.Md5Util;
117
import com.electric.chargingpile.util.Md5Util;
117
import com.electric.chargingpile.util.OkHttpUtil;
118
import com.electric.chargingpile.util.OkHttpUtil;
119
import com.electric.chargingpile.util.ScreenUtils;
118
import com.electric.chargingpile.util.SharedPreferencesUtil;
120
import com.electric.chargingpile.util.SharedPreferencesUtil;
119
import com.electric.chargingpile.util.ToastUtil;
121
import com.electric.chargingpile.util.ToastUtil;
120
import com.electric.chargingpile.util.Util;
122
import com.electric.chargingpile.util.Util;
4999
            moveRefresh = false;
5001
            moveRefresh = false;
5000
            ClusterItem clusterItem = clusterItems.get(0);
5002
            ClusterItem clusterItem = clusterItems.get(0);
5001
            LatLng position = clusterItem.getPosition();
5003
            LatLng position = clusterItem.getPosition();
5002
            float zoom = aMap.getCameraPosition().zoom;
5003
//            Log.e(TAG, "onClick: ==" + zoom);
5004
            aMap.animateCamera(CameraUpdateFactory.newLatLngZoom(marker.getPosition(), zoom));
5005
5004
            clickMarkAndMove(position);
5006
5005
5007
            RegionItem regionItem = (RegionItem) clusterItems.get(0);
5006
            RegionItem regionItem = (RegionItem) clusterItems.get(0);
5008
            zhan_list chargePoint = regionItem.getChargePoint();
5007
            zhan_list chargePoint = regionItem.getChargePoint();
5061
        }
5060
        }
5062
    }
5061
    }
5063
5062
5063
    private void clickMarkAndMove(LatLng latLng) {
5064
        float zoom = aMap.getCameraPosition().zoom;
5065
        int width = mapView.getMeasuredWidth();
5066
        int height = mapView.getMeasuredHeight();
5067
        if (height > 1122) {
5068
            LatLngBounds.Builder b = LatLngBounds.builder();
5069
            b.include(latLng);
5070
5071
            LatLngBounds bounds = b.build();
5072
//            aMap.moveCamera(CameraUpdateFactory.newLatLngBoundsRect(bounds, width/2,width/2,100, 1000));
5073
//            aMap.moveCamera(CameraUpdateFactory.scrollBy(0, 100));
5074
            Point point = aMap.getProjection().toScreenLocation(latLng);
5075
5076
            Log.d("ssssssssss", "clickMarkAndMove: " + point.toString());
5077
5078
            int y = point.y - (height - 1122);
5079
            aMap.moveCamera(CameraUpdateFactory.scrollBy(point.x - width/2, y));
5080
        } else {
5081
            aMap.animateCamera(CameraUpdateFactory.newLatLngZoom(latLng, zoom));
5082
        }
5083
    }
5084
5064
    private void getSingleZhanInfo(String zhan_id, final LatLng ll) {
5085
    private void getSingleZhanInfo(String zhan_id, final LatLng ll) {
5065
5086
5066
        String url = MainApplication.url + "/zhannew/basic/web/index.php/zhanlist/zhan-info?zhan_id=" + zhan_id + "&version=" + MainApplication.current_code;
5087
        String url = MainApplication.url + "/zhannew/basic/web/index.php/zhanlist/zhan-info?zhan_id=" + zhan_id + "&version=" + MainApplication.current_code;
5197
        windowRedPaperBag.setVisibility("1".equals(own_pay) ? View.VISIBLE : View.GONE);
5218
        windowRedPaperBag.setVisibility("1".equals(own_pay) ? View.VISIBLE : View.GONE);
5198
        windowLabelPublic.setText("0".equals(belong_attribute) ? "公共" : "私人");
5219
        windowLabelPublic.setText("0".equals(belong_attribute) ? "公共" : "私人");
5199
        windowLabelGround.setText("0".equals(park_location) ? "地下" : "地上");
5220
        windowLabelGround.setText("0".equals(park_location) ? "地下" : "地上");
5200
        windowLabelPublic.setVisibility(stop_cost.contains("免费") ? View.VISIBLE : View.GONE);
5221
        windowLabelFreePark.setVisibility(stop_cost.contains("免费") ? View.VISIBLE : View.GONE);
5201
5222
5202
5223
5203
        String acNum = null, dcNum = null, acableNum = null, dcableNum = null;
5224
        String acNum = null, dcNum = null, acableNum = null, dcableNum = null;