Skip to content

Instantly share code, notes, and snippets.

View markus2610's full-sized avatar

Markus markus2610

View GitHub Profile
@markus2610
markus2610 / button_bar_layout.xml
Created July 4, 2012 18:52 — forked from romannurik/button_bar_layout.xml
How to make a proper button bar on ICS
<!--
A button bar is a set of buttons at the bottom of an activity.
An example is an AlertDialog with OK/Cancel buttons.
Note that something similar can be accomplished using a
split action bar and text-only action buttons, but this is an
alternate presentation that's often preferred.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
@markus2610
markus2610 / DecorDrawerWrapper.java
Created July 27, 2012 04:52 — forked from EddieRingle/gist:3179361
A Slide-out Navigation Implementation for Android
/*
* Copyright (c) 2012 Eddie Ringle <[email protected]>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this list of conditions
* and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
@markus2610
markus2610 / TextureAtlas.java
Created August 1, 2012 07:23 — forked from billylindeman/TextureAtlas.java
This is a TextureAtlas class for AndEngine that will load in a Zwoptex Generic plist file (requires android-plist-parser)
//TextureAtlas for andengine
// Billy Lindeman ([email protected])
// 2011 Protozoa, LLC
//loads texture atlas from Zwoptex Generic plist file
//you pass it the name of the asset (without extension)
//it will load .plist as the coordinates and .png as the texture
//requires https://github.com/tenaciousRas/android-plist-parser
package org.anddev.andengine.opengl.texture.atlas;
@markus2610
markus2610 / ViewAdditions.java
Created September 25, 2012 13:49 — forked from cyrilmottier/ViewAdditions.java
An implementation of a "findViewsByTag" method on Android
package com.cyrilmottier.android.tests;
import android.view.View;
import android.view.ViewGroup;
/**
* @author Cyril Mottier
*/
public class ViewAdditions {
@markus2610
markus2610 / LocationMonitorActivity.java
Created September 25, 2012 18:14 — forked from rajiv-singaseni/LocationMonitorActivity.java
A location monitoring activity that toasts if it cannot monitor location.
package com.webile.location;
import android.app.Activity;
import android.location.Location;
import android.location.LocationManager;
import android.location.LocationProvider;
import android.os.Bundle;
import android.os.Handler;
import android.util.Log;
import android.widget.Toast;
@markus2610
markus2610 / BaseActivity.java
Created September 26, 2012 05:26 — forked from JakeWharton/BaseActivity.java
Scoped event bus which automatically registers and unregisters with the lifecycle.
package com.squareup.example;
public abstract BaseActivity extends SherlockActivity {
private final ScopedBus scopedBus = new ScopedBus();
protected ScopedBus getBus() {
return scopedBus;
}
@Override public void onPause() {
@markus2610
markus2610 / ContractFragment.java
Created September 26, 2012 05:50 — forked from JakeWharton/ContractFragment.java
Base fragment to ensure the parent activity implements a contract interface.
/* Base fragment to ensure the parent activity implements a contract interface. */
public abstract class ContractFragment<T> extends Fragment {
private T mContract;
@Override
public void onAttach(Activity activity) {
try {
mContract = (T)activity;
} catch (ClassCastException e) {
throw new IllegalStateException(activity.getClass().getSimpleName()
/**
* Global one way asynchronous notification mechanism between parts of application based on Handler class.
* For example from service to activities.
*
* <p>
* Notification are always delivered to the UI thread.
* </p>
*
* <p>
* This class keep all listeners as weak reference so it is save to add whole activities as listeners, but do not use
@markus2610
markus2610 / gist:3789158
Created September 26, 2012 16:54 — forked from cyrilmottier/gist:3788097
ViewPager in a ListView
private OnPageChangeListener mOnPageChangeListener = new OnPageChangeListener() {
@Override
public void onPageSelected(int position) {
// Do whatever you wan't to do. It's up to you ... not me :)
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
// Do whatever you wan't to do. It's up to you ... not me :)
}
@markus2610
markus2610 / gist:3844590
Created October 6, 2012 10:44
Hack around collapsed tab dropdown selection bug in ICS and ActionBarSherlock
@Override
public void onPageScrollStateChanged(int state) {
}
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
}