This file contains 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
package id.ihwan.aac.network | |
import okhttp3.OkHttpClient | |
import okhttp3.logging.HttpLoggingInterceptor | |
import retrofit2.Retrofit | |
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory | |
import retrofit2.converter.gson.GsonConverterFactory | |
object ApiFactory { | |
fun create(): ApiInterface{ |
This file contains 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
interface ApiInterface { | |
@GET("upcoming?api_key=78adf61cd991fec888c055105c148a44") | |
fun getMovie(): Observable<MovieResponse> | |
} |
This file contains 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
package id.ihwan.aac.network | |
import io.reactivex.Observer | |
import io.reactivex.disposables.CompositeDisposable | |
import io.reactivex.disposables.Disposable | |
abstract class ApiObserver<T> constructor(private val compositeDisposable: CompositeDisposable): Observer<T> { | |
override fun onComplete() { | |
} |
This file contains 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
package id.ihwan.aac.network | |
import id.ihwan.aac.model.MovieResponse | |
import io.reactivex.android.schedulers.AndroidSchedulers | |
import io.reactivex.disposables.CompositeDisposable | |
import io.reactivex.schedulers.Schedulers | |
class MainRepository { | |
private val apiService = ApiFactory.create() | |
private val compositeDisposable = CompositeDisposable() |
This file contains 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
package id.ihwan.aac.adapter | |
import android.content.Context | |
import android.view.LayoutInflater | |
import android.view.ViewGroup | |
import androidx.databinding.DataBindingUtil | |
import androidx.recyclerview.widget.RecyclerView | |
import id.ihwan.aac.R | |
import id.ihwan.aac.databinding.ItemMovieBinding | |
import id.ihwan.aac.model.Movie |
This file contains 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"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools" | |
xmlns:app="http://schemas.android.com/apk/res-auto"> | |
<data> | |
<variable | |
name="itemMovie" | |
type="id.ihwan.aac.viewmodel.ItemMovieViewModel"/> | |
</data> |
This file contains 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"?> | |
<layout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:tools="http://schemas.android.com/tools"> | |
<data> | |
<variable | |
name="main" | |
type="id.ihwan.aac.viewmodel.MainViewModel"/> | |
</data> |
This file contains 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
package id.ihwan.aac.utils | |
import android.widget.ImageView | |
import androidx.databinding.BindingAdapter | |
import com.squareup.picasso.Picasso | |
class BindingAdapter { | |
companion object { | |
@JvmStatic |
This file contains 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
package id.ihwan.aac.viewmodel | |
import android.app.Application | |
import androidx.lifecycle.AndroidViewModel | |
import androidx.lifecycle.MutableLiveData | |
import id.ihwan.aac.model.MovieResponse | |
import id.ihwan.aac.network.MainRepository | |
class MainViewModel(application: Application): AndroidViewModel(application) { |
This file contains 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
package id.ihwan.aac.viewmodel | |
import androidx.databinding.ObservableField | |
import androidx.lifecycle.ViewModel | |
import id.ihwan.aac.model.Movie | |
class ItemMovieViewModel(model: Movie): ViewModel() { | |
var title: ObservableField<String> = ObservableField() | |
var overview: ObservableField<String> = ObservableField() | |
var poster: ObservableField<String> = ObservableField() |