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
| 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
| 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
| data class Result( | |
| var type: String = "TV", | |
| @SerializedName("original_name") | |
| @Expose | |
| var originalName: String? = null, | |
| @SerializedName("genre_ids") | |
| @Expose | |
| var genreIds: List<Int>? = 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
| class TvFragment : BaseFragment(), TvMvpView, TvAdapter.Callback { | |
| @Inject | |
| lateinit var presenter: TvMvpPresenter<TvMvpView> | |
| @Inject | |
| lateinit var gridLayoutManager: GridLayoutManager | |
| @Inject | |
| lateinit var itemOffsetDecoration: ItemOffsetDecoration | |
| @Inject | |
| lateinit var tvAdapter: TvAdapter |
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 TvAdapter(private val resultList: MutableList<Result>?) : | |
| RecyclerView.Adapter<RecyclerView.ViewHolder>() { | |
| private val TYPE_LOADING = -1 | |
| private val TYPE_TV = 1 | |
| interface Callback { | |
| fun onTvShowClick(id: Int) | |
| } |
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
| HttpLoggingInterceptor httpLoggingInterceptor = new HttpLoggingInterceptor(); | |
| if (BuildConfig.DEBUG) { | |
| httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY); | |
| } else { | |
| httpLoggingInterceptor.setLevel(HttpLoggingInterceptor.Level.NONE); | |
| } | |
| OkHttpClient okHttpClient = new OkHttpClient.Builder() | |
| .readTimeout(1000, TimeUnit.SECONDS) | |
| .addInterceptor(httpLoggingInterceptor) |
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
| commonApiService.sendOtp(phone) | |
| .subscribeOn(Schedulers.io()) | |
| .observeOn(AndroidSchedulers.mainThread()) | |
| .subscribe(login -> { | |
| if (!isViewAttached()) { | |
| return; | |
| } | |
| getMvpView().hideLoading(); | |
| if (login != null && login.getSuccess() != null) { | |
| if (login.getSuccess()) { |
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 String getRealPathFromURI(Context context, Uri contentUri) { | |
| Cursor cursor = null; | |
| try { | |
| String[] proj = { MediaStore.Images.Media.DATA }; | |
| cursor = context.getContentResolver().query(contentUri, proj, null, null, null); | |
| int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA); | |
| cursor.moveToFirst(); | |
| return cursor.getString(column_index); | |
| } catch (Exception e) { | |
| Log.e(TAG, "getRealPathFromURI Exception : " + e.toString()); |