public void init(@NonNull Context argContext) { if (isInEditMode()) { return; } setMax(RANGE_MAX); setOnSeekBarChangeListener(onSeekBarChangeListener); mIsPlaying = MainActivity.sBoundPlayerService != null && MainActivity.sBoundPlayerService.isPlaying(); // FIXME mSideMargin = (int) UIUtils.convertDpToPixel(40, getContext()); // argContext.getResources().getDimensionPixelSize(R.dimen.action_bar_height); int seekbarHeight = argContext.getResources().getDimensionPixelSize(R.dimen.seekbar_thumb_size); int seebarWidth = seekbarHeight / 3 * 2; Drawable thumb = getResources().getDrawable(R.drawable.seekbar_handle); Bitmap bitmap = ((BitmapDrawable) thumb).getBitmap(); thumb = new BitmapDrawable( getResources(), Bitmap.createScaledBitmap(bitmap, seebarWidth, seekbarHeight, true)); // thumb = new BitmapDrawable(getResources(), Bitmap.createBitmap(bitmap)); setThumb(thumb); }
private static int canScrollUp(RecyclerView argRecyclerView) { int lastItemPos = ((LinearLayoutManager) argRecyclerView.getLayoutManager()) .findLastCompletelyVisibleItemPosition(); View v = (argRecyclerView.getLayoutManager()).findViewByPosition(lastItemPos); if (v == null) return -1; int[] loc = new int[2]; v.getLocationOnScreen(loc); Context context = argRecyclerView.getContext(); int screen = UIUtils.getScreenHeight(context); int navBar = UIUtils.NavigationBarHeight(context); int realloc = (int) (loc[1] + argRecyclerView.getTranslationY()); int realloc2 = loc[1] + v.getHeight(); return (realloc2 + navBar) - screen; // }
@Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); // mOverlay.setTranslationY(800); Log.d("mPaintSeekInfo", "draw with mPaintSeekInfo => " + mPaintSeekInfo); if (isInEditMode()) { return; } if (mPaintSeekInfo) { Log.d("PlayerSeekbar", "Draw seekinfo"); if (params.height == 0) { mOverlay.setVisibility(INVISIBLE); params.height = mOverlay.getHeight(); params.width = mOverlay.getWidth(); mOverlay.bringToFront(); } mBackwards.setText(mBackwardsText); mCurrent.setText(mCurrentText); mForwards.setText(mForwardText); this.getLocationOnScreen(loc); int offset = loc[1] - (int) UIUtils.convertDpToPixel(200, getContext()); // FIXME this.getHeight()*4; int translationY = (int) ((View) this.getParent()).getTranslationY(); Log.d("PlayerSeekbar", "trans => " + translationY); Log.d("PlayerSeekbar", "loc0 => " + loc[0] + " loc0 => " + loc[1]); params.setMargins(mSideMargin, offset, mSideMargin, 0); if (mOverlay != null) { mOverlay.setLayoutParams(params); mOverlay.setVisibility(VISIBLE); } } else { Log.d("PlayerSeekbar", "Remove seekinfo"); if (mOverlay != null) { mOverlay.setVisibility(GONE); } } }