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 / FullscreenFragment.java
Created December 25, 2016 09:12 — forked from gelldur/FullscreenFragment.java
FullscreenFragment - simple android fragment that will make fullscreen for you. Remember to: "You must manually call onKeyDown and onWindowFocusChanged."
package com.dexode.fragment;
import android.annotation.TargetApi;
import android.app.Activity;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.Fragment;
import android.view.KeyEvent;
@webserveis
webserveis / RealPathUtil.java
Created March 21, 2018 09:01 — forked from tatocaster/RealPathUtil.java
Real Path Utility class for Android, works for all API
public class RealPathUtil {
public static String getRealPath(Context context, Uri fileUri) {
String realPath;
// SDK < API11
if (Build.VERSION.SDK_INT < 11) {
realPath = RealPathUtil.getRealPathFromURI_BelowAPI11(context, fileUri);
}
// SDK >= 11 && SDK < 19
else if (Build.VERSION.SDK_INT < 19) {
@webserveis
webserveis / JSONArrayCursor.java
Created March 21, 2018 12:05 — forked from soeminnminn/JSONArrayCursor.java
Android Cursor for JSONArray.
package com.s16.data;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
@webserveis
webserveis / KotlinAndroidMainApplication
Created May 17, 2018 12:11 — forked from paraya3636/KotlinAndroidMainApplication
Kotlin Android MainApplication class for global applicationContext.
// Not object class. AndroidManifest.xml error happen.
class MainApplication : Application() {
init {
instance = this
}
companion object {
private var instance: MainApplication? = null
@webserveis
webserveis / colors_material.xml
Created July 2, 2018 15:15 — forked from eyecatchup/colors_material.xml
Android L Material Color Specs
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2014 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
@webserveis
webserveis / MyApplication.java
Created November 2, 2018 20:15 — forked from jgilfelt/MyApplication.java
Android - Set default preference values for a modern fragment-based PreferenceActivity
public class MyApplication extends Application {
@Override
public void onCreate() {
super.onCreate();
// we cannot call setDefaultValues for multiple fragment based XML preference
// files with readAgain flag set to false, so always check KEY_HAS_SET_DEFAULT_VALUES
if (!PreferenceManager.getDefaultSharedPreferences(getApplicationContext())
.getBoolean(PreferenceManager.KEY_HAS_SET_DEFAULT_VALUES, false)) {
@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
@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 / 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" />