-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
37 changed files
with
565 additions
and
162 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
common/src/main/java/id/synrgy6team2/bookingticket/common/ParcelableExt.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package id.synrgy6team2.bookingticket.common | ||
|
||
import android.content.Intent | ||
import android.os.Build.VERSION.SDK_INT | ||
import android.os.Parcelable | ||
|
||
inline fun <reified T : Parcelable> Intent.parcelable(key: String): T? = when { | ||
SDK_INT >= 33 -> getParcelableExtra(key, T::class.java) | ||
else -> @Suppress("DEPRECATION") getParcelableExtra(key) as? T | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<vector xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:width="647.64dp" | ||
android:height="632.17dp" | ||
android:viewportWidth="647.64" | ||
android:viewportHeight="632.17"> | ||
<path | ||
android:pathData="M411.15,142.17L236.64,142.17a15.02,15.02 0,0 0,-15 15v387.85l-2,0.61 -42.81,13.11a8.01,8.01 0,0 1,-9.99 -5.31L39.5,137.48a8,8 0,0 1,5.31 -9.99l65.97,-20.2 191.25,-58.54 65.97,-20.2a7.99,7.99 0,0 1,9.99 5.3l32.55,106.32Z" | ||
android:fillColor="@color/neutral_01"/> | ||
<path | ||
android:pathData="M449.23,140.17l-39.23,-128.14a16.99,16.99 0,0 0,-21.23 -11.28l-92.75,28.39L104.78,87.69l-92.75,28.4a17.02,17.02 0,0 0,-11.28 21.23l134.08,437.93a17.03,17.03 0,0 0,16.26 12.03,16.79 16.79,0 0,0 4.97,-0.75l63.58,-19.46 2,-0.62v-2.09l-2,0.61 -64.17,19.65a15.01,15.01 0,0 1,-18.73 -9.95l-134.07,-437.94a14.98,14.98 0,0 1,9.95 -18.73l92.75,-28.4 191.24,-58.54 92.75,-28.4a15.16,15.16 0,0 1,4.41 -0.66,15.01 15.01,0 0,1 14.32,10.61l39.05,127.56 0.62,2h2.08Z" | ||
android:fillColor="@color/primary_dark_blue"/> | ||
<path | ||
android:pathData="M122.68,127.82a9.02,9.02 0,0 1,-8.61 -6.37l-12.88,-42.07a9,9 0,0 1,5.97 -11.24l175.94,-53.86a9.01,9.01 0,0 1,11.24 5.97l12.88,42.07a9.01,9.01 0,0 1,-5.97 11.24L125.31,127.43A8.98,8.98 0,0 1,122.68 127.82Z" | ||
android:fillColor="#0064ff"/> | ||
<path | ||
android:pathData="M190.15,24.95m-20,0a20,20 0,1 1,40 0a20,20 0,1 1,-40 0" | ||
android:fillColor="#0064ff"/> | ||
<path | ||
android:pathData="M190.15,24.95m-12.66,0a12.66,12.66 0,1 1,25.33 0a12.66,12.66 0,1 1,-25.33 0" | ||
android:fillColor="#fff"/> | ||
<path | ||
android:pathData="M602.64,582.17h-338a8.51,8.51 0,0 1,-8.5 -8.5v-405a8.51,8.51 0,0 1,8.5 -8.5h338a8.51,8.51 0,0 1,8.5 8.5v405A8.51,8.51 0,0 1,602.64 582.17Z" | ||
android:fillColor="@color/neutral_01"/> | ||
<path | ||
android:pathData="M447.14,140.17h-210.5a17.02,17.02 0,0 0,-17 17v407.8l2,-0.61v-407.19a15.02,15.02 0,0 1,15 -15L447.76,142.17ZM630.64,140.17h-394a17.02,17.02 0,0 0,-17 17v458a17.02,17.02 0,0 0,17 17h394a17.02,17.02 0,0 0,17 -17v-458A17.02,17.02 0,0 0,630.64 140.17ZM645.64,615.17a15.02,15.02 0,0 1,-15 15h-394a15.02,15.02 0,0 1,-15 -15v-458a15.02,15.02 0,0 1,15 -15h394a15.02,15.02 0,0 1,15 15Z" | ||
android:fillColor="@color/primary_dark_blue"/> | ||
<path | ||
android:pathData="M525.64,184.17h-184a9.01,9.01 0,0 1,-9 -9v-44a9.01,9.01 0,0 1,9 -9h184a9.01,9.01 0,0 1,9 9v44A9.01,9.01 0,0 1,525.64 184.17Z" | ||
android:fillColor="#0064ff"/> | ||
<path | ||
android:pathData="M433.64,105.17m-20,0a20,20 0,1 1,40 0a20,20 0,1 1,-40 0" | ||
android:fillColor="#0064ff"/> | ||
<path | ||
android:pathData="M433.64,105.17m-12.18,0a12.18,12.18 0,1 1,24.36 0a12.18,12.18 0,1 1,-24.36 0" | ||
android:fillColor="#fff"/> | ||
</vector> |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
plugins { | ||
id("com.android.library") | ||
id("org.jetbrains.kotlin.android") | ||
id("kotlin-parcelize") | ||
} | ||
|
||
android { | ||
|
11 changes: 7 additions & 4 deletions
11
domain/src/main/java/id/synrgy6team2/bookingticket/domain/model/TicketRequestModel.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
package id.synrgy6team2.bookingticket.domain.model | ||
|
||
import android.os.Parcelable | ||
import kotlinx.parcelize.Parcelize | ||
|
||
@Parcelize | ||
data class TicketRequestModel( | ||
val classId: Int? = null, | ||
val dataPerPage: Int? = null, | ||
val passenger: Passenger? = null, | ||
val departureCode: String? = null, | ||
val sortBy: List<String?>? = null, | ||
val page: Int? = null, | ||
val departureDateStart: String? = null, | ||
val arrivalCode: String? = null, | ||
val departureDateEnd: String? = null, | ||
val airlineId: List<Long?>? = null | ||
) { | ||
) : Parcelable { | ||
@Parcelize | ||
data class Passenger( | ||
val adult: Int? = null, | ||
val infant: Int? = null, | ||
val child: Int? = null | ||
) | ||
) : Parcelable | ||
} | ||
|
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
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
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
17 changes: 16 additions & 1 deletion
17
presentation/src/main/java/id/synrgy6team2/bookingticket/presentation/BookingActivity.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,26 @@ | ||
package id.synrgy6team2.bookingticket.presentation | ||
|
||
import android.content.Intent | ||
import androidx.appcompat.app.AppCompatActivity | ||
import android.os.Bundle | ||
import id.synrgy6team2.bookingticket.presentation.databinding.ActivityBookingBinding | ||
|
||
class BookingActivity : AppCompatActivity() { | ||
|
||
private lateinit var binding: ActivityBookingBinding | ||
|
||
override fun onCreate(savedInstanceState: Bundle?) { | ||
super.onCreate(savedInstanceState) | ||
setContentView(R.layout.activity_booking) | ||
binding = ActivityBookingBinding.inflate(layoutInflater) | ||
setContentView(binding.root) | ||
|
||
binding.materialToolbar.setNavigationOnClickListener { | ||
finish() | ||
} | ||
|
||
binding.btnContinue.setOnClickListener { | ||
val intent = Intent(this, PaymentActivity::class.java) | ||
startActivity(intent) | ||
} | ||
} | ||
} |
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
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
37 changes: 37 additions & 0 deletions
37
presentation/src/main/java/id/synrgy6team2/bookingticket/presentation/MainViewModel.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package id.synrgy6team2.bookingticket.presentation | ||
|
||
import androidx.lifecycle.LiveData | ||
import androidx.lifecycle.ViewModel | ||
import androidx.lifecycle.viewModelScope | ||
import dagger.hilt.android.lifecycle.HiltViewModel | ||
import id.synrgy6team2.bookingticket.common.LiveEvent | ||
import id.synrgy6team2.bookingticket.common.State | ||
import id.synrgy6team2.bookingticket.domain.repository.AuthenticationUseCase | ||
import kotlinx.coroutines.Dispatchers | ||
import kotlinx.coroutines.launch | ||
import kotlinx.coroutines.withContext | ||
import javax.inject.Inject | ||
|
||
@HiltViewModel | ||
class MainViewModel @Inject constructor( | ||
private val authenticationUseCase: AuthenticationUseCase | ||
) : ViewModel() { | ||
private var _verify: LiveEvent<State<Unit>> = LiveEvent() | ||
|
||
val verify: LiveData<State<Unit>> = _verify | ||
|
||
fun verify(token: String?) { | ||
val dataToken = token ?: "-1" | ||
viewModelScope.launch { | ||
try { | ||
_verify.postValue(State.Loading()) | ||
withContext(Dispatchers.IO) { | ||
authenticationUseCase.executeVerify(dataToken.toInt()) | ||
} | ||
_verify.postValue(State.Success(Unit)) | ||
} catch (e: Exception) { | ||
_verify.postValue(State.Error(null, e.message.toString())) | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.