@Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    ButterKnife.bind(this);
    mContext = this;
    mUrl = getIntent().getStringExtra(EXTRA_URL);
    mTitle = getIntent().getStringExtra(EXTRA_TITLE);

    WebSettings settings = mWebView.getSettings();
    settings.setJavaScriptEnabled(true);
    settings.setLoadWithOverviewMode(true);
    settings.setAppCacheEnabled(true);
    settings.setLayoutAlgorithm(WebSettings.LayoutAlgorithm.SINGLE_COLUMN);
    settings.setSupportZoom(true);
    mWebView.setWebChromeClient(new ChromeClient());
    mWebView.setWebViewClient(new LoveClient());

    mWebView.loadUrl(mUrl);

    mTextSwitcher.setFactory(
        () -> {
          TextView textView = new TextView(this);
          textView.setTextAppearance(this, R.style.WebTitle);
          textView.setSingleLine(true);
          textView.setEllipsize(TextUtils.TruncateAt.MARQUEE);
          textView.postDelayed(() -> textView.setSelected(true), 1738);
          return textView;
        });
    mTextSwitcher.setInAnimation(this, android.R.anim.fade_in);
    mTextSwitcher.setOutAnimation(this, android.R.anim.fade_out);
    if (mTitle != null) setTitle(mTitle);
  }
Example #2
0
  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    parseIntent();

    // init image view
    mImageView = (ImageView) findViewById(R.id.picture);
    ViewCompat.setTransitionName(mImageView, TRANSIT_PIC);
    Picasso.with(this).load(mImageUrl).into(mImageView);

    // set up app bar
    setAppBarAlpha(0.7f);
    setTitle(mImageTitle);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) actionBar.setDisplayHomeAsUpEnabled(true);

    setUpPhotoAttacher();
  }
 @Override
 protected void onResume() {
   super.onResume();
   if (mWebView != null) mWebView.onResume();
   MobclickAgent.onResume(this);
 }
 @Override
 protected void onPause() {
   if (mWebView != null) mWebView.onPause();
   super.onPause();
   MobclickAgent.onPause(this);
 }
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (mWebView != null) mWebView.destroy();
   ButterKnife.unbind(this);
 }
 @Override
 public void setTitle(CharSequence title) {
   super.setTitle(title);
   mTextSwitcher.setText(title);
 }
Example #7
0
 @Override
 public void onPause() {
   super.onPause();
   MobclickAgent.onPause(this);
 }
Example #8
0
 @Override
 public void onResume() {
   super.onResume();
   MobclickAgent.onResume(this);
 }