Android Open Source - akrellm Ambil Warna Pref Widget View






From Project

Back to project page akrellm.

License

The source code is released under:

Copyright (c) 2012, Tim Edwards All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: ...

If you think the Android project akrellm listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package yuku.ambilwarna.widget;
//www .  j a  v  a2 s . co  m
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.util.AttributeSet;
import android.util.FloatMath;
import android.view.View;

public class AmbilWarnaPrefWidgetView extends View {
  Paint paint;
  float rectSize;
  float strokeWidth;

  public AmbilWarnaPrefWidgetView(Context context, AttributeSet attrs) {
    super(context, attrs);
    
    float density = context.getResources().getDisplayMetrics().density;
    rectSize = FloatMath.floor(24.f * density + 0.5f);
    strokeWidth = FloatMath.floor(1.f * density + 0.5f);

    paint = new Paint();
    paint.setColor(0xffffffff);
    paint.setStyle(Style.STROKE);
    paint.setStrokeWidth(strokeWidth);
  }

  @Override protected void onDraw(Canvas canvas) {
    super.onDraw(canvas);

    canvas.drawRect(strokeWidth, strokeWidth, rectSize - strokeWidth, rectSize - strokeWidth, paint);
  }
}




Java Source Code List

com.pythonistas.akrellm.AKrellmLoad.java
com.pythonistas.akrellm.AKrellmPoint.java
com.pythonistas.akrellm.AKrellmPreferencesActivity.java
com.pythonistas.akrellm.AKrellmTop.java
com.pythonistas.akrellm.AKrellmWallPaperService.java
yuku.ambilwarna.AmbilWarnaDialog.java
yuku.ambilwarna.AmbilWarnaKotak.java
yuku.ambilwarna.widget.AmbilWarnaPrefWidgetView.java
yuku.ambilwarna.widget.AmbilWarnaPreference.java