コード例 #1
0
 @Override
 public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
   int baseColor = color;
   float alpha = Math.min(1, (float) scrollY / mParallaxImageHeight);
   mToolbarView.setBackgroundColor(ScrollUtils.getColorWithAlpha(alpha, baseColor));
   ViewHelper.setTranslationY(banner, scrollY / 2);
 }
コード例 #2
0
  private void initialize() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar_actionbar);
    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowTitleEnabled(false);

    mToolbarView = findViewById(R.id.toolbar_actionbar);

    // Setup RecyclerView inside drawer
    final TypedValue typedValue = new TypedValue();
    getTheme().resolveAttribute(R.attr.colorPrimary, typedValue, true);
    color = typedValue.data;

    mToolbarView.setBackgroundColor(ScrollUtils.getColorWithAlpha(0, color));
    mScrollView = (ObservableScrollView) findViewById(R.id.scroll);
    mScrollView.addScrollViewCallbacks(this);

    mParallaxImageHeight = getResources().getDimensionPixelSize(R.dimen.parallax_image_height);

    banner = (ImageView) findViewById(R.id.banner);
    displayMainString = (TextView) findViewById(R.id.tv_albumname);
    displayFirstSubString = (TextView) findViewById(R.id.tv_title_frst);
    displaySecondSubString = (TextView) findViewById(R.id.tv_title_sec);
    songsList = (ExpandableHeightListView) findViewById(R.id.listView_songs);
    mSongsListAdapter = new AllSongsListAdapter(context);

    songsList.setAdapter(mSongsListAdapter);

    options =
        new DisplayImageOptions.Builder()
            .showImageOnLoading(R.drawable.bg_default_album_art)
            .showImageForEmptyUri(R.drawable.bg_default_album_art)
            .showImageOnFail(R.drawable.bg_default_album_art)
            .cacheInMemory(true)
            .cacheOnDisk(true)
            .considerExifParams(true)
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();

    try {
      fab_button = (ImageView) findViewById(R.id.fab_button);
      fab_button.setColorFilter(color);
      fab_button.setImageAlpha(255);
    } catch (Exception e) {
      e.printStackTrace();
    }

    setupVkMusicHelper();
  }