Drawable setLevel - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Drawable setLevel method.

This code example shows how to use the following methods:setBounds, setLevel, draw, setDither
			int col = Color.HSVToColor(hsv);
 
			int colors[] = new int[2];
			colors[0] = col;
			colors[1] = 0xFF000000;
			GradientDrawable gradDraw = new GradientDrawable(Orientation.TOP_BOTTOM, colors);
			gradDraw.setDither(true);
			gradDraw.setLevel(10000);
			gradDraw.setBounds(0, 0, SLIDER_THICKNESS, PALETTE_DIM);
			gradDraw.draw(mVerSliderCv);
		} 
 
		/** 
		 * Report the correct tightly bounded dimensions of the view. 
		 */ 
		@Override 
		protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
			setMeasuredDimension(VIEW_DIM_X, VIEW_DIM_Y);
		} 
 
7
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:draw, setBounds, setLevel
        @Override 
        protected void onDraw(Canvas canvas) {
            super.onDraw(canvas);
 
            canvas.translate(100, 100);
            mDrawable1.setBounds(0, 0, 33, 120);
            mDrawable1.setLevel(5000);
            mDrawable1.draw(canvas);
 
            canvas.translate(20, 0);
            mDrawable2.setBounds(0, 0, 33, 120);
            mDrawable2.setLevel(5000);
            mDrawable2.draw(canvas);
 
            canvas.translate(20, 0);
            mDrawable3.setBounds(0, 0, 33, 120);
            mDrawable3.draw(canvas);            
        } 
    } 
} 
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setLevel
        mWindowManager.updateViewLayout(mDragView, mWindowParams);
 
        if (mTrashcan != null) {
            int width = mDragView.getWidth();
            if (y > getHeight() * 3 / 4) {
                mTrashcan.setLevel(2);
            } else if (width > 0 && x > width / 4) {
                mTrashcan.setLevel(1);
            } else { 
                mTrashcan.setLevel(0);
            } 
        } 
    } 
     
    private void stopDragging() { 
        if (mDragView != null) {
            mDragView.setVisibility(GONE);
            WindowManager wm = (WindowManager)getContext().getSystemService(Context.WINDOW_SERVICE);
            wm.removeView(mDragView);
            mDragView.setImageDrawable(null);
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setAlpha, setBounds, setColorFilter, setDither, setLevel
        final long now = SystemClock.uptimeMillis();
        boolean animating = false;
        if (mCurrDrawable != null) {
            if (mEnterAnimationEnd != 0) {
                if (mEnterAnimationEnd <= now) {
                    mCurrDrawable.setAlpha(mAlpha);
                    mEnterAnimationEnd = 0;
                } else { 
                    int animAlpha = (int) ((mEnterAnimationEnd - now) * 255)
                            / mDrawableContainerState.mEnterFadeDuration;
                    mCurrDrawable.setAlpha((255 - animAlpha) * mAlpha / 255);
                    animating = true;
                } 
            } 
        } else { 
            mEnterAnimationEnd = 0;
        } 
        if (mLastDrawable != null) {
            if (mExitAnimationEnd != 0) {
                if (mExitAnimationEnd <= now) {

6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setLevel
//				Log.d(TAG, "onLevelChange scheduleSelf --"); 
				mDelta = -1;
				mAnimation.startScrolling(mTextXScale, 0);
				scheduleSelf(this, SystemClock.uptimeMillis() + DELAY);
			} 
			return mProgress.setLevel(level);
		} 
		 
		@Override 
		public void draw(Canvas canvas) {
			mProgress.draw(canvas);
 
			if (mAnimation.hasStarted() && !mAnimation.hasEnded()) {
				// pending animation 
				mAnimation.getTransformation(AnimationUtils.currentAnimationTimeMillis(), null);
				mTextXScale = mAnimation.getCurrent();
//				Log.d(TAG, "draw " + mTextX + " " + SystemClock.uptimeMillis()); 
			} 
			 
			Rect bounds = getBounds();
6
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setLevel
    } 
 
    @Override 
    public void setBackgroundDrawable(Drawable drawable) {
        if (getBackground() == null || drawable == null) {
            super.setBackgroundDrawable(drawable);
            return; 
        } 
 
        int[] padding =  new int[] { getPaddingLeft(),
                                     getPaddingTop(), 
                                     getPaddingRight(), 
                                     getPaddingBottom() 
                                   }; 
        drawable.setLevel(getBackground().getLevel());
        super.setBackgroundDrawable(drawable);
 
        setPadding(padding[0], padding[1], padding[2], padding[3]);
    } 
 
    @Override 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setBounds, setLevel, draw, setDither
			int col = Color.HSVToColor(hsv);
 
			int colors[] = new int[2];
			colors[0] = col;
			colors[1] = 0xFF000000;
			GradientDrawable gradDraw = new GradientDrawable(Orientation.TOP_BOTTOM, colors);
			gradDraw.setDither(true);
			gradDraw.setLevel(10000);
			gradDraw.setBounds(0, 0, SLIDER_THICKNESS, PALETTE_DIM);
			gradDraw.draw(mVerSliderCv);
		} 
 
		/** 
		 * Report the correct tightly bounded dimensions of the view. 
		 */ 
		@Override 
		protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
			setMeasuredDimension(VIEW_DIM_X, VIEW_DIM_Y);
		} 
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setBounds, setLevel, draw, setDither
			int col = Color.HSVToColor(hsv);
 
			int colors[] = new int[2];
			colors[0] = col;
			colors[1] = 0xFF000000;
			GradientDrawable gradDraw = new GradientDrawable(Orientation.TOP_BOTTOM, colors);
			gradDraw.setDither(true);
			gradDraw.setLevel(10000);
			gradDraw.setBounds(0, 0, SLIDER_THICKNESS, PALETTE_DIM);
			gradDraw.draw(mVerSliderCv);
		} 
 
		/** 
		 * Report the correct tightly bounded dimensions of the view. 
		 */ 
		@Override 
		protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
			setMeasuredDimension(VIEW_DIM_X, VIEW_DIM_Y);
		} 
 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setLevel
    } 
 
    @Override 
    protected boolean onLevelChange(int level) {
        if (mCurrDrawable != null) {
            return mCurrDrawable.setLevel(level);
        } 
        return false; 
    } 
	public int[] getState() { 
		return mCurrDrawable.getState();
	} 
 
	public Drawable getCurrent() {
		return mCurrDrawable;
	} 
 
	public boolean setVisible(boolean visible, boolean restart) {
		return mCurrDrawable.setVisible(visible, restart);
	} 
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods:setLevel
	 * Permette di visualizzare il contenuto della barra data la x selezionata 
	 */ 
	private void manageXValue(float xValue) {
		// Facciamo la proporzione per calcolare il livello associato 
		int level = (int) (10000 * xValue) / getWidth();
		barDrawable.setLevel(level);
		// Calcoliamo il nuovo valore selezionato 
		int oldValue = selectedValue;
		selectedValue = (int) ((maxValue - minValue) * xValue) / getWidth();
		// Notifichiamo l'evento se il valore è cambiato 
		if (selectedValue != oldValue) {
			dispatchOnInputTouchEvent(); 
		} 
	} 
 
} 
3
CodeRank
Experience pair programming with AI  Get Codota for Java

Related Drawable setLevel Questions & Answers:

setLevel Method Overview
Specify the level for the drawable.
See Code Examples for other Android Drawable Methods: