For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.
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
| adapter.addLoadStateListener { combinedLoadStates -> | |
| when (val loadState = combinedLoadStates.source.refresh) { | |
| is LoadState.NotLoading -> { | |
| popular_movies_refresh_layout.visible() | |
| popular_movies_progress.gone() | |
| } | |
| is LoadState.Loading -> { | |
| popular_movies_progress.visible() | |
| popular_movies_refresh_layout.gone() | |
| } |
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
| lifecycleScope.launch { | |
| viewModel.getPopularMovies().collectLatest { | |
| adapter.submitData(it) | |
| } | |
| } |
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 MovieAdapter: PagingDataAdapter<Movie, MovieAdapter.MovieViewHolder>(MovieDiffCallback) { | |
| override fun onBindViewHolder(holder: MovieViewHolder, position: Int) { | |
| val movie = getItem(position) | |
| holder.itemView.movie_title.text = movie.title | |
| holder.itemView.movie_image.load(ImageUrlProvider.posterPathUrl(movie.posterPath)) | |
| } | |
| override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MovieViewHolder { | |
| return MovieViewHolder( |
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 PopularMoviesViewModel @ViewModelInject constructor( | |
| private val repository: MoviesRepository | |
| ) : ViewModel() { | |
| fun getPopularMovies(): Flow<PagingData<Movie>> { | |
| return Pager( | |
| config = PagingConfig(pageSize = PAGE_SIZE, enablePlaceholders = false), | |
| pagingSourceFactory = { PopularMoviesPagingSource(repository) } | |
| ).flow | |
| .cachedIn(viewModelScope) |
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 PopularMoviesPagingSource @Inject constructor( | |
| val movieApiService: MovieApiService | |
| ) : PagingSource<Int, Movie>() { | |
| override suspend fun load(params: LoadParams<Int>): LoadResult<Int, Movie> { | |
| val position = params.key ?: STARTING_INDEX | |
| return try { | |
| val movies = movieApiService.getPopularMovies(position) | |
| LoadResult.Page( | |
| data = movies.results, |
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"?> | |
| <!-- | |
| Google Material Design Color Palette for Android http://www.google.com/design/spec/style/color.html#color-ui-color-palette | |
| Spreadsheet used to create this reosurce - http://bit.ly/mdcolor_spreadsheet | |
| Link to this colors.xml resource file - http://bit.ly/mdcolorsxml | |
| Harshad Kale | |
| https://github.com/kalehv | |
| --> |
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
| val spinnerAdapter = PenaltyReasonSpinnerAdapter(this, penaltyReasonsList!!) | |
| spinnerAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item) | |
| penaltyReasonSpinner.adapter = spinnerAdapter | |
| penaltyReasonSpinner.onItemSelectedListener = this | |
| .... | |
| override fun onItemSelected(parent: AdapterView<*>?, view: View?, position: Int, id: Long) { | |
| // ilk eleman "lütfen seçiniz" şeklinde olduğu için 0. indexi pass geçtik |
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
| # Created by https://www.gitignore.io/api/android,androidstudio | |
| ### Android ### | |
| # Built application files | |
| *.apk | |
| *.ap_ | |
| # Files for the ART/Dalvik VM | |
| *.dex |
NewerOlder