Skip to content

Instantly share code, notes, and snippets.

View antslava's full-sized avatar

Antonenko Viacheslav antslava

View GitHub Profile
@antslava
antslava / ViewAdditions.java
Created September 25, 2012 15:53 — 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 {
@antslava
antslava / .gitignore
Created November 12, 2012 07:32
.gitignore template
#Android generated
bin
gen
lint.xml
#Eclipse
.project
.classpath
.settings
.checkstyle
@antslava
antslava / LicensesActivity.java
Created November 21, 2012 15:37 — forked from cyrilmottier/LicensesActivity.java
"Open source licenses" screen
package com.cyrilmottier.android.citybikes;
import android.os.Bundle;
import com.cyrilmottier.android.avelov.R;
import com.cyrilmottier.android.citybikes.app.BaseActivity;
public class LicensesActivity extends BaseActivity {
private WebView mWebView;
/**
* Copyright (c) 2013 Xcellent Creations, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
// THIS IS A BETA! I DON'T RECOMMEND USING IT IN PRODUCTION CODE JUST YET
/*
* Copyright 2012 Roman Nurik
*
* 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
package com.cyrilmottier.android.avelov.database;
import android.database.Cursor;
import android.database.CursorWrapper;
import android.os.Bundle;
/**
* A Cursor that completely re-writes the actual Cursor capabilities related to extras. It allows clients to use the setExtras(Bundle) (this
* method is actually hidden in the Android framework).
*
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
/** An implementation of {@link BaseAdapter} which uses the new/bind pattern for its views. */
public abstract class BindingAdapter extends BaseAdapter {
@Override public final View getView(int position, View convertView, ViewGroup parent) {
int type = getItemViewType(position);
if (convertView == null) {
convertView = newView(type, parent);
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
public class FragmentUtils {
/**
* @param frag
* The Fragment whose parent is to be found
* @param callbackInterface
* The interface class that the parent should implement
* @return The parent of frag that implements the callbackInterface or null
/**
* A {@link HttpRequest.ConnectionFactory connection factory} which uses OkHttp.
* <p/>
* Call {@link HttpRequest#setConnectionFactory(HttpRequest.ConnectionFactory)} with an instance of
* this class to enable.
*/
public class OkConnectionFactory implements HttpRequest.ConnectionFactory {
private final OkHttpClient client;
public OkConnectionFactory() {