导航菜单

页面标题

页面副标题

St.John's v1.0.9 - DetailGuestNotifications.java 源代码

正在查看: St.John's v1.0.9 应用的 DetailGuestNotifications.java JAVA 源代码文件

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


package com.mcb.stjohnsemschool.activity;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Message;
import android.util.Base64;
import android.view.MenuItem;
import android.view.View;
import android.webkit.WebChromeClient;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.exoplayer2.C;
import com.squareup.picasso.Picasso;
import java.io.UnsupportedEncodingException;

public class DetailGuestNotifications extends AppCompatActivity {
    String dateStr;
    private ImageView filePahImg;
    String filePath;
    String link;
    private TextView linkTv;
    private WebView linkWv;
    private TextView mDate;
    String notificationMsg;
    private WebView notificationWv;
    String subjectTitle = "";
    private TextView subjectTv;

    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        setContentView(R.layout.activity_detail_guest_notifications);
        this.mDate = (TextView) findViewById(R.id.date_tv);
        this.filePahImg = (ImageView) findViewById(2131362628);
        this.linkTv = (TextView) findViewById(R.id.link_tv);
        this.subjectTv = (TextView) findViewById(R.id.txv_subject);
        this.notificationWv = (WebView) findViewById(R.id.notificationmsg);
        getSupportActionBar().setTitle("Notification Details");
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        this.dateStr = getIntent().getStringExtra("Date");
        this.filePath = getIntent().getStringExtra("FilePath");
        this.link = getIntent().getStringExtra("Link");
        this.notificationMsg = getIntent().getStringExtra("NotificationMessage");
        String stringExtra = getIntent().getStringExtra("Subject");
        this.subjectTitle = stringExtra;
        if (stringExtra != null && stringExtra.length() > 0) {
            this.subjectTv.setText(this.subjectTitle);
        } else {
            this.subjectTv.setText("");
        }
        this.filePahImg.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent(DetailGuestNotifications.this.getApplicationContext(), (Class<?>) ViewFileFromUrlActivity.class);
                intent.putExtra("Title", DetailGuestNotifications.this.subjectTitle);
                intent.putExtra("URL", DetailGuestNotifications.this.filePath);
                DetailGuestNotifications.this.startActivity(intent);
            }
        });
        this.notificationWv.getSettings().setJavaScriptEnabled(true);
        this.notificationWv.getSettings().setDefaultFontSize(16);
        this.notificationWv.setHorizontalScrollBarEnabled(false);
        this.notificationWv.setVerticalScrollBarEnabled(false);
        this.notificationWv.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
        this.notificationWv.getSettings().setSupportMultipleWindows(true);
        this.notificationWv.setWebChromeClient(new WebChromeClient() {
            @Override
            public boolean onCreateWindow(WebView webView, boolean z, boolean z2, Message message) {
                webView.getContext().startActivity(new Intent("android.intent.action.VIEW", Uri.parse(webView.getHitTestResult().getExtra())));
                return false;
            }
        });
        this.notificationWv.setWebViewClient(new WebViewClient() {
            @Override
            public boolean shouldOverrideUrlLoading(WebView webView, String str) {
                try {
                    DetailGuestNotifications.this.startActivity(new Intent("android.intent.action.VIEW", Uri.parse(str)));
                    return true;
                } catch (Exception e) {
                    e.printStackTrace();
                    return true;
                }
            }
        });
        this.linkTv.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent = new Intent("android.intent.action.VIEW", Uri.parse(DetailGuestNotifications.this.link));
                intent.addFlags(268435456);
                DetailGuestNotifications.this.startActivity(intent);
            }
        });
        String str = this.dateStr;
        if (str != null && str.length() > 0) {
            this.mDate.setText(this.dateStr);
        }
        String str2 = this.filePath;
        if (str2 != null && str2.length() > 0) {
            this.filePahImg.setVisibility(0);
            Picasso.get().load(this.filePath).into(this.filePahImg);
        } else {
            this.filePahImg.setVisibility(8);
        }
        String str3 = this.link;
        if (str3 != null && str3.length() > 0) {
            this.linkTv.setText(this.link);
        }
        String str4 = this.notificationMsg;
        if (str4 == null || str4.length() <= 0) {
            return;
        }
        try {
            this.notificationWv.loadData(Base64.encodeToString(this.notificationMsg.getBytes(C.UTF8_NAME), 0), "text/html; charset=utf-8", "base64");
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
    }

    public boolean onOptionsItemSelected(MenuItem menuItem) {
        if (menuItem.getItemId() == 16908332) {
            finish();
        }
        return super.onOptionsItemSelected(menuItem);
    }
}