Skip to content

Instantly share code, notes, and snippets.

View ppamorim's full-sized avatar
🎯
Focusing

Pedro Paulo Amorim ppamorim

🎯
Focusing
View GitHub Profile
public class TabsPagerAdapter extends FragmentPagerAdapter {
public List<Fragment> mFragments;
public TabsPagerAdapter(FragmentManager fm, List<Fragment> fragments) {
super(fm);
this.mFragments = fragments;
}
@Override
public abstract class AbstractActivity extends AppCompatActivity {
@Override protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(getLayoutId()); //This guy accept a Integer and View...
ButterKnife.bind(this);
}
protected abstract int getLayoutId();
protected abstract View getLayoutId();
package com.camerite.ui.dialog;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TextView;
package com.myhappyapp.utils;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.login.LoginManager;
package com.happyapp.utils;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.login.LoginManager;
@ppamorim
ppamorim / fail.java
Last active September 9, 2015 13:43
package com.happyapp.utils;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import com.facebook.CallbackManager;
import com.facebook.FacebookCallback;
import com.facebook.FacebookException;
import com.facebook.GraphRequest;
import com.facebook.GraphResponse;
import com.facebook.login.LoginManager;
language: android
before_install:
- chmod 755 gradlew
- echo yes | android update sdk --filter extra-android-support --no-ui --force > /dev/null
- echo yes | android update sdk --filter extra-android-m2repository --no-ui --force > /dev/null
android:
components:
- build-tools-23.0.1
@ppamorim
ppamorim / DraggableView.java
Created October 27, 2015 20:02
FullScreen simple
/*
* Copyright (C) 2014 Pedro Vicente Gómez Sánchez.
*
* 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
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/blue"> <!-- Change your color here -->
<com.github.ppamorim.cult.CultView
android:id="@+id/cult_view"
android:layout_width="match_parent"
@ppamorim
ppamorim / ImageInsets.swift
Created November 5, 2015 16:30
Add padding/margin at a image!
import UIKit
extension UIImage {
func imageWithInsets(insetDimen: CGFloat) -> UIImage {
return imageWithInset(UIEdgeInsets(top: insetDimen, left: insetDimen, bottom: insetDimen, right: insetDimen))
}
func imageWithInset(insets: UIEdgeInsets) -> UIImage {
UIGraphicsBeginImageContextWithOptions(
CGSizeMake(self.size.width + insets.left + insets.right,