Skip to content

Instantly share code, notes, and snippets.

View webserveis's full-sized avatar

Webserveis webserveis

View GitHub Profile
@webserveis
webserveis / BatteryInfo.kt
Last active January 6, 2025 08:12
Ejemplo de cómo usar la batería en Android con Kotlin
package com.webserveis.batterycheck
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.os.BatteryManager
import android.os.Build
import android.os.Bundle
import android.util.Log
@webserveis
webserveis / ContentView.swift
Created July 31, 2023 15:43 — forked from dkun7944/ContentView.swift
AirDrop iOS 17 Swift.Shader Animation
//
// ContentView.swift
// Airdrop Demo
//
// Created by Daniel Kuntz on 7/30/23.
//
import SwiftUI
struct ContentView: View {
@webserveis
webserveis / material text sizes.md
Last active August 10, 2024 02:29 — forked from passsy/material text sizes.md
Material font sizes

Material text sizes XML for Android

Simple helper file for standard text sizes in material design. The sizes are provided by the material design documentation https://www.google.com/design/spec/style/typography.html#typography-roboto

material typography

Standard Styles

Too many type sizes and styles at once can wreck any layout. A typographic scale is a limited set of type sizes that work well together, along with the layout grid. The basic set of styles are based on a typographic scale of 12, 14, 16, 20, and 34.

import SwiftUI
// Remember to download FontSettings.swift
struct WWDC24AnimatedTextView: View {
var text = "Hello, World!"
var animation: Animation = .easeInOut
var targetFontSize: CGFloat = 40
var minimumFontSize: CGFloat = 30
var targetFontWeight: Font.Weight = .semibold
@webserveis
webserveis / MainActivity.kt
Created January 19, 2020 22:37
Show app usage with UsageStatsManager
import android.Manifest
import android.app.AppOpsManager
import android.app.usage.StorageStats
import android.app.usage.StorageStatsManager
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.os.Process
struct RoundedTrapezoid: Shape {
var depth: CGFloat
var edge: Edge
var cornerRadius: CGFloat = 0
var isRightAngle: Edge? = .none
func path(in rect: CGRect) -> Path {
var path = Path()
@webserveis
webserveis / MeshGradientEditor.swift
Created June 17, 2024 06:51 — forked from coughski/MeshGradientEditor.swift
SwiftUI Mesh Gradient Editor
import SwiftUI
import UniformTypeIdentifiers
struct MeshGradientPoint: Identifiable {
let id = UUID()
var point: SIMD2<Float>
var color: Color
}
struct ContentView: View {
@webserveis
webserveis / ContentView.swift
Created June 16, 2024 11:43 — forked from lostincode/ContentView.swift
MeshGradient Playground iOS 18
//
// ContentView.swift
// MeshGradientPlayground
//
// Created by Bill Richards on 6/14/24.
//
import SwiftUI
struct ContentView: View {
@webserveis
webserveis / AnimatingMaskedMeshView.swift
Created June 13, 2024 13:07 — forked from Matt54/AnimatingMaskedMeshView.swift
An animating mesh gradient view with an animating mask
import SwiftUI
struct AnimatingMaskedMeshView: View {
let referenceDate: Date = .now
@State private var mainPosition: CGPoint = .zero
@State private var positions: [CGPoint] = []
private let blurRadius = 20.0
private let alphaThreshold = 0.875
@webserveis
webserveis / MainActivity.java
Last active November 24, 2023 09:06
RecyclerView onClick
package com.example.testlist;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Toast;
import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar;