Skip to content

Instantly share code, notes, and snippets.

👀
Always watching for new awesome repos.

César Díez Sánchez cesards

👀
Always watching for new awesome repos.
Block or report user

Report or block cesards

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@cesards
cesards / AndroidManifest.xml
Last active Jun 3, 2018
Fusing Dynamic Features
View AndroidManifest.xml
<manifest
package="com.example.android.mydynamicapp.vrviewer">
<dist:module
xmlns:dist="http://schemas.android.com/apk/distribution"
dist:title="@string/vr_viewer_module_title"
dist:onDemand="true">
<dist:fusing include="true" />
</dist:module>
</manifest>
View ABaseFragment.java
ArrayList<WeakReference<ContentObserver>> observers = new ArrayList<WeakReference<ContentObserver>>();
public void loadCursor(final BetterCursorAdapter adapter, final Uri uri, final String[] projection, final String selection, final String[] selectionArgs, final String sortOrder) {
final FutureCallback<BetterCursorAdapter> callback = new FutureCallback<BetterCursorAdapter>() {
@Override
public void onCompleted(Exception e, BetterCursorAdapter result) {
if (e != null)
return;
View view = getView();
if (view == null)
@cesards
cesards / MarginSpan.java
Created Oct 11, 2016 — forked from liberorignanese/MarginSpan.java
Android TextInputLayout with credit card mask
View MarginSpan.java
package com.liberorignanese.android.gist;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.text.style.ReplacementSpan;
/**
* Created by Libero Rignanese.
*/
@cesards
cesards / build.gradle
Last active Aug 29, 2015 — forked from JakeWharton/build.gradle
Task to install all variants on the mobile phone
View build.gradle
def installAll = tasks.create('installAll')
installAll.description = 'Install all applications.'
android.applicationVariants.all { variant ->
installAll.dependsOn(variant.install)
// Ensure we end up in the same group as the other install tasks.
installAll.group = variant.install.group
}
View UiThreadRule.java
/*
* Copyright (C) 2015 Jake Wharton
*
* 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
View MockParcel.java
import android.os.Parcel;
import java.util.ArrayList;
import java.util.List;
import org.mockito.invocation.InvocationOnMock;
import org.mockito.stubbing.Answer;
import static org.mockito.Matchers.anyInt;
import static org.mockito.Matchers.anyLong;
import static org.mockito.Matchers.anyString;
import static org.mockito.Mockito.doAnswer;
View OneShotCancelableAnimatorListenerAdapter
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.annotation.TargetApi;
/**
* Created by Gustavo Claramunt (AnderWeb) on 2014/07/10
*
*
*
* This class extends android.animation.AnimatorListenerAdapter to bypass 2 issues:
View HexagonDrawable.java
package org.adw.drawables;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.util.FloatMath;
View Simple setup for item backgrounds pre - post lollipop
AppCompat-v7:21 provides a very useful way of dealing with pressed/focused/activated states maintaining backwards compatibility downto API-7, but there's a small issue (big for some) with the default selectableItemBackground: It uses some PNGs and/or default values for API<21.
The main reason is that android drawable resource definitions (prior API 21) CANNOT use theme attributes at all, so there's no way of making something like:
<shape android:shape="rectangle">
<solid android:color="?attr/colorControlHighlight" />
</shape>
For this, I've put this simple mockup on how to give your app better drawables that the appcompat defaults.
View CityBikesContract.java
package com.cyrilmottier.android.citybikes.provider;
import android.net.Uri;
import com.cyrilmottier.android.avelov.BuildConfig;
/**
* @author Cyril Mottier
*/
public class CityBikesContract {
You can’t perform that action at this time.