Browse Source

站点气泡页开发完成

huyuguo 4 years ago
parent
commit
5331e99d35

+ 101 - 18
app/src/main/java/com/electric/chargingpile/activity/MainMapActivity.java

@ -274,6 +274,12 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
274 274
    private int sortTye = 1;
275 275
    private SlideAdView sav;
276 276
    private static TextView userLogin;
277
278
    private float mPosX;
279
    private float mCurPosX;
280
    private float mPosY;
281
    private float mCurPosY;
282
277 283
    private TextView tv_msg_num;
278 284
    BitmapDescriptor bdyes = BitmapDescriptorFactory.fromResource(R.drawable.icon_sgreen);
279 285
    BitmapDescriptor bdgift = BitmapDescriptorFactory.fromResource(R.drawable.icon_sgift);
@ -324,7 +330,7 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
324 330
    public static LinearLayout rl_control;
325 331
    private RelativeLayout rela, ll_comment, rl_ad, rl_grade, rl_search, ll_paoxiang, rl_charging_notice;
326 332
    private ConstraintLayout rl_privacy_protocol;
327
    private  ImageView private_protocol_sure_and_go;
333
    private ImageView private_protocol_sure_and_go;
328 334
    private Button private_protocol_web;
329 335
    private RelativeLayout tv_notice, tv_citynotice, rl_mapList, ll_tab_find;
330 336
    private LinearLayout ll_paogo, ll_title, ll_open, tab_me, tab_screen;
@ -356,7 +362,7 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
356 362
    public static Marker nMarker;
357 363
    private boolean paoShow = false;
358 364
    private TextView windowName, windowGrade, windowCost, windowFastNum, windowFastAble, windowFastAbleNum,
359
            windowSlowNum, windowSlowAble, windowSlowAbleNum, windowCommentNum, windowDistance;
365
            windowSlowNum, windowSlowAble, windowSlowAbleNum, windowCommentNum, windowDistance, stopCost;
360 366
    private RelativeLayout windowGo, windowZhanDetails, windowComments;
361 367
    private ImageView windowAd, windowGradeImg;
362 368
    public static RelativeLayout windowLayout;
@ -1239,6 +1245,7 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
1239 1245
        iv_guzhang = (ImageView) findViewById(R.id.iv_guzhang);
1240 1246
        ivIsCost = (ImageView) findViewById(R.id.iv_is_cost);
1241 1247
        windowName = (TextView) findViewById(R.id.window_tv_zhan_name);
1248
        stopCost = findViewById(R.id.window_tv_stop_cost);
1242 1249
        windowGrade = (TextView) findViewById(R.id.window_tv_zhan_grade);
1243 1250
        windowCost = (TextView) findViewById(R.id.window_tv_zhan_cost);
1244 1251
        windowFastNum = (TextView) findViewById(R.id.window_tv_fast_num);
@ -5267,6 +5274,13 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
5267 5274
        }
5268 5275
5269 5276
        windowName.setText(zhan_name);
5277
        if (stop_cost != null && !stop_cost.equals("")) {
5278
            stopCost.setVisibility(View.VISIBLE);
5279
            stopCost.setText("停车费:" + stop_cost);
5280
        } else {
5281
            stopCost.setVisibility(View.GONE);
5282
        }
5283
5270 5284
        if (center != null) {
5271 5285
            String wei = poi_wei;
5272 5286
            String jing = poi_jing;
@ -5407,22 +5421,91 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
5407 5421
            }
5408 5422
        });
5409 5423
5410
        windowLayout.setOnClickListener(new View.OnClickListener() {
5424
//        windowLayout.setOnClickListener(new View.OnClickListener() {
5425
//            @Override
5426
//            public void onClick(View view) {
5427
//                Intent intent = new Intent(getApplication(), NewZhanDetailsActivity.class);
5428
//                intent.putExtra("zhan_id", id);
5429
//                intent.putExtra("poi_jing", poi_jing);
5430
//                intent.putExtra("poi_wei", poi_wei);
5431
//                startActivity(intent);
5432
//                MainMapActivity.isR = true;
5433
//                HashMap<String, String> map = new HashMap<String, String>();
5434
//                map.put("type", "详情");
5435
//                MobclickAgent.onEvent(context, "0102", map);
5436
//                map.clear();
5437
//            }
5438
//        });
5439
5440
5441
        windowLayout.setOnTouchListener(new View.OnTouchListener() {
5411 5442
            @Override
5412
            public void onClick(View view) {
5413
                Intent intent = new Intent(getApplication(), NewZhanDetailsActivity.class);
5414
                intent.putExtra("zhan_id", id);
5415
                intent.putExtra("poi_jing", poi_jing);
5416
                intent.putExtra("poi_wei", poi_wei);
5417
                startActivity(intent);
5418
                MainMapActivity.isR = true;
5419
                HashMap<String, String> map = new HashMap<String, String>();
5420
                map.put("type", "详情");
5421
                MobclickAgent.onEvent(context, "0102", map);
5422
                map.clear();
5443
            public boolean onTouch(View view, MotionEvent motionEvent) {
5444
                switch (motionEvent.getAction()) {
5445
                    case MotionEvent.ACTION_DOWN:
5446
                        mPosX = motionEvent.getX();
5447
                        mPosY = motionEvent.getY();
5448
                        break;
5449
                    case MotionEvent.ACTION_MOVE:
5450
                        mCurPosX = motionEvent.getX();
5451
                        mCurPosY = motionEvent.getY();
5452
                        break;
5453
                    case MotionEvent.ACTION_UP:
5454
                        if (mCurPosY > mPosY && Math.abs(mCurPosY - mPosY) > 25) { // 向下滑动
5455
                            // 取消气泡选中状态
5456
                            if (nMarker != null) {
5457
                                nMarker.hideInfoWindow();
5458
                                if (current_chargePoint.getOwn_pay().equals("1")) {
5459
                                    nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker1));
5460
                                } else {
5461
                                    if (current_chargePoint.getSuit_car().equals("特斯拉")) {
5462
                                        nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker3));
5463
                                    } else {
5464
                                        if (WelcomeActivity.canCost.contains(current_chargePoint.getSupplier())) {
5465
                                            nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker2));
5466
                                        } else {
5467
                                            nMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.icon_newmarker3));
5468
                                        }
5469
                                    }
5470
                                }
5471
                            }
5472
                            // 隐藏气泡弹窗视图
5473
                            Animation animation = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.out);
5474
                            animation.setDuration(500);
5475
                            windowLayout.startAnimation(animation);
5476
                            new Handler().postDelayed(new Runnable() {
5477
                                @Override
5478
                                public void run() {
5479
                                    windowLayout.setVisibility(View.GONE);
5480
                                    rl_control.setVisibility(View.VISIBLE);
5481
                                }
5482
                            }, 500);
5483
                        } else if (mCurPosY < mPosY && Math.abs(mCurPosY - mPosY) > 25) { // 向上活动
5484
5485
                        } else if (mCurPosX > mPosX && Math.abs(mCurPosX - mPosX) > 25) { // 向右滑动
5486
5487
                        } else if (mCurPosX < mPosX && Math.abs(mCurPosX - mPosX) > 25) { // 向左滑动
5488
5489
                        } else { // 点击事件
5490
                            Intent intent = new Intent(getApplication(), NewZhanDetailsActivity.class);
5491
                            intent.putExtra("zhan_id", id);
5492
                            intent.putExtra("poi_jing", poi_jing);
5493
                            intent.putExtra("poi_wei", poi_wei);
5494
                            startActivity(intent);
5495
                            MainMapActivity.isR = true;
5496
                            HashMap<String, String> map = new HashMap<String, String>();
5497
                            map.put("type", "详情");
5498
                            MobclickAgent.onEvent(context, "0102", map);
5499
                            map.clear();
5500
                        }
5501
                        break;
5502
                }
5503
5504
                return true;
5423 5505
            }
5424 5506
        });
5425 5507
5508
5426 5509
        windowComments.setOnClickListener(new View.OnClickListener() {
5427 5510
            @Override
5428 5511
            public void onClick(View v) {
@ -6229,23 +6312,23 @@ public class MainMapActivity extends Activity implements LocationSource, AMapLoc
6229 6312
            return;
6230 6313
        }
6231 6314
6232
        TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
6315
        TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
6233 6316
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
6234 6317
            int checkPermission = ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_PHONE_STATE);
6235 6318
            if (checkPermission != PackageManager.PERMISSION_GRANTED) { // 未授权,去授权
6236
                ActivityCompat.requestPermissions(MainMapActivity.this, new String[]{Manifest.permission.READ_PHONE_STATE},READ_PHONE_STATE);
6319
                ActivityCompat.requestPermissions(MainMapActivity.this, new String[]{Manifest.permission.READ_PHONE_STATE}, READ_PHONE_STATE);
6237 6320
            } else {
6238 6321
                deviceId = telephonyManager.getImei();
6239 6322
            }
6240 6323
        } else {
6241 6324
            int checkPermission = ActivityCompat.checkSelfPermission(getApplicationContext(), Manifest.permission.READ_PHONE_STATE);
6242 6325
            if (checkPermission != PackageManager.PERMISSION_GRANTED) { // 未授权,去授权
6243
                ActivityCompat.requestPermissions(MainMapActivity.this, new String[]{Manifest.permission.READ_PHONE_STATE},READ_PHONE_STATE);
6326
                ActivityCompat.requestPermissions(MainMapActivity.this, new String[]{Manifest.permission.READ_PHONE_STATE}, READ_PHONE_STATE);
6244 6327
            } else {
6245 6328
                deviceId = telephonyManager.getDeviceId();
6246 6329
            }
6247 6330
        }
6248
        if (!TextUtils.isEmpty(deviceId )) {
6331
        if (!TextUtils.isEmpty(deviceId)) {
6249 6332
            ProfileManager.getInstance().setDeviceId(deviceId);
6250 6333
        }
6251 6334
    }

+ 14 - 0
app/src/main/res/layout/activity_main_map.xml

@ -1205,6 +1205,20 @@
1205 1205
                android:textSize="14sp"
1206 1206
                tools:text="可使用本APP扫码支付" />
1207 1207
1208
            <TextView
1209
                android:id="@+id/window_tv_stop_cost"
1210
                android:layout_width="wrap_content"
1211
                android:layout_height="wrap_content"
1212
                android:layout_marginLeft="15dp"
1213
                android:layout_marginTop="5dp"
1214
                android:layout_marginRight="15dp"
1215
                android:ellipsize="end"
1216
                android:maxLines="2"
1217
                android:textColor="@color/orange"
1218
                android:textSize="14sp"
1219
                tools:text="停车费:参考价格:10元\/小时(以实际收取为准)" />
1220
1221
1208 1222
            <!-- 广告 -->
1209 1223
            <ImageView
1210 1224
                android:id="@+id/window_iv_ad"

+ 1 - 1
app/src/main/res/values/color.xml

@ -39,7 +39,7 @@
39 39
    <color name="tab_lv">#01b637</color>
40 40
    <color name="tab_hei">#555555</color>
41 41
    <color name="navpage">#FFE1E8EB</color>
42

42
    <color name="orange">#FE6200</color>
43 43

44 44

45 45