Skip to content

Commit

Permalink
📝 code format
Browse files Browse the repository at this point in the history
  • Loading branch information
yoesuv committed Apr 12, 2024
1 parent cf07aca commit 827040e
Show file tree
Hide file tree
Showing 34 changed files with 109 additions and 77 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.yoesuv.infomadiun.databinding.ActivitySplashBinding
import com.yoesuv.infomadiun.main.viewmodels.SplashViewModel

@SuppressLint("CustomSplashScreen")
class SplashActivity: AppCompatActivity() {
class SplashActivity : AppCompatActivity() {

private lateinit var binding: ActivitySplashBinding
private lateinit var viewModel: SplashViewModel
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import com.yoesuv.infomadiun.utils.AdapterCallback
/**
* Updated by yusuf on 26 July 2020.
*/
class GalleryAdapter(val onItemClick:(galleryModel: GalleryModel) -> Unit): ListAdapter<GalleryModel, GalleryViewHolder>(AdapterCallback.diffGalleryCallback) {
class GalleryAdapter(val onItemClick: (galleryModel: GalleryModel) -> Unit) :
ListAdapter<GalleryModel, GalleryViewHolder>(AdapterCallback.diffGalleryCallback) {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): GalleryViewHolder {
return GalleryViewHolder.from(parent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import kotlinx.parcelize.Parcelize
@Entity(tableName = "galleries")
@Parcelize
data class GalleryModel(
@PrimaryKey(autoGenerate = true) val id: Int,
@SerializedName("caption") @Expose val caption:String?,
@SerializedName("thumbnail") @Expose val thumbnail:String?,
@SerializedName("image") @Expose val image:String?
): Parcelable
@PrimaryKey(autoGenerate = true) val id: Int,
@SerializedName("caption") @Expose val caption: String?,
@SerializedName("thumbnail") @Expose val thumbnail: String?,
@SerializedName("image") @Expose val image: String?
) : Parcelable
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ import androidx.lifecycle.ViewModel
import androidx.databinding.ObservableField
import com.yoesuv.infomadiun.menu.gallery.models.GalleryModel

class ItemGalleryViewModel(galleryModel: GalleryModel): ViewModel() {
class ItemGalleryViewModel(galleryModel: GalleryModel) : ViewModel() {
var imageUrl: ObservableField<String> = ObservableField(galleryModel.thumbnail)
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.yoesuv.infomadiun.utils.AdapterCallback
/**
* Updated by yusuf on 26 July 2020.
*/
class ListPlaceAdapter(val onItemClick:(PlaceModel) -> Unit): ListAdapter<PlaceModel, PlaceViewHolder>(AdapterCallback.diffPlaceCallback) {
class ListPlaceAdapter(val onItemClick: (PlaceModel) -> Unit) : ListAdapter<PlaceModel, PlaceViewHolder>(AdapterCallback.diffPlaceCallback) {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): PlaceViewHolder {
return PlaceViewHolder.from(parent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,11 @@ import kotlinx.parcelize.Parcelize
@Entity(tableName = "places")
@Parcelize
data class PlaceModel(
@PrimaryKey(autoGenerate = true) val id: Int,
@SerializedName("nama") @Expose val name:String?,
@SerializedName("lokasi") @Expose val location:String?,
@SerializedName("kategori") @Expose val category:String?,
@SerializedName("deskripsi") @Expose val description:String?,
@SerializedName("thumbnail") @Expose val thumbnail:String?,
@SerializedName("gambar") @Expose val image:String?): Parcelable
@PrimaryKey(autoGenerate = true) val id: Int,
@SerializedName("nama") @Expose val name: String?,
@SerializedName("lokasi") @Expose val location: String?,
@SerializedName("kategori") @Expose val category: String?,
@SerializedName("deskripsi") @Expose val description: String?,
@SerializedName("thumbnail") @Expose val thumbnail: String?,
@SerializedName("gambar") @Expose val image: String?
) : Parcelable
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class FragmentListPlaceViewModel(application: Application) : AndroidViewModel(ap

var listPlace: MutableLiveData<List<PlaceModel>> = MutableLiveData()

fun getListPlace(placeLocation: PlaceLocation){
fun getListPlace(placeLocation: PlaceLocation) {
if (placeLocation == PlaceLocation.ALL) {
dbPlaceRepository.places {
listPlace.postValue(it)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import androidx.lifecycle.ViewModel
import androidx.databinding.ObservableField
import com.yoesuv.infomadiun.menu.listplace.models.PlaceModel

class ItemListPlaceViewModel(placeModel: PlaceModel): ViewModel() {
class ItemListPlaceViewModel(placeModel: PlaceModel) : ViewModel() {

var name: ObservableField<String> = ObservableField(placeModel.name)
var location: ObservableField<String> = ObservableField(placeModel.location)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import com.yoesuv.infomadiun.databinding.ActivityDetailListplaceBinding
import com.yoesuv.infomadiun.menu.listplace.viewmodels.DetailListPlaceViewModel
import com.yoesuv.infomadiun.utils.binding.ViewModelFactory

class DetailListPlaceActivity: AppCompatActivity() {
class DetailListPlaceActivity : AppCompatActivity() {

private lateinit var binding: ActivityDetailListplaceBinding
private val viewModel: DetailListPlaceViewModel by viewModels { ViewModelFactory(args.placeModel) }
Expand All @@ -28,13 +28,13 @@ class DetailListPlaceActivity: AppCompatActivity() {
}

override fun onOptionsItemSelected(item: MenuItem): Boolean {
if (item.itemId==android.R.id.home) {
if (item.itemId == android.R.id.home) {
onBackPressedDispatcher.onBackPressed()
}
return super.onOptionsItemSelected(item)
}

private fun setupToolbar(){
private fun setupToolbar() {
setSupportActionBar(binding.toolbarDetailListPlace.toolbarInclude)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
supportActionBar?.setDisplayShowTitleEnabled(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.yoesuv.infomadiun.R
import com.yoesuv.infomadiun.databinding.CustomInfoWindowBinding
import com.yoesuv.infomadiun.menu.maps.models.MarkerTag

class MyCustomInfoWindowAdapter(private val context: Context?): GoogleMap.InfoWindowAdapter {
class MyCustomInfoWindowAdapter(private val context: Context?) : GoogleMap.InfoWindowAdapter {

private val binding = CustomInfoWindowBinding.inflate(LayoutInflater.from(context))

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package com.yoesuv.infomadiun.menu.maps.models

class MarkerTag(val title:String, val type:Int, val latitude:Double?, val longitude:Double?)
class MarkerTag(val title: String, val type: Int, val latitude: Double?, val longitude: Double?)
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import com.google.gson.annotations.SerializedName
@Keep
@Entity(tableName = "pins")
data class PinModel(
@PrimaryKey(autoGenerate = true) val id:Int?,
@SerializedName("name") @Expose val name:String?,
@SerializedName("lokasi") @Expose val location:Int?,
@SerializedName("latitude") val latitude:Double?,
@SerializedName("longitude") val longitude:Double?,
@SerializedName("image") @Expose val image:String?
@PrimaryKey(autoGenerate = true) val id: Int?,
@SerializedName("name") @Expose val name: String?,
@SerializedName("lokasi") @Expose val location: Int?,
@SerializedName("latitude") val latitude: Double?,
@SerializedName("longitude") val longitude: Double?,
@SerializedName("image") @Expose val image: String?
)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class FragmentMapsViewModel(application: Application) : AndroidViewModel(applica

var listPin: MutableLiveData<List<PinModel>> = MutableLiveData()

fun getListPin(){
fun getListPin() {
dbPin.pins {
listPin.postValue(it)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import com.yoesuv.infomadiun.App
import com.yoesuv.infomadiun.R
import com.yoesuv.infomadiun.menu.maps.models.MarkerTag

class MyLocationCallback(private val googleMap: GoogleMap?) : LocationCallback(){
class MyLocationCallback(private val googleMap: GoogleMap?) : LocationCallback() {

private var markerUser: Marker? = null

override fun onLocationResult(locationResult: LocationResult) {
super.onLocationResult(locationResult)
val listLocation = locationResult.locations
if (listLocation.isNotEmpty()){
if (listLocation.isNotEmpty()) {
val markerOpt = MarkerOptions()
markerOpt.position(LatLng(listLocation[0].latitude, listLocation[0].longitude))
markerOpt.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_user_position))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import com.yoesuv.infomadiun.menu.other.adapters.viewholders.ChangeLogViewHolder
import com.yoesuv.infomadiun.menu.other.models.ChangeLogModel
import com.yoesuv.infomadiun.utils.AdapterCallback

class ChangeLogAdapter: ListAdapter<ChangeLogModel, ChangeLogViewHolder>
(AdapterCallback.diffChangeLogCallback){
class ChangeLogAdapter : ListAdapter<ChangeLogModel, ChangeLogViewHolder>
(AdapterCallback.diffChangeLogCallback) {

override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ChangeLogViewHolder {
return ChangeLogViewHolder.from(parent)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.yoesuv.infomadiun.databinding.ItemChangelogBinding
import com.yoesuv.infomadiun.menu.other.models.ChangeLogModel
import com.yoesuv.infomadiun.menu.other.viewmodels.ItemChangeLogViewModel

class ChangeLogViewHolder(val binding: ItemChangelogBinding): RecyclerView.ViewHolder(binding.root) {
class ChangeLogViewHolder(val binding: ItemChangelogBinding) : RecyclerView.ViewHolder(binding.root) {

fun bind(changeLogModel: ChangeLogModel) {
binding.itemChangelog = ItemChangeLogViewModel(changeLogModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import com.yoesuv.infomadiun.databinding.ItemLibrariesBinding
import com.yoesuv.infomadiun.menu.other.models.LicenseModel
import com.yoesuv.infomadiun.menu.other.viewmodels.ItemLibrariesViewModel

class LicenseViewHolder(val binding: ItemLibrariesBinding): RecyclerView.ViewHolder(binding.root) {
class LicenseViewHolder(val binding: ItemLibrariesBinding) : RecyclerView.ViewHolder(binding.root) {

fun bind(licenseModel: LicenseModel) {
binding.itemLibraries = ItemLibrariesViewModel(licenseModel)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import com.google.errorprone.annotations.Keep

@Keep
data class ChangeLogModel(
val title: String?,
val description: String?,
val isLast: Boolean?
val title: String?,
val description: String?,
val isLast: Boolean?
)
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import com.google.errorprone.annotations.Keep

@Keep
data class LicenseModel(
val title: String?,
val url: String?,
val license: String?,
val isLast: Boolean?
val title: String?,
val url: String?,
val license: String?,
val isLast: Boolean?
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import android.content.Context
import com.yoesuv.infomadiun.R
import com.yoesuv.infomadiun.menu.other.models.ChangeLogModel

class ChildFragmentChangelogViewModel: ViewModel() {
class ChildFragmentChangelogViewModel : ViewModel() {

private var listChangelog: MutableList<ChangeLogModel> = mutableListOf()
var listData: MutableLiveData<MutableList<ChangeLogModel>> = MutableLiveData()

fun setupData(context: Context?){
fun setupData(context: Context?) {
listChangelog.clear()
listChangelog.add(ChangeLogModel(context?.getString(R.string.ver_15), context?.getString(R.string.ver_15_info), false))
listChangelog.add(ChangeLogModel(context?.getString(R.string.ver_14), context?.getString(R.string.ver_14_info), false))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,25 +6,50 @@ import android.content.Context
import com.yoesuv.infomadiun.R
import com.yoesuv.infomadiun.menu.other.models.LicenseModel

class ChildFragmentLibrariesViewModel: ViewModel() {
class ChildFragmentLibrariesViewModel : ViewModel() {

private var listLibraries: MutableList<LicenseModel> = mutableListOf()
var listData: MutableLiveData<MutableList<LicenseModel>> = MutableLiveData()

fun setupData(context: Context?){
fun setupData(context: Context?) {
listLibraries.clear()
val icons8 = LicenseModel(context?.getString(R.string.icons8), context?.getString(R.string.icons8_url), context?.getString(R.string.icons8_license), false)
val retrofit = LicenseModel(context?.getString(R.string.retrofit), context?.getString(R.string.retrofit_url), context?.getString(R.string.retrofit_license), false)
val icons8 =
LicenseModel(context?.getString(R.string.icons8), context?.getString(R.string.icons8_url), context?.getString(R.string.icons8_license), false)
val retrofit =
LicenseModel(context?.getString(R.string.retrofit), context?.getString(R.string.retrofit_url), context?.getString(R.string.retrofit_license), false)
val glide = LicenseModel(context?.getString(R.string.glide), context?.getString(R.string.glide_url), context?.getString(R.string.glide_license), false)
val photoView = LicenseModel(context?.getString(R.string.photoview), context?.getString(R.string.photoview_url), context?.getString(R.string.photoview_license), false)
val toasty = LicenseModel(context?.getString(R.string.toasty), context?.getString(R.string.toasty_url), context?.getString(R.string.toasty_license), true)
val googleDirection = LicenseModel(context?.getString(R.string.google_direction), context?.getString(R.string.google_direction_url), context?.getString(R.string.google_direction_license), false)
val sdp = LicenseModel(context?.getString(R.string.sdp_android), context?.getString(R.string.sdp_android_url), context?.getString(R.string.sdp_android_license), false)
val ssp = LicenseModel(context?.getString(R.string.ssp_android), context?.getString(R.string.ssp_android_url), context?.getString(R.string.sdp_android_license), false)
val okhttp = LicenseModel(context?.getString(R.string.okhttp), context?.getString(R.string.okhttp_url), context?.getString(R.string.okhttp_license), false)
val photoView = LicenseModel(
context?.getString(R.string.photoview),
context?.getString(R.string.photoview_url),
context?.getString(R.string.photoview_license),
false
)
val toasty =
LicenseModel(context?.getString(R.string.toasty), context?.getString(R.string.toasty_url), context?.getString(R.string.toasty_license), true)
val googleDirection = LicenseModel(
context?.getString(R.string.google_direction),
context?.getString(R.string.google_direction_url),
context?.getString(R.string.google_direction_license),
false
)
val sdp = LicenseModel(
context?.getString(R.string.sdp_android),
context?.getString(R.string.sdp_android_url),
context?.getString(R.string.sdp_android_license),
false
)
val ssp = LicenseModel(
context?.getString(R.string.ssp_android),
context?.getString(R.string.ssp_android_url),
context?.getString(R.string.sdp_android_license),
false
)
val okhttp =
LicenseModel(context?.getString(R.string.okhttp), context?.getString(R.string.okhttp_url), context?.getString(R.string.okhttp_license), false)
val aosp = LicenseModel(context?.getString(R.string.aosp), context?.getString(R.string.aosp_url), context?.getString(R.string.aosp_license), false)
val gson = LicenseModel(context?.getString(R.string.gson), context?.getString(R.string.gson_url), context?.getString(R.string.gson_license), false)
val dexcount = LicenseModel(context?.getString(R.string.dexcount), context?.getString(R.string.dexcount_url), context?.getString(R.string.dexcount_license), false)
val dexcount =
LicenseModel(context?.getString(R.string.dexcount), context?.getString(R.string.dexcount_url), context?.getString(R.string.dexcount_license), false)

listLibraries.add(aosp)
listLibraries.add(googleDirection)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.databinding.ObservableField
import com.yoesuv.infomadiun.menu.other.models.ChangeLogModel
import com.yoesuv.infomadiun.utils.AppHelper

class ItemChangeLogViewModel(changeLogModel: ChangeLogModel): ViewModel() {
class ItemChangeLogViewModel(changeLogModel: ChangeLogModel) : ViewModel() {

var name: ObservableField<String> = ObservableField(changeLogModel.title!!)
var description: ObservableField<String> = ObservableField(AppHelper.fromHtml(changeLogModel.description!!))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import androidx.databinding.ObservableField
import com.yoesuv.infomadiun.menu.other.models.LicenseModel
import com.yoesuv.infomadiun.utils.AppHelper

class ItemLibrariesViewModel(licenseModel: LicenseModel): ViewModel() {
class ItemLibrariesViewModel(licenseModel: LicenseModel) : ViewModel() {

var name: ObservableField<String> = ObservableField(licenseModel.title!!)
var url: ObservableField<String> = ObservableField(licenseModel.url!!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import com.yoesuv.infomadiun.databinding.ChildFragmentChangelogBinding
import com.yoesuv.infomadiun.menu.other.adapters.ChangeLogAdapter
import com.yoesuv.infomadiun.menu.other.viewmodels.ChildFragmentChangelogViewModel

class ChildFragmentChangelog: Fragment() {
class ChildFragmentChangelog : Fragment() {

companion object {
fun getInstance(): Fragment {
Expand All @@ -39,7 +39,7 @@ class ChildFragmentChangelog: Fragment() {
return binding.root
}

private fun setupRecycler(){
private fun setupRecycler() {
binding.recyclerViewChangelog.layoutManager = LinearLayoutManager(context)
adapter = ChangeLogAdapter()
binding.recyclerViewChangelog.adapter = adapter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.yoesuv.infomadiun.BuildConfig
import com.yoesuv.infomadiun.R
import com.yoesuv.infomadiun.databinding.ChildFragmentInfoBinding

class ChildFragmentInfo: Fragment() {
class ChildFragmentInfo : Fragment() {

companion object {
fun getInstance(): Fragment {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import com.yoesuv.infomadiun.databinding.ChildFragmentLibrariesBinding
import com.yoesuv.infomadiun.menu.other.adapters.LicenseAdapter
import com.yoesuv.infomadiun.menu.other.viewmodels.ChildFragmentLibrariesViewModel

class ChildFragmentLibraries: Fragment() {
class ChildFragmentLibraries : Fragment() {

companion object {
fun getInstance(): Fragment {
Expand All @@ -37,7 +37,7 @@ class ChildFragmentLibraries: Fragment() {
return binding.root
}

private fun setupRecycler(){
private fun setupRecycler() {
adapter = LicenseAdapter()
binding.recyclerViewLicense.adapter = adapter
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import com.yoesuv.infomadiun.R
import com.yoesuv.infomadiun.databinding.ChildFragmentThanksBinding
import com.yoesuv.infomadiun.utils.AppHelper

class ChildFragmentThanks: Fragment(){
class ChildFragmentThanks : Fragment() {

companion object {
fun getInstance(): Fragment {
Expand Down
Loading

0 comments on commit 827040e

Please sign in to comment.