Skip to content

Instantly share code, notes, and snippets.

Avatar

Victor Campos vic797

View GitHub Profile
@vic797
vic797 / GridPagerAdapter.java
Last active Oct 21, 2020
Grid layout pager adapter
View GridPagerAdapter.java
import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.GridView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.viewpager.widget.PagerAdapter;
@vic797
vic797 / LinePagerIndicator.java
Last active Oct 21, 2020
Simple line indicator for ViewPager
View LinePagerIndicator.java
import android.content.Context;
import android.database.DataSetObserver;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.view.View;
import androidx.annotation.NonNull;
@vic797
vic797 / getparams.js
Created May 28, 2019
Function to read the GET parameters from JavaScript
View getparams.js
function loadGet() {
var getData = {};
var url = decodeURI(window.location.href);
try {
var getArr = url.split("?")[1];
var args = getArr.split("&");
for (var a = 0; a < args.length; a++) {
var kv = args[a].split("=");
getData[kv[0]] = kv[1];
}
View WidgetView.java
import android.app.Activity;
import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetHostView;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
import android.content.Intent;
import android.view.Gravity;
import android.view.ViewGroup;
import android.widget.FrameLayout;
View AudioManager.cs
using System;
using System.Runtime.InteropServices;
// ReSharper disable SuspiciousTypeConversion.Global
// ReSharper disable InconsistentNaming
namespace VideoPlayerController
{
/// <summary>
/// Controls audio using the Windows CoreAudio API
/// from: http://stackoverflow.com/questions/14306048/controling-volume-mixer
View android_material_design_colours.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- google's material design colours from
http://www.google.com/design/spec/style/color.html#color-ui-color-palette -->
<!--reds-->
<color name="md_red_50">#FFEBEE</color>
<color name="md_red_100">#FFCDD2</color>
<color name="md_red_200">#EF9A9A</color>
@vic797
vic797 / mcfunction.xml
Last active Jan 15, 2018
This is the syntax hylighter for Notepad++ for Minecraft functions introduced in version 1.12. Includes all the commands. When Mojang releases the 1.13 I will update this.
View mcfunction.xml
<NotepadPlus>
<UserLang name="Minecraft" ext="mcfunction" udlVersion="2.1">
<Settings>
<Global caseIgnored="no" allowFoldOfComments="no" foldCompact="no" forcePureLC="0" decimalSeparator="0" />
<Prefix Keywords1="yes" Keywords2="yes" Keywords3="yes" Keywords4="yes" Keywords5="yes" Keywords6="yes" Keywords7="no" Keywords8="no" />
</Settings>
<KeywordLists>
<Keywords name="Comments">00 01 02 03 04</Keywords>
<Keywords name="Numbers, prefix1">~</Keywords>
<Keywords name="Numbers, prefix2">-</Keywords>
@vic797
vic797 / OnSwipeTouchListener.java
Last active May 28, 2018
This is a simple class for basic gestures detection on Android. The original class that I found on internet includes only the swipe gestures.
View OnSwipeTouchListener.java
import android.content.Context;
import android.util.Log;
import android.view.GestureDetector;
import android.view.MotionEvent;
import android.view.View;
@SuppressWarnings("unused")
public abstract class OnSwipeTouchListener implements View.OnTouchListener {
private final GestureDetector gestureDetector;