Skip to content

Instantly share code, notes, and snippets.

View novanto's full-sized avatar
🎯
Focusing

Novanto Ji novanto

🎯
Focusing
View GitHub Profile
@novanto
novanto / YouTubePlayerSupportFragmentXKt.kt
Last active June 7, 2023 13:55
This is an alternative solution for YoutubePlayerSupportFragment for AndroidX - written in Kotlin. Feel free to comment if the code is not working! this is a translated version of https://gist.github.com/medyo/f226b967213c3b8ec6f6bebb5338a492#file-youtubeplayersupportfragmentx-java
package com.google.android.youtube.player
import android.os.Bundle
import android.util.AttributeSet
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import com.google.android.youtube.player.internal.ab
@novanto
novanto / CircularProgressView.kt
Created February 4, 2019 17:25
Static Circular Progress in kotlin
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.RectF
import android.util.AttributeSet
import android.view.View
import androidx.annotation.FloatRange
class CircularProgressView : View {
constructor(context: Context) : super(context)
@novanto
novanto / LogUtils.java
Last active April 23, 2016 15:49
LogUtils from google io app
public class LogUtils {
private static final String LOG_PREFIX = "APP_NAME";
private static final int LOG_PREFIX_LENGTH = LOG_PREFIX.length();
private static final int MAX_LOG_TAG_LENGTH = 23;
public static boolean LOGGING_ENABLED = true;
private LogUtils() {
}
@novanto
novanto / TimeHelper.java
Last active April 14, 2016 19:56
Time helper for parsing YYYY-MM-dd
public class TimeHelper {
public String timeParser(String timestamp){
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = new Date();
try{
Date date2 = sdf.parse(timestamp);
long currentTimestamp = date.getTime();
long targetTimestamp = date2.getTime();
long res = currentTimestamp - targetTimestamp;
@novanto
novanto / RoundedImageView.java
Created December 4, 2015 09:28
Rounded ImageView for Android
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.drawable.BitmapDrawable;