Skip to content

Instantly share code, notes, and snippets.

👋
I'm back

Enrico D'Ortenzio enricocid

👋
I'm back
View GitHub Profile
@enricocid
enricocid / GradientDayLP.kt
Last active Feb 11, 2020
Draw gradient LP according to hour of the day
View GradientDayLP.kt
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.os.Handler
import android.service.wallpaper.WallpaperService
import android.util.DisplayMetrics
import android.view.SurfaceHolder
import android.view.WindowManager
import java.util.*
@enricocid
enricocid / MainActivity.kt
Last active Dec 29, 2019
[Android/Kotlin] Make Toolbar's title scrollable
View MainActivity.kt
import android.os.Bundle
import android.text.TextUtils
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.widget.Toolbar
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@enricocid
enricocid / MainActivity.kt
Last active Dec 29, 2019
[Android/Kotlin] Center TextView in custom Toolbar when Navigation Icon is present
View MainActivity.kt
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
//get the toolbar
val toolbar = (get your toolbar)
setSupportActionBar(toolbar)
//enable navigation icon
You can’t perform that action at this time.