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
| data class Results( | |
| @SerializedName("page") | |
| @Expose | |
| var page: Int? = null, | |
| @SerializedName("total_results") | |
| @Expose | |
| var totalResults: Int? = null, | |
| @SerializedName("total_pages") | |
| @Expose |
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
| class TvPresenter<V : TvMvpView> @Inject constructor( | |
| private val dataManager: DataManager, | |
| private val compositeDisposable: CompositeDisposable | |
| ) : BasePresenter<V>(dataManager, compositeDisposable), TvMvpPresenter<V> { | |
| private var page = 1 | |
| override fun getTvs() { | |
| compositeDisposable.add( | |
| dataManager.getTvs( |
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
| ImageView imageView = (ImageView) findViewById(R.id.card_thumbnail_image); | |
| Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.rose); | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ | |
| //Default | |
| imageView.setBackgroundResource(R.drawable.rose); | |
| } else { | |
| //RoundCorners | |
| RoundCornersDrawable round = new RoundCornersDrawable(mBitmap, | |
| getResources().getDimension(R.dimen.cardview_default_radius), 0); //or your custom radius |
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
| ImageView imageView = (ImageView) findViewById(R.id.card_thumbnail_image); | |
| Bitmap mBitmap = BitmapFactory.decodeResource(getResources(), R.drawable.rose); | |
| if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP){ | |
| //Default | |
| imageView.setBackgroundResource(R.drawable.rose); | |
| } else { | |
| //RoundCorners | |
| RoundCornersDrawable round = new RoundCornersDrawable(mBitmap, | |
| getResources().getDimension(R.dimen.cardview_default_radius), 0); //or your custom radius |
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
| // Custom interface that enables communication between Fragment and its Activity | |
| public interface OnItemSelectedListener | |
| { | |
| public void onItemSelected(String item); | |
| } |
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 MainActivity extends AppCompatActivity { | |
| @Override | |
| protected void onCreate(Bundle savedInstanceState) { | |
| super.onCreate(savedInstanceState); | |
| setContentView(R.layout.activity_about); | |
| //Schedule Note Syncing | |
| NoteSyncJob.scheduleJob(); | |
| } | |
| } |
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 NoteJobCreator implements JobCreator { | |
| @Override | |
| @Nullable | |
| public Job create(@NonNull String tag) { | |
| switch (tag) { | |
| case NoteSyncJob.TAG: | |
| return new NoteSyncJob(); | |
| default: | |
| return null; |
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 NoteApplication extends Application { | |
| @Override | |
| public void onCreate() { | |
| super.onCreate(); | |
| JobManager.create(this).addJobCreator(new NoteJobCreator()); | |
| } | |
| } |
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 NoteSyncJob extends Job { | |
| public static final String TAG = "job_note_sync"; | |
| @Override | |
| @NonNull | |
| protected Result onRunJob(@NonNull Params params) { | |
| List<Note> notes = AppDatabase.getNotes(); | |
| if (notes.size() > 0) { | |
| NoteSyncApi.sync(notes); |