思特奇智慧酒店云平台 v0.0.5版本的 MD5 值为:dedb172bb322639d79d7e0e26262fb5c
以下内容为反编译后的 WebViewActivity.java 源代码,内容仅作参考
package com.sitech.oncon.activity;
import android.annotation.TargetApi;
import android.app.PendingIntent;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Configuration;
import android.hardware.Sensor;
import android.hardware.SensorEvent;
import android.hardware.SensorEventListener;
import android.hardware.SensorManager;
import android.net.Uri;
import android.nfc.NfcAdapter;
import android.nfc.tech.NfcA;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.text.TextUtils;
import android.util.Patterns;
import android.view.KeyEvent;
import android.view.View;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.Toast;
import androidx.annotation.RequiresApi;
import com.sitech.core.util.Log;
import com.sitech.oncon.R;
import com.sitech.oncon.application.MyApplication;
import com.sitech.oncon.widget.TitleView;
import com.sitech.oncon.widget.webview.MyWebView;
import com.sitech.onloc.common.util.Base64;
import com.taobao.weex.common.RenderTypes;
import com.umeng.analytics.pro.am;
import defpackage.bk0;
import defpackage.vq1;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.ArrayList;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
public class WebViewActivity extends BaseActivity implements nk1 {
public static final String k0 = "keepStatusBar";
public static final String l0 = "TopLayout_BackgroundResId";
public static final String m0 = "MarginTop";
public static final String n0 = "MarginRight";
public static final String o0 = "EnterAnimResId";
public static final String p0 = "ExitAnimResId";
public static final String q0 = "0";
public static final String r0 = "1";
public static final String s0 = "1";
public static final String t0 = "0";
public static d u0 = null;
public static tj1 v0 = null;
public static final int w0 = 1002;
public static final int x0 = 1001;
public static final int y0 = 1003;
public static long z0;
public SensorManager B;
public Sensor C;
public SensorEventListener D;
public TitleView a;
public MyWebView c;
public float e0;
public float f0;
public float g0;
public LinearLayout q;
public int s;
public String t;
public NfcAdapter v;
public PendingIntent w;
public IntentFilter[] x;
public String[][] y;
public String d = "";
public String e = "";
public String f = "";
public String g = "";
public String h = "";
public String i = "";
public String j = "";
public String k = "";
public int l = 0;
public int m = 0;
public int n = -1;
public int o = -1;
public int p = -1;
public vq1 r = null;
public String u = "";
public String z = "";
public e A = new e(this);
public int h0 = 1;
public Handler i0 = new Handler();
public Runnable j0 = new c();
public class a implements vq1.c {
public a() {
}
@Override
public void a(int i) {
if (i == R.id.shareScreen_TV) {
WebViewActivity.this.c.b();
WebViewActivity.this.r.dismiss();
} else if (i == R.id.share_TV) {
if (!TextUtils.isEmpty(WebViewActivity.this.c.getCurrUrl())) {
WebViewActivity webViewActivity = WebViewActivity.this;
webViewActivity.a(webViewActivity.d, WebViewActivity.this.e, "", WebViewActivity.this.c.getCurrUrl(), WebViewActivity.this.f);
} else {
WebViewActivity webViewActivity2 = WebViewActivity.this;
Toast.makeText(webViewActivity2, webViewActivity2.getString(R.string.url_null), 0).show();
}
WebViewActivity.this.r.dismiss();
} else if (i == R.id.copy_url_TV) {
boolean matches = Patterns.WEB_URL.matcher(WebViewActivity.this.c.getCurrUrl()).matches();
if (!TextUtils.isEmpty(WebViewActivity.this.c.getCurrUrl()) && matches) {
WebViewActivity webViewActivity3 = WebViewActivity.this;
ak0.a(webViewActivity3, webViewActivity3.c.getCurrUrl());
WebViewActivity webViewActivity4 = WebViewActivity.this;
Toast.makeText(webViewActivity4, webViewActivity4.getString(R.string.copy_url_success), 1).show();
} else {
WebViewActivity webViewActivity5 = WebViewActivity.this;
Toast.makeText(webViewActivity5, webViewActivity5.getString(R.string.url_null), 0).show();
}
WebViewActivity.this.r.dismiss();
} else if (i == R.id.open_in_browser_TV) {
boolean matches2 = Patterns.WEB_URL.matcher(WebViewActivity.this.c.getCurrUrl()).matches();
if (!TextUtils.isEmpty(WebViewActivity.this.c.getCurrUrl()) && matches2) {
Intent intent = new Intent();
intent.setAction("android.intent.action.VIEW");
intent.setData(Uri.parse(WebViewActivity.this.c.getCurrUrl()));
WebViewActivity.this.startActivity(intent);
} else {
WebViewActivity webViewActivity6 = WebViewActivity.this;
Toast.makeText(webViewActivity6, webViewActivity6.getString(R.string.url_null), 0).show();
}
WebViewActivity.this.r.dismiss();
} else if (i == R.id.Report_TV) {
Intent intent2 = new Intent();
intent2.setClass(WebViewActivity.this, WebViewActivity.class);
JSONObject jSONObject = new JSONObject();
try {
jSONObject.put("type", "web");
jSONObject.put("value", WebViewActivity.this.h);
jSONObject.put(RenderTypes.RENDER_TYPE_NATIVE, WebViewActivity.this.getPackageName());
if (TextUtils.isEmpty(bf1.L().b())) {
jSONObject.put(tg1.e, kk0.k(WebViewActivity.this));
} else {
jSONObject.put(tg1.e, bf1.L().b());
}
} catch (JSONException e) {
e.printStackTrace();
}
String encodeBytes = Base64.encodeBytes(jSONObject.toString().getBytes());
intent2.putExtra("url", "http://www.myyule.com/nw/report?reportReq=" + encodeBytes);
WebViewActivity.this.startActivity(intent2);
WebViewActivity.this.r.dismiss();
}
}
}
public class b implements SensorEventListener {
public b() {
}
@Override
public void onAccuracyChanged(Sensor sensor, int i) {
}
@Override
public void onSensorChanged(SensorEvent sensorEvent) {
WebViewActivity webViewActivity = WebViewActivity.this;
float[] fArr = sensorEvent.values;
webViewActivity.e0 = fArr[0];
webViewActivity.f0 = fArr[1];
webViewActivity.g0 = fArr[2];
if (MyApplication.h().a.f1()) {
WebViewActivity webViewActivity2 = WebViewActivity.this;
webViewActivity2.i0.removeCallbacks(webViewActivity2.j0);
WebViewActivity webViewActivity3 = WebViewActivity.this;
webViewActivity3.i0.postDelayed(webViewActivity3.j0, 2000L);
}
}
}
public class c implements Runnable {
public c() {
}
@Override
public void run() {
if (System.currentTimeMillis() - WebViewActivity.z0 >= 2000) {
WebViewActivity webViewActivity = WebViewActivity.this;
webViewActivity.a(webViewActivity.e0, webViewActivity.f0, webViewActivity.g0);
}
}
}
public interface d {
void a(JSONObject jSONObject);
}
public class e extends Handler {
public WeakReference<WebViewActivity> a;
public e(WebViewActivity webViewActivity) {
this.a = new WeakReference<>(webViewActivity);
}
@Override
public void handleMessage(Message message) {
WebViewActivity webViewActivity = this.a.get();
switch (message.what) {
case 1001:
try {
webViewActivity.deleteDatabase("webview.db");
webViewActivity.deleteDatabase("webviewCache.db");
webViewActivity.c.a.clearHistory();
webViewActivity.c.a.clearCache(true);
return;
} catch (Throwable th) {
th.printStackTrace();
return;
}
case 1002:
webViewActivity.setValues();
MyWebView myWebView = webViewActivity.c;
if (myWebView != null) {
myWebView.p();
return;
}
return;
case 1003:
MyWebView myWebView2 = webViewActivity.c;
if (myWebView2 != null) {
myWebView2.a.reload();
return;
}
return;
default:
return;
}
}
}
private String imageToBase64(String str) {
?? isEmpty = TextUtils.isEmpty(str);
String str2 = null;
try {
try {
} catch (Throwable th) {
th = th;
}
} catch (IOException e2) {
e2.printStackTrace();
}
if (isEmpty != 0) {
return null;
}
try {
isEmpty = new FileInputStream(str);
try {
byte[] bArr = new byte[isEmpty.available()];
isEmpty.read(bArr);
str2 = android.util.Base64.encodeToString(bArr, 2);
isEmpty.close();
isEmpty = isEmpty;
} catch (IOException e3) {
e = e3;
e.printStackTrace();
if (isEmpty != 0) {
isEmpty.close();
isEmpty = isEmpty;
}
return str2;
}
} catch (IOException e4) {
e = e4;
isEmpty = 0;
} catch (Throwable th2) {
th = th2;
isEmpty = 0;
if (isEmpty != 0) {
try {
isEmpty.close();
} catch (IOException e5) {
e5.printStackTrace();
}
}
throw th;
}
return str2;
}
private void initView() {
if (!bk0.g1) {
setRequestedOrientation(1);
}
this.c = (MyWebView) findViewById(R.id.webview);
this.a = (TitleView) findViewById(R.id.title);
this.a.e.setEllipsize(TextUtils.TruncateAt.MARQUEE);
this.a.e.setTextSize(1, 16.0f);
v();
this.c.setTitleV(this.a);
if (bk0.A3 == bk0.d.ALL_PAGE_REFRESH) {
this.c.d();
} else {
this.c.c();
}
this.q = (LinearLayout) findViewById(R.id.topLayout);
getWindow().setFormat(-3);
}
public void setValues() {
String str;
String str2;
try {
this.t = getIntent().hasExtra("nextActivity") ? getIntent().getStringExtra("nextActivity") : "";
this.d = getIntent().hasExtra("title") ? getIntent().getStringExtra("title") : "";
this.e = getIntent().hasExtra("share_content") ? getIntent().getStringExtra("share_content") : "";
this.f = getIntent().hasExtra("share_icon") ? getIntent().getStringExtra("share_icon") : "";
this.g = getIntent().hasExtra("manageentercode") ? getIntent().getStringExtra("manageentercode") : "";
this.l = getIntent().getIntExtra(m0, 0);
this.m = getIntent().getIntExtra(n0, 0);
FrameLayout.LayoutParams layoutParams = (FrameLayout.LayoutParams) this.q.getLayoutParams();
layoutParams.topMargin = this.l;
layoutParams.rightMargin = this.m;
this.p = getIntent().getIntExtra(l0, -1);
if (this.p != -1) {
this.q.setBackgroundResource(this.p);
}
this.a.setTitle(this.d);
this.c.setAppid(getIntent().hasExtra("app_id") ? getIntent().getStringExtra("app_id") : "");
if (bk0.h.Share == bk0.Hc) {
this.a.setRightImg(R.drawable.ic_scan);
this.a.setRightImgVisible(false);
} else if (bk0.h.Close == bk0.Hc) {
this.a.setRightImg(R.drawable.ic_close_1);
} else {
this.a.setRightImgVisible(false);
}
if (getIntent().hasExtra("currUrl")) {
this.h = getIntent().getStringExtra("currUrl");
} else {
this.h = getIntent().hasExtra("url") ? getIntent().getStringExtra("url") : "";
}
this.u = getIntent().hasExtra("reloadModule") ? getIntent().getStringExtra("reloadModule") : "";
this.i = getIntent().hasExtra("transact_key") ? getIntent().getStringExtra("transact_key") : "";
if (getIntent().hasExtra("hideTitle")) {
str = getIntent().getStringExtra("hideTitle");
} else {
str = bk0.w1 ? "1" : "0";
}
this.j = str;
if (getIntent().hasExtra(k0)) {
str2 = getIntent().getStringExtra(k0);
} else {
str2 = bk0.x1 ? "1" : "0";
}
this.k = str2;
if (TextUtils.equals("1", this.k)) {
if (TextUtils.equals("1", this.j)) {
this.a.c();
} else {
this.a.a(true);
}
} else if (!TextUtils.equals("1", this.j)) {
this.a.a(false);
}
this.z = getIntent().hasExtra("from") ? getIntent().getStringExtra("from") : "";
if (TextUtils.equals(this.h, bk0.x5) && !TextUtils.isEmpty(bk0.x5)) {
this.a.setVisibility(8);
}
this.h = ve1.b(this.h, this.i, this.g);
ve1.a(this.c, this.h);
} catch (Exception e2) {
Log.a((Throwable) e2);
}
}
private void t() {
Intent b2 = sb1.b((Context) this);
a(b2);
startActivity(b2);
try {
finish();
} catch (Exception unused) {
}
}
private void u() {
setRequestedOrientation(1);
this.B = (SensorManager) getSystemService(am.ac);
this.C = this.B.getDefaultSensor(1);
this.D = new b();
this.B.registerListener(this.D, this.C, 1);
}
private void v() {
this.a.e.setMaxWidth(getWindow().getWindowManager().getDefaultDisplay().getWidth() - (getResources().getDimensionPixelSize(R.dimen.titleview_left_ic_w) * 4));
}
private void w() {
if (this.r == null) {
this.r = new vq1(this);
}
this.d = this.a.getCenterValue();
if (TextUtils.isEmpty(this.d)) {
this.d = getString(R.string.extra_share_deafult_text);
}
if (TextUtils.isEmpty(this.e)) {
this.e = getString(R.string.extra_share_deafult_text);
}
this.r.a(new a());
this.r.a(this.q);
}
@Override
public void finish() {
setRequestedOrientation(-1);
super.finish();
if ("from_conf".equals(this.z)) {
cx0.a(getBaseContext());
} else if (bk0.O9.equals(this.z)) {
u51.h().d();
}
int i = this.o;
if (i != -1) {
overridePendingTransition(0, i);
}
}
@Override
public void i() {
this.A.sendEmptyMessage(1003);
}
@Override
public void j() {
this.A.sendEmptyMessage(1002);
}
@Override
public void onActivityResult(int i, int i2, Intent intent) {
d dVar;
super.onActivityResult(i, i2, intent);
if (-1 == i2 && 10003 == i) {
em0.a(this).a(false);
em0.a(this).a(findViewById(R.id.topLayout), intent.getStringExtra("BackgroundBitmapPath"));
em0.a(this).a();
} else if (i2 == -1 && i == 10089) {
List<tq0> c2 = qq0.c();
JSONObject jSONObject = new JSONObject();
JSONArray jSONArray = new JSONArray();
if (c2 != null) {
try {
} catch (JSONException e2) {
Log.b("", e2.toString());
}
if (c2.size() > 0) {
jSONObject.put("status", "1");
for (int i3 = 0; i3 < c2.size(); i3++) {
JSONObject jSONObject2 = new JSONObject();
String str = c2.get(i3).c;
jSONObject2.put("image", imageToBase64(str));
jSONObject2.put("imageType", str.substring(str.length() - 3, str.length()));
jSONArray.put(jSONObject2);
}
jSONObject.put("images", jSONArray);
dVar = u0;
if (dVar == null) {
dVar.a(jSONObject);
return;
}
return;
}
}
jSONObject.put("status", "0");
jSONObject.put("images", jSONArray);
dVar = u0;
if (dVar == null) {
}
} else {
if (i2 == -1 && i == 10090) {
try {
String stringExtra = intent.getStringExtra(bk0.p8);
if (stringExtra == null) {
stringExtra = "";
}
String stringExtra2 = intent.getStringExtra(bk0.q8);
if (stringExtra2 == null) {
stringExtra2 = "";
}
String stringExtra3 = intent.getStringExtra(bk0.r8);
JSONObject jSONObject3 = new JSONObject();
jSONObject3.put(bk0.p8, stringExtra);
jSONObject3.put(bk0.q8, stringExtra2);
jSONObject3.put(bk0.r8, stringExtra3);
if (v0 != null) {
v0.a(jSONObject3);
return;
}
return;
} catch (JSONException e3) {
e3.printStackTrace();
return;
}
}
this.c.a(i, i2, intent);
}
}
@Override
public void onBackPressed() {
if (bk0.p2) {
this.c.t();
} else if (this.c.g.onBackPressed()) {
} else {
if (this.c.a()) {
this.c.e();
return;
}
if (!TextUtils.isEmpty(this.t)) {
try {
if (this.t.equals(LoadingActivity.k)) {
t();
} else {
Intent intent = new Intent(this, Class.forName(this.t));
if (this.t.equals(LoadingActivity.j)) {
intent.putExtra("first", true);
a(intent);
startActivity(intent);
} else {
Intent a2 = sb1.a((Context) this);
a(a2);
startActivity(a2);
}
}
} catch (Exception e2) {
String str = bk0.V5;
e2.getMessage();
}
}
finish();
}
}
@Override
public void onClick(View view) {
super.onClick(view);
int id2 = view.getId();
if (id2 == R.id.common_title_TV_left) {
onBackPressed();
} else if (id2 == R.id.common_title_TV_left2) {
finish();
} else if (id2 == R.id.common_title_TV_right) {
if (this.c.i()) {
this.c.a(this.a);
} else if (this.c.h()) {
this.c.m();
} else if (bk0.h.Share == bk0.Hc) {
w();
} else if (bk0.h.Close == bk0.Hc) {
finish();
}
} else if (id2 == R.id.common_title_TV_right2) {
if (this.c.i()) {
this.c.f();
} else if (this.c.g()) {
this.c.l();
}
}
}
@Override
public void onConfigurationChanged(Configuration configuration) {
super.onConfigurationChanged(configuration);
v();
}
@Override
public void onCreate(Bundle bundle) {
super.onCreate(bundle);
setContentView(R.layout.activity_webview);
this.n = getIntent().getIntExtra(o0, -1);
this.o = getIntent().getIntExtra(p0, -1);
int i = this.n;
if (i != -1) {
overridePendingTransition(i, 0);
}
MyApplication.h().a(bk0.Ea, this);
initView();
setValues();
if (Build.VERSION.SDK_INT < 19 || !bk0.j2) {
return;
}
r();
}
@Override
public void onDestroy() {
try {
super.onDestroy();
em0.b();
this.q.removeAllViews();
this.c.n();
} catch (Throwable th) {
th.printStackTrace();
}
qd1.j(this.h);
qd1.i(this.h);
ud1.h(this.h);
if (TextUtils.isEmpty(this.u)) {
return;
}
try {
ArrayList arrayList = new ArrayList();
arrayList.addAll(MyApplication.h().a(bk0.hb));
for (int i = 0; i < arrayList.size(); i++) {
try {
if (arrayList.get(i) != null) {
((fk1) arrayList.get(i)).a(this.u);
}
} catch (Exception unused) {
}
}
} catch (Exception unused2) {
}
}
@Override
public boolean onKeyDown(int i, KeyEvent keyEvent) {
if (this.c.onKeyDown(i, keyEvent)) {
return true;
}
return super.onKeyDown(i, keyEvent);
}
@Override
public void onPause() {
NfcAdapter nfcAdapter;
if (Build.VERSION.SDK_INT >= 19 && bk0.j2 && (nfcAdapter = this.v) != null) {
nfcAdapter.disableForegroundDispatch(this);
}
super.onPause();
if (this.C != null) {
this.B.unregisterListener(this.D);
}
}
@Override
public void onResume() {
NfcAdapter nfcAdapter;
if (Build.VERSION.SDK_INT >= 19 && bk0.j2 && (nfcAdapter = this.v) != null) {
nfcAdapter.enableForegroundDispatch(this, this.w, this.x, this.y);
}
super.onResume();
Sensor sensor = this.C;
if (sensor != null) {
this.B.registerListener(this.D, sensor, 1);
}
}
@RequiresApi(api = 19)
@TargetApi(10)
public void r() {
this.v = NfcAdapter.getDefaultAdapter(this);
this.w = PendingIntent.getActivity(this, 0, new Intent(this, WebViewActivity.class).addFlags(536870912), 0);
IntentFilter intentFilter = new IntentFilter("android.nfc.action.NDEF_DISCOVERED");
try {
intentFilter.addDataType("*/*");
intentFilter.setPriority(Integer.MAX_VALUE);
} catch (IntentFilter.MalformedMimeTypeException e2) {
Log.a(bk0.V5, "MalformedMimeTypeException", e2);
}
this.x = new IntentFilter[]{intentFilter};
this.y = new String[][]{new String[]{NfcA.class.getName()}};
}
public static void a(d dVar) {
u0 = dVar;
}
@Override
public void e() {
this.A.sendEmptyMessage(1001);
}
public static void a(tj1 tj1Var) {
v0 = tj1Var;
}
public void a(String str, String str2, String str3, String str4, String str5) {
em0.a(this).a(false);
em0.a(this).a(findViewById(R.id.topLayout), "", str, str2, str3, "", str4, str5, false, 18);
em0.a(this).a();
}
private void a(Intent intent) {
if (getIntent().hasExtra("menu_tag")) {
intent.putExtra("menu_tag", getIntent().getStringExtra("menu_tag"));
}
if (getIntent().hasExtra("encryptInfo")) {
intent.putExtra("encryptInfo", getIntent().getStringExtra("encryptInfo"));
}
yw0.b(getIntent(), intent);
}
public void a(float f, float f2, float f3) {
int i;
if (((f * f) + (f2 * f2)) * 4.0f >= f3 * f3) {
i = 90 - Math.round(((float) Math.atan2(-f2, f)) * 57.29578f);
while (i >= 360) {
i -= 360;
}
while (i < 0) {
i += 360;
}
} else {
i = -1;
}
int i2 = 1;
if (i > 45 && i < 135) {
i2 = 0;
} else if (i > 135 && i < 225) {
i2 = 9;
} else if (i > 225 && i < 315) {
i2 = 8;
}
if (i2 != this.h0) {
setRequestedOrientation(i2);
this.h0 = i2;
z0 = System.currentTimeMillis();
}
}
}