Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Hamed Momeni 2hamed

🎯
Focusing
Block or report user

Report or block 2hamed

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Dockerfile_php_conf
RUN sed -i 's/pm.max_children = 5/pm.max_children = 10/g' /etc/php/7.2/fpm/pool.d/www.conf && \
sed -i 's/pm.start_servers = 2/pm.start_servers = 4/g' /etc/php/7.2/fpm/pool.d/www.conf && \
sed -i 's/pm.min_spare_servers = 1/pm.min_spare_servers = 3/g' /etc/php/7.2/fpm/pool.d/www.conf && \
sed -i 's/pm.max_spare_servers = 3/pm.max_spare_servers = 5/g' /etc/php/7.2/fpm/pool.d/www.conf && \
sed -i 's/;pm.max_requests = 500/pm.max_requests = 500/g' /etc/php/7.2/fpm/pool.d/www.conf && \
sed -i 's|listen = /run/php/php7.2-fpm.sock|listen = "9000"|g' /etc/php/7.2/fpm/pool.d/www.conf && \
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 500M/g' /etc/php/7.2/fpm/php.ini && \
sed -i 's/post_max_size = 8M/post_max_size = 500M/g' /etc/php/7.2/fpm/php.ini
View RecordButton_10.kt
var mode: Mode = Mode.Idle
set(value) {
field = value
invalidate()
}
var progress = 0
set(value) {
field = value
invalidate()
}
View RecordButton_9.kt
override fun onDraw(canvas: Canvas) {
when (mode) {
Mode.Loading -> {
canvas.drawArc(arcRect, 0f, 360f * (progress.toFloat() / 100f), true, outerPaint)
canvas.drawCircle(cx, cy, radius - radiusDiff, innerPaint)
...
View RecordButton_8.kt
private val arcRect = RectF()
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
if (measuredHeight > 0 && measuredWidth > 0) {
...
arcRect.set(0f, 0f, measuredWidth.toFloat(), measuredHeight.toFloat())
}
}
View RecordButton_7.kt
var mode: Mode = Mode.Idle
override fun onDraw(canvas: Canvas) {
when (mode) {
Mode.Ready -> {
canvas.drawCircle(cx, cy, radius, outerPaint)
canvas.drawCircle(cx, cy, radius - radiusDiff, innerPaint)
canvas.drawCircle(cx, cy, recordRadius, recordPaint)
}
Mode.Recording -> {
View RecordButton_6.kt
private var recordRadius: Float = 0f
private val recordRect = RectF()
private val recordPaint = Paint().apply {
color = Color.RED
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
if (measuredHeight > 0 && measuredWidth > 0) {
...
View RecordButton_5.kt
enum class Mode {
Idle, Ready, Recording, Loading
}
View RecordButton_4.kt
override fun onDraw(canvas: Canvas) {
canvas.drawCircle(cx, cy, radius, outerPaint)
canvas.drawCircle(cx, cy, radius - radiusDiff, innerPaint)
}
View RecordButton_3.kt
private val radiusDiff = dpToPx(10).toFloat()
private val innerPaint = Paint().apply {
color = Color.WHITE
isAntiAlias = true
}
private val outerPaint = Paint().apply {
color = Color.parseColor("#99FFFFFF")
strokeWidth = radiusDiff.toFloat()
style = Paint.Style.FILL
View RecordButton_2.kt
private var cx: Float = 0f // x coordinate of the center
private var cy: Float = 0f // y coordinate of the center
private var radius: Float = 0f // the radius of the view = min(width, height) * 0.95
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
if (measuredHeight > 0 && measuredWidth > 0) {
cx = measuredWidth / 2f
cy = measuredHeight / 2f
radius = Math.min(measuredHeight, measuredWidth) / 2 * 0.95f - paddingBottom
You can’t perform that action at this time.