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
| <?xml version="1.0" encoding="utf-8"?> | |
| <android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" | |
| android:id="@+id/main_recycler" | |
| android:layout_width="match_parent" | |
| android:layout_height="wrap_content" | |
| android:orientation="vertical"/> |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <android.support.v7.widget.CardView 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="100dp" | |
| android:layout_margin="5dp" | |
| android:orientation="vertical" | |
| app:cardCornerRadius="4dp"> | |
| <TextView |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:app="http://schemas.android.com/apk/res-auto" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| android:layout_width="match_parent" | |
| android:layout_height="100dp" | |
| android:layout_margin="5dp" | |
| android:orientation="vertical" | |
| app:cardCornerRadius="4dp"> |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <android.support.v7.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android" | |
| xmlns:app="http://schemas.android.com/apk/res-auto" | |
| xmlns:tools="http://schemas.android.com/tools" | |
| android:id="@+id/main_recycler" | |
| android:layout_width="match_parent" | |
| android:layout_height="wrap_content" | |
| android:orientation="vertical" | |
| app:layoutManager="LinearLayoutManager" | |
| tools:listitem="@layout/row_person" /> |
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
| <?xml version="1.0" encoding="utf-8"?> | |
| <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
| android:id="@+id/main_background" | |
| android:layout_width="match_parent" | |
| android:layout_height="match_parent"> | |
| <ImageView | |
| android:id="@+id/main_image" | |
| android:layout_width="@dimen/image_size" | |
| android:layout_height="@dimen/image_size" |
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
| compile 'com.android.support:appcompat-v7:23.2.1' | |
| compile 'com.android.support:palette-v7:23.2.1' | |
| compile 'com.squareup.picasso:picasso:2.5.2' |
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
| Picasso.with(MainActivity.this) | |
| .load("https://source.unsplash.com/random") | |
| .centerCrop() | |
| .into(imageView); |
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
| Picasso.with(MainActivity.this) | |
| .load("https://source.unsplash.com/random") | |
| .into(new Target() { | |
| @Override | |
| public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { | |
| } | |
| @Override | |
| public void onBitmapFailed(Drawable errorDrawable) { |
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
| int imageDimension = | |
| (int) getResources().getDimension(R.dimen.image_size); | |
| Picasso.with(MainActivity.this) | |
| .load("https://source.unsplash.com/random") | |
| .resize(imageDimension, imageDimension) | |
| .centerCrop() | |
| .into(new Target() { | |
| @Override | |
| public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { |
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
| @Override | |
| public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) { | |
| assert imageView != null; | |
| imageView.setImageBitmap(bitmap); | |
| Palette.from(bitmap) | |
| .generate(new Palette.PaletteAsyncListener() { | |
| @Override | |
| public void onGenerated(Palette palette) { | |
| Palette.Swatch textSwatch = palette.getVibrantSwatch(); | |
| if (textSwatch == null) { |
OlderNewer