Пример #1
0
  @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);
  }
Пример #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();
  }
Пример #3
0
 @Override
 protected void onResume() {
   super.onResume();
   if (mWebView != null) mWebView.onResume();
   MobclickAgent.onResume(this);
 }
Пример #4
0
 @Override
 protected void onPause() {
   if (mWebView != null) mWebView.onPause();
   super.onPause();
   MobclickAgent.onPause(this);
 }
Пример #5
0
 @Override
 protected void onDestroy() {
   super.onDestroy();
   if (mWebView != null) mWebView.destroy();
   ButterKnife.unbind(this);
 }
Пример #6
0
 @Override
 public void setTitle(CharSequence title) {
   super.setTitle(title);
   mTextSwitcher.setText(title);
 }
Пример #7
0
 @Override
 public void onPause() {
   super.onPause();
   MobclickAgent.onPause(this);
 }
Пример #8
0
 @Override
 public void onResume() {
   super.onResume();
   MobclickAgent.onResume(this);
 }