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
| mPicasso.load(ICON_URL + "&" + position) | |
| .placeholder(R.mipmap.ic_launcher) | |
| .into(viewHolder.mIcon); |
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
| OkHttpClient okClient = new OkHttpClient | |
| .Builder() | |
| .addNetworkInterceptor(new StethoInterceptor()) | |
| .build(); | |
| mPicasso = new Picasso.Builder(getApplicationContext()) | |
| .downloader(new OkHttp3Downloader(okClient)) | |
| .loggingEnabled(true) | |
| .build(); |
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
| mPicasso = Picasso.with(getApplicationContext()); |
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
| mPicasso = Picasso.with(getApplicationContext()); | |
| if (BuildConfig.DEBUG) { | |
| Stetho.initializeWithDefaults(this); | |
| } |
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.squareup.picasso:picasso:2.5.2' | |
| compile 'com.jakewharton.picasso:picasso2-okhttp3-downloader:1.0.2' | |
| compile 'com.facebook.stetho:stetho:1.4.1' | |
| compile 'com.facebook.stetho:stetho-okhttp3:1.4.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
| public void onBindRealmViewHolder(ViewHolder viewHolder, int position) { | |
| final Note note = realmResults.get(position); | |
| viewHolder.mText.setText(note.getText()); | |
| viewHolder.mDate.setText(note.getDate().toString()); | |
| mPicasso.load(ICON_URL) | |
| .placeholder(R.mipmap.ic_launcher) | |
| .into(viewHolder.mIcon); | |
| } |
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
| public class ViewHolder extends RealmViewHolder { | |
| private TextView mText; | |
| private TextView mDate; | |
| private ImageView mIcon; | |
| public ViewHolder(RelativeLayout container) { | |
| super(container); | |
| this.mText = (TextView) container.findViewById(R.id.tv_text); | |
| this.mDate = (TextView) container.findViewById(R.id.tv_date); | |
| this.mIcon = (ImageView) container.findViewById(R.id.iv_icon); |
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
| private static final String ICON_URL = "https://unsplash.it/100/100?random"; | |
| public NoteRecyclerViewAdapter( | |
| Context context, | |
| RealmResults<Note> realmResults) { | |
| super(context, realmResults, true, true); | |
| } |
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
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_main); | |
| mPicasso = Picasso.with(getApplicationContext()); |
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
| private Realm mRealm; | |
| private RealmConfiguration mRealmConfig; | |
| private EditText mText; | |
| private RealmRecyclerView mNotes; | |
| private Picasso mPicasso; |