-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
111
- Loading branch information
Showing
186 changed files
with
7,150 additions
and
347 deletions.
There are no files selected for viewing
Binary file not shown.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.mzyl.album; | ||
|
||
import android.content.Context; | ||
import android.graphics.Canvas; | ||
import android.graphics.Color; | ||
import android.graphics.Paint; | ||
import android.support.annotation.Nullable; | ||
import android.util.AttributeSet; | ||
import android.view.View; | ||
import android.view.ViewGroup; | ||
|
||
/** | ||
* Created by mzyl on 2018/3/27. | ||
*/ | ||
|
||
public class CircleView extends View { | ||
int randius; | ||
int color; | ||
|
||
public CircleView(Context context) { | ||
this(context, null); | ||
} | ||
|
||
public CircleView(Context context, @Nullable AttributeSet attrs) { | ||
this(context, attrs, 0); | ||
} | ||
|
||
public CircleView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
init(); | ||
} | ||
|
||
@Override | ||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | ||
super.onMeasure(widthMeasureSpec, heightMeasureSpec); | ||
randius = getMeasuredWidth() / 2; | ||
} | ||
|
||
private void init() { | ||
color = Color.BLACK; | ||
} | ||
|
||
@Override | ||
protected void onDraw(Canvas canvas) { | ||
Paint paint = new Paint(); | ||
paint.setAntiAlias(true); | ||
paint.setColor(color); | ||
paint.setStrokeWidth(0); | ||
paint.setStyle(Paint.Style.FILL_AND_STROKE); | ||
canvas.drawCircle(randius, randius, randius, paint); | ||
super.onDraw(canvas); | ||
} | ||
|
||
public void changeColor(int color) { | ||
this.color = color; | ||
invalidate(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package com.mzyl.album; | ||
|
||
import android.content.Context; | ||
import android.graphics.Canvas; | ||
import android.graphics.drawable.Drawable; | ||
import android.support.v7.widget.AppCompatCheckBox; | ||
import android.util.AttributeSet; | ||
import android.view.Gravity; | ||
|
||
public class CustomCheckBox extends AppCompatCheckBox { | ||
private static final String TAG = CustomCheckBox.class.getSimpleName(); | ||
|
||
public CustomCheckBox(Context context) { | ||
super(context); | ||
} | ||
|
||
public CustomCheckBox(Context context, AttributeSet attrs) { | ||
super(context, attrs); | ||
} | ||
|
||
public CustomCheckBox(Context context, AttributeSet attrs, int defStyleAttr) { | ||
super(context, attrs, defStyleAttr); | ||
} | ||
|
||
@Override | ||
protected void onDraw(Canvas canvas) { | ||
super.onDraw(canvas); | ||
Drawable[] drawables = getCompoundDrawables(); | ||
Drawable drawable = drawables[0]; | ||
int gravity = getGravity(); | ||
int left = 0; | ||
if (gravity == Gravity.CENTER) { | ||
left = ((int) (getWidth() - drawable.getIntrinsicWidth() - getPaint().measureText(getText().toString())) | ||
/ 2); | ||
} | ||
drawable.setBounds(left, 0, left + drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); | ||
} | ||
} |
Oops, something went wrong.