This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Em alguns casos, no do lib de carregamento de imagens Fresco (http://frescolib.org/), é necessário | |
utilizar uri's. Para carregar um recurso local como um URI, segue trecho de código. | |
*/ | |
Uri path = Uri.parse("android.resource://com.yourdomain.yourapp/" + R.drawable.ic_notif_single_tick); | |
/* | |
Onde com.yourdomain.yourapp é o pacote de seu aplicativo. | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
View view = getWindow().getDecorView().findViewById(android.R.id.content); | |
/** | |
* Em alguns casos, é interessante ter acesso a view. Eu seto componentes fora da Activity, em outra classe, | |
* para me organizar melhor, e isso foi de grande ajuda (motivo da solução: usar o Butter Knife fora da activity) | |
* / |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Se o elemento não for exibido, mesmo no preview do Android Studio, | |
verificar se não está dentro de um ScrollView |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Error desc: | |
junit.framework.AssertionFailedError: Class fatorx.com.br.testdriven.MainActivityTest has no public constructor | |
TestCase(String name) or TestCase() | |
When creating the test class, and automatically implemented in some cases the constructor as follows below: | |
public MainActivityTest(Class<MainActivity> activityClass) { | |
super(activityClass); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Configurar Unit Tests no Android Studio | |
Adicionar, em dependencies no arquivo build.gralde do projeto, a lib Junit: | |
dependencies { | |
compile fileTree(dir: 'libs', include: ['*.jar']) | |
testCompile 'junit:junit:4.12' | |
compile 'com.android.support:appcompat-v7:23.0.1' | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Configuração Roboletric (http://robolectric.org) | |
build.gradle - (padrão) | |
repositories { | |
maven { url "https://oss.sonatype.org/content/repositories/snapshots" } | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
RequestInterceptor requestInterceptor = new RequestInterceptor() { | |
@Override | |
public void intercept(RequestFacade request) { | |
request.addHeader("Content-Type", "application/json"); | |
//request.addHeader("Authorization", tokenApp); | |
} | |
}; | |
RestAdapter restAdapter = new RestAdapter.Builder() | |
.setEndpoint(Configs.getAddressApi()) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Para executar um script php em um hook do git, basta seguir alguns passos. | |
Por exemplo, para utilizar o hook pre-commit: | |
- Criar ou editar o arquivo pre-commit na pasta de .git/hooks | |
- Criar o arquivo pre-commit.php na pasta de .git/hooks | |
- Adicionar a seguinte linha para o arquivo: | |
php .git/hooks/pre-commit.php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var exec = require('child_process').exec | |
gulp.task('update-templates', function(){ | |
exec('php scripts/update-html.php', function (err, stdout, stderr) { | |
console.log(stdout) | |
console.log(stderr) | |
}) | |
}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Baixar a versão correta do PHP (x86 ou x64 | NTS ou TS) | |
A dll php_zmq.dll vai na pasta /ext e as demais na pasta raiz do PHP. |