po.java 3.21 KB
package com.lotus.town.notify;

import android.os.Bundle;
import android.support.annotation.Nullable;
import android.text.Html;
import android.widget.TextView;

import com.ad.lib.AdPlacement;
import com.ad.lib.RequestInfo;
import com.bytedance.sdk.openadsdk.AdSlot;
import com.controller.NotifyType;
import com.lotus.town.R;

/**
 * 挂机电话
 */
public class po extends BaseNotifyActivity {

    private TextView mPhoneTime;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

    }

    @Override
    protected void initSmallView() {
    }

    @Override
    protected void initLayout() {
        setContentView(R.layout.po_notify_layout);

    }
    @Override
    protected void initSmallAd() {

    }

    @Override
    protected String getEventName() {
        return "p_o_a_d";
    }

    @Override
    protected String getEventClickName() {
        return "p_o_s_c";
    }

    @Override
    protected String getEventPageName() {
        return "p_o_s_p";
    }

    @Override
    protected RequestInfo getSmallPlacementId() {
        RequestInfo info = new RequestInfo();
        info.setId(AdPlacement.getPhoneOverId());
        info.setWidth(1080);
        info.setHeight(1920);
        info.setType(AdSlot.TYPE_INTERACTION_AD);
        return info;
    }

    @Override
    protected RequestInfo getBigPlacementId() {
        RequestInfo info = new RequestInfo();
        info.setId(AdPlacement.getPhoneOverId());
        info.setWidth(1080);
        info.setHeight(1920);
        info.setType(AdSlot.TYPE_INTERACTION_AD);
        return info;
    }

    @Override
    protected void initInfo() {
        if(NotifyManager.PhoneStartTime == 0){
            String html="<font color='black'>本次通话</font>";
            html+="<font color='#FF6861'> <big> "+"已结束"+" </big> </font>";

            CharSequence charSequence= Html.fromHtml(html);
            mPhoneTime.setText(charSequence);
        } else {
            long time = NotifyManager.PhoneEndTime - NotifyManager.PhoneStartTime;
            String times = getTimeString(time);
            String html="<font color='black'>本次通话</font>";
            html+="<font color='#FF6861'> <big> "+times+" </big> </font>";

            CharSequence charSequence= Html.fromHtml(html);
            mPhoneTime.setText(charSequence);
        }

    }

    private String getTimeString(long time){
        String result = "";
        if(time <=60000){
            result = time/1000 +"秒";
        } else if(time >60000 && time <60*60*1000){
            //70000        10000
            result = time/60/1000 +"分钟"+time%(60*1000)/(1000) +"秒";
        } else if(time >= 60*60*1000){

            //60 * 60 *1000  3600000
            result = time/(60*60*1000) +"小时"+time%(60*60*1000)/60/1000 +"分";
        }
        return result;
    }
    @Override
    protected void initView(){
        super.initView();

        mPhoneTime = findViewById(R.id.phone_time);
    }
    @Override
    protected int getSmallAdType() {
        return 0;
    }

    @Override
    protected int getBitAdType() {
        return 0;
    }

    @Override
    protected int getBigAdNotifyType() {
        return NotifyType.PHONE_OVER_NOTIRY;
    }
}