正在查看: St.John's v1.0.9 应用的 LearningTopicDataActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: St.John's v1.0.9 应用的 LearningTopicDataActivity.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package com.mcb.stjohnsemschool.activity;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.SharedPreferences;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.util.Base64;
import android.view.KeyEvent;
import android.view.MenuItem;
import android.view.View;
import android.webkit.JsResult;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import androidx.appcompat.app.AppCompatActivity;
import com.google.android.exoplayer2.C;
import com.google.firebase.analytics.FirebaseAnalytics;
import com.mcb.stjohnsemschool.utils.Utility;
import java.io.UnsupportedEncodingException;
public class LearningTopicDataActivity extends AppCompatActivity {
private static final String TAG = "com.mcb.stjohnsemschool.activity.LearningTopicDataActivity";
private int chapterId;
private Context context;
private int id;
private ProgressDialog mProgress;
private SharedPreferences mSharedPref;
private WebView mWebView;
private AppCompatActivity myActivity;
private String studentEnrollmentId = "0";
private String subjectGUID = "";
private int topicId;
protected void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_learning_topic_description);
this.context = getApplicationContext();
this.myActivity = this;
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
getSupportActionBar().setDisplayShowTitleEnabled(true);
getSupportActionBar().setHomeButtonEnabled(true);
getSupportActionBar().setTitle("Note");
this.mProgress = ProgressDialog.show(this.myActivity, "", "Please wait for a moment...");
setUpIds();
}
private void setUpIds() {
SharedPreferences sharedPreferences = this.context.getSharedPreferences("", 0);
this.mSharedPref = sharedPreferences;
this.studentEnrollmentId = sharedPreferences.getString("studentEnrollmentIdKey", this.studentEnrollmentId);
Bundle extras = getIntent().getExtras();
this.subjectGUID = extras.getString("SubjectGUID", "");
this.chapterId = extras.getInt("ChapterId", 0);
this.topicId = extras.getInt("TopicId", 0);
this.id = extras.getInt("Id", 0);
String string = extras.getString("Description", "");
WebView webView = (WebView) findViewById(2131364517);
this.mWebView = webView;
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView webView2, String str) {
return false;
}
@Override
public void onPageStarted(WebView webView2, String str, Bitmap bitmap) {
super.onPageStarted(webView2, str, bitmap);
}
@Override
public void onPageFinished(WebView webView2, String str) {
if (LearningTopicDataActivity.this.mProgress.isShowing()) {
LearningTopicDataActivity.this.mProgress.dismiss();
}
}
});
this.mWebView.setWebChromeClient(new WebChromeClient() {
@Override
public boolean onJsAlert(WebView webView2, String str, String str2, JsResult jsResult) {
return super.onJsAlert(webView2, str, str2, jsResult);
}
});
this.mWebView.setOnKeyListener(new View.OnKeyListener() {
@Override
public boolean onKey(View view, int i, KeyEvent keyEvent) {
if (i != 4 || !LearningTopicDataActivity.this.mWebView.canGoBack()) {
return false;
}
LearningTopicDataActivity.this.mWebView.goBack();
return true;
}
});
WebSettings settings = this.mWebView.getSettings();
settings.setJavaScriptEnabled(true);
settings.getAllowContentAccess();
settings.setDomStorageEnabled(true);
settings.setBuiltInZoomControls(true);
settings.setDisplayZoomControls(false);
settings.setLoadWithOverviewMode(true);
settings.setUseWideViewPort(true);
settings.setDefaultFontSize(40);
settings.setDefaultTextEncodingName("utf-8");
try {
this.mWebView.loadData(Base64.encodeToString(string.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) {
super.onBackPressed();
return true;
}
return super.onOptionsItemSelected(menuItem);
}
protected void onResume() {
super.onResume();
String string = this.mSharedPref.getString("usernamekey", "");
Bundle bundle = new Bundle();
bundle.putString("user_name", string);
FirebaseAnalytics.getInstance(this).logEvent("PAGE_LEARNING_TOPIC_CONTENT", bundle);
Utility.saveNoteViewLog(this.context, this.subjectGUID, this.chapterId, this.topicId, this.id, 0);
}
protected void onDestroy() {
Utility.saveNoteViewLog(this.context, this.subjectGUID, this.chapterId, this.topicId, this.id, 1);
super.onDestroy();
}
}