Skip to content

Instantly share code, notes, and snippets.

View webserveis's full-sized avatar

Webserveis webserveis

View GitHub Profile
@webserveis
webserveis / material text sizes.md
Last active September 20, 2023 10:10 — 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.

@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 / SeparatorTextView.java
Created February 3, 2023 18:54 — forked from alphamu/SeparatorTextView.java
Demonstration of how to make a custom TextView which has a separator running across it. Screenshot of TextView https://raw.githubusercontent.com/alphamu/RxAndroidDemo/master/app/SeparatorTextViewSample.png
import android.annotation.TargetApi;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Build;
import android.util.AttributeSet;
import android.view.Gravity;
import android.widget.TextView;
/**
* Simple version used in the article:
@webserveis
webserveis / gist:c0d61834232fec7790a4a736813c7b75
Last active December 29, 2022 12:36 — forked from menht/gist:2698877
Install and Uninstall Android applications with Intents

In android source code can get

<activity android:name=".PackageInstallerActivity">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <data android:scheme="content" />
        <data android:scheme="file" />
@webserveis
webserveis / KIntent.kt
Created February 12, 2021 12:28 — forked from wajahatkarim3/KIntent.kt
Kotlin extension functions to start a generic Activity
package com.pascalwelsch.extensions
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
/**
* Extensions for simpler launching of Activities
@webserveis
webserveis / RVEmptyObserver.java
Last active February 1, 2021 18:02 — forked from sheharyarn/RVEmptyObserver.java
Set Empty Layout for RecyclerViews in Android
/**
* https://stackoverflow.com/questions/28217436/how-to-show-an-empty-view-with-a-recyclerview
*
* Custom implementation of AdapterDataObserver to show empty layouts
* for RecyclerView when there's no data
*
* Usage:
*
* adapter.registerAdapterDataObserver(new RVEmptyObserver(recyclerView, emptyView));
*/
@webserveis
webserveis / KIntent.kt
Created August 14, 2020 13:40 — forked from passsy/KIntent.kt
Kotlin extension functions to start a generic Activity
package com.pascalwelsch.extensions
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.os.Build
import android.os.Bundle
/**
* Extensions for simpler launching of Activities
@webserveis
webserveis / UseCase.kt
Created April 22, 2020 15:33 — forked from DenysZP/UseCase.kt
The implementation of the base UseCase with kotlin coroutines.
import kotlinx.coroutines.*
import kotlin.coroutines.CoroutineContext
abstract class UseCase<T, Params : Any> {
private lateinit var parentJob: Job
private lateinit var params: Params
private var isAttachedToLifecycle = false
private val backgroundContext: CoroutineContext = Dispatchers.IO
private val foregroundContext: CoroutineContext = Dispatchers.Main
@webserveis
webserveis / HTTPUtils2.java
Last active March 12, 2019 10:31 — forked from liangzai-cool/HttpUtils.java
convert relative url to absolute url and beautify the result in java.
package com.webserveis.httpredirectiontrace.utils;
import android.net.Uri;
import android.util.Log;
import android.util.Patterns;
import android.webkit.URLUtil;
import java.io.UnsupportedEncodingException;
import java.net.IDN;
import java.net.MalformedURLException;
@webserveis
webserveis / AnimatedGifEncoder.java
Created December 3, 2018 17:28 — forked from wasabeef/AnimatedGifEncoder.java
Android - AnimatedGifEncoder
import java.io.IOException;
import java.io.OutputStream;
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.graphics.Paint;
public class AnimatedGifEncoder {
protected int width; // image size