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
Palette.Swatch vibrantSwatch = palette.getVibrantSwatch(); | |
Palette.Swatch vibrantSwatchDark = palette.getDarkVibrantSwatch(); | |
Palette.Swatch vibrantSwatchLight = palette.getLightVibrantSwatch(); | |
Palette.Swatch mutedSwatch = palette.getMutedSwatch(); | |
Palette.Swatch mutedSwatchDark = palette.getDarkMutedSwatch(); | |
Palette.Swatch mutedSwatchLight = palette.getLightMutedSwatch(); |
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
if (vibrantSwatch!=null) { | |
vibrant.setBackgroundColor(vibrantSwatch.getRgb()); | |
vibrantText.setTextColor(vibrantSwatch.getTitleTextColor()); | |
vibrantText.setText("Vibrant"); | |
} | |
if (vibrantSwatchDark!=null) { | |
vibrantDark.setBackgroundColor(vibrantSwatchDark.getRgb()); | |
vibrantDarkText.setTextColor(vibrantSwatchDark.getTitleTextColor()); | |
vibrantDarkText.setText("Vibrant Dark"); |
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
apply plugin: 'com.android.application' | |
apply plugin: 'android-apt'//plugin que auxilia no processamento das annotations | |
android { | |
compileSdkVersion 23 | |
buildToolsVersion "23.0.2" | |
defaultConfig { | |
applicationId "br.com.luizmarcus.exemploannotations" | |
minSdkVersion 15 |
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
@EActivity(R.layout.activity_main) | |
public class MainActivity extends AppCompatActivity { | |
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
} | |
} |
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
@EActivity(R.layout.activity_main) | |
public class MainActivity extends AppCompatActivity { | |
@ViewById | |
protected ImageView imagem; | |
@ViewById(R.id.viewText) | |
protected TextView texto; | |
@ViewById |
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
/** | |
* Chamado após carregar as views | |
*/ | |
@AfterViews | |
void loadViews(){ | |
texto.setText("Views inicializadas"); | |
} |
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
/* | |
* Chamado quando o botão é clicado | |
* */ | |
@Click(R.id.botao) | |
void baixarImagem(){ | |
texto.setText("Baixando imagem"); | |
executarDownload(); | |
} |
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
/* | |
* Cria um thread em background para executar o método | |
* */ | |
@Background | |
void executarDownload(){ | |
Bitmap img = null; | |
try { | |
InputStream in = new java.net.URL(IMG_URL).openStream(); | |
img = BitmapFactory.decodeStream(in); | |
} catch (Exception e) { |
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
@EActivity(R.layout.activity_main) | |
public class MainActivity extends AppCompatActivity { | |
private static final String IMG_URL = "https://pixabay.com/static/uploads/photo/2013/10/22/03/49/waterfall-199204_960_720.jpg"; | |
@ViewById | |
protected ImageView imagem; | |
@ViewById(R.id.viewText) | |
protected TextView texto; |
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
//Antes da alteração | |
<activity android:name="br.com.luizmarcus.exemploannotations.MainActivity" > | |
//Após a alteração | |
<activity android:name="br.com.luizmarcus.exemploannotations.MainActivity_" > |