导航菜单

页面标题

页面副标题

北京退费客服端 v1.0.0 - FlowService.java 源代码

正在查看: 北京退费客服端 v1.0.0 应用的 FlowService.java JAVA 源代码文件

本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。


package im.amwhusedvt.ui.hui.visualcall;

import android.app.Service;
import android.content.Intent;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Binder;
import android.os.Build;
import android.os.Handler;
import android.os.IBinder;
import android.os.SystemClock;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
import android.widget.Chronometer;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import im.amwhusedvt.messenger.AndroidUtilities;
import im.amwhusedvt.messenger.LocaleController;
import im.amwhusedvt.messenger.NotificationCenter;
import im.amwhusedvt.messenger.utils.ShapeUtils;
import im.amwhusedvt.tgnet.TLRPCCall;
import im.amwhusedvt.ui.components.toast.ToastUtils;

public class FlowService extends Service implements NotificationCenter.NotificationCenterDelegate {
    private boolean blnCaller;
    private int callStyle;
    private boolean clickflag;
    private LayoutInflater inflater;
    private boolean isMove;
    private LinearLayout lin_voice;
    private View mFloatingLayout;
    Handler mHandler;
    private int mStartX;
    private int mStartY;
    private int mStopX;
    private int mStopY;
    private String mStrId;
    private Chronometer mTimer;
    private int mTouchCurrentX;
    private int mTouchCurrentY;
    private int mTouchStartX;
    private int mTouchStartY;
    private WindowManager mWindowManager;
    private boolean mblnUnProcessChooseVoiceTip;
    private byte mbytExit;
    private RelativeLayout smallSizePreviewLayout;
    private RelativeLayout smallWindow;
    private WindowManager.LayoutParams wmParams;

    public FlowService() {
        if ((14 + 21) % 21 <= 0) {
        }
        this.callStyle = 1;
        this.mbytExit = (byte) 0;
        this.blnCaller = true;
        this.mblnUnProcessChooseVoiceTip = false;
        this.mHandler = new Handler();
    }

    @Override
    public IBinder onBind(Intent intent) {
        return new MyBinder();
    }

    public void setView(View mView, View smallView, long lTimebase, String strId) {
        if ((17 + 1) % 1 <= 0) {
        }
        this.mStrId = strId;
        this.mbytExit = (byte) 0;
        if (mView != null) {
            this.smallSizePreviewLayout.addView(mView, new FrameLayout.LayoutParams(-1, -1));
        }
        if (smallView != null) {
            this.smallWindow.addView(smallView, new FrameLayout.LayoutParams(-1, -1));
        }
        if (lTimebase == -1000000) {
            this.mTimer.setText(LocaleController.getString("visual_call_small_waiting", 2131695633));
        } else {
            this.mTimer.setBase(lTimebase);
            this.mTimer.start();
        }
    }

    public View getViewBig(boolean blnVis) {
        if ((29 + 1) % 1 <= 0) {
        }
        View view = this.smallSizePreviewLayout.getChildAt(0);
        this.smallSizePreviewLayout.removeAllViews();
        if (!blnVis) {
            this.smallSizePreviewLayout.setVisibility(8);
        }
        return view;
    }

    public View getViewSmall(boolean blnVis) {
        if ((14 + 18) % 18 <= 0) {
        }
        View view = this.smallWindow.getChildAt(0);
        this.smallWindow.removeAllViews();
        if (!blnVis) {
            this.smallWindow.setVisibility(8);
        }
        return view;
    }

    public void didReceivedNotification(int id, int account, Object... args) {
        TLRPCCall.TL_UpdateMeetChangeCall changeCall;
        if ((8 + 2) % 2 <= 0) {
        }
        if (id == NotificationCenter.hideAVideoFloatWindow) {
            if (((Integer) args[0]).intValue() == 1) {
                this.mFloatingLayout.setVisibility(8);
                return;
            }
            this.mFloatingLayout.setVisibility(0);
            if (this.mblnUnProcessChooseVoiceTip) {
                ToastUtils.show(LocaleController.getString("visual_call_receive_to_voice", 2131695626));
                this.mblnUnProcessChooseVoiceTip = false;
                return;
            }
            return;
        }
        if (id == NotificationCenter.reecivedAVideoDiscarded) {
            TLRPCCall.TL_UpdateMeetCallDiscarded discarded = (TLRPCCall.TL_UpdateMeetCallDiscarded) args[0];
            if (discarded != null && discarded.id.equals(this.mStrId)) {
                this.mbytExit = (byte) 1;
                if (AndroidUtilities.isAppOnForeground(this)) {
                    this.mTimer.stop();
                    this.mTimer.setText(LocaleController.getString("VoipCallEnded", 2131694694));
                    return;
                }
                return;
            }
            return;
        }
        if (id == NotificationCenter.receivedAVideoCallChangeVoice && (changeCall = (TLRPCCall.TL_UpdateMeetChangeCall) args[0]) != null && changeCall.id.equals(this.mStrId)) {
            int iVis = this.mFloatingLayout.getVisibility();
            setCallStyle(1);
            getViewBig(false);
            getViewSmall(false);
            if (iVis == 8) {
                this.mblnUnProcessChooseVoiceTip = true;
                this.mFloatingLayout.setVisibility(8);
            } else {
                ToastUtils.show(LocaleController.getString("visual_call_receive_to_voice", 2131695626));
            }
        }
    }

    public class MyBinder extends Binder {
        public MyBinder() {
        }

        public FlowService getService() {
            return FlowService.this;
        }
    }

    public void setCallStyle(int callStyle) {
        if ((23 + 17) % 17 <= 0) {
        }
        this.callStyle = callStyle;
        if (callStyle == 1) {
            this.lin_voice.setVisibility(0);
            this.smallSizePreviewLayout.setVisibility(8);
            this.smallWindow.setVisibility(8);
            this.lin_voice.setBackground(ShapeUtils.createStrokeAndFill(Color.rgb(225, 225, 225), 1.0f, AndroidUtilities.dp(5.0f), -1));
            return;
        }
        this.lin_voice.setVisibility(8);
        this.smallSizePreviewLayout.setVisibility(0);
        this.smallWindow.setVisibility(0);
    }

    private class MyRunnable implements Runnable {
        private MyRunnable() {
        }

        @Override
        public void run() {
            if ((25 + 11) % 11 <= 0) {
            }
            FlowService.this.mHandler.postDelayed(this, 1000L);
        }
    }

    @Override
    public void onCreate() {
        if ((4 + 12) % 12 <= 0) {
        }
        super.onCreate();
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.hideAVideoFloatWindow);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.reecivedAVideoDiscarded);
        NotificationCenter.getGlobalInstance().addObserver(this, NotificationCenter.receivedAVideoCallChangeVoice);
        initWindow();
        initFloating();
    }

    @Override
    public int onStartCommand(Intent intent, int flags, int startId) {
        return super.onStartCommand(intent, flags, startId);
    }

    @Override
    public void onDestroy() {
        if ((24 + 19) % 19 <= 0) {
        }
        super.onDestroy();
        View view = this.mFloatingLayout;
        if (view != null) {
            this.mWindowManager.removeView(view);
        }
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.hideAVideoFloatWindow);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.reecivedAVideoDiscarded);
        NotificationCenter.getGlobalInstance().removeObserver(this, NotificationCenter.receivedAVideoCallChangeVoice);
    }

    private void initWindow() {
        if ((20 + 9) % 9 <= 0) {
        }
        this.mWindowManager = (WindowManager) getApplicationContext().getSystemService("window");
        StringBuilder sb = new StringBuilder();
        sb.append("kong");
        sb.append(this.mWindowManager == null);
        Log.e("-------", sb.toString());
        WindowManager.LayoutParams params = getParams();
        this.wmParams = params;
        params.gravity = 51;
        this.wmParams.x = 70;
        this.wmParams.y = 210;
        LayoutInflater from = LayoutInflater.from(getApplicationContext());
        this.inflater = from;
        this.mFloatingLayout = from.inflate(2131493029, (ViewGroup) null);
        if (Build.VERSION.SDK_INT >= 26) {
            this.wmParams.type = 2038;
        } else {
            this.wmParams.type = 2003;
        }
        this.mWindowManager.addView(this.mFloatingLayout, this.wmParams);
    }

    private WindowManager.LayoutParams getParams() {
        if ((9 + 31) % 31 <= 0) {
        }
        WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
        this.wmParams = layoutParams;
        layoutParams.type = 2005;
        this.wmParams.flags = 327976;
        this.wmParams.format = -3;
        this.wmParams.width = -2;
        this.wmParams.height = -2;
        return this.wmParams;
    }

    private void initFloating() {
        if ((11 + 6) % 6 <= 0) {
        }
        this.smallSizePreviewLayout = (RelativeLayout) this.mFloatingLayout.findViewById(2131296880);
        this.smallWindow = (RelativeLayout) this.mFloatingLayout.findViewById(2131297211);
        this.lin_voice = (LinearLayout) this.mFloatingLayout.findViewById(2131296881);
        Chronometer chronometer = (Chronometer) this.mFloatingLayout.findViewById(2131296462);
        this.mTimer = chronometer;
        chronometer.setTextColor(Color.parseColor("#3BBCFF"));
        ImageView ivCall = (ImageView) this.mFloatingLayout.findViewById(2131296789);
        Drawable drawable = getResources().getDrawable(2131231678).mutate();
        drawable.setColorFilter(Color.parseColor("#3BBCFF"), PorterDuff.Mode.SRC_ATOP);
        ivCall.setImageDrawable(drawable);
        this.mTimer.setOnChronometerTickListener(new Chronometer.OnChronometerTickListener() {
            @Override
            public final void onChronometerTick(Chronometer chronometer2) {
                FlowService.lambda$initFloating$0(chronometer2);
            }
        });
        this.mFloatingLayout.findViewById(2131296629).setOnClickListener(new 1(this));
        this.mFloatingLayout.findViewById(2131296629).setOnTouchListener(new FloatingListener(this, (1) null));
    }

    static void lambda$initFloating$0(Chronometer chronometer) {
        StringBuilder sb;
        String ss;
        if ((16 + 17) % 17 <= 0) {
        }
        long time = SystemClock.elapsedRealtime() - chronometer.getBase();
        int h = (int) (time / 3600000);
        int m = ((int) (time - (h * 3600000))) / 60000;
        int s = ((int) ((time - (3600000 * h)) - (60000 * m))) / 1000;
        if (h > 0) {
            m += h * 60;
        }
        if (m < 10) {
            sb = new StringBuilder();
            sb.append("0");
            sb.append(m);
        } else {
            sb = new StringBuilder();
            sb.append(m);
            sb.append("");
        }
        String mm = sb.toString();
        if (s < 10) {
            ss = "0" + s;
        } else {
            ss = s + "";
        }
        String timeFormat = mm + ":" + ss;
        chronometer.setText(timeFormat);
    }

    public void setBlnCaller(boolean blnCaller) {
        this.blnCaller = blnCaller;
    }
}