Skip to content

Instantly share code, notes, and snippets.

View gnuton's full-sized avatar
:shipit:

Antonio Aloisio gnuton

:shipit:
View GitHub Profile
@gnuton
gnuton / BoilerPipeTask.java
Created May 21, 2013 23:04
Generic Android Async Task with internal interface
package com.example.toniotest.utils;
import android.os.AsyncTask;
/**
* Created by gnuton on 5/22/13.
*/
public class BoilerPipeTask extends AsyncTask<String, Void, String> {
private static final String TAG = "BOILER PIPE TASK";
@gnuton
gnuton / gist:5704247
Created June 4, 2013 07:36
Android: How to display rich text in a textView
TextView tv = (TextView)findViewById(R.id.mytextview);
Spanned myStringSpanned = Html.fromHtml(myString, null, null);
tv.setText(myStringSpanned, TextView.BufferType.SPANNABLE);
Supporte TAGS on Android 2.1
<a href="...">
<b>
<big>
<blockquote>
<br>
@gnuton
gnuton / gist:5748980
Created June 10, 2013 14:09
Printing in utf8 unicode escaped strings in Python
t = 'R\\u00f3is\\u00edn'
print(t.decode('unicode_escape'))
output => Róisín
@gnuton
gnuton / fadeout.xml
Created June 16, 2013 07:10
Android Infinite rotation animation
<?xml version="1.0" encoding="UTF-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<rotate
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:duration="2000"
private TextView htmlTextView;
private SpannableStringBuilder htmlSpannable;
@Override
public void onCreate(Bundle savedInstanceState) {
// ...
// first parse the html
// replace getHtmlCode() with whatever generates/fetches your html
@gnuton
gnuton / DiskLruImageCache.java
Created June 18, 2013 06:42
Using Log on Android
if ( BuildConfig.DEBUG ) {
Log.d(TAG, "getBitmap " + key);
}
@gnuton
gnuton / ImageAdapter.java
Last active December 18, 2015 16:09
Image adapter for viewPager. It works with mViewPager.setOffscreenPageLimit(1);
/**
*
* Created by gnuton on 6/18/13.
*/
public class ImageAdapter extends PagerAdapter {
Context mContext;
public List<Drawable> mImages = new ArrayList<Drawable>();
private List<ImageView> mImageViews = new ArrayList<ImageView>();
@gnuton
gnuton / MainActivity.java
Created June 21, 2013 06:34
Get orientation on Android
/*Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
int rotation = display.getRotation();
Log.d(TAG, "Orientation " + rotation);
If in portrait mode
if (rotation == Surface.ROTATION_180 || rotation == Surface.ROTATION_0 )*/
@gnuton
gnuton / FragmentUtils.java
Created June 22, 2013 06:20
Fuck you Fragments IDs/TAGs! Here is the way to map dynamic fragments in your app!
public class FragmentUtils {
private static Map mMap = new HashMap<String, Fragment>();
public static Fragment getFragment(FragmentManager fm, String className, String tag){
if (tag == null)
tag = className;
Fragment f = (Fragment) mMap.get(tag);
if (f != null)
return f;

IDs

  • user_id - user/:uid
  • feed_id - feed/:feed_uri
  • category_id - :user_id/category/:category (special category: global.all, global.uncategorized)
  • tag_id - :user_id/tag/:tag (special tag: global.saved)

APIs

http://cloud.feedly.com/:version/:api