|
|
@@ -63,22 +63,22 @@ public class SignatureView extends View {
|
|
|
int idx_lastaction = 0;
|
|
|
public SignatureView(Context context) {
|
|
|
super(context);
|
|
|
- init(context);
|
|
|
+// init(context);
|
|
|
}
|
|
|
|
|
|
public SignatureView(Context context, @Nullable AttributeSet attrs) {
|
|
|
super(context, attrs);
|
|
|
- init(context);
|
|
|
+// init(context);
|
|
|
}
|
|
|
|
|
|
public SignatureView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
|
|
|
super(context, attrs, defStyleAttr);
|
|
|
- init(context);
|
|
|
+// init(context);
|
|
|
}
|
|
|
|
|
|
public SignatureView(Context context, @Nullable AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
|
|
super(context, attrs, defStyleAttr, defStyleRes);
|
|
|
- init(context);
|
|
|
+// init(context);
|
|
|
}
|
|
|
@Override
|
|
|
protected void finalize() throws Throwable
|
|
|
@@ -93,17 +93,18 @@ public class SignatureView extends View {
|
|
|
void init(final Context context)
|
|
|
{
|
|
|
|
|
|
- post(new Runnable() {
|
|
|
-
|
|
|
- @Override
|
|
|
- public void run() {
|
|
|
+// Log.d("viewpost", "post ");
|
|
|
+// post(new Runnable() {
|
|
|
+//
|
|
|
+// @Override
|
|
|
+// public void run() {
|
|
|
Log.d("viewpost", "run: ");
|
|
|
// mVelocityTracker = VelocityTracker.obtain();
|
|
|
initPaint();
|
|
|
initCanvas( context);
|
|
|
Log.d("viewpost", "init done ");
|
|
|
- }
|
|
|
- });
|
|
|
+// }
|
|
|
+// });
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -136,7 +137,9 @@ public class SignatureView extends View {
|
|
|
View.MeasureSpec.UNSPECIFIED);
|
|
|
measure(width, height);
|
|
|
|
|
|
+// Log.d("signature mBitmap", "initCanvas: "+width+" , "+height);
|
|
|
mBitmap = Bitmap.createBitmap(getWidth(), getHeight(), Bitmap.Config.ARGB_8888);
|
|
|
+ Log.d("signature mBitmap", "initCanvas: "+getWidth()+" , "+getHeight());
|
|
|
mbmpCanvas = new Canvas(mBitmap);
|
|
|
//设置画布的颜色的问题
|
|
|
mbmpCanvas.drawColor(Color.TRANSPARENT);
|
|
|
@@ -375,6 +378,11 @@ public class SignatureView extends View {
|
|
|
@Override
|
|
|
protected void onDraw(Canvas canvas) {
|
|
|
|
|
|
+ if(mPaint==null)
|
|
|
+ {
|
|
|
+
|
|
|
+ init(getContext());
|
|
|
+ }
|
|
|
if (canvas == null) {
|
|
|
super.onDraw(canvas);
|
|
|
return;
|