Skip to content

Instantly share code, notes, and snippets.

View fredgrott's full-sized avatar
👾
focusing on flutter cross platform mobile dev

Fred Grott fredgrott

👾
focusing on flutter cross platform mobile dev
View GitHub Profile
@pocmo
pocmo / CursorFragmentPagerAdapter.java
Created November 21, 2012 10:08 — forked from peterkuterna/CursorFragmentPagerAdapter.java
A FragmentPagerAdapter that exposes data from a Cursor
package com.example;
import android.content.Context;
import android.database.Cursor;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.util.SparseIntArray;
import android.view.ViewGroup;
import android.provider.BaseColumns;
@bowmanb
bowmanb / SavedTabsFragment.java
Last active December 6, 2020 23:52
A basic Android ExpandableListFragment (SavedTabsFragment) example.
package com.advinture.ukuleletabs.fragments;
import android.app.ExpandableListActivity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
@billynyh
billynyh / gist:4043695
Created November 9, 2012 04:27
android monkeyrunner screencap
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
import datetime
def capture_and_save(fname):
device = MonkeyRunner.waitForConnection()
snapshot = device.takeSnapshot()
snapshot.writeToFile(fname)
def capture(prefix=""):
d = datetime.datetime.now()
@atermenji
atermenji / ExpandablePanel.java
Created November 8, 2012 11:06
A layout that expands/collapses its content by pressing on some view
package some.awesome.package;
import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.Transformation;
import android.widget.RelativeLayout;
@thuytrinh
thuytrinh / MainActivity.java
Last active September 21, 2020 01:22
Create carousel view with ViewPager
package com.thuytrinh.cardselectordemo;
import android.os.Bundle;
import android.support.v4.view.PagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v4.view.ViewPager.OnPageChangeListener;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.app.Activity;
@romannurik
romannurik / CheatSheet.java
Last active May 16, 2023 13:42
Android helper class for showing cheat sheets (tooltips) for icon-only UI elements on long-press. This is already default platform behavior for icon-only action bar items and tabs. This class provides this behavior for any other such UI element.
/*
* Copyright 2012 Google Inc.
*
* 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
@pocmo
pocmo / ViewPagerAdapter.java
Created October 21, 2012 15:02
ViewPagerAdapter: Implementation of PagerAdapter that represents each page as a View
/*
* Copyright (C) 2012 Sebastian Kaspari
*
* 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
@jollychang
jollychang / MonkeyrunnerLibrary.py
Created October 16, 2012 06:44
monkeyrunner for robotframework
# -*- coding: utf-8 -*-
from com.android.monkeyrunner import MonkeyRunner
class MonkeyrunnerLibrary(object):
"""docstring for ClassName"""
ROBOT_LIBRARY_SCOPE = 'Global'
self.device = MonkeyRunner.waitForConnection()
@scruffyfox
scruffyfox / HintedImageButton.java
Last active April 25, 2020 18:45
Image view with long press hint
package in.lib.view;
import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.view.View.OnLongClickListener;
import android.widget.ImageView;
import android.widget.Toast;
@chrsan
chrsan / AkkaSourceDiscriminator.java
Created September 27, 2012 13:14
A logback discriminator for the akkaSource MDC value.
package se.fishtank;
import java.net.URI;
import java.util.Map;
import ch.qos.logback.classic.spi.ILoggingEvent;
import ch.qos.logback.core.sift.Discriminator;
import ch.qos.logback.core.spi.ContextAwareBase;
public class AkkaSourceDiscriminator extends ContextAwareBase implements Discriminator<ILoggingEvent> {