Browse Source

测试数据显示

huyuguo 5 years ago
parent
commit
ad6ab1b304

+ 13 - 0
app/src/main/java/com/electric/chargingpile/activity/HomeAdActivity.java

@ -3,16 +3,19 @@ package com.electric.chargingpile.activity;
3 3
import android.app.Activity;
4 4
import android.content.Intent;
5 5
import android.os.Bundle;
6
import android.support.constraint.ConstraintLayout;
6 7
import android.util.Log;
7 8
import android.view.View;
8 9
import android.widget.ImageView;
9 10
import android.widget.RelativeLayout;
10 11
import android.widget.TextView;
11 12
13
import com.andview.refreshview.utils.Utils;
12 14
import com.blankj.utilcode.util.EmptyUtils;
13 15
import com.blankj.utilcode.util.LogUtils;
14 16
import com.blankj.utilcode.util.ScreenUtils;
15 17
import com.electric.chargingpile.R;
18
import com.electric.chargingpile.application.MainApplication;
16 19
import com.electric.chargingpile.util.BarColorUtil;
17 20
import com.squareup.picasso.Callback;
18 21
import com.squareup.picasso.Picasso;
@ -30,6 +33,8 @@ public class HomeAdActivity extends Activity implements View.OnClickListener {
30 33
    private Timer timer = new Timer();
31 34
    private TimerTask task;
32 35
    private int flag = 0;
36
    private ConstraintLayout resolution;
37
    private TextView wh;
33 38
34 39
    @Override
35 40
    protected void onCreate(Bundle savedInstanceState) {
@ -70,6 +75,9 @@ public class HomeAdActivity extends Activity implements View.OnClickListener {
70 75
    }
71 76
72 77
    private void initViews() {
78
        resolution = findViewById(R.id.resolution);
79
        wh = findViewById(R.id.wh);
80
73 81
        rl_time = (RelativeLayout) findViewById(R.id.rl_time);
74 82
        rl_time.setOnClickListener(this);
75 83
        tv_time = (TextView) findViewById(R.id.tv_time);
@ -80,6 +88,11 @@ public class HomeAdActivity extends Activity implements View.OnClickListener {
80 88
    }
81 89
82 90
    private void initDatas() {
91
        if (!MainApplication.url.contains("cdz.evcharge.cc")) {
92
            resolution.setVisibility(View.VISIBLE);
93
            wh.setText(Utils.getScreenWidth(HomeAdActivity.this) + " x " + Utils.getScreenHeight(HomeAdActivity.this));
94
        }
95
83 96
        url = getIntent().getStringExtra("url");
84 97
        imgUrl = getIntent().getStringExtra("imgUrl");
85 98
        text = getIntent().getStringExtra("title");

+ 21 - 0
app/src/main/res/layout/activity_home_ad.xml

@ -1,6 +1,8 @@
1 1
<?xml version="1.0" encoding="utf-8"?>
2 2
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
3
    xmlns:app="http://schemas.android.com/apk/res-auto"
3 4
    android:id="@+id/fl_bg"
5
    xmlns:tools="http://schemas.android.com/tools"
4 6
    android:layout_width="match_parent"
5 7
    android:layout_height="match_parent">
6 8
@ -59,4 +61,23 @@
59 61
60 62
    </RelativeLayout>
61 63
64
    <android.support.constraint.ConstraintLayout
65
        android:id="@+id/resolution"
66
        android:layout_width="match_parent"
67
        android:visibility="gone"
68
        tools:visibility="visible"
69
        android:layout_height="match_parent">
70
        <TextView
71
            android:id="@+id/wh"
72
            android:text="1080 x 1920"
73
            android:textSize="40sp"
74
            android:textColor="@color/red"
75
            app:layout_constraintLeft_toLeftOf="parent"
76
            app:layout_constraintRight_toRightOf="parent"
77
            app:layout_constraintTop_toTopOf="parent"
78
            app:layout_constraintBottom_toBottomOf="parent"
79
            android:layout_width="wrap_content"
80
            android:layout_height="wrap_content"/>
81
    </android.support.constraint.ConstraintLayout>
82
62 83
</FrameLayout>