Phones and Apps
NulledBB Android App | Simple, No ads from App! | APK DOWNLOAD FREE! (:
Submitted by Weytaan, 06-10-2015, 12:03 AM, Thread ID: 10934
Thread Closed
RE: NulledBB Android App | Simple, No ads from App! | APK DOWNLOAD FREE! (:
06-10-2015, 08:43 PM
#7 Guys you are just being paranoid.
Source is clean:
Source is clean:
Code:
package com.wNulledBBForum;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Bundle;
import android.os.CountDownTimer;
import android.os.Handler;
import android.view.View;
import android.view.Window;
import android.webkit.CookieSyncManager;
import android.webkit.DownloadListener;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import android.widget.ImageButton;
import android.widget.TextView;
import com.wNulledBBForum.Server.StatController;
import java.util.HashMap;
import java.util.List;
public class BrowserActivity extends Activity
{
class DetectJSInterface
{
public static final String NAME = "HtmlViewer";
final BrowserActivity this$0;
public void detectHTML(String s)
{
String s1;
if (s != null && s.length() >= 40)
{
s1 = "click_finish_html";
} else
{
s1 = "click_finish_epmty_html";
}
if (_isFullScreenBanner)
{
HashMap hashmap = new HashMap();
hashmap.put("details", _trimSubstring(s, 1000));
StatController.getInstance().sendRequestAsyncByKey(s1, hashmap);
}
}
DetectJSInterface()
{
this$0 = BrowserActivity.this;
super();
}
}
public static final String BANNER_TYPE_FULLSCREEN = "banner_type_fullscreen";
public static final String BANNER_TYPE_SMALL = "banner_type_small";
private static final int HTML_SUBSTRING_LENGTH = 1000;
public static final String KEY_BANNER_TYPE = "banner_type";
public static final String KEY_BROWSER_URL = "browser_url";
public static final String KEY_TIMER_DURATION = "timer_duration";
private static final int MIN_HTML_ALLOWED_LENGTH = 40;
private static final int REDIRECT_FINISH_TIMEOUT = 1000;
private Handler _handler;
private boolean _isFullScreenBanner;
private long _timerDuration;
private long _timerStep;
boolean _toShowTimer;
ImageButton mBackButton;
ImageButton mCloseButton;
ImageButton mForwardButton;
private Runnable mHtmlCheckRunnable;
ImageButton mRefreshButton;
TextView mTimer;
WebView mWebView;
public BrowserActivity()
{
_timerStep = 1000L;
_timerDuration = -1L;
_isFullScreenBanner = false;
_toShowTimer = false;
_handler = new Handler();
mHtmlCheckRunnable = new Runnable() {
final BrowserActivity this$0;
public void run()
{
if (mWebView != null)
{
mWebView.loadUrl("javascript:window.HtmlViewer.detectHTML(document.documentElement.innerHTML);");
}
}
{
this$0 = BrowserActivity.this;
super();
}
};
}
private void _initButtons()
{
mCloseButton = (ImageButton)findViewById(0x7f070011);
mBackButton = (ImageButton)findViewById(0x7f07000e);
mForwardButton = (ImageButton)findViewById(0x7f07000f);
mRefreshButton = (ImageButton)findViewById(0x7f070010);
mTimer = (TextView)findViewById(0x7f070012);
mCloseButton.setOnClickListener(new android.view.View.OnClickListener() {
final BrowserActivity this$0;
public void onClick(View view)
{
if (_isFullScreenBanner)
{
view = new HashMap();
view.put("url", mWebView.getUrl());
StatController.getInstance().sendRequestAsyncByKey("click_cross_mini_browser", view);
}
finish();
}
{
this$0 = BrowserActivity.this;
super();
}
});
mBackButton.setOnClickListener(new android.view.View.OnClickListener() {
final BrowserActivity this$0;
public void onClick(View view)
{
if (mWebView.canGoBack())
{
mWebView.goBack();
}
}
{
this$0 = BrowserActivity.this;
super();
}
});
mForwardButton.setOnClickListener(new android.view.View.OnClickListener() {
final BrowserActivity this$0;
public void onClick(View view)
{
if (mWebView.canGoForward())
{
mWebView.goForward();
}
}
{
this$0 = BrowserActivity.this;
super();
}
});
mRefreshButton.setOnClickListener(new android.view.View.OnClickListener() {
final BrowserActivity this$0;
public void onClick(View view)
{
mWebView.reload();
}
{
this$0 = BrowserActivity.this;
super();
}
});
}
private static boolean _isHttpUrl(String s)
{
s = Uri.parse(s).getScheme();
return s.equals("http") || s.equals("https");
}
private static boolean _isMarketUrl(String s)
{
s = Uri.parse(s);
String s1 = s.getHost();
return s.getScheme().equals("market") || s1 != null && s1.equals("play.google.com");
}
private static String _replaceHttpWithMarketUrl(String s)
{
if (!_isMarketUrl(s))
{
return s;
} else
{
s = Uri.parse(s);
return (new StringBuilder()).append("market://details?").append(s.getEncodedQuery()).toString();
}
}
private void _showClose()
{
mTimer.setVisibility(8);
mCloseButton.setVisibility(0);
}
private void _showTimer()
{
mTimer.setVisibility(0);
mCloseButton.setVisibility(8);
}
private void _startTimer()
{
(new CountDownTimer(_timerDuration, _timerStep) {
final BrowserActivity this$0;
public void onFinish()
{
_showClose();
}
public void onTick(long l)
{
mTimer.setText(String.valueOf(l / _timerStep));
}
{
this$0 = BrowserActivity.this;
super(l, l1);
}
}).start();
}
private String _trimSubstring(String s, int i)
{
if (s == null)
{
return null;
}
int j = i;
if (i > s.length())
{
j = s.length();
}
return s.substring(0, j - 1);
}
public static boolean deviceCanHandleIntent(Context context, Intent intent)
{
boolean flag = false;
boolean flag1;
try
{
flag1 = context.getPackageManager().queryIntentActivities(intent, 0).isEmpty();
}
// Misplaced declaration of an exception variable
catch (Context context)
{
return false;
}
if (!flag1)
{
flag = true;
}
return flag;
}
private void enableCookies()
{
CookieSyncManager.createInstance(this);
CookieSyncManager.getInstance().startSync();
}
public void onBackPressed()
{
}
protected void onCreate(Bundle bundle)
{
super.onCreate(bundle);
enableCookies();
bundle = getIntent();
String s = bundle.getStringExtra("browser_url");
_isFullScreenBanner = bundle.getStringExtra("banner_type").equals("banner_type_fullscreen");
_timerDuration = bundle.getLongExtra("timer_duration", -1L);
requestWindowFeature(2);
getWindow().setFeatureInt(2, -1);
getWindow().setFlags(1024, 1024);
setContentView(0x7f030002);
mWebView = (WebView)findViewById(0x7f070013);
mWebView.resumeTimers();
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.addJavascriptInterface(new DetectJSInterface(), "HtmlViewer");
mWebView.setWebViewClient(new WebViewClient() {
final BrowserActivity this$0;
private boolean _handleRedirect(String s1)
{
_handler.removeCallbacksAndMessages(null);
if (s1 != null)
{
boolean flag = BrowserActivity._isHttpUrl(s1);
boolean flag1 = BrowserActivity._isMarketUrl(s1);
Object obj = s1;
if (flag1)
{
obj = s1;
if (flag)
{
obj = BrowserActivity._replaceHttpWithMarketUrl(s1);
}
}
if (flag1 || !flag)
{
s1 = new HashMap();
s1.put("url", obj);
obj = new Intent("android.intent.action.VIEW", Uri.parse(((String) (obj))));
if (BrowserActivity.deviceCanHandleIntent(BrowserActivity.this, ((Intent) (obj))))
{
startActivity(((Intent) (obj)));
if (_isFullScreenBanner)
{
StatController.getInstance().sendRequestAsyncByKey("click_finish_market", s1);
}
finish();
return true;
}
if (_isFullScreenBanner)
{
StatController.getInstance().sendRequestAsyncByKey("click_no_market_on_device", s1);
return false;
}
}
}
return false;
}
public void onPageFinished(WebView webview, String s1)
{
if (BrowserActivity._isMarketUrl(s1) || !BrowserActivity._isHttpUrl(s1))
{
return;
} else
{
_handler.postDelayed(mHtmlCheckRunnable, 1000L);
super.onPageFinished(webview, s1);
return;
}
}
public void onPageStarted(WebView webview, String s1, Bitmap bitmap)
{
_handleRedirect(s1);
super.onPageStarted(webview, s1, bitmap);
}
public void onReceivedError(WebView webview, int i, String s1, String s2)
{
if (_isFullScreenBanner)
{
HashMap hashmap = new HashMap();
hashmap.put("details", _trimSubstring((new StringBuilder()).append(Integer.toString(i)).append(" : ").append(s1).toString(), 1000));
hashmap.put("url", s2);
StatController.getInstance().sendRequestAsyncByKey("click_loading_error", hashmap);
}
super.onReceivedError(webview, i, s1, s2);
}
public boolean shouldOverrideUrlLoading(WebView webview, String s1)
{
return _handleRedirect(s1);
}
{
this$0 = BrowserActivity.this;
super();
}
});
mWebView.setWebChromeClient(new WebChromeClient() {
final BrowserActivity this$0;
public void onProgressChanged(WebView webview, int i)
{
setTitle("Loading...");
setProgress(i * 100);
if (i == 100)
{
setTitle(webview.getUrl());
}
}
{
this$0 = BrowserActivity.this;
super();
}
});
mWebView.setDownloadListener(new DownloadListener() {
final BrowserActivity this$0;
public void onDownloadStart(String s1, String s2, String s3, String s4, long l)
{
s3 = new Intent("android.intent.action.VIEW", Uri.parse(s1));
s4 = getPackageManager().resolveActivity(s3, 0);
s2 = "click_can_not_start_download";
if (s4 != null)
{
startActivity(s3);
s2 = "click_finish_download";
}
if (_isFullScreenBanner)
{
s3 = new HashMap();
s3.put("url", s1);
StatController.getInstance().sendRequestAsyncByKey(s2, s3);
}
}
{
this$0 = BrowserActivity.this;
super();
}
});
_initButtons();
if (_timerDuration > 0L)
{
_showTimer();
_startTimer();
} else
{
_showClose();
}
mWebView.loadUrl(s);
}
protected void onDestroy()
{
super.onDestroy();
mWebView.destroy();
mWebView = null;
}
protected void onPause()
{
super.onPause();
CookieSyncManager.getInstance().stopSync();
}
protected void onResume()
{
super.onResume();
mWebView.resumeTimers();
CookieSyncManager.getInstance().startSync();
}
}
Users browsing this thread: 4 Guest(s)