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
| import android.content.res.Resources | |
| import android.graphics.Rect | |
| import android.view.View | |
| import androidx.recyclerview.widget.RecyclerView | |
| class CardStackSpacingItemDecoration : RecyclerView.ItemDecoration() { | |
| private val dp = Resources.getSystem().displayMetrics.density | |
| override fun getItemOffsets(outRect: Rect, view: View, parent: RecyclerView, state: RecyclerView.State) { |
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 WebViewActivity : Activity() { | |
| @SuppressLint("SetJavaScriptEnabled") | |
| public override fun onCreate(savedInstanceState: Bundle?) { | |
| super.onCreate(savedInstanceState) | |
| setContentView(R.layout.activity_webview) | |
| val webView = findViewById<WebView>(R.id.webView) | |
| webView.settings.javaScriptEnabled = true | |
| webView.loadUrl(intent.getStringExtra("url")) |
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
| android { | |
| ... | |
| compileOptions { | |
| sourceCompatibility JavaVersion.VERSION_1_8 | |
| targetCompatibility JavaVersion.VERSION_1_8 | |
| } | |
| } |
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
| package id.ihwan.aac.view | |
| import androidx.appcompat.app.AppCompatActivity | |
| import android.os.Bundle | |
| import androidx.databinding.DataBindingUtil | |
| import androidx.lifecycle.Observer | |
| import androidx.lifecycle.ViewModelProviders | |
| import androidx.recyclerview.widget.LinearLayoutManager | |
| import id.ihwan.aac.R | |
| import id.ihwan.aac.adapter.MainAdapter |
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
| 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() |
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
| 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 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
| 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 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"?> | |
| <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 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"?> | |
| <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 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
| 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 |