Android ClipDrawable - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ClipDrawable class.

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(); 
		} 
	} 
 
} 
Full Snippet Info
3
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: setLevel
		 
		ClipDrawable drawable = (ClipDrawable) progressDrawableImageView.getBackground();
		double percent = (double) progress / (double) max;
		int level = (int) Math.floor(percent * 10000);
		 
		drawable.setLevel(level);
	} 
	 
	private void init(Context context, AttributeSet attrs) {
		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		inflater.inflate(R.layout.round_progress, this);
		 
		setup(context, attrs);
	} 
	 
	private void setup(Context context, AttributeSet attrs) {
		TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.RoundProgress);
		 
		final String xmlns = "http://schemas.android.com/apk/res/com.nhn.android.band";
		int bgResource = attrs.getAttributeResourceValue(xmlns, "progressDrawable", 0);
Full Snippet Info
4
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: setLevel
This code example shows how to use the following methods: setLevel
This code example shows how to use the following methods: getLevel, setLevel
		mHandler.removeCallbacks(mUpdateTimeTask);  //Remove old timer
	    mHandler.postDelayed(mUpdateTimeTask, 100); //How fast thread updated
	} 
    
   public void buttonPressed(View view){
	   drawable.setLevel(drawable.getLevel() + 1);
	   Toast.makeText(this, "button pressed", Toast.LENGTH_SHORT).show();
   } 
    
	protected void onResume(){ 
		super.onResume(); 
	} 
	 
	public void slide(View view, float fromX, float toX, float fromY, float toY, int duration){
        TranslateAnimation slide = new TranslateAnimation(
        		Animation.RELATIVE_TO_PARENT, fromX/100,
        		Animation.RELATIVE_TO_PARENT, toX/100,
        		Animation.RELATIVE_TO_PARENT, fromY/100,
        		Animation.RELATIVE_TO_PARENT, toY/100);
        slide.setDuration(duration);
Full Snippet Info
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: getLevel, setLevel
    
   private Runnable mUpdateTimeTask = new Runnable() {
		long start = SystemClock.uptimeMillis(); 
		public void run() { 
			long millis = SystemClock.uptimeMillis() - start; 
			drawable.setLevel(drawable.getLevel()  + (slideDistance/10 * slideDirection)); 
			if(( drawable.getLevel() > slideTarget && slideDirection == -1) || ( drawable.getLevel() < slideTarget && slideDirection == 1)) 
			mHandler.postAtTime(this, start + millis); 
			else  mHandler.removeCallbacks(mUpdateTimeTask); 
		} 
	}; 
	 
	public void cropSlide(int direction, int target){
		slideDirection = direction;
		slideTarget  = (int) (10000.0 - target/100.0*7500.0);
		Log.i("State", "target: " +slideTarget);
		slideOrigin = drawable.getLevel();
		slideDistance = Math.abs(slideTarget-slideOrigin);
		mHandler.removeCallbacks(mUpdateTimeTask);  //Remove old timer
	    mHandler.postDelayed(mUpdateTimeTask, 100); //How fast thread updated
Full Snippet Info
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: setLevel
This code example shows how to use the following methods: getLevel, setLevel
		//always use the .png (.jpg could cause error) 
		final Handler handler = new Handler(){
			@Override 
			public void handleMessage(Message msg) {
				if (msg.what == 0x123) {
					drawable.setLevel(drawable.getLevel() + 200);
				} 
			} 
		}; 
		 
		final Timer timer = new Timer();
		timer.schedule(new TimerTask() {
			 
			@Override 
			public void run() { 
				Message msg = new Message();
				msg.what = 0x123;
				handler.sendMessage(msg);
				if (drawable.getLevel() >= 10000) {
					timer.cancel();
Full Snippet Info
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: getLevel, setLevel
        imageView = (ImageView) this.findViewById(R.id.imageView);
    } 
     
    public void changeImage(View v){
    	ClipDrawable clipDrawable = (ClipDrawable) imageView.getDrawable();
    	clipDrawable.setLevel(clipDrawable.getLevel()+1000);
    	 
    	/* 
    	TransitionDrawable transitionDrawable = (TransitionDrawable) ((Button)v).getBackground(); 
    	transitionDrawable.startTransition(500); 
    	*/ 
    	 
    	/* 
    	LevelListDrawable levelListDrawable = (LevelListDrawable) imageView.getDrawable(); 
    	levelListDrawable.setLevel(12); 
    	*/ 
    	/* 
    	//LayerDrawable layerDrawable = (LayerDrawable) imageView.getDrawable(); 
    	LayerDrawable layerDrawable = (LayerDrawable)getResources().getDrawable(R.drawable.layerlist); 
    	Drawable drawable = getResources().getDrawable(R.drawable.icon); 
Full Snippet Info
5
CodeRank
Experience pair programming with AI  Get Codota for Java
This code example shows how to use the following methods: setLevel

Related Android ClipDrawable Questions & Answers:

See Code Examples for Android ClipDrawable Methods: