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 com.jonrysimbolon.base.adapter | |
import android.view.View | |
import androidx.recyclerview.widget.DiffUtil | |
import androidx.recyclerview.widget.RecyclerView | |
import androidx.recyclerview.widget.RecyclerView.ViewHolder | |
import com.jonrysimbolon.base.model.BaseModel | |
abstract class BaseRecyclerViewAdapter<VH : ViewHolder, T, I: BaseModel<T>> : RecyclerView.Adapter<VH>() { |
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 com.jonrysimbolon.base.adapter | |
import androidx.paging.PagingSource | |
import androidx.paging.PagingState | |
/* | |
class BasePagingSource( | |
private val remote: ApiService, | |
private val idCategory: String, | |
) : PagingSource<Int, MovieModel>() { |
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 com.jonrysimbolon.base.adapter | |
import androidx.paging.PagingDataAdapter | |
import androidx.recyclerview.widget.DiffUtil | |
import androidx.recyclerview.widget.RecyclerView | |
import com.jonrysimbolon.base.model.BaseModel | |
abstract class BasePagingDataAdapter<I, T : BaseModel<I>, VH : RecyclerView.ViewHolder> | |
: PagingDataAdapter<T, VH>(object : DiffUtil.ItemCallback<T>() { | |
override fun areItemsTheSame(oldItem: T, newItem: T): Boolean { |
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"?> | |
<androidx.coordinatorlayout.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent" | |
android:id="@+id/coordinatorLayout"> | |
<com.google.android.material.appbar.AppBarLayout | |
android:id="@+id/app_bar" | |
android:layout_width="match_parent" |
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
According to me, | |
mkdir membuat file tanpa parent nya, sehingga dapat terjadi error akan tetapi beberapa foldernya berhasil terbuat, sedangkan | |
mkdirs membuat file langsung satu set dengan parent nya. | |
jika ada yang ingin menambahkan / memperbaiki, dipersilahkan. | |
agar siapa yang melihat file ini dapat mengerti antara mkdir dan mkdirs. | |
dan juga untuk teman kita yang malas belajar bahasa inggris, supaya paham mengenai mkdir dan mkdirs. |
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 fun screenValue() { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) { | |
val defaultDisplay = | |
DisplayManagerCompat.getInstance(this).getDisplay(Display.DEFAULT_DISPLAY) | |
val displayContext = createDisplayContext(defaultDisplay!!) | |
val width = displayContext.resources.displayMetrics.widthPixels | |
val height = displayContext.resources.displayMetrics.heightPixels |
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
fun changeDate(date: String): String { | |
//val myFormat = "EEEE, dd-MM-yyyy" | |
val dateKom = date.split(", ") | |
val dayStr = dateKom[0] | |
val dateStr = dateKom[1] | |
var showDayDate = "" | |
when (dayStr) { | |
"Monday" -> { | |
showDayDate = "Senin, $dateStr" |
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 fun formatRupiah(number: Double): String { | |
val localeID = Locale("in", "ID") | |
val formatRupiah = NumberFormat.getCurrencyInstance(localeID) | |
return formatRupiah.format(number) | |
} |