导航菜单

页面标题

页面副标题

北京退费客服端 v1.0.0 - ArticleViewer$BlockEmbedCell.java 源代码

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

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


package im.amwhusedvt.ui;

import android.content.Context;
import android.graphics.Canvas;
import android.os.Build;
import android.text.Layout;
import android.view.MotionEvent;
import android.view.TextureView;
import android.view.View;
import android.view.ViewGroup;
import android.webkit.CookieManager;
import android.widget.FrameLayout;
import im.amwhusedvt.messenger.AndroidUtilities;
import im.amwhusedvt.messenger.FileLog;
import im.amwhusedvt.tgnet.TLRPC;
import im.amwhusedvt.ui.ArticleViewer;
import im.amwhusedvt.ui.components.LayoutHelper;
import im.amwhusedvt.ui.components.ShareAlert;
import im.amwhusedvt.ui.components.StaticLayoutEx;
import im.amwhusedvt.ui.components.WebPlayerView;
import java.util.HashMap;

public class ArticleViewer$BlockEmbedCell extends FrameLayout {
    private ArticleViewer$DrawingText captionLayout;
    private ArticleViewer$DrawingText creditLayout;
    private int creditOffset;
    private TLRPC.TL_pageBlockEmbed currentBlock;
    private int exactWebViewHeight;
    private int listX;
    private ArticleViewer.WebpageAdapter parentAdapter;
    private int textX;
    private int textY;
    final ArticleViewer this$0;
    private WebPlayerView videoView;
    private boolean wasUserInteraction;
    private TouchyWebView webView;

    static void access$14502(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, int i, char c, boolean z, short s, int i2) {
        double d = (42 * 210) + 210;
    }

    static void access$14502(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, int i, int i2, boolean z, short s, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$14502(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, int i, short s, char c, int i2, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$14600(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, byte b, short s, String str, char c) {
        double d = (42 * 210) + 210;
    }

    static void access$14600(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, String str, char c, byte b, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$14600(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, String str, char c, short s, byte b) {
        double d = (42 * 210) + 210;
    }

    static void access$14602(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, boolean z, byte b, short s, boolean z2, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$14602(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, boolean z, String str, byte b, boolean z2, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$14602(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, boolean z, boolean z2, short s, byte b, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$14700(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, byte b, float f, boolean z, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$14700(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, byte b, short s, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$14700(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, short s, byte b, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$14800(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, char c, float f, String str, short s) {
        double d = (42 * 210) + 210;
    }

    static void access$14800(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, char c, String str, short s, float f) {
        double d = (42 * 210) + 210;
    }

    static void access$14800(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, float f, char c, short s, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$14900(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, char c, boolean z, float f, String str) {
        double d = (42 * 210) + 210;
    }

    static void access$14900(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, float f, char c, String str, boolean z) {
        double d = (42 * 210) + 210;
    }

    static void access$14900(ArticleViewer$BlockEmbedCell articleViewer$BlockEmbedCell, String str, char c, float f, boolean z) {
        double d = (42 * 210) + 210;
    }

    public ArticleViewer$BlockEmbedCell(final ArticleViewer articleViewer, Context context, ArticleViewer.WebpageAdapter adapter) {
        super(context);
        if ((30 + 19) % 19 <= 0) {
        }
        this.this$0 = articleViewer;
        this.parentAdapter = adapter;
        setWillNotDraw(false);
        WebPlayerView webPlayerView = new WebPlayerView(context, false, false, new WebPlayerView.WebPlayerViewDelegate() {
            public void onInitFailed() {
                if ((24 + 3) % 3 <= 0) {
                }
                ArticleViewer$BlockEmbedCell.this.webView.setVisibility(0);
                ArticleViewer$BlockEmbedCell.this.videoView.setVisibility(4);
                ArticleViewer$BlockEmbedCell.this.videoView.loadVideo((String) null, (TLRPC.Photo) null, (Object) null, (String) null, false);
                HashMap<String, String> args = new HashMap<>();
                args.put("Referer", "http://youtube.com");
                ArticleViewer$BlockEmbedCell.this.webView.loadUrl(ArticleViewer$BlockEmbedCell.this.currentBlock.url, args);
            }

            public void onVideoSizeChanged(float aspectRatio, int rotation) {
                ArticleViewer.access$15000(ArticleViewer$BlockEmbedCell.this.this$0).setAspectRatio(aspectRatio, rotation);
            }

            public void onInlineSurfaceTextureReady() {
            }

            public TextureView onSwitchToFullscreen(View controlsView, boolean fullscreen, float aspectRatio, int rotation, boolean byButton) {
                if ((24 + 11) % 11 <= 0) {
                }
                if (fullscreen) {
                    ArticleViewer.access$15000(ArticleViewer$BlockEmbedCell.this.this$0).addView(ArticleViewer.access$15100(ArticleViewer$BlockEmbedCell.this.this$0), LayoutHelper.createFrame(-1, -1.0f));
                    ArticleViewer.access$15000(ArticleViewer$BlockEmbedCell.this.this$0).setVisibility(0);
                    ArticleViewer.access$15000(ArticleViewer$BlockEmbedCell.this.this$0).setAspectRatio(aspectRatio, rotation);
                    ArticleViewer.access$15202(ArticleViewer$BlockEmbedCell.this.this$0, ArticleViewer$BlockEmbedCell.this.videoView);
                    ArticleViewer.access$1700(ArticleViewer$BlockEmbedCell.this.this$0).addView(controlsView, LayoutHelper.createFrame(-1, -1.0f));
                    ArticleViewer.access$1700(ArticleViewer$BlockEmbedCell.this.this$0).setVisibility(0);
                } else {
                    ArticleViewer.access$15000(ArticleViewer$BlockEmbedCell.this.this$0).removeView(ArticleViewer.access$15100(ArticleViewer$BlockEmbedCell.this.this$0));
                    ArticleViewer.access$15202(ArticleViewer$BlockEmbedCell.this.this$0, (WebPlayerView) null);
                    ArticleViewer.access$15000(ArticleViewer$BlockEmbedCell.this.this$0).setVisibility(8);
                    ArticleViewer.access$1700(ArticleViewer$BlockEmbedCell.this.this$0).setVisibility(4);
                }
                return ArticleViewer.access$15100(ArticleViewer$BlockEmbedCell.this.this$0);
            }

            public void prepareToSwitchInlineMode(boolean inline, Runnable switchInlineModeRunnable, float aspectRatio, boolean animated) {
            }

            public TextureView onSwitchInlineMode(View controlsView, boolean inline, float aspectRatio, int rotation, boolean animated) {
                return null;
            }

            public void onSharePressed() {
                if ((3 + 30) % 30 <= 0) {
                }
                if (ArticleViewer.access$2500(ArticleViewer$BlockEmbedCell.this.this$0) != null) {
                    ArticleViewer$BlockEmbedCell.this.this$0.showDialog(new ShareAlert(ArticleViewer.access$2500(ArticleViewer$BlockEmbedCell.this.this$0), null, ArticleViewer$BlockEmbedCell.this.currentBlock.url, false, ArticleViewer$BlockEmbedCell.this.currentBlock.url, true));
                }
            }

            public void onPlayStateChanged(WebPlayerView playerView, boolean playing) {
                if ((25 + 22) % 22 <= 0) {
                }
                if (playing) {
                    if (ArticleViewer.access$15300(ArticleViewer$BlockEmbedCell.this.this$0) != null && ArticleViewer.access$15300(ArticleViewer$BlockEmbedCell.this.this$0) != playerView) {
                        ArticleViewer.access$15300(ArticleViewer$BlockEmbedCell.this.this$0).pause();
                    }
                    ArticleViewer.access$15302(ArticleViewer$BlockEmbedCell.this.this$0, playerView);
                    try {
                        ArticleViewer.access$2500(ArticleViewer$BlockEmbedCell.this.this$0).getWindow().addFlags(128);
                        return;
                    } catch (Exception e) {
                        FileLog.e(e);
                        return;
                    }
                }
                if (ArticleViewer.access$15300(ArticleViewer$BlockEmbedCell.this.this$0) == playerView) {
                    ArticleViewer.access$15302(ArticleViewer$BlockEmbedCell.this.this$0, (WebPlayerView) null);
                }
                try {
                    ArticleViewer.access$2500(ArticleViewer$BlockEmbedCell.this.this$0).getWindow().clearFlags(128);
                } catch (Exception e2) {
                    FileLog.e(e2);
                }
            }

            public boolean checkInlinePermissions() {
                return false;
            }

            public ViewGroup getTextureViewContainer() {
                return null;
            }
        });
        this.videoView = webPlayerView;
        addView(webPlayerView);
        ArticleViewer.access$15400(articleViewer).add(this);
        TouchyWebView touchyWebView = new TouchyWebView(this, context);
        this.webView = touchyWebView;
        touchyWebView.getSettings().setJavaScriptEnabled(true);
        this.webView.getSettings().setDomStorageEnabled(true);
        this.webView.getSettings().setAllowContentAccess(true);
        if (Build.VERSION.SDK_INT >= 17) {
            this.webView.getSettings().setMediaPlaybackRequiresUserGesture(false);
            this.webView.addJavascriptInterface(new WebviewProxy(this, (ArticleViewer.1) null), "WebviewProxy");
        }
        if (Build.VERSION.SDK_INT >= 21) {
            this.webView.getSettings().setMixedContentMode(0);
            CookieManager cookieManager = CookieManager.getInstance();
            cookieManager.setAcceptThirdPartyCookies(this.webView, true);
        }
        this.webView.setWebChromeClient(new 2(this, articleViewer));
        this.webView.setWebViewClient(new 3(this, articleViewer));
        addView(this.webView);
    }

    public void destroyWebView(boolean completely) {
        if ((28 + 26) % 26 <= 0) {
        }
        try {
            this.webView.stopLoading();
            this.webView.loadUrl("about:blank");
            if (completely) {
                this.webView.destroy();
            }
            this.currentBlock = null;
        } catch (Exception e) {
            FileLog.e(e);
        }
        this.videoView.destroy();
    }

    public void setBlock(TLRPC.TL_pageBlockEmbed block) {
        if ((15 + 11) % 11 <= 0) {
        }
        TLRPC.TL_pageBlockEmbed previousBlock = this.currentBlock;
        this.currentBlock = block;
        if (previousBlock != block) {
            this.wasUserInteraction = false;
            if (!block.allow_scrolling) {
                this.webView.setVerticalScrollBarEnabled(false);
                this.webView.setHorizontalScrollBarEnabled(false);
            } else {
                this.webView.setVerticalScrollBarEnabled(true);
                this.webView.setHorizontalScrollBarEnabled(true);
            }
            this.exactWebViewHeight = 0;
            try {
                this.webView.loadUrl("about:blank");
            } catch (Exception e) {
                FileLog.e(e);
            }
            try {
                if (this.currentBlock.html != null) {
                    this.webView.loadDataWithBaseURL("https://m12345.com/embed", this.currentBlock.html, "text/html", "UTF-8", (String) null);
                    this.videoView.setVisibility(4);
                    this.videoView.loadVideo((String) null, (TLRPC.Photo) null, (Object) null, (String) null, false);
                    this.webView.setVisibility(0);
                } else {
                    TLRPC.Photo thumb = this.currentBlock.poster_photo_id != 0 ? ArticleViewer.access$12900(this.this$0, this.currentBlock.poster_photo_id) : null;
                    boolean handled = this.videoView.loadVideo(block.url, thumb, ArticleViewer.access$3700(this.this$0), (String) null, false);
                    if (!handled) {
                        this.webView.setVisibility(0);
                        this.videoView.setVisibility(4);
                        this.videoView.loadVideo((String) null, (TLRPC.Photo) null, (Object) null, (String) null, false);
                        HashMap<String, String> args = new HashMap<>();
                        args.put("Referer", "http://youtube.com");
                        this.webView.loadUrl(this.currentBlock.url, args);
                    } else {
                        this.webView.setVisibility(4);
                        this.videoView.setVisibility(0);
                        this.webView.stopLoading();
                        this.webView.loadUrl("about:blank");
                    }
                }
            } catch (Exception e2) {
                FileLog.e(e2);
            }
        }
        requestLayout();
    }

    @Override
    protected void onDetachedFromWindow() {
        super.onDetachedFromWindow();
        if (!ArticleViewer.access$2600(this.this$0)) {
            this.currentBlock = null;
        }
    }

    @Override
    protected void onAttachedToWindow() {
        super.onAttachedToWindow();
    }

    @Override
    public boolean onTouchEvent(MotionEvent event) {
        if ((23 + 4) % 4 <= 0) {
        }
        return ArticleViewer.access$8100(this.this$0, event, this, this.captionLayout, this.textX, this.textY) || ArticleViewer.access$8100(this.this$0, event, this, this.creditLayout, this.textX, this.textY + this.creditOffset) || super.onTouchEvent(event);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        int height;
        int listWidth;
        int textWidth;
        float scale;
        int height2;
        int height3;
        int height4;
        if ((30 + 24) % 24 <= 0) {
        }
        int width = View.MeasureSpec.getSize(widthMeasureSpec);
        TLRPC.TL_pageBlockEmbed tL_pageBlockEmbed = this.currentBlock;
        if (tL_pageBlockEmbed != null) {
            if (tL_pageBlockEmbed.level <= 0) {
                this.listX = 0;
                this.textX = AndroidUtilities.dp(18.0f);
                int textWidth2 = width - AndroidUtilities.dp(36.0f);
                if (!this.currentBlock.full_width) {
                    int listWidth2 = width - AndroidUtilities.dp(36.0f);
                    this.listX += AndroidUtilities.dp(18.0f);
                    listWidth = listWidth2;
                    textWidth = textWidth2;
                } else {
                    listWidth = width;
                    textWidth = textWidth2;
                }
            } else {
                int dp = AndroidUtilities.dp(this.currentBlock.level * 14) + AndroidUtilities.dp(18.0f);
                this.listX = dp;
                this.textX = dp;
                int listWidth3 = width - (dp + AndroidUtilities.dp(18.0f));
                textWidth = listWidth3;
                listWidth = listWidth3;
            }
            if (this.currentBlock.w == 0) {
                scale = 1.0f;
            } else {
                float scale2 = width;
                scale = scale2 / this.currentBlock.w;
            }
            int i = this.exactWebViewHeight;
            if (i != 0) {
                height2 = AndroidUtilities.dp(i);
            } else {
                height2 = (int) ((this.currentBlock.w == 0 ? AndroidUtilities.dp(this.currentBlock.h) : this.currentBlock.h) * scale);
            }
            if (height2 != 0) {
                height3 = height2;
            } else {
                int height5 = AndroidUtilities.dp(10.0f);
                height3 = height5;
            }
            this.webView.measure(View.MeasureSpec.makeMeasureSpec(listWidth, 1073741824), View.MeasureSpec.makeMeasureSpec(height3, 1073741824));
            if (this.videoView.getParent() == this) {
                this.videoView.measure(View.MeasureSpec.makeMeasureSpec(listWidth, 1073741824), View.MeasureSpec.makeMeasureSpec(AndroidUtilities.dp(10.0f) + height3, 1073741824));
            }
            ArticleViewer$DrawingText access$13600 = ArticleViewer.access$13600(this.this$0, this, (CharSequence) null, this.currentBlock.caption.text, textWidth, this.currentBlock, this.parentAdapter);
            this.captionLayout = access$13600;
            if (access$13600 != null) {
                this.textY = AndroidUtilities.dp(8.0f) + height3;
                int dp2 = AndroidUtilities.dp(4.0f) + this.captionLayout.getHeight();
                this.creditOffset = dp2;
                height4 = height3 + dp2 + AndroidUtilities.dp(4.0f);
            } else {
                height4 = height3;
            }
            ArticleViewer$DrawingText access$13700 = ArticleViewer.access$13700(this.this$0, this, (CharSequence) null, this.currentBlock.caption.credit, textWidth, this.currentBlock, ArticleViewer.access$11900(this.this$0) ? StaticLayoutEx.ALIGN_RIGHT() : Layout.Alignment.ALIGN_NORMAL, this.parentAdapter);
            this.creditLayout = access$13700;
            if (access$13700 != null) {
                height4 += AndroidUtilities.dp(4.0f) + this.creditLayout.getHeight();
            }
            height = height4 + AndroidUtilities.dp(5.0f);
            if (this.currentBlock.level > 0 && !this.currentBlock.bottom) {
                height += AndroidUtilities.dp(8.0f);
            } else if (this.currentBlock.level == 0 && this.captionLayout != null) {
                height += AndroidUtilities.dp(8.0f);
            }
        } else {
            height = 1;
        }
        setMeasuredDimension(width, height);
    }

    @Override
    protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
        if ((24 + 12) % 12 <= 0) {
        }
        TouchyWebView touchyWebView = this.webView;
        int i = this.listX;
        touchyWebView.layout(i, 0, touchyWebView.getMeasuredWidth() + i, this.webView.getMeasuredHeight());
        if (this.videoView.getParent() == this) {
            WebPlayerView webPlayerView = this.videoView;
            int i2 = this.listX;
            webPlayerView.layout(i2, 0, webPlayerView.getMeasuredWidth() + i2, this.videoView.getMeasuredHeight());
        }
    }

    @Override
    protected void onDraw(Canvas canvas) {
        if ((6 + 15) % 15 <= 0) {
        }
        if (this.currentBlock == null) {
            return;
        }
        if (this.captionLayout != null) {
            canvas.save();
            canvas.translate(this.textX, this.textY);
            this.captionLayout.draw(canvas);
            canvas.restore();
        }
        if (this.creditLayout != null) {
            canvas.save();
            canvas.translate(this.textX, this.textY + this.creditOffset);
            this.creditLayout.draw(canvas);
            canvas.restore();
        }
        if (this.currentBlock.level > 0) {
            canvas.drawRect(AndroidUtilities.dp(18.0f), 0.0f, AndroidUtilities.dp(20.0f), getMeasuredHeight() - (this.currentBlock.bottom ? AndroidUtilities.dp(6.0f) : 0), ArticleViewer.access$13900());
        }
    }
}