Skip to content

Commit 5ea7b93

Browse files
authored
Merge pull request #6 from ENTS-H104/daffa/dev
WOWOWOWOW 🤩🤩✨
2 parents f674610 + 6c791fd commit 5ea7b93

File tree

77 files changed

+1970
-620
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+1970
-620
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Key features include detailed mountain information, secure guide and partner boo
3434
![ViewPager](https://img.shields.io/badge/ViewPager-FF4081?style=for-the-badge&logo=android&logoColor=white)
3535
![DataStore](https://img.shields.io/badge/DataStore-FF6F00?style=for-the-badge&logo=android&logoColor=white)
3636
![Room](https://img.shields.io/badge/Room-007FFF?style=for-the-badge&logo=room&logoColor=white)
37+
![Paging 3](https://img.shields.io/badge/Paging%203-FF6F00?style=for-the-badge&logo=android&logoColor=white)
3738

3839

3940
## 📚 Reference
@@ -43,6 +44,8 @@ Key features include detailed mountain information, secure guide and partner boo
4344
- [ViewPager](https://developer.android.com/training/animation/screen-slide)
4445
- [DataStore](https://developer.android.com/topic/libraries/architecture/datastore)
4546
- [Room](https://developer.android.com/training/data-storage/room/)
47+
- [Paging 3](https://developer.android.com/topic/libraries/architecture/paging/v3-overview)
48+
4649

4750
## 🚩 Issue
4851

app/build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ android {
2020
versionName = "1.0"
2121

2222
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
23+
resValue("string", "google_maps_key", "AIzaSyDsbvczf_2-MgmpGzxjdrMRZPcatQI4bPA")
24+
buildConfigField("String", "BASE_URL", "\"https://highking.cloud/api/\"")
2325
}
2426

2527
buildTypes {
@@ -43,6 +45,7 @@ android {
4345

4446
buildFeatures {
4547
viewBinding = true
48+
buildConfig = true
4649
}
4750
}
4851

@@ -78,11 +81,21 @@ dependencies {
7881
implementation(libs.lifecycle.livedata.ktx)
7982
implementation(libs.androidx.room.runtime)
8083
ksp(libs.room.compiler)
84+
implementation("androidx.room:room-ktx:2.5.2")
8185

8286

8387
// Midtrans Sandbox
8488
implementation("com.midtrans:uikit:2.0.0-SANDBOX")
8589
// Midtrans Production
8690
// implementation("com.midtrans:uikit:2.0.0")
8791

92+
// Barcode
93+
implementation("com.google.zxing:core:3.4.1")
94+
implementation("com.journeyapps:zxing-android-embedded:4.3.0")
95+
96+
//maps
97+
implementation("com.google.android.gms:play-services-maps:18.0.2")
98+
99+
//paging 3
100+
implementation("androidx.paging:paging-runtime-ktx:3.3.0")
88101
}

app/src/main/AndroidManifest.xml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@
33
xmlns:tools="http://schemas.android.com/tools">
44

55
<uses-permission android:name="android.permission.INTERNET" />
6+
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"
7+
android:maxSdkVersion="32"
8+
tools:ignore="ScopedStorage" />
9+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
10+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
11+
612
<application
713
android:allowBackup="true"
814
android:dataExtractionRules="@xml/data_extraction_rules"
@@ -32,6 +38,18 @@
3238
<category android:name="android.intent.category.LAUNCHER" />
3339
</intent-filter>
3440
</activity>
41+
<provider
42+
android:name="androidx.core.content.FileProvider"
43+
android:authorities="${applicationId}.fileprovider"
44+
android:exported="false"
45+
android:grantUriPermissions="true">
46+
<meta-data
47+
android:name="android.support.FILE_PROVIDER_PATHS"
48+
android:resource="@xml/file_paths" />
49+
</provider>
50+
<meta-data
51+
android:name="com.google.android.geo.API_KEY"
52+
android:value="@string/google_maps_key" />
3553
</application>
3654

3755
</manifest>
Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,59 +1,7 @@
11
package com.entsh104.highking
22

3-
import android.os.Bundle
4-
import androidx.fragment.app.Fragment
5-
import android.view.LayoutInflater
6-
import android.view.View
7-
import android.view.ViewGroup
8-
93
// TODO: Rename parameter arguments, choose names that match
104
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
115
private const val ARG_PARAM1 = "param1"
126
private const val ARG_PARAM2 = "param2"
137

14-
/**
15-
* A simple [Fragment] subclass.
16-
* Use the [FragmentCustProfileEdit.newInstance] factory method to
17-
* create an instance of this fragment.
18-
*/
19-
class FragmentCustProfileEdit : Fragment() {
20-
// TODO: Rename and change types of parameters
21-
private var param1: String? = null
22-
private var param2: String? = null
23-
24-
override fun onCreate(savedInstanceState: Bundle?) {
25-
super.onCreate(savedInstanceState)
26-
arguments?.let {
27-
param1 = it.getString(ARG_PARAM1)
28-
param2 = it.getString(ARG_PARAM2)
29-
}
30-
}
31-
32-
override fun onCreateView(
33-
inflater: LayoutInflater, container: ViewGroup?,
34-
savedInstanceState: Bundle?
35-
): View? {
36-
// Inflate the layout for this fragment
37-
return inflater.inflate(R.layout.fragment_cust_profile_edit, container, false)
38-
}
39-
40-
companion object {
41-
/**
42-
* Use this factory method to create a new instance of
43-
* this fragment using the provided parameters.
44-
*
45-
* @param param1 Parameter 1.
46-
* @param param2 Parameter 2.
47-
* @return A new instance of fragment FragmentCustProfileEdit.
48-
*/
49-
// TODO: Rename and change types and number of parameters
50-
@JvmStatic
51-
fun newInstance(param1: String, param2: String) =
52-
FragmentCustProfileEdit().apply {
53-
arguments = Bundle().apply {
54-
putString(ARG_PARAM1, param1)
55-
putString(ARG_PARAM2, param2)
56-
}
57-
}
58-
}
59-
}

app/src/main/java/com/entsh104/highking/data/database/Favorite.kt

Lines changed: 0 additions & 22 deletions
This file was deleted.

app/src/main/java/com/entsh104/highking/data/database/FavoriteDao.kt

Lines changed: 0 additions & 23 deletions
This file was deleted.

app/src/main/java/com/entsh104/highking/data/database/FavoriteRoomDatabase.kt

Lines changed: 0 additions & 30 deletions
This file was deleted.

app/src/main/java/com/entsh104/highking/data/helper/ViewModelFactory.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package com.entsh104.highking.data.helper
33
import android.app.Application
44
import androidx.lifecycle.ViewModel
55
import androidx.lifecycle.ViewModelProvider
6-
import com.entsh104.highking.data.viewmodel.FavoritesViewModel
76

87
class ViewModelFactory private constructor(private val mApplication: Application) :
98
ViewModelProvider.NewInstanceFactory() {
@@ -21,12 +20,4 @@ class ViewModelFactory private constructor(private val mApplication: Application
2120
return INSTANCE as ViewModelFactory
2221
}
2322
}
24-
25-
@Suppress("UNCHECKED_CAST")
26-
override fun <T : ViewModel> create(modelClass: Class<T>): T {
27-
if (modelClass.isAssignableFrom(FavoritesViewModel::class.java)) {
28-
return FavoritesViewModel(mApplication) as T
29-
}
30-
throw IllegalArgumentException("Unknown ViewModel class: ${modelClass.name}")
31-
}
3223
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// data/mapper/MountainMapper.kt
2+
package com.entsh104.highking.data.mapper
3+
4+
import com.entsh104.highking.data.model.MountainResponse
5+
import com.entsh104.highking.data.source.local.entity.MountainEntity
6+
7+
object MountainMapper {
8+
fun mapResponseToEntity(response: MountainResponse, isLoved: Boolean = false): MountainEntity {
9+
return MountainEntity(
10+
mountainId = response.mountainId,
11+
name = response.name,
12+
imageUrl = response.imageUrl,
13+
description = response.description,
14+
height = response.height,
15+
status = response.status,
16+
lat = response.lat,
17+
lon = response.lon,
18+
magmaCategory = response.magmaCategory,
19+
province = response.province,
20+
harga = response.harga,
21+
gmaps = response.gmaps,
22+
totalTripOpen = response.totalTripOpen,
23+
isLoved = isLoved
24+
)
25+
}
26+
27+
fun mapEntityToResponse(entity: MountainEntity): MountainResponse {
28+
return MountainResponse(
29+
mountainId = entity.mountainId,
30+
name = entity.name,
31+
imageUrl = entity.imageUrl,
32+
description = entity.description ?: "",
33+
height = entity.height ?: "",
34+
status = entity.status ?: "",
35+
lat = entity.lat ?: 0.0,
36+
lon = entity.lon ?: 0.0,
37+
magmaCategory = entity.magmaCategory ?: "",
38+
province = entity.province ?: "",
39+
harga = entity.harga ?: 0,
40+
gmaps = entity.gmaps ?: "",
41+
totalTripOpen = entity.totalTripOpen ?: 0
42+
)
43+
}
44+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
// data/mapper/TripMapper.kt
2+
package com.entsh104.highking.data.mapper
3+
4+
import com.entsh104.highking.data.model.TripFilter
5+
import com.entsh104.highking.data.source.local.entity.TripEntity
6+
7+
object TripMapper {
8+
fun mapFilterToEntity(filter: TripFilter): TripEntity {
9+
return TripEntity(
10+
openTripUuid = filter.open_trip_uuid,
11+
name = filter.name,
12+
imageUrl = filter.image_url,
13+
price = filter.price,
14+
mountainName = filter.mountain_name,
15+
mountainUuid = filter.mountain_uuid,
16+
totalParticipants = filter.total_participants,
17+
minPeople = filter.min_people,
18+
maxPeople = filter.max_people
19+
)
20+
}
21+
22+
fun mapEntityToFilter(entity: TripEntity): TripFilter {
23+
return TripFilter(
24+
open_trip_uuid = entity.openTripUuid,
25+
name = entity.name,
26+
image_url = entity.imageUrl,
27+
price = entity.price,
28+
mountain_name = entity.mountainName,
29+
mountain_uuid = entity.mountainUuid,
30+
total_participants = entity.totalParticipants,
31+
min_people = entity.minPeople,
32+
max_people = entity.maxPeople
33+
)
34+
}
35+
}

0 commit comments

Comments
 (0)