path
stringlengths 4
297
| contentHash
stringlengths 1
10
| content
stringlengths 0
13M
|
---|---|---|
callastro/app/src/main/java/com/callastro/model/LanguageResponse.kt | 1793718642 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class LanguageResponse(
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<LanguageResponseData> = arrayListOf()
)
data class LanguageResponseData(
@SerializedName("id" ) var id : Int? = null,
@SerializedName("language" ) var language : String? = null
) |
callastro/app/src/main/java/com/callastro/model/GiveReviewResponse.kt | 481414024 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class GiveReviewResponse(
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : String? = null
)
|
callastro/app/src/main/java/com/callastro/model/GetAddedExpertiseResponse.kt | 2868350370 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class GetAddedExpertiseResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<GetAddedExpertiseData> = arrayListOf()
)
data class GetAddedExpertiseData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("expertise_name" ) var expertiseName : String? = null
) |
callastro/app/src/main/java/com/callastro/model/GetAddedLanguageResponse.kt | 4181232954 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class GetAddedLanguageResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<GetAddedLanguageData> = arrayListOf()
)
data class GetAddedLanguageData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("language_name" ) var languageName : String? = null
) |
callastro/app/src/main/java/com/callastro/model/DeleteSkillsItemResponse.kt | 2534121557 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class DeleteSkillsItemResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : String? = null
)
|
callastro/app/src/main/java/com/callastro/model/AddExpertiseItemResponse.kt | 3826615967 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class AddExpertiseItemResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<AddExpertiseItemData> = arrayListOf()
)
data class AddExpertiseItemData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("expertise_name" ) var expertiseName : String? = null
) |
callastro/app/src/main/java/com/callastro/model/AstroEarningResponse.kt | 3194114076 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class AstroEarningResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : AstroEarningData? = AstroEarningData()
)
data class AstroEarningTransactionHistory (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("transaction" ) var transaction : String? = null,
@SerializedName("user_name" ) var userName : String? = null,
@SerializedName("amount" ) var amount : String? = null,
@SerializedName("pay_date" ) var payDate : String? = null
)
data class AstroEarningData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("wallet" ) var wallet : String? = null,
@SerializedName("remainig" ) var remainig : String? = null,
@SerializedName("withdrawal" ) var withdrawal : String? = null,
@SerializedName("transaction_history" ) var transactionHistory : ArrayList<AstroEarningTransactionHistory> = arrayListOf()
) |
callastro/app/src/main/java/com/callastro/model/ConfirmationReportHistoryResponse.kt | 3964921961 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class ConfirmationReportHistoryResponse(
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ConfirmationReportHistoryResponseData? = ConfirmationReportHistoryResponseData()
)
data class ConfirmationReportHistoryResponseData(
@SerializedName("id" ) var id : Int? = null,
@SerializedName("user_id" ) var userId : Int? = null,
@SerializedName("astro_id" ) var astroId : Int? = null,
@SerializedName("language_id" ) var languageId : String? = null,
@SerializedName("report_id" ) var reportId : Int? = null,
@SerializedName("full_name" ) var fullName : String? = null,
@SerializedName("gender" ) var gender : String? = null,
@SerializedName("dob" ) var dob : String? = null,
@SerializedName("birth_time" ) var birthTime : String? = null,
@SerializedName("place_birth" ) var placeBirth : String? = null,
@SerializedName("occupation" ) var occupation : String? = null,
@SerializedName("maritial_status" ) var maritialStatus : String? = null,
@SerializedName("topic_consultation" ) var topicConsultation : String? = null,
@SerializedName("created_at" ) var createdAt : String? = null,
@SerializedName("updated_at" ) var updatedAt : String? = null
) |
callastro/app/src/main/java/com/callastro/model/GetAstroRatingReviewPinResponse.kt | 1313119953 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class GetAstroRatingReviewPinResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<GetAstroRatingReviewPinData> = arrayListOf()
)
data class GetAstroRatingReviewPinData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("rating" ) var rating : String? = null,
@SerializedName("reveiw" ) var reveiw : String? = null,
@SerializedName("user_name" ) var userName : String? = null,
@SerializedName("profile" ) var profile : String? = null,
@SerializedName("pin" ) var pin : Int? = null
) |
callastro/app/src/main/java/com/callastro/model/SkillsListResponse.kt | 574058212 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class SkillsListResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<SkillsListData> = arrayListOf()
)
data class SkillsListData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("skill_name" ) var skillName : String? = null
) |
callastro/app/src/main/java/com/callastro/model/ConfirmationBookingResponse.kt | 2712880077 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class ConfirmationBookingResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<ConfirmationBookingData> = arrayListOf()
)
data class ConfirmationBookingData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("user_detail_id" ) var userDetailId : Int? = null,
@SerializedName("type" ) var type : Int? = null,
@SerializedName("user_id" ) var userId : Int? = null,
@SerializedName("astro_id" ) var astroId : Int? = null,
@SerializedName("language_id" ) var languageId : Int? = null,
@SerializedName("request_status" ) var requestStatus : Int? = null,
@SerializedName("reason" ) var reason : String? = null,
@SerializedName("comment" ) var comment : String? = null,
@SerializedName("created_at" ) var createdAt : String? = null,
@SerializedName("updated_at" ) var updatedAt : String? = null,
@SerializedName("user_name" ) var userName : String? = null,
@SerializedName("mobile_no" ) var mobileNo : String? = null,
@SerializedName("language" ) var language : String? = null,
@SerializedName("profile" ) var profile : String? = null,
@SerializedName("unique_id" ) var uniqueId : String? = null,
@SerializedName("active_status" ) var active_status : Int? = null,
@SerializedName("fix_session" ) var fix_session : String? = null
) |
callastro/app/src/main/java/com/callastro/model/ViewProfileResponse.kt | 1352114967 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class ViewProfileResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ViewProfileResponseData? = ViewProfileResponseData()
)
data class ViewProfileResponseData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("type" ) var type : Int? = null,
@SerializedName("name" ) var name : String? = null,
@SerializedName("email" ) var email : String? = null,
@SerializedName("mobile_no" ) var mobileNo : String? = null,
@SerializedName("company_name" ) var companyName : String? = null,
@SerializedName("calling_charg" ) var calling_charg : String? = null,
@SerializedName("profile" ) var profile : String? = null,
@SerializedName("wallet" ) var wallet : String? = null,
@SerializedName("gender" ) var gender : Int? = null,
@SerializedName("dob" ) var dob : String? = null,
@SerializedName("address" ) var address : String? = null,
@SerializedName("state" ) var state : Int? = null,
@SerializedName("city" ) var city : Int? = null,
@SerializedName("pincode" ) var pincode : String? = null,
@SerializedName("document1" ) var document1 : String? = null,
@SerializedName("document2" ) var document2 : String? = null,
@SerializedName("otp" ) var otp : String? = null,
@SerializedName("about_us" ) var aboutUs : String? = null,
@SerializedName("experence_id" ) var experenceId : Int? = null,
@SerializedName("birth_time" ) var birthTime : String? = null,
@SerializedName("birth_place" ) var birthPlace : String? = null,
@SerializedName("is_chat" ) var isChat : Int? = null,
@SerializedName("is_audio_call" ) var isAudioCall : Int? = null,
@SerializedName("is_video_call" ) var isVideoCall : Int? = null,
@SerializedName("is_live" ) var isLive : Int? = null,
@SerializedName("status" ) var status : Int? = null,
@SerializedName("login_status" ) var loginStatus : Int? = null,
@SerializedName("is_deleted" ) var isDeleted : Int? = null,
@SerializedName("email_verified_at" ) var emailVerifiedAt : String? = null,
@SerializedName("password" ) var password : String? = null,
@SerializedName("api_token" ) var apiToken : String? = null,
@SerializedName("remember_token" ) var rememberToken : String? = null,
@SerializedName("latitude" ) var latitude : String? = null,
@SerializedName("longtitude" ) var longtitude : String? = null,
@SerializedName("fixed_session_30min_charge" ) var fixed_session_30min_charge : String? = null,
@SerializedName("fixed_session_60min_charge" ) var fixed_session_60min_charge : String? = null,
// @SerializedName("longtitude" ) var longtitude : String? = null,
@SerializedName("device_id" ) var deviceId : String? = null,
@SerializedName("device_type" ) var deviceType : String? = null,
@SerializedName("device_name" ) var deviceName : String? = null,
@SerializedName("device_token" ) var deviceToken : String? = null,
@SerializedName("created_at" ) var createdAt : String? = null,
@SerializedName("updated_at" ) var updatedAt : String? = null
) |
callastro/app/src/main/java/com/callastro/model/CallUserListResponse.kt | 3826709856 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class CallUserListResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<CallUserListData> = arrayListOf()
)
data class CallUserListData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("user_id" ) var userId : Int? = null,
@SerializedName("name" ) var name : String? = null,
@SerializedName("profile" ) var profile : String? = null,
@SerializedName("is_live" ) var isLive : Int? = null,
@SerializedName("last_online_time" ) var lastOnlineTime : String? = null
) |
callastro/app/src/main/java/com/callastro/model/GetAddedSkillsResponse.kt | 2619343580 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class GetAddedSkillsResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<GetAddedSkillsData> = arrayListOf()
)
data class GetAddedSkillsData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("skill_name" ) var skillName : String? = null
) |
callastro/app/src/main/java/com/callastro/model/AddSuggestRemedyResponse.kt | 1654161031 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class AddSuggestRemedyResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : String? = null
) |
callastro/app/src/main/java/com/callastro/model/ScheduleCalendarDeleteResponse.kt | 1318177947 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class ScheduleCalendarDeleteResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("date" ) var date : String? = null
) |
callastro/app/src/main/java/com/callastro/model/DeleteExpertiseItemResponse.kt | 2418639154 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class DeleteExpertiseItemResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : String? = null
) |
callastro/app/src/main/java/com/callastro/model/CommonResponse.kt | 3301707673 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class CommonResponse(
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : String? = null
)
|
callastro/app/src/main/java/com/callastro/model/LiveCommentsModelClass.kt | 3602407645 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class LiveCommentsModelClass(
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<LiveCommentsModelClassData> = arrayListOf()
)
data class LiveCommentsModelClassData(
@SerializedName("id" ) var id : Int? = null,
@SerializedName("user_id" ) var userId : Int? = null,
@SerializedName("astro_id" ) var astroId : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("channel_name" ) var channelName : String? = null,
@SerializedName("type" ) var type : Int? = null,
@SerializedName("status" ) var status : Int? = null,
@SerializedName("created_at" ) var createdAt : String? = null,
@SerializedName("updated_at" ) var updatedAt : String? = null,
@SerializedName("gift_id" ) var giftId : String? = null,
@SerializedName("name" ) var name : String? = null,
@SerializedName("profile" ) var profile : String? = null,
@SerializedName("image" ) var image : String? = null
) |
callastro/app/src/main/java/com/callastro/model/AboutUsResponse.kt | 4254423060 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class AboutUsResponse(
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : AboutUsResponseData? = AboutUsResponseData()
)
data class AboutUsResponseData(
@SerializedName("details" ) var details : String? = null
) |
callastro/app/src/main/java/com/callastro/model/PostProfileDetailResponse.kt | 654646957 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class PostProfileDetailResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : PostProfileDetaiData? = PostProfileDetaiData()
)
data class Language (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("language" ) var language : String? = null
)
data class Skills (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("skill_name" ) var skillName : String? = null
)
data class Expertises (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("name" ) var name : String? = null
)
data class RatingRaview (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("rating" ) var rating : String? = null,
@SerializedName("reveiw" ) var reveiw : String? = null,
@SerializedName("name" ) var name : String? = null,
@SerializedName("profile" ) var profile : String? = null
)
data class PostProfileDetaiData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("name" ) var name : String? = null,
@SerializedName("gender" ) var gender : Int? = null,
@SerializedName("experence_id" ) var experenceId : Int? = null,
@SerializedName("language" ) var language : ArrayList<Language> = arrayListOf(),
@SerializedName("skills" ) var skills : ArrayList<Skills> = arrayListOf(),
@SerializedName("expertises" ) var expertises : ArrayList<Expertises> = arrayListOf(),
@SerializedName("experence" ) var experence : String? = null,
@SerializedName("rating_raview" ) var ratingRaview : ArrayList<RatingRaview> = arrayListOf()
)
|
callastro/app/src/main/java/com/callastro/model/LoginResponse.kt | 751851561 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class LoginResponse(
@SerializedName("status" ) var status : Int? = null,
@SerializedName("approval" ) var approval : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : LoginData? = LoginData()
)
data class LoginData(
@SerializedName("id" ) var id : Int? = null,
@SerializedName("mobile_no" ) var mobileNo : String? = null,
@SerializedName("otp" ) var otp : String? = null,
@SerializedName("is_new" ) var is_new : String? = null
) |
callastro/app/src/main/java/com/callastro/model/FixSessionDetail.kt | 3463189775 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class FixSessionDetail(
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : FixSessionDetailData = FixSessionDetailData()
)
data class FixSessionDetailData(
@SerializedName("id" ) var id : Int? = null,
@SerializedName("user_id" ) var userId : Int? = null,
@SerializedName("type" ) var type : Int? = null,
@SerializedName("name" ) var name : String? = null,
@SerializedName("gender" ) var gender : Int? = null,
@SerializedName("dob" ) var dob : String? = null,
@SerializedName("birth_time" ) var birthTime : String? = null,
@SerializedName("place_birth" ) var placeBirth : String? = null,
@SerializedName("occupation" ) var occupation : String? = null,
@SerializedName("maritial_status" ) var maritialStatus : String? = null,
@SerializedName("topic_consultation" ) var topicConsultation : String? = null,
@SerializedName("boy_name" ) var boyName : String? = null,
@SerializedName("dob_boy" ) var dobBoy : String? = null,
@SerializedName("birth_time_boy" ) var birthTimeBoy : String? = null,
@SerializedName("place_birth_boy" ) var placeBirthBoy : String? = null,
@SerializedName("occupation_boy" ) var occupationBoy : String? = null,
@SerializedName("maritial_status_boy" ) var maritialStatusBoy : String? = null,
@SerializedName("topic_consultation_boy" ) var topicConsultationBoy : String? = null,
@SerializedName("girl_name" ) var girlName : String? = null,
@SerializedName("dob_girl" ) var dobGirl : String? = null,
@SerializedName("birth_time_girl" ) var birthTimeGirl : String? = null,
@SerializedName("place_birth_girl" ) var placeBirthGirl : String? = null,
@SerializedName("occupation_girl" ) var occupationGirl : String? = null,
@SerializedName("maritial_status_girl" ) var maritialStatusGirl : String? = null,
@SerializedName("topic_consultation_girl" ) var topicConsultationGirl : String? = null,
@SerializedName("state" ) var state : String? = null,
@SerializedName("city" ) var city : String? = null,
@SerializedName("created_at" ) var createdAt : String? = null,
@SerializedName("updated_at" ) var updatedAt : String? = null,
@SerializedName("language" ) var language : String? = null,
@SerializedName("mobile_no" ) var mobile_no : String? = null,
@SerializedName("fixed_session" ) var fixedSession : String? = null,
@SerializedName("fixed_session_type" ) var fixedSessionType : Int? = null,
@SerializedName("calendar_schedules_id" ) var calendarSchedulesId : String? = null
) |
callastro/app/src/main/java/com/callastro/model/MyBookingsUpcomingCompletedResponse.kt | 2957956634 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class MyBookingsUpcomingCompletedResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<MyBookingsUpcomingCompletedData> = arrayListOf()
)
data class MyBookingsUpcomingCompletedData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("user_detail_id" ) var userDetailId : Int? = null,
@SerializedName("type" ) var type : Int? = null,
@SerializedName("user_id" ) var userId : Int? = null,
@SerializedName("astro_id" ) var astroId : Int? = null,
@SerializedName("language_id" ) var languageId : Int? = null,
@SerializedName("request_status" ) var requestStatus : Int? = null,
@SerializedName("reason" ) var reason : String? = null,
@SerializedName("comment" ) var comment : String? = null,
@SerializedName("created_at" ) var createdAt : String? = null,
@SerializedName("updated_at" ) var updatedAt : String? = null,
@SerializedName("user_name" ) var userName : String? = null,
@SerializedName("mobile" ) var mobile : String? = null,
@SerializedName("language" ) var language : String? = null,
@SerializedName("profile" ) var profile : String? = null
) |
callastro/app/src/main/java/com/callastro/model/FAQResponse.kt | 246781996 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class FAQResponse(
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<FAQResponseData> = arrayListOf()
)
data class FAQResponseData(
@SerializedName("type" ) var type : Int? = null,
@SerializedName("questions" ) var questions : String? = null,
@SerializedName("answers" ) var answers : String? = null
) |
callastro/app/src/main/java/com/callastro/model/SettingDetailsGetResponse.kt | 1487473480 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class SettingDetailsGetResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : SettingDetailsGetData? = SettingDetailsGetData()
)
data class SettingDetailsGetData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("is_chat" ) var isChat : Int? = null,
@SerializedName("is_audio_call" ) var isAudioCall : Int? = null,
@SerializedName("is_video_call" ) var isVideoCall : Int? = null
) |
callastro/app/src/main/java/com/callastro/model/ChatCallCancelReasonResponse.kt | 1928079328 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class ChatCallCancelReasonResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<ChatCallCancelReasonData> = arrayListOf()
)
data class ChatCallCancelReasonData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("reason" ) var reason : String? = null
) |
callastro/app/src/main/java/com/callastro/model/ChatUserListResponse.kt | 2266513458 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class ChatUserListResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<ChatUserListData> = arrayListOf()
)
data class ChatUserListData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("user_id" ) var userId : Int? = null,
@SerializedName("name" ) var name : String? = null,
@SerializedName("profile" ) var profile : String? = null,
@SerializedName("is_live" ) var isLive : Int? = null,
@SerializedName("unique_id" ) var unique_id : Int? = null,
@SerializedName("last_online_time" ) var lastOnlineTime : String? = null
) |
callastro/app/src/main/java/com/callastro/model/LoginverificationResponse.kt | 4211798801 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class LoginverificationResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var otpdata : LoginverificationResponseData? = LoginverificationResponseData()
)
data class LoginverificationResponseData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("type" ) var type : Int? = null,
@SerializedName("name" ) var name : String? = null,
@SerializedName("email" ) var email : String? = null,
@SerializedName("mobile_no" ) var mobileNo : String? = null,
@SerializedName("company_name" ) var companyName : String? = null,
@SerializedName("profile" ) var profile : String? = null,
@SerializedName("wallet" ) var wallet : String? = null,
@SerializedName("gender" ) var gender : Int? = null,
@SerializedName("dob" ) var dob : String? = null,
@SerializedName("address" ) var address : String? = null,
@SerializedName("state" ) var state : String? = null,
@SerializedName("city" ) var city : String? = null,
@SerializedName("pincode" ) var pincode : String? = null,
@SerializedName("document1" ) var document1 : String? = null,
@SerializedName("document2" ) var document2 : String? = null,
@SerializedName("otp" ) var otp : String? = null,
@SerializedName("about_us" ) var aboutUs : String? = null,
@SerializedName("experence_id" ) var experenceId : String? = null,
@SerializedName("birth_time" ) var birthTime : String? = null,
@SerializedName("birth_place" ) var birthPlace : String? = null,
@SerializedName("is_live" ) var isLive : Int? = null,
@SerializedName("status" ) var status : Int? = null,
@SerializedName("login_status" ) var loginStatus : Int? = null,
@SerializedName("is_deleted" ) var isDeleted : Int? = null,
@SerializedName("email_verified_at" ) var emailVerifiedAt : String? = null,
@SerializedName("api_token" ) var apiToken : String? = null,
@SerializedName("latitude" ) var latitude : String? = null,
@SerializedName("longtitude" ) var longtitude : String? = null,
@SerializedName("device_id" ) var deviceId : String? = null,
@SerializedName("device_type" ) var deviceType : String? = null,
@SerializedName("device_name" ) var deviceName : String? = null,
@SerializedName("device_token" ) var deviceToken : String? = null,
@SerializedName("created_at" ) var createdAt : String? = null,
@SerializedName("updated_at" ) var updatedAt : String? = null
) |
callastro/app/src/main/java/com/callastro/model/CalenderList.kt | 2336055585 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class CalenderList(
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("date" ) var date : String? = null,
@SerializedName("data" ) var data : ArrayList<CalenderListData> = arrayListOf()
)
data class CalenderListData(
@SerializedName("id" ) var id : Int? = null,
@SerializedName("date" ) var date : String? = null,
@SerializedName("from_time" ) var fromTime : String? = null,
@SerializedName("to_time" ) var toTime : String? = null
) |
callastro/app/src/main/java/com/callastro/model/CheckChatEndResponse.kt | 3750409655 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class CheckChatEndResponse(
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : CheckChatEndResponseData = CheckChatEndResponseData()
)
data class CheckChatEndResponseData(
@SerializedName("is_chat_end" ) var is_chat_end : Int? = null,
@SerializedName("user_type" ) var user_type : Int? = null,
)
|
callastro/app/src/main/java/com/callastro/model/CityListResponse.kt | 744971402 | package com.callastro.model
import com.google.gson.annotations.SerializedName
data class CityListResponse (
@SerializedName("status" ) var status : Int? = null,
@SerializedName("message" ) var message : String? = null,
@SerializedName("data" ) var data : ArrayList<CityListData> = arrayListOf()
)
data class CityListData (
@SerializedName("id" ) var id : Int? = null,
@SerializedName("state_id" ) var stateId : Int? = null,
@SerializedName("city_name" ) var cityName : String? = null
) |
callastro/app/src/main/java/com/callastro/AndroidApp.kt | 1774694123 | package com.callastro
import android.app.Application
import android.util.Log
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent
import dagger.hilt.android.HiltAndroidApp
@HiltAndroidApp
class AndroidApp : Application(),LifecycleObserver {
override fun onCreate() {
super.onCreate()
onAppForegrounded()
onAppBackgrounded()
// ProcessLifecycleOwner.get().lifecycle.addObserver(this);
// ProcessLifecycleOwner.get().lifecycle.addObserver(this);
}
// override fun onTerminate() {
// super.onTerminate()
//
// onAppForegrounded()
// onAppBackgrounded()
//
// }
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
fun onAppBackgrounded() {
// toast("False")
// toast("True")
Log.d("AppLog", "App in background")
}
@OnLifecycleEvent(Lifecycle.Event.ON_START)
fun onAppForegrounded() {
// toast("False")
// toast("True")
Log.d("AppLog", "App in foreground")
}
} |
callastro/app/src/main/java/com/callastro/fcm/MyFirebaseMessagingService.kt | 2781794376 | package com.callastro.fcm
import android.annotation.SuppressLint
import android.app.Notification
import android.app.NotificationChannel
import android.app.NotificationManager
import android.app.PendingIntent
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.media.MediaPlayer
import android.media.RingtoneManager
import android.os.Build
import android.os.Vibrator
import android.util.Log
import androidx.core.app.NotificationCompat
import com.callastro.R
import com.callastro.broadcastReceiver.NotificationBroadcastReceiver
import com.callastro.ui.activities.CallRequest
import com.callastro.ui.activities.ChatwithUsActivity
import com.callastro.util.SoundUtil
import com.google.firebase.messaging.FirebaseMessagingService
import com.google.firebase.messaging.RemoteMessage
import com.maxtra.u.Constant
@SuppressLint("MissingFirebaseInstanceTokenRefresh")
class MyFirebaseMessagingService : FirebaseMessagingService() {
private var count = 0
var notificationCount = 0
var mNotificationId = 1
private var vib: Vibrator? = null
var mMediaPlayer: MediaPlayer? = null
override fun onMessageReceived(remote: RemoteMessage) {
super.onMessageReceived(remote)
Log.d("TAG", "onMessageReceived: " + remote.data)
val data = remote.data
val title = remote.notification?.title ?: "title"
val body = remote.notification?.body ?: "body"
createNotification(body, remote.data, title)
Log.d("title1", "title1: " + title)
Log.d("body1", "body1: " + body)
val broadcastReceiver: BroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context?, intent: Intent?) {
// internet lost alert dialog method call from here...
// broadCastingReceiver.ma!!.chatList()
}
}
}
@SuppressLint("LaunchActivityFromNotification")
private fun createNotification(
body1: String,
data: MutableMap<String, String>, title1: String
) {
try {
val notificationType: String = data["call_type"].toString()
val type: String = data["type"].toString()
val user_id: String = data["astro_id"].toString()
val user_name: String = data["astro_name"].toString()
val agora_token: String = data["agora_token"].toString()
val channel_name: String = data["channel_name"].toString()
val appId: String = data["app_id"].toString()
val title = data["body"].toString()
val name: String = data["title"].toString()
val other_user: String = data["other_user"].toString()
SoundUtil.playSound(this)
val notificationManager =
getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
val notificationBuilder =
NotificationCompat.Builder(
this,
getString(R.string.app_name)
)
.setSmallIcon(getNotificationIcon())
/* .setSound(defaultSoundUri)*/
.setContentTitle(title1)
.setContentText(body1)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setChannelId(getString(R.string.app_name))
val notificationBuilder1 =
NotificationCompat.Builder(
this,
getString(R.string.app_name)
)
.setSmallIcon(getNotificationIcon())
/*.setSound(defaultSoundUri)*/
.setContentTitle(title1)
.setContentText(body1)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.setChannelId(getString(R.string.app_name))
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
notificationBuilder.setChannelId(getString(R.string.app_name))
val notificationChannel = NotificationChannel(
getString(R.string.app_name),
getString(R.string.app_name),
NotificationManager.IMPORTANCE_HIGH
)
notificationChannel.lockscreenVisibility = Notification.VISIBILITY_PRIVATE
notificationManager.createNotificationChannel(notificationChannel)
val contentIntent = PendingIntent.getBroadcast(
this,
0,
// Intent(this, ChatwithUsActivity::class.java)
Intent(this, NotificationBroadcastReceiver::class.java)
.putExtra("other_user", other_user)
.putExtra("title", name)
.putExtra("call_type", notificationType)
.putExtra("list_id", user_id)
.putExtra("list_userName", user_name)
.putExtra("app_id", appId)
.putExtra("channel_name", channel_name)
.putExtra(Constant.NOTIFICATION_ID, 321)
.putExtra("agora_token", agora_token)
.putExtra("type", type),
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
// notificationBuilder.clearActions()
notificationBuilder.setContentIntent(contentIntent)
if (notificationType == "3") {
SoundUtil.playSound(this)
try {
val contentIntent = PendingIntent.getActivity(
this,
1,
// Intent(this, ChatwithUsActivity::class.java)
Intent(this, ChatwithUsActivity::class.java)
.putExtra("other_user", other_user)
.putExtra("title", name)
.putExtra("call_type", notificationType)
.putExtra("list_id", user_id)
.putExtra("list_userName", user_name)
.putExtra("app_id", appId)
.putExtra("channel_name", channel_name)
.putExtra("agora_token", agora_token),
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
// notificationBuilder.clearActions()
notificationBuilder.setContentIntent(contentIntent)
} catch (e: Exception) {
e.printStackTrace()
}
} else if (notificationType == "2") {
SoundUtil.playSound(this)
try {
val contentIntent = PendingIntent.getActivity(
this,
2,
// Intent(this, IncomingCallActivity::class.java).putExtra(
Intent(this, CallRequest::class.java).putExtra(
"other_user",
other_user
)
.putExtra("title", name)
.putExtra("app_id", appId)
.putExtra("channel_name", channel_name)
.putExtra("call_type", "2") //Video Call Request
.putExtra("list_id", user_id)
.putExtra("astro_name", user_name)
.putExtra("agora_token", agora_token),
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
notificationBuilder.setContentIntent(contentIntent)
} catch (e: Exception) {
e.printStackTrace()
}
} else if (notificationType == "1") {
SoundUtil.playSound(this)
try {
val contentIntent = PendingIntent.getActivity(
this,
3,
// Intent(this, DashboardAudioCallActivity::class.java).putExtra(
Intent(this, CallRequest::class.java).putExtra(
"other_user",
other_user
)
.putExtra("title", name)
.putExtra("app_id", appId)
.putExtra("channel_name", channel_name)
.putExtra("call_type", "1") //Audio Call Request
.putExtra("list_id", user_id)
.putExtra("astro_name", user_name)
.putExtra("notification","1")
.putExtra("agora_token", agora_token),
PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE
)
notificationBuilder.setContentIntent(contentIntent)
} catch (e: Exception) {
e.printStackTrace()
}
} else {
}
}
// Gets an instance of the NotificationManager service
// Gets an instance of the NotificationManager service
val mNotificationManager =
this.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
// Builds the notification and issues it.
// Builds the notification and issues it.
mNotificationManager.notify(mNotificationId, notificationBuilder.build())
} catch (e: Exception) {
e.printStackTrace()
}
}
/* fun playSound() {
// if (mMediaPlayer == null) {
mMediaPlayer = MediaPlayer.create(this, R.raw.rington)
vib = this.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
vib!!.vibrate(1000)
mMediaPlayer!!.isLooping = false
mMediaPlayer!!.start()
// } else mMediaPlayer!!.start()
}*/
private fun getNotificationIcon(): Int {
val useWhiteIcon = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP
return if (useWhiteIcon) R.drawable.logo else R.drawable.logo
}
} |
callastro/app/src/main/java/com/callastro/data/MainRepository.kt | 404033284 | package com.callastro.data
import com.callastro.model.*
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.Response
import retrofit2.http.Field
import retrofit2.http.GET
import retrofit2.http.Header
interface MainRepository {
suspend fun login(country_code: String,mobile:String,device_id: String,device_type: String,device_name: String,device_token: String):
Response<LoginResponse>
suspend fun loginverification(id: String, otp: String):
Response<LoginverificationResponse>
suspend fun Expertize(token:String):
Response<ExpertizeResponse>
suspend fun Language(token:String):
Response<LanguageResponse>
suspend fun post_profile_detailApi(token:String):
Response<PostProfileDetailResponse>
suspend fun stateListApi(token:String):
Response<StateListResponse>
suspend fun cityListApi(token:String, state_id:String):
Response<CityListResponse>
suspend fun pinCodeListApi(token:String, city_id:String):
Response<PincodeListResponse>
suspend fun skills_listApi(token:String):
Response<SkillsListResponse>
suspend fun agora_generate_tokenApi(token:String, astro_id: String, call_type: String):
Response<AgoraGenerateTokenResponse>
suspend fun add_comment(
user_id: String,
astro_id: String,
message: String,
type: String,
): Response<CommonResponse>
suspend fun call_end_by_status(token:String,caller_id: String):
Response<CallendbyuserResponse>
suspend fun live_agora_generate_token(token:String,topic: String):
Response<GoLiveResponse>
suspend fun delete_live_astro(token:String):
Response<CommonResponse>
suspend fun checkOnlineStatusRepo(token:String):
Response<CommonResponse>
suspend fun live_agora_topic(token:String, topic:String):
Response<GoLiveResponse>
suspend fun astro_home(token:String):
Response<CallChatStatusResponse>
suspend fun chat_user_listApi(token:String):
Response<ChatUserListResponse>
suspend fun click_user_chat(token:String,user_id: String):
Response<CommonResponse>
suspend fun astro_give_review(token: String,astro_id: String,rating: String,review: String,):
Response<GiveReviewResponse>
suspend fun recent_otp(mobile_no: String,type: String,):
Response<LoginResponse>
suspend fun call_user_listApi(token:String):
Response<CallUserListResponse>
suspend fun banner(token:String):
Response<BannerResponse>
suspend fun AddAstroDetailsApi(token:String,
full_name: RequestBody,
company_name: RequestBody,
email: RequestBody,
gender: RequestBody,
address: RequestBody,
state_id: RequestBody,
city_id: RequestBody,
pincode_id: RequestBody,
expertise: RequestBody,
language: RequestBody,
skills: RequestBody,
bank_name: RequestBody,
account_no: RequestBody,
acc_holder_name: RequestBody,
ifsc_code: RequestBody,
branch: RequestBody,
document1: MultipartBody.Part,
document2: MultipartBody.Part,
profile_image: MultipartBody.Part,
calling_charge:RequestBody,
about_us: RequestBody,
fixed_session_30min_charge :RequestBody,
fixed_session_60min_charge :RequestBody,
experience :RequestBody
):
Response<AddAstroDetailResponse>
@GET("get_added_expertise")
suspend fun get_added_expertiseApi(
@Header("Authorization") authorization: String,
): Response<GetAddedExpertiseResponse>
suspend fun add_expertiseApi(token:String, expertise_id:String):
Response<AddExpertiseItemResponse>
suspend fun delete_expertiseApi(token:String, id:String):
Response<DeleteExpertiseItemResponse>
suspend fun get_added_skillsApi(token:String):
Response<GetAddedSkillsResponse>
suspend fun add_skillsApi(token:String, skill_id:String):
Response<AddSkillsItemResponse>
suspend fun delete_skillsApi(token:String, id:String):
Response<DeleteSkillsItemResponse>
suspend fun get_added_languageApi(token:String):
Response<GetAddedLanguageResponse>
suspend fun add_languageApi(token:String, language_id:String):
Response<AddLanguageItemResponse>
suspend fun delete_languageApi(token:String, id:String):
Response<DeleteLanguageItemResponse>
suspend fun post_profile_updateApi(token:String, full_name:String, gender:String, experience:String):
Response<PostProfileUpdateResponse>
suspend fun experience_listApi(token:String):
Response<ExperienceListResponse>
suspend fun callHistoryListApi(token:String, /*dummy:String*/):
Response<CallHistoryListResponse>
suspend fun chatHistoryListApi(token:String,/* dummy:String*/):
Response<ChatHistoryListResponse>
suspend fun product_listApi(token:String):
Response<ProductListResponse>
suspend fun add_suggest_remedyApi(token:String, product_ids:String, user_id:String):
Response<AddSuggestRemedyResponse>
suspend fun suggest_remedy_listApi(token:String,user_id: String):
Response<SuggestRemedyListResponse>
suspend fun add_suggest_remedy_messageApi(token:String, user_id: String, message: String):
Response<CommonResponse>
suspend fun fix_session_detail(token:String,user_detail_id:String):
Response<FixSessionDetail>
suspend fun EmailUs(token:String):
Response<EmailUs_Response>
suspend fun callback_apply(token:String,mobile:String,discription:String):
Response<CommonResponse>
suspend fun aboutus(token:String):
Response<AboutUsResponse>
suspend fun get_chat_with_us(token:String):
Response<GetCustomerSupportChat>
suspend fun call_ring_status_save(token:String,channel_name: String):
Response<call_ring_status_save_Response>
suspend fun call_ring_end(token:String,channel_name: String):
Response<CommonResponse>
suspend fun send_chat_with_us(token:String,message:String):
Response<CommonResponse>
suspend fun notificationApi(token:String):
Response<NotificationListResponse>
suspend fun faq(token:String):
Response<FAQResponse>
suspend fun chat_list_MessageApi(token:String, to_id: String):
Response<ChatListMessageResponse>
suspend fun call_end(token:String,timer:String,from_user: String,to_user: String,caller_id:String,type: String,fixed_session: String):
Response<CommonResponse>
suspend fun live_end(token:String,timer:String,from_user: String,to_user: String,type: String):
Response<CommonResponse>
suspend fun chat_end(token:String,timer:String,from_user: String,to_user: String,caller_id:String,type: String,fixed_session: String,):
Response<CommonResponse>
suspend fun check_chat_end(token:String,caller_id: String):
Response<CheckChatEndResponse>
suspend fun notification(token: String):
Response<NotificationResponse>
suspend fun chatagoraApi(token:String, to_userId: String, message: String, type: String):
Response<ChatAgoraResponse>
suspend fun setting_detailsApi(token:String):
Response<SettingDetailsGetResponse>
suspend fun setting_updateApi(token:String, is_chat:String, is_audio_call:String, is_video_call:String):
Response<SettingDetailsGetResponse>
suspend fun GetCalender(token:String,date:String):
Response<CalenderList>
suspend fun manage_calendar_scheduleApi(token:String, date: String, from_time: String, to_time: String):
Response<ManageCalendarScheduleResponse>
suspend fun calendar_schedule_deleteApi(token:String, id: String):
Response<ScheduleCalendarDeleteResponse>
suspend fun call_request_detail_api(token:String,id:String):
Response<CallRequestDetailResponse>
suspend fun call_request_accecpt_api(token:String,id:String):
Response<ChatRequestCancelResponse>
suspend fun call_request_cancel_api(token:String,id:String,reason:String,comment:String,action_by: String,):
Response<ChatRequestCancelResponse>
suspend fun upcomingCompletedBookingsApi(token:String, type:String):
Response<MyBookingsUpcomingCompletedResponse>
suspend fun chat_request_detail_api(token:String,id:String):
Response<ChatRequestDetailResponse>
suspend fun ViewProfile(token:String):
Response<ViewProfileResponse>
suspend fun chat_request_accecpt_api(token:String,id:String):
Response<ChatRequestCancelResponse>
suspend fun chatcallReasonCancelListApi(token:String):
Response<ChatCallCancelReasonResponse>
suspend fun cancellationByUserApi(token:String):
Response<CancellationByUserResponse>
suspend fun chat_request_cancel_api(token:String,id:String,reason:String,comment:String):
Response<ChatRequestCancelResponse>
suspend fun Chathome(token:String):
Response<Chat_Call_Response>
suspend fun Callhome(token:String):
Response<Chat_Call_Response>
suspend fun confirmation_booking_listApi(token:String, type:String):
Response<ConfirmationBookingResponse>
suspend fun report_doc_upload(token:String,
user_id: RequestBody,
report_intake_id: RequestBody,
text: RequestBody,
file: MultipartBody.Part,
): Response<CommonResponse>
suspend fun astro_earningApi(token:String, filter:String):
Response<AstroEarningResponse>
suspend fun fixed_session_requests(token:String):
Response<FixedsessionResponseList>
suspend fun request_money(token:String, money:String):
Response<CommonResponse>
suspend fun fixed_session_request_accecpt(token:String,id:String):
Response<ChatRequestCancelResponse>
suspend fun UpdateBank(token:String,bank_name:String,account_no: String,acc_holder_name: String,ifsc_code: String,branch: String):
Response<BankDetailResponse>
suspend fun GetBankDetail(token:String):
Response<GetBankDetail>
suspend fun get_live_comments(
token: String,
channel_name: String,
): Response<LiveCommentsModelClass>
// suspend fun Expertize(token:String):
// Response<ExpertizeResponse>
//
// suspend fun Liveastrologersviewall(token:String):
// Response<LiveastrologerviewallResponse>
//
// suspend fun RemedySuggested(token:String):
// Response<RemedySuggestedResponse>
//
// suspend fun RemedyProduct(token:String):
// Response<RemedyProductResponse>
//
// suspend fun ShopwithusViewall(token:String):
// Response<ShopwithusViewallResponse>
//
// suspend fun Chat(token:String):
// Response<ChatFragmentResponse>
//
// suspend fun CategoryList(token:String,id:String):
// Response<CategoryProductResponse>
//
// suspend fun ProductDetails(token:String,id:String):
// Response<ProductResponse>
//
// suspend fun Call(token:String):
// Response<ChatFragmentResponse>
// suspend fun EditProfile(token:String, name: RequestBody, mobile_no: RequestBody, email: RequestBody, dob: RequestBody, profile: MultipartBody.Part):
// Response<LoginverificationResponse>
suspend fun confirmation_booking_report_detail(token:String,report_intakes_id: String):
Response<ConfirmationReportHistoryResponse>
suspend fun astro_rating_review_listApi(token:String):
Response<GetAstroRatingReviewListResponse>
suspend fun rating_review_pinselected_listApi(token:String):
Response<GetAstroRatingReviewPinResponse>
suspend fun review_pin_updateApi(token:String, id:String, type:String):
Response<ReviewPinUpdateResponse>
suspend fun astro_history_wallets(token:String):
Response<AstroEarningListResponse>
suspend fun EditProfile(token:String, name: RequestBody, mobile_no: RequestBody, email: RequestBody, gender: RequestBody, profile: MultipartBody.Part,
address: RequestBody,
state_id: RequestBody,
/*expertise: RequestBody,
language: RequestBody,
skills: RequestBody,*/
company_name: RequestBody,
city: RequestBody,
pincode: RequestBody,
calling_charg: RequestBody,
document1: MultipartBody.Part,
document2: MultipartBody.Part,
about_us: RequestBody,
fixed_session_30min_charge: RequestBody,
fixed_session_60min_charge: RequestBody,
experience: RequestBody,):
Response<LoginverificationResponse>
suspend fun refund_money(token:String,order_id: String):
Response<CommonResponse>
suspend fun call_ring(token: String,astro_id:String,user_id:String,request_id: String):
Response<CallRingResponse>
// suspend fun StateList(): Response<StateList>
//
// suspend fun CityList(id:Int): Response<CityList>
//
// suspend fun banner(token:String):
// Response<BannerResponse>
//
// suspend fun OrderDetails(token:String,product_id:String,address_id:String): Response<MyCartResponse>
//
// suspend fun HistoryWallet(token: String):
// Response<HistoryWallet>
//
// suspend fun history_call(token: String):
// Response<CallHistoryResponse>
//
// suspend fun history_chat(token: String):
// Response<ChatHistoryResponse>
// suspend fun history_reports(token: String):
// Response<ReportsHistoryResponse>
// suspend fun OrderPlaced(
// token: String,
// product_id: String,
// product_price: String,
// shipping_chard: String,
// coupon_discount: String,
// grand_total: String,
// coupon_code: String,
// address_id: String,
// qty: String,
// transaction_id: String,
// payment_status: String,
// payment_type: String,
// ): Response<PlaceOrderResponse>
//
// suspend fun history_products(token: String,type:String):
// Response<HistoryProductSuggestedResponse>
//
// suspend fun user_my_reveiw(token: String):
// Response<MyReviewsResponse>
//
// suspend fun my_orders(token: String,type:String):
// Response<MyOrdersEcommersProductResponse>
//
// suspend fun booking_detail(token: String,order_id:String):
// Response<BookingDetailsResponse>
//
// suspend fun strologer_details(token: String, id: String,):
// Response<AstrorahiResponse>
//
// suspend fun consultancy_order(token: String):
// Response<ConsultancyOrderResponse>
//
// suspend fun consultancy_order_detail(token: String, id: String):
// Response<ConsultancyDetail>
//
//
// suspend fun user_give_review(token: String,astro_id: String,rating: String,review: String,):
// Response<GiveReviewResponse>
//
// suspend fun strologer_availability(token: String,id: String,):Response<AvailabilityResponse>
//
// suspend fun MatchMaking(
// token: String,
// dob_boy: String,
// birth_time_boy: String,
// place_birth_boy: String,
// occupation_boy: String,
// maritial_status_boy: String,
// topic_consultation_boy: String,
// dob_girl: String,
// birth_time_girl: String,
// place_birth_girl: String,
// occupation_girl: String,
// maritial_status_girl: String,
// topic_consultation_girl: String,
// ): Response<MatchMakingResponse>
//
// suspend fun Language(token:String):
// Response<LanguageResponse>
// suspend fun add_user_details_first(
// token: String,
// dob: String,
// birth_time: String,
// place_birth: String,
// occupation: String,
// maritial_status: String,
// topic_consultation: String,
// language_id: String,
// astro_id: String,
// request_type: String,
// ):
// Response<IntakeResponse>
//
//
// suspend fun agora_generate_tokenApi(token:String, astro_id: String, call_type: String):
// Response<AgoraGenerateTokenResponse>
//
// suspend fun agora_create_userApi(token:String, to_userId:String, nickname:String):
// Response<AgoraCreateUserResponse>
//
// suspend fun chat_list_MessageApi(token:String, to_id: String):
// Response<ChatListMessageResponse>
//
// suspend fun chatagoraApi(token:String, to_userId: String, message: String, type: String):
// Response<ChatAgoraResponse>
//
// suspend fun reason_cancel_list(token: String):
// Response<CancelReasonResponse>
// suspend fun strologers_list(token: String):
// Response<AstrologersListViewAllResponse>
//
// suspend fun request_for_report(
// token: String,
// dob: String,
// birth_time: String,
// place_birth: String,
// occupation: String,
// maritial_status: String,
// topic_consultation: String,
// astro_id: String,
// ):
// Response<CommonResponse>
//
// suspend fun delete_address(token:String,id:String):
// Response<CommonResponse>
//
// suspend fun cancel_order(token:String,id:String,reason_ids: String,write_reason: String,):
// Response<CommonResponse>
//
// suspend fun call_end(token:String,timer:String,from_user: String,to_user: String,caller_id:String):
// Response<CommonResponse>
//
// suspend fun when_call_start(token:String,astro_id: String):
// Response<CallStartResponse>
//
// suspend fun add_money(token:String,amount: String,payment_status: String,transaction_id: String,):
// Response<CommonResponse>
//
// suspend fun get_report_astro_list(token: String):
// Response<AstrologersListViewAllResponse>
//
// suspend fun get_report_astro_details(token: String,astro_id:String):
// Response<GetAstroDetailsResponse>
}
|
callastro/app/src/main/java/com/callastro/data/ApiService.kt | 49263579 | package com.callastro.data
import com.callastro.model.*
import hilt_aggregated_deps._com_maxtra_astrorahiastrologer_util_Utils
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.Response
import retrofit2.http.*
interface ApiService {
@FormUrlEncoded
@POST("astro_login")
suspend fun login(
@Field("country_code") country_code: String,
@Field("mobile_no") mobile: String,
@Field("device_id") device_id: String,
@Field("device_type") device_type: String,
@Field("device_name") device_name: String,
@Field("device_token") device_token: String,
): Response<LoginResponse>
@FormUrlEncoded
@POST("astro_verify_otp")
suspend fun login_verification(
@Field("id") id: String,
@Field("otp") otp: String,
): Response<LoginverificationResponse>
@FormUrlEncoded
@POST("astro_earning")
suspend fun astro_earningApi(
@Header("Authorization") authorization: String,
@Field("filter") filter: String
): Response<AstroEarningResponse>
@FormUrlEncoded
@POST("request_money")
suspend fun request_money(
@Header("Authorization") authorization: String,
@Field("money") money: String
): Response<CommonResponse>
@GET("expertise_list")
suspend fun Expertize(
@Header("Authorization") authorization: String,
): Response<ExpertizeResponse>
@GET("language_list")
suspend fun Language(
@Header("Authorization") authorization: String,
): Response<LanguageResponse>
@GET("post_profile_detail")
suspend fun post_profile_detailApi(
@Header("Authorization") authorization: String,
): Response<PostProfileDetailResponse>
@GET("state_list")
suspend fun stateListApi(
@Header("Authorization") authorization: String
): Response<StateListResponse>
@FormUrlEncoded
@POST("city_list")
suspend fun cityListApi(
@Header("Authorization") authorization: String,
@Field("state_id") state_id: String
): Response<CityListResponse>
@FormUrlEncoded
@POST("pincode_list")
suspend fun pinCodeListApi(
@Header("Authorization") authorization: String,
@Field("city_id") city_id: String
): Response<PincodeListResponse>
@GET("skills_list")
suspend fun skills_listApi(
@Header("Authorization") authorization: String
): Response<SkillsListResponse>
@Multipart
@POST("add_astro_details")
suspend fun AddAstroDetailsApi(
@Header("Authorization") authorization: String,
@Part("full_name") full_name: RequestBody,
@Part("company_name") company_name: RequestBody,
@Part("email") email: RequestBody,
@Part("gender") gender: RequestBody,
@Part("address") address: RequestBody,
@Part("state_id") state_id: RequestBody,
@Part("city_id") city_id: RequestBody,
@Part("pincode_id") pincode_id: RequestBody,
@Part("expertise") expertise: RequestBody,
@Part("language") language: RequestBody,
@Part("skills") skills: RequestBody,
@Part("bank_name") bank_name: RequestBody,
@Part("account_no") account_no: RequestBody,
@Part("acc_holder_name") acc_holder_name: RequestBody,
@Part("ifsc_code") ifsc_code: RequestBody,
@Part("branch") branch: RequestBody,
@Part document1: MultipartBody.Part,
@Part document2: MultipartBody.Part,
@Part profile_image: MultipartBody.Part,
@Part("calling_charg") calling_charge: RequestBody,
@Part("about_us") about_us: RequestBody,
@Part("fixed_session_30min_charge") fixed_session_30min_charge :RequestBody,
@Part("fixed_session_60min_charge") fixed_session_60min_charge :RequestBody,
@Part("experience") experience: RequestBody,
): Response<AddAstroDetailResponse>
@FormUrlEncoded
@POST("add_expertise")
suspend fun add_expertiseApi(
@Header("Authorization") authorization: String,
@Field("expertise_id") expertise_id: String
): Response<AddExpertiseItemResponse>
@GET("astro_banner")
suspend fun banner(
@Header("Authorization") authorization: String,
): Response<BannerResponse>
@FormUrlEncoded
@POST("delete_expertise")
suspend fun delete_expertiseApi(
@Header("Authorization") authorization: String,
@Field("id") id: String
): Response<DeleteExpertiseItemResponse>
@GET("get_added_skills")
suspend fun get_added_skillsApi(
@Header("Authorization") authorization: String,
): Response<GetAddedSkillsResponse>
@FormUrlEncoded
@POST("add_skills")
suspend fun add_skillsApi(
@Header("Authorization") authorization: String,
@Field("skill_id") skill_id: String
): Response<AddSkillsItemResponse>
@GET("get_added_expertise")
suspend fun get_added_expertiseApi(
@Header("Authorization") authorization: String,
): Response<GetAddedExpertiseResponse>
@FormUrlEncoded
@POST("astro_give_review")
suspend fun astro_give_review(
@Header("Authorization") authorization: String,
@Field("user_id") astro_id: String,
@Field("rating") rating: String,
@Field("review") review: String,
): Response<GiveReviewResponse>
@FormUrlEncoded
@POST("recent_otp")
suspend fun recent_otp(
@Field("mobile_no") mobile_no: String,
@Field("type") type: String,
): Response<LoginResponse>
@FormUrlEncoded
@POST("delete_skills")
suspend fun delete_skillsApi(
@Header("Authorization") authorization: String,
@Field("id") id: String
): Response<DeleteSkillsItemResponse>
@GET("get_added_language")
suspend fun get_added_languageApi(
@Header("Authorization") authorization: String,
): Response<GetAddedLanguageResponse>
@GET("astro_bank_detail")
suspend fun GetBankDetail(
@Header("Authorization") authorization: String,
): Response<GetBankDetail>
@FormUrlEncoded
@POST("refund_money")
suspend fun refund_money(
@Header("Authorization") authorization: String,
@Field("order_id") order_id: String,
): Response<CommonResponse>
@FormUrlEncoded
@POST("astro_update_bank")
suspend fun UpdateBank(
@Header("Authorization") authorization: String,
@Field("bank_name") bank_name: String,
@Field("account_no") account_no: String,
@Field("acc_holder_name") acc_holder_name: String,
@Field("ifsc_code") ifsc_code: String,
@Field("branch") branch: String,
): Response<BankDetailResponse>
@FormUrlEncoded
@POST("add_language")
suspend fun add_languageApi(
@Header("Authorization") authorization: String,
@Field("language_id") language_id: String
): Response<AddLanguageItemResponse>
@FormUrlEncoded
@POST("delete_language")
suspend fun delete_languageApi(
@Header("Authorization") authorization: String,
@Field("id") id: String
): Response<DeleteLanguageItemResponse>
@FormUrlEncoded
@POST("post_profile_update")
suspend fun post_profile_updateApi(
@Header("Authorization") authorization: String,
@Field("full_name") full_name: String,
@Field("gender") gender: String,
@Field("experience") experience: String
): Response<PostProfileUpdateResponse>
@GET("experience_list")
suspend fun experience_listApi(
@Header("Authorization") authorization: String,
): Response<ExperienceListResponse>
// @GET("astro_profile")
// suspend fun experience_listApi(
// @Header("Authorization") authorization: String,
// ): Response<>
@Multipart
@POST("astro_profile_update")
suspend fun Editprofile(
@Header("Authorization") authorization: String,
@Part("name") name: RequestBody,
@Part("mobile_no") mobile_no: RequestBody,
@Part("email") email: RequestBody,
@Part("gender") gender: RequestBody,
@Part profile: MultipartBody.Part,
@Part("address") address: RequestBody,
@Part("state_id") state_id: RequestBody,
// @Part("expertise") expertise: RequestBody,
// @Part("language") language: RequestBody,
// @Part("skills") skills: RequestBody,
@Part("company_name") company_name: RequestBody,
@Part("city") city: RequestBody,
@Part("pincode") pincode: RequestBody,
@Part("calling_charg") calling_charg: RequestBody,
@Part document1: MultipartBody.Part,
@Part document2: MultipartBody.Part,
@Part("about_us") about_us: RequestBody,
@Part("fixed_session_30min_charge") fixed_session_30min_charge: RequestBody,
@Part("fixed_session_60min_charge") fixed_session_60min_charge: RequestBody,
@Part("experence_id") experience: RequestBody,
): Response<LoginverificationResponse>
@GET("astro_rating_review_list")
suspend fun astro_rating_review_listApi(
@Header("Authorization") authorization: String,
): Response<GetAstroRatingReviewListResponse>
@FormUrlEncoded
@POST("review_pin_update")
suspend fun review_pin_updateApi(
@Header("Authorization") authorization: String,
@Field("id") id: String,
@Field("type") type: String
): Response<ReviewPinUpdateResponse>
@GET("rating_review_pinselected_list")
suspend fun rating_review_pinselected_listApi(
@Header("Authorization") authorization: String,
): Response<GetAstroRatingReviewPinResponse>
@FormUrlEncoded
@POST("confirmation_booking_report_detail")
suspend fun confirmation_booking_report_detail(
@Header("Authorization") authorization: String,
@Field("report_intakes_id") report_intakes_id: String
): Response<ConfirmationReportHistoryResponse>
// @FormUrlEncoded
@GET("call_history")
suspend fun callHistoryListApi(
@Header("Authorization") authorization: String,
// @Field("dummy") dummy: String
): Response<CallHistoryListResponse>
// @FormUrlEncoded
@GET("chart_history")
suspend fun chatHistoryListApi(
@Header("Authorization") authorization: String,
// @Field("dummy") dummy: String
): Response<ChatHistoryListResponse>
@GET("product_list")
suspend fun product_listApi(
@Header("Authorization") authorization: String,
): Response<ProductListResponse>
@FormUrlEncoded
@POST("add_suggest_remedy")
suspend fun add_suggest_remedyApi(
@Header("Authorization") authorization: String,
@Field("product_ids") product_ids: String,
@Field("user_id") user_id: String,
): Response<AddSuggestRemedyResponse>
@FormUrlEncoded
@POST("suggest_remedy_list")
suspend fun suggest_remedy_listApi(
@Header("Authorization") authorization: String,
@Field("user_id") user_id: String,
): Response<SuggestRemedyListResponse>
@FormUrlEncoded
@POST("agora_generate_token")
suspend fun agora_generate_tokenApi(
@Header("Authorization") authorization: String,
@Field("astro_id") astro_id: String,
@Field("call_type") call_type: String, // 1-audiocall, 2-videocall
): Response<AgoraGenerateTokenResponse>
@FormUrlEncoded
@POST("call_end_by_status")
suspend fun call_end_by_status(
@Header("Authorization") authorization: String,
@Field("caller_id") caller_id: String,
): Response<CallendbyuserResponse>
@FormUrlEncoded
@POST("live_agora_generate_token")
suspend fun live_agora_generate_token(
@Header("Authorization") authorization: String,
@Field("topic") topic: String,
): Response<GoLiveResponse>
@GET("delete_live_astro")
suspend fun delete_live_astro(
@Header("Authorization") authorization: String,
): Response<CommonResponse>
@GET("astro_history_wallets")
suspend fun astro_history_wallets(
@Header("Authorization") authorization: String,
): Response<AstroEarningListResponse>
@FormUrlEncoded
@POST("live_agora_topic")
suspend fun live_agora_topic(
@Header("Authorization") authorization: String,
@Field("topic") topic: String
): Response<GoLiveResponse>
@GET("astro_home")
suspend fun astro_home(
@Header("Authorization") authorization: String,
): Response<CallChatStatusResponse>
@FormUrlEncoded
@POST("add_suggest_remedy_message")
suspend fun add_suggest_remedy_messageApi(
@Header("Authorization") authorization: String,
@Field("user_id") user_id: String,
@Field("message") message: String,
): Response<CommonResponse>
@GET("customer_support_email")
suspend fun EmailUs(
@Header("Authorization") authorization: String,
): Response<EmailUs_Response>
@FormUrlEncoded
@POST("callback_apply")
suspend fun callback_apply(
@Header("Authorization") authorization: String,
@Field("mobile") mobile: String,
@Field("message") message: String,
): Response<CommonResponse>
@GET("about_us")
suspend fun AboutUs(
@Header("Authorization") authorization: String,
): Response<AboutUsResponse>
@GET("astro_profile")
suspend fun ViewProfile(
@Header("Authorization") authorization: String,
): Response<ViewProfileResponse>
@GET("notification")
suspend fun notificationApi(
@Header("Authorization") authorization: String,
): Response<NotificationListResponse>
@GET("faq")
suspend fun FAQ(
@Header("Authorization") authorization: String,
): Response<FAQResponse>
@FormUrlEncoded
@POST("chat_list")
suspend fun chat_list_MessageApi(
@Header("Authorization") authorization: String,
@Field("to_id") to_id: String,
): Response<ChatListMessageResponse>
@FormUrlEncoded
@POST("call_end")
suspend fun call_end(
@Header("Authorization") authorization: String,
@Field("timer") timer: String,
@Field("from_user") from_user: String,
@Field("to_user") to_user: String,
@Field("caller_id") caller_id: String,
@Field("type") type: String,
@Field("unique_id") fixed_session: String,
): Response<CommonResponse>
@FormUrlEncoded
@POST("chat_end")
suspend fun chat_end(
@Header("Authorization") authorization: String,
@Field("timer") timer: String,
@Field("from_user") from_user: String,
@Field("to_user") to_user: String,
@Field("caller_id") caller_id: String,
@Field("type") type: String,
@Field("unique_id") fixed_session: String,
): Response<CommonResponse>
@FormUrlEncoded
@POST("live_end")
suspend fun live_end(
@Header("Authorization") authorization: String,
@Field("timer") timer: String,
@Field("from_user") from_user: String,
@Field("to_user") to_user: String,
@Field("type") type: String,
): Response<CommonResponse>
@FormUrlEncoded
@POST("send_chat_with_us")
suspend fun send_chat_with_us(
@Header("Authorization") authorization: String,
@Field("message") caller_id: String,
): Response<CommonResponse>
@GET("get_chat_with_us")
suspend fun get_chat_with_us(
@Header("Authorization") authorization: String,
): Response<GetCustomerSupportChat>
@FormUrlEncoded
@POST("check_chat_end")
suspend fun check_chat_end(
@Header("Authorization") authorization: String,
@Field("caller_id") caller_id: String,
): Response<CheckChatEndResponse>
@GET("notification")
suspend fun Notification(
@Header("Authorization") authorization: String,
): Response<NotificationResponse>
@FormUrlEncoded
@POST("call_ring_status_save")
suspend fun call_ring_status_save(
@Header("Authorization") authorization: String,
@Field("channel_name") channel_name: String,
): Response<call_ring_status_save_Response>
@FormUrlEncoded
@POST("call_ring_end")
suspend fun call_ring_end(
@Header("Authorization") authorization: String,
@Field("channel_name") channel_name: String,
): Response<CommonResponse>
@FormUrlEncoded
@POST("call_ring")
suspend fun call_ring(
@Header("Authorization") authorization: String,
@Field("astro_id") astro_id: String,
@Field("user_id") user_id: String,
@Field("request_id") request_id: String,
): Response<CallRingResponse>
@FormUrlEncoded
@POST("chatagora")
suspend fun chatagoraApi(
@Header("Authorization") authorization: String,
@Field("to_userId") to_userId: String,
@Field("message") message: String,
@Field("type") type: String,
): Response<ChatAgoraResponse>
@GET("setting_details")
suspend fun setting_detailsApi(
@Header("Authorization") authorization: String,
): Response<SettingDetailsGetResponse>
@GET("update_online_status")
suspend fun checkOnlineStatusApi(
@Header("Authorization") authorization: String,
): Response<CommonResponse>
@FormUrlEncoded
@POST("setting_update")
suspend fun setting_updateApi(
@Header("Authorization") authorization: String,
@Field("is_chat") is_chat: String,
@Field("is_audio_call") is_audio_call: String,
@Field("is_video_call") is_video_call: String
): Response<SettingDetailsGetResponse>
@FormUrlEncoded
@POST("get_cls_date_wise")
suspend fun GetCalender(
@Header("Authorization") authorization: String,
@Field("date") date: String,
): Response<CalenderList>
@FormUrlEncoded
@POST("manage_calendar_schedule")
suspend fun manage_calendar_scheduleApi(
@Header("Authorization") authorization: String,
@Field("date") date: String,
@Field("from_time") from_time: String,
@Field("to_time") to_time: String,
): Response<ManageCalendarScheduleResponse>
@FormUrlEncoded
@POST("calendar_schedule_delete")
suspend fun calendar_schedule_deleteApi(
@Header("Authorization") authorization: String,
@Field("id") id: String,
): Response<ScheduleCalendarDeleteResponse>
@FormUrlEncoded
@POST("call_request_detail")
suspend fun call_request_detail_api(
@Header("Authorization") authorization: String,
@Field("id") id: String
): Response<CallRequestDetailResponse>
@FormUrlEncoded
@POST("call_request_accecpt")
suspend fun call_request_accecpt_api(
@Header("Authorization") authorization: String,
@Field("id") id: String
): Response<ChatRequestCancelResponse>
@FormUrlEncoded
@POST("call_request_cancel")
suspend fun call_request_cancel_api(
@Header("Authorization") authorization: String,
@Field("id") id: String,
@Field("reason") reason: String,
@Field("comment") comment: String,
@Field("action_by") action_by: String,
): Response<ChatRequestCancelResponse>
@FormUrlEncoded
@POST("click_user_chat")
suspend fun click_user_chat(
@Header("Authorization") authorization: String,
@Field("user_id") user_id: String,
): Response<CommonResponse>
@GET("chat_user_list")
suspend fun chat_user_listApi(
@Header("Authorization") authorization: String,
): Response<ChatUserListResponse>
@FormUrlEncoded
@POST("chat_request_detail")
suspend fun chat_request_detail_api(
@Header("Authorization") authorization: String,
@Field("id") id: String
): Response<ChatRequestDetailResponse>
@GET("call_user_list")
suspend fun call_user_listApi(
@Header("Authorization") authorization: String,
): Response<CallUserListResponse>
@FormUrlEncoded
@POST("chat_request_accecpt")
suspend fun chat_request_accecpt_api(
@Header("Authorization") authorization: String,
@Field("id") id: String
): Response<ChatRequestCancelResponse>
@GET("reason_cancel_list")
suspend fun chatcallReasonCancelListApi(
@Header("Authorization") authorization: String,
): Response<ChatCallCancelReasonResponse>
@GET("cancellation_by_user")
suspend fun cancellationByUserApi(
@Header("Authorization") authorization: String,
): Response<CancellationByUserResponse>
@FormUrlEncoded
@POST("chat_request_cancel")
suspend fun chat_request_cancel_api(
@Header("Authorization") authorization: String,
@Field("id") id: String,
@Field("reason") reason: String,
@Field("comment") comment: String
): Response<ChatRequestCancelResponse>
@GET("chat_request_list")
suspend fun Chathome(
@Header("Authorization") authorization: String,
): Response<Chat_Call_Response>
@GET("call_request_list")
suspend fun Callhome(
@Header("Authorization") authorization: String,
): Response<Chat_Call_Response>
@FormUrlEncoded
@POST("add_comment")
suspend fun add_comment(
@Field("user_id") user_id: String,
@Field("astro_id") astro_id: String,
@Field("message") message: String,
@Field("type") type: String,
): Response<CommonResponse>
@FormUrlEncoded
@POST("get_live_comments")
suspend fun get_live_comments(
@Header("Authorization") authorization: String,
@Field("channel_name") channel_name: String,
): Response<LiveCommentsModelClass>
@FormUrlEncoded
@POST("confirmation_booking_list")
suspend fun confirmation_booking_listApi(
@Header("Authorization") authorization: String,
@Field("type") type: String
): Response< ConfirmationBookingResponse>
@Multipart
@POST("report_doc_upload")
suspend fun report_doc_upload(
@Header("Authorization") authorization: String,
@Part("user_id") user_id: RequestBody,
@Part("report_intake_id") report_intake_id: RequestBody,
@Part("text") text: RequestBody,
@Part file: MultipartBody.Part,
): Response<CommonResponse>
@GET("fixed_session_requests")
suspend fun fixed_session_requests(
@Header("Authorization") authorization: String,
): Response<FixedsessionResponseList>
@FormUrlEncoded
@POST("fixed_session_request_accecpt")
suspend fun fixed_session_request_accecpt(
@Header("Authorization") authorization: String,
@Field("id") id: String
): Response<ChatRequestCancelResponse>
@FormUrlEncoded
@POST("fix_session_detail")
suspend fun fix_session_detail(
@Header("Authorization") authorization: String,
@Field("user_detail_id") user_detail_id: String
): Response<FixSessionDetail>
@FormUrlEncoded
@POST("my_bookings")
suspend fun upcomingCompletedBookingsApi(
@Header("Authorization") authorization: String,
@Field("type") type: String,
): Response<MyBookingsUpcomingCompletedResponse>
} |
callastro/app/src/main/java/com/callastro/data/MainRepositoryImpl.kt | 1189102254 | package com.callastro.data
import com.callastro.model.*
import okhttp3.MultipartBody
import okhttp3.RequestBody
import retrofit2.Response
import retrofit2.http.Field
import retrofit2.http.Part
import javax.inject.Inject
class MainRepositoryImpl @Inject constructor(private val apiService: ApiService) : MainRepository {
override suspend fun login(
country_code: String,
mobile: String,
device_id: String,
device_type: String,
device_name: String,
device_token: String
):
Response<LoginResponse> =
apiService.login(country_code,mobile, device_id, device_type, device_name, device_token)
override suspend fun loginverification(id: String, otp: String):
Response<LoginverificationResponse> = apiService.login_verification(id, otp)
override suspend fun Expertize(token:String):
Response<ExpertizeResponse> = apiService.Expertize(token)
override suspend fun Language(token:String):
Response<LanguageResponse> = apiService.Language(token)
override suspend fun post_profile_detailApi(token:String):
Response<PostProfileDetailResponse> = apiService.post_profile_detailApi(token)
override suspend fun stateListApi(token:String):
Response<StateListResponse> = apiService.stateListApi(token)
override suspend fun cityListApi(token:String, state_id:String):
Response<CityListResponse> = apiService.cityListApi(token,state_id)
override suspend fun pinCodeListApi(token:String, city_id:String):
Response<PincodeListResponse> = apiService.pinCodeListApi(token, city_id)
override suspend fun skills_listApi(token:String):
Response<SkillsListResponse> = apiService.skills_listApi(token)
override suspend fun astro_earningApi(token:String, filter:String):
Response<AstroEarningResponse> = apiService.astro_earningApi(token, filter)
override suspend fun request_money(token:String, money:String):
Response<CommonResponse> = apiService.request_money(token, money)
override suspend fun chat_user_listApi(token:String):
Response<ChatUserListResponse> = apiService.chat_user_listApi(token)
override suspend fun click_user_chat(token:String,user_id: String):
Response<CommonResponse> = apiService.click_user_chat(token,user_id)
override suspend fun agora_generate_tokenApi(token:String, astro_id: String, call_type: String):
Response<AgoraGenerateTokenResponse> = apiService.agora_generate_tokenApi(token, astro_id, call_type)
override suspend fun call_end_by_status(token:String,caller_id: String):
Response<CallendbyuserResponse> = apiService.call_end_by_status(token,caller_id)
override suspend fun live_agora_generate_token(token:String,topic: String):
Response<GoLiveResponse> = apiService.live_agora_generate_token(token,topic)
override suspend fun upcomingCompletedBookingsApi(token:String, type:String):
Response<MyBookingsUpcomingCompletedResponse> = apiService.upcomingCompletedBookingsApi(token, type)
override suspend fun delete_live_astro(token:String):
Response<CommonResponse> = apiService.delete_live_astro(token)
override suspend fun checkOnlineStatusRepo(token: String): Response<CommonResponse> = apiService.checkOnlineStatusApi(token)
override suspend fun astro_history_wallets(token:String):
Response<AstroEarningListResponse> = apiService.astro_history_wallets(token)
override suspend fun live_agora_topic(token:String, topic:String):
Response<GoLiveResponse> = apiService.live_agora_topic(token, topic)
override suspend fun astro_home(token:String):
Response<CallChatStatusResponse> = apiService.astro_home(token)
override suspend fun AddAstroDetailsApi(token:String,
full_name: RequestBody,
company_name: RequestBody,
email: RequestBody,
gender: RequestBody,
address: RequestBody,
state_id: RequestBody,
city_id: RequestBody,
pincode_id: RequestBody,
expertise: RequestBody,
language: RequestBody,
skills: RequestBody,
bank_name: RequestBody,
account_no: RequestBody,
acc_holder_name: RequestBody,
ifsc_code: RequestBody,
branch: RequestBody,
document1: MultipartBody.Part,
document2: MultipartBody.Part,
profile_image: MultipartBody.Part,
calling_charge:RequestBody,
about_us: RequestBody,
fixed_session_30min_charge :RequestBody,
fixed_session_60min_charge :RequestBody,
experience :RequestBody,):
Response<AddAstroDetailResponse> = apiService.AddAstroDetailsApi(token,
full_name, company_name, email, gender, address ,state_id , city_id, pincode_id,expertise , language,
skills, bank_name,account_no , acc_holder_name,ifsc_code , branch,document1, document2,profile_image,calling_charge,about_us,fixed_session_30min_charge,fixed_session_60min_charge,experience )
override suspend fun add_expertiseApi(token:String, expertise_id:String):
Response<AddExpertiseItemResponse> = apiService.add_expertiseApi(token, expertise_id)
override suspend fun banner(token: String):
Response<BannerResponse> = apiService.banner(token)
override suspend fun delete_expertiseApi(token:String, id:String):
Response<DeleteExpertiseItemResponse> = apiService.delete_expertiseApi(token, id)
override suspend fun get_added_skillsApi(token:String):
Response<GetAddedSkillsResponse> = apiService.get_added_skillsApi(token)
override suspend fun add_skillsApi(token:String, skill_id:String):
Response<AddSkillsItemResponse> = apiService.add_skillsApi(token, skill_id)
override suspend fun get_added_expertiseApi(token:String):
Response<GetAddedExpertiseResponse> = apiService.get_added_expertiseApi(token)
override suspend fun astro_give_review(token: String,astro_id: String,rating: String,review: String,):
Response<GiveReviewResponse> = apiService.astro_give_review(token, astro_id,rating,review)
override suspend fun recent_otp(mobile_no: String,type: String,):
Response<LoginResponse> = apiService.recent_otp(mobile_no,type)
override suspend fun delete_skillsApi(token:String, id:String):
Response<DeleteSkillsItemResponse> = apiService.delete_skillsApi(token, id)
override suspend fun get_added_languageApi(token:String):
Response<GetAddedLanguageResponse> = apiService.get_added_languageApi(token)
override suspend fun add_languageApi(token:String, language_id:String):
Response<AddLanguageItemResponse> = apiService.add_languageApi(token, language_id)
override suspend fun delete_languageApi(token:String, id:String):
Response<DeleteLanguageItemResponse> = apiService.delete_languageApi(token, id)
override suspend fun post_profile_updateApi(token:String, full_name:String, gender:String, experience:String):
Response<PostProfileUpdateResponse> = apiService.post_profile_updateApi(token, full_name, gender, experience)
override suspend fun experience_listApi(token:String):
Response<ExperienceListResponse> = apiService.experience_listApi(token)
override suspend fun confirmation_booking_report_detail(token:String,report_intakes_id: String):
Response<ConfirmationReportHistoryResponse> = apiService.confirmation_booking_report_detail(token,report_intakes_id)
override suspend fun astro_rating_review_listApi(token:String):
Response<GetAstroRatingReviewListResponse> = apiService.astro_rating_review_listApi(token)
override suspend fun review_pin_updateApi(token:String, id:String, type:String):
Response<ReviewPinUpdateResponse> = apiService.review_pin_updateApi(token, id, type)
override suspend fun rating_review_pinselected_listApi(token:String):
Response<GetAstroRatingReviewPinResponse> = apiService.rating_review_pinselected_listApi(token)
override suspend fun EditProfile(token:String, name: RequestBody, mobile_no: RequestBody, email: RequestBody, gender: RequestBody, profile: MultipartBody.Part,
address: RequestBody,
state_id: RequestBody,
// expertise: RequestBody,
// language: RequestBody,
// skills: RequestBody,
company_name: RequestBody,
city: RequestBody,
pincode: RequestBody,
calling_charg: RequestBody,
document1: MultipartBody.Part,
document2: MultipartBody.Part,
about_us: RequestBody,
fixed_session_30min_charge: RequestBody,
fixed_session_60min_charge: RequestBody,
experience: RequestBody,):
Response<LoginverificationResponse> = apiService.Editprofile(token,
name,
mobile_no,
email,gender,
profile,address, state_id, /*expertise, language, skills, */company_name, city, pincode, calling_charg, document1, document2,about_us,fixed_session_30min_charge,fixed_session_60min_charge,experience)
override suspend fun callHistoryListApi(token:String,/* dummy:String*/):
Response<CallHistoryListResponse> = apiService.callHistoryListApi(token, /*dummy*/)
override suspend fun chatHistoryListApi(token:String, /*dummy:String*/):
Response<ChatHistoryListResponse> = apiService.chatHistoryListApi(token,/*dummy*/)
override suspend fun EmailUs(token:String):
Response<EmailUs_Response> = apiService.EmailUs(token)
override suspend fun product_listApi(token:String):
Response<ProductListResponse> = apiService.product_listApi(token)
override suspend fun add_suggest_remedyApi(token:String, product_ids:String, user_id:String):
Response<AddSuggestRemedyResponse> = apiService.add_suggest_remedyApi(token, product_ids, user_id)
override suspend fun suggest_remedy_listApi(token:String, user_id: String):
Response<SuggestRemedyListResponse> = apiService.suggest_remedy_listApi(token, user_id)
override suspend fun add_suggest_remedy_messageApi(token:String, user_id: String, message: String):
Response<CommonResponse> = apiService.add_suggest_remedy_messageApi(token, user_id, message)
override suspend fun callback_apply(token:String,mobile:String,discription:String):
Response<CommonResponse> = apiService.callback_apply(token,mobile,discription)
override suspend fun aboutus(token:String):
Response<AboutUsResponse> = apiService.AboutUs(token)
override suspend fun notificationApi(token:String):
Response<NotificationListResponse> = apiService.notificationApi(token)
override suspend fun faq(token:String):
Response<FAQResponse> = apiService.FAQ(token)
override suspend fun chat_list_MessageApi(token:String, to_id: String):
Response<ChatListMessageResponse> = apiService.chat_list_MessageApi(token, to_id)
override suspend fun call_end(token:String,timer:String,from_user: String,to_user: String,caller_id:String,type: String,fixed_session: String,):
Response<CommonResponse> = apiService.call_end(token,timer,from_user,to_user,caller_id,type,fixed_session)
override suspend fun chat_end(token:String,timer:String,from_user: String,to_user: String,caller_id:String,type: String,fixed_session: String,):
Response<CommonResponse> = apiService.chat_end(token,timer,from_user,to_user,caller_id,type,fixed_session)
override suspend fun live_end(token:String,timer:String,from_user: String,to_user: String,type: String):
Response<CommonResponse> = apiService.live_end(token,timer,from_user,to_user,type)
override suspend fun send_chat_with_us(token:String,message:String):
Response<CommonResponse> = apiService.send_chat_with_us(token,message)
override suspend fun get_chat_with_us(token:String):
Response<GetCustomerSupportChat> = apiService.get_chat_with_us(token)
override suspend fun notification(token: String):
Response<NotificationResponse> = apiService.Notification(token)
override suspend fun call_ring_status_save(token:String,channel_name: String):
Response<call_ring_status_save_Response> = apiService.call_ring_status_save(token,channel_name)
override suspend fun call_ring_end(token:String,channel_name: String):
Response<CommonResponse> = apiService.call_ring_end(token,channel_name)
override suspend fun call_ring(token: String,astro_id:String,user_id:String,request_id: String):
Response<CallRingResponse> = apiService.call_ring(token,astro_id,user_id,request_id)
override suspend fun check_chat_end(token:String,caller_id: String):
Response<CheckChatEndResponse> = apiService.check_chat_end(token,caller_id)
override suspend fun chatagoraApi(token:String, to_userId: String, message: String, type: String):
Response<ChatAgoraResponse> = apiService.chatagoraApi(token, to_userId, message, type)
override suspend fun setting_detailsApi(token:String):
Response<SettingDetailsGetResponse> = apiService.setting_detailsApi(token)
override suspend fun setting_updateApi(token:String, is_chat:String, is_audio_call:String, is_video_call:String):
Response<SettingDetailsGetResponse> = apiService.setting_updateApi(token, is_chat, is_audio_call, is_video_call)
override suspend fun GetCalender(token:String,date:String):
Response<CalenderList> = apiService.GetCalender(token,date)
override suspend fun manage_calendar_scheduleApi(token:String, date: String, from_time: String, to_time: String):
Response<ManageCalendarScheduleResponse> = apiService.manage_calendar_scheduleApi(token, date, from_time, to_time)
override suspend fun calendar_schedule_deleteApi(token:String, id: String):
Response<ScheduleCalendarDeleteResponse> = apiService.calendar_schedule_deleteApi(token, id)
override suspend fun call_request_detail_api(token:String,id:String):
Response<CallRequestDetailResponse> = apiService.call_request_detail_api(token,id)
override suspend fun call_request_accecpt_api(token:String,id:String):
Response<ChatRequestCancelResponse> = apiService.call_request_accecpt_api(token,id)
override suspend fun call_request_cancel_api(token:String,id:String,reason:String,comment:String,action_by: String,):
Response<ChatRequestCancelResponse> = apiService.call_request_cancel_api(token,id,reason,comment,action_by)
override suspend fun chat_request_detail_api(token:String,id:String):
Response<ChatRequestDetailResponse> = apiService.chat_request_detail_api(token,id)
override suspend fun chat_request_accecpt_api(token:String,id:String):
Response<ChatRequestCancelResponse> = apiService.chat_request_accecpt_api(token,id)
override suspend fun chatcallReasonCancelListApi(token:String):
Response<ChatCallCancelReasonResponse> = apiService.chatcallReasonCancelListApi(token)
override suspend fun cancellationByUserApi(token:String):
Response<CancellationByUserResponse> = apiService.cancellationByUserApi(token)
override suspend fun chat_request_cancel_api(token:String,id:String,reason:String,comment:String):
Response<ChatRequestCancelResponse> = apiService.chat_request_cancel_api(token,id,reason,comment)
override suspend fun Chathome(token:String):
Response<Chat_Call_Response> = apiService.Chathome(token)
override suspend fun Callhome(token:String):
Response<Chat_Call_Response> = apiService.Callhome(token)
override suspend fun confirmation_booking_listApi(token:String, type:String):
Response<ConfirmationBookingResponse> = apiService.confirmation_booking_listApi(token, type)
override suspend fun report_doc_upload(token:String,
user_id: RequestBody,
report_intake_id: RequestBody,
text: RequestBody,
file: MultipartBody.Part,
):
Response<CommonResponse> = apiService.report_doc_upload(
token,
user_id,
report_intake_id,
text,
file)
override suspend fun call_user_listApi(token:String):
Response<CallUserListResponse> = apiService.call_user_listApi(token)
override suspend fun ViewProfile(token: String):
Response<ViewProfileResponse> = apiService.ViewProfile(token)
override suspend fun add_comment(
user_id: String,
astro_id: String,
message: String,
type: String,
): Response<CommonResponse> =
apiService.add_comment(user_id, astro_id, message, type)
override suspend fun fixed_session_requests(token:String):
Response<FixedsessionResponseList> = apiService.fixed_session_requests(token)
override suspend fun fixed_session_request_accecpt(token:String,id:String):
Response<ChatRequestCancelResponse> = apiService.fixed_session_request_accecpt(token,id)
override suspend fun fix_session_detail(token:String,user_detail_id:String):
Response<FixSessionDetail> = apiService.fix_session_detail(token,user_detail_id)
override suspend fun UpdateBank(token:String,bank_name:String,account_no: String,acc_holder_name: String,ifsc_code: String,branch: String):
Response<BankDetailResponse> = apiService.UpdateBank(token,bank_name,account_no,acc_holder_name,ifsc_code,branch)
override suspend fun GetBankDetail(token:String):
Response<GetBankDetail> = apiService.GetBankDetail(token)
override suspend fun refund_money(token:String,order_id: String):
Response<CommonResponse> = apiService.refund_money(token,order_id)
override suspend fun get_live_comments(
token: String,
channel_name: String,
): Response<LiveCommentsModelClass> =
apiService.get_live_comments(token,channel_name)
} |
callastro/app/src/main/java/com/callastro/broadcastReceiver/NotificationBroadcastReceiver.kt | 2392833591 | package com.callastro.broadcastReceiver
//import com.example.swastharakshak.chats.VoiceCallActivity
import android.annotation.SuppressLint
import android.app.NotificationManager
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.media.MediaPlayer
import android.os.Vibrator
import com.callastro.R
import com.callastro.fcm.MyFirebaseMessagingService
import com.maxtra.u.Constant
class NotificationBroadcastReceiver : BroadcastReceiver() {
// private var incomingCallNotificationBuilder: FirebaseMessaging? = null
// lateinit var apppcontext:Context
private var vib: Vibrator? = null
var mMediaPlayer: MediaPlayer? = null
override fun onReceive(context: Context, intent: Intent) {
if (intent != null) {
val eventType = intent.getStringExtra("action")
val roomId = intent.getStringExtra("Channelname")
val type = intent.getStringExtra("types")
val notId = intent.getIntExtra(Constant.NOTIFICATION_ID, 0)
val token = intent.getStringExtra(Constant.TOKEN)
val doctor_name = intent.getStringExtra("doctor_name")
val doctor_image = intent.getStringExtra("doctor_image")
// println("shivani>" + eventType)
// apppcontext = this
val notificationManager = context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notificationManager.cancel(notId!!)
var vib: Vibrator? = null
var mMediaPlayer: MediaPlayer? = null
mMediaPlayer = MediaPlayer.create(context, R.raw.notification)
vib = context.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
vib!!.vibrate(1000)
mMediaPlayer!!.isLooping = false
mMediaPlayer!!.start()
// mMediaPlayer = MediaPlayer.create(context, R.raw.notification)
// vib = context.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator
// vib!!.vibrate(1000)
// mMediaPlayer!!.isLooping = false
// mMediaPlayer!!.start()
// incomingCallNotificationBuilder = apppcontext
val intent = Intent(context, MyFirebaseMessagingService::class.java)
// Toast.makeText(context, "hiiftrhtrhtrhtrff", Toast.LENGTH_SHORT).show()
intent.putExtra("id", 101)
intent.putExtra("msg", "hi")
context.sendBroadcast(intent)
// FirebaseMessaging().stopSound(context)
//starting service
// stopSound()
//starting service
// Toast.makeText(context, "hiiftrhtrhtrhtrff", Toast.LENGTH_SHORT).show()
// val pm = getSystemService(Context.POWER_SERVICE) as PowerManager
// val wl = pm.newWakeLock(
// PowerManager.PARTIAL_WAKE_LOCK or PowerManager.ACQUIRE_CAUSES_WAKEUP,
// "myalarmapp:alarm."
// )
// wl.acquire(5000)
val notifManager =
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
notifManager.cancelAll()
// eventType?.let {
//// if (it.equals("Accept")) {
//// Toast.makeText(context, eventType, Toast.LENGTH_SHORT).show()
// if (type == "1"){
//
// val intent = Intent(context, VoiceCallActivity::class.java).apply {
// putExtra("channelName", roomId)
// putExtra("token", token)
// putExtra("doctor_name", doctor_name)
// putExtra("doctor_image", doctor_image)
// flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
// }
// context.startActivity(intent)
//// context.sendBroadcast(intent)
// NotificationManagerCompat.from(context).cancel(null, 321);
// }else if (type == "2"){
//// Toast.makeText(context, "hiihtrhtrhtrfff", Toast.LENGTH_SHORT).show()
// val intent = Intent(context, VideoCallActivity::class.java).apply {
// putExtra("channelName", roomId)
// putExtra("token", token)
// putExtra("doctor_name", doctor_name)
// putExtra("doctor_image", doctor_image)
// flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
//
// }
// context.startActivity(intent)
//
//// context.sendBroadcast(intent)
// NotificationManagerCompat.from(context).cancel(null, 321);
// }
//// Toast.makeText(context, "hiiftrhtrhtrhtrff", Toast.LENGTH_SHORT).show()
//// }else if (it.equals("Reject")) {
//// context.stopService(Intent(context, FirebaseMessaging::class.java))
//// val it = Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS)
//// context.sendBroadcast(it)
////
//// }
// }
}
}
@SuppressLint("MissingPermission")
fun stopSound() {
if (mMediaPlayer != null) {
mMediaPlayer!!.stop()
vib!!.cancel()
mMediaPlayer!!.release()
mMediaPlayer = null
}
}
} |
callastro/sample/src/main/java/com/swnishan/materialdatetimepicker/sample/MainActivity.kt | 2750257319 | package com.swnishan.materialdatetimepicker.sample
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import com.google.android.material.tabs.TabLayoutMediator
import kotlinx.android.synthetic.main.activity_main.*
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
viewPager.adapter = ViewPagerAdapter(supportFragmentManager, this.lifecycle)
TabLayoutMediator(tabLayout, viewPager) { tab, position ->
when (position) {
0 -> tab.text = getString(R.string.time_picker)
1 -> tab.text = getString(R.string.date_picker)
}
}.attach()
}
}
|
callastro/sample/src/main/java/com/swnishan/materialdatetimepicker/sample/ViewPagerAdapter.kt | 1249144338 | package com.swnishan.materialdatetimepicker.sample
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.lifecycle.Lifecycle
import androidx.viewpager2.adapter.FragmentStateAdapter
import com.swnishan.materialdatetimepicker.sample.fragment.DatePickerFragment
import com.swnishan.materialdatetimepicker.sample.fragment.TimePickerFragment
internal class ViewPagerAdapter(fragmentManager: FragmentManager, lifeCycle: Lifecycle) : FragmentStateAdapter(fragmentManager, lifeCycle) {
override fun getItemCount(): Int = 2
override fun createFragment(position: Int): Fragment = when (position) {
0 -> TimePickerFragment()
else -> DatePickerFragment()
}
}
|
callastro/sample/src/main/java/com/swnishan/materialdatetimepicker/sample/fragment/TimePickerFragment.kt | 2244138662 | package com.swnishan.materialdatetimepicker.sample.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import com.swnishan.materialdatetimepicker.sample.R
import com.swnishan.materialdatetimepicker.timepicker.MaterialTimePickerDialog
import com.swnishan.materialdatetimepicker.timepicker.MaterialTimePickerView
import kotlinx.android.synthetic.main.fragment_time_picker.*
class TimePickerFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_time_picker, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
btnTimePickerDialog.setOnClickListener {
val builder = MaterialTimePickerDialog.Builder.setTitle(getString(R.string.set_start_time))
.setNegativeButtonText(getString(R.string.cancel))
.setPositiveButtonText(getString(R.string.ok))
// Below values can be set from the style as well (materialTimePickerViewStyle)
.setTimeConvention(MaterialTimePickerView.TimeConvention.HOURS_12) // default 12 hours
.setHour(13) // default current hour
.setMinute(34) // default current minute
.setTimePeriod(MaterialTimePickerView.TimePeriod.AM) // default based on the current time
.setFadeAnimation(350L, 1050L, .3f, .7f)
.setTheme(R.style.ThemeOverlay_Dialog_TimePicker) // default [R.style.ThemeOverlay_Dialog_MaterialTimePicker]
.build()
builder.setOnTimePickListener { selectedTime -> // Selected time as long value
Toast.makeText(
requireContext(),
"${builder.getHour()} : ${builder.getMinute()} ${builder.getTimePeriod().name}",
Toast.LENGTH_SHORT
).show()
}
builder.show(requireNotNull(this.fragmentManager), MaterialTimePickerDialog::class.simpleName)
}
}
}
|
callastro/sample/src/main/java/com/swnishan/materialdatetimepicker/sample/fragment/DatePickerFragment.kt | 2914383241 | package com.swnishan.materialdatetimepicker.sample.fragment
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import com.swnishan.materialdatetimepicker.datepicker.MaterialDatePickerDialog
import com.swnishan.materialdatetimepicker.datepicker.MaterialDatePickerView
import com.swnishan.materialdatetimepicker.sample.R
import kotlinx.android.synthetic.main.fragment_date_picker.*
import org.threeten.bp.OffsetDateTime
class DatePickerFragment : Fragment() {
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_date_picker, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
btnDatePickerDialog.setOnClickListener {
val builder = MaterialDatePickerDialog.Builder.setTitle(getString(R.string.set_start_date))
.setNegativeButtonText(getString(R.string.cancel))
.setPositiveButtonText(getString(R.string.ok))
// Below values can be set from the style as well (materialDatePickerViewStyle)
.setDate(OffsetDateTime.now().plusDays(10).toInstant().toEpochMilli()) // default current date
.setDateFormat(MaterialDatePickerView.DateFormat.DD_MMMM_YYYY) // default DateFormat.DD_MMM_YYYY (05 Feb 2021)
.setTheme(R.style.ThemeOverlay_Dialog_DatePicker) // default R.style.ThemeOverlay_Dialog_MaterialDatePicker
.setFadeAnimation(350L, 1050L, .3f, .7f)
.build()
builder.setOnDatePickListener { selectedDate -> // selected date as long value
Toast.makeText(
it.context,
"${builder.getDayOfMonth()}-${builder.getMonth()}-${builder.getYear()}",
Toast.LENGTH_SHORT
).show()
}
builder.show(requireNotNull(this.fragmentManager), MaterialDatePickerDialog::class.simpleName)
}
}
}
|
061_RestAPI/app/src/androidTest/java/com/example/project8_classc/ExampleInstrumentedTest.kt | 909588357 | package com.example.project8_classc
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.project8_classc", appContext.packageName)
}
} |
061_RestAPI/app/src/test/java/com/example/project8_classc/ExampleUnitTest.kt | 2290303531 | package com.example.project8_classc
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/ui/home/viewmodel/HomeViewModel.kt | 3416876544 | package com.example.project8_classc.ui.home.viewmodel
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.project8_classc.model.Kontak
import com.example.project8_classc.repository.KontakRepository
import kotlinx.coroutines.launch
import retrofit2.HttpException
import java.io.IOException
sealed class KontakUIState{
data class Success(val kontak: List<Kontak>) : KontakUIState()
object Error : KontakUIState()
object Loading : KontakUIState()
}
class HomeViewModel(private val kontakRepository: KontakRepository) : ViewModel(){
var kontakUIState: KontakUIState by mutableStateOf(KontakUIState.Loading)
private set
init {
getKontak()
}
fun getKontak(){
viewModelScope.launch {
kontakUIState = KontakUIState.Loading
kontakUIState = try {
KontakUIState.Success(kontakRepository.getKontak())
}catch (e: IOException){
KontakUIState.Error
}catch (e : HttpException){
KontakUIState.Error
}
}
}
fun deleteKontak(id: Int){
viewModelScope.launch {
try {
kontakRepository.deleteKontak(id)
}catch (e: IOException){
KontakUIState.Error
}catch (e: HttpException){
KontakUIState.Error
}
}
}
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/ui/home/screen/HomeScreen.kt | 3843956696 | package com.example.project8_classc.ui.home.screen
import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Add
import androidx.compose.material.icons.filled.Delete
import androidx.compose.material.icons.filled.Email
import androidx.compose.material.icons.filled.Person
import androidx.compose.material.icons.filled.Phone
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.FloatingActionButton
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import com.example.project8_classc.R
import com.example.project8_classc.model.Kontak
import com.example.project8_classc.navigation.DestinasiNavigasi
import com.example.project8_classc.ui.home.viewmodel.HomeViewModel
import com.example.project8_classc.ui.home.viewmodel.KontakUIState
import androidx.lifecycle.viewmodel.compose.viewModel
import com.example.project8_classc.ui.PenyediaViewModel
import com.example.project8_classc.ui.TopAppBarKontak
import com.example.project8_classc.ui.theme.Project8_ClassCTheme
object DestinasiHome : DestinasiNavigasi{
override val route = "home"
override val titleRes = "Kontak"
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun HomeScreen(
navigateToItemEntry: () -> Unit,
modifier: Modifier = Modifier,
onDetailClick: (Int) -> Unit = {},
viewModel: HomeViewModel = viewModel(factory = PenyediaViewModel.Factory)
){
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior()
Scaffold(
modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = {
TopAppBarKontak(
title = DestinasiHome.titleRes ,
canNavigasiBack = false,
scrollBehavior = scrollBehavior
)
},
floatingActionButton = {
FloatingActionButton(
onClick = navigateToItemEntry,
shape = MaterialTheme.shapes.medium,
modifier = Modifier.padding(18.dp)
) {
Icon(
imageVector = Icons.Default.Add,
contentDescription = "Add Kontak"
)
}
},
) { innerPadding ->
HomeStatus(
kontakUIState = viewModel.kontakUIState ,
retryAction = {
viewModel.getKontak()
},
modifier = Modifier.padding(innerPadding),
onDetailClick = onDetailClick,
onDeleteClick = {
viewModel.deleteKontak(it.id)
viewModel.getKontak()
}
)
}
}
@Composable
fun HomeStatus(
kontakUIState: KontakUIState,
retryAction: () -> Unit,
modifier: Modifier = Modifier,
onDeleteClick: (Kontak) -> Unit = {},
onDetailClick: (Int) -> Unit
){
when (kontakUIState){
is KontakUIState.Loading -> OnLoading(modifier.fillMaxSize())
is KontakUIState.Success -> KontakLayout(
kontak = kontakUIState.kontak,
modifier = modifier.fillMaxWidth(),
onDetailClick = {
onDetailClick(it.id)
}
) {
onDeleteClick(it)
}
is KontakUIState.Error -> OnError(retryAction, modifier.fillMaxSize())
}
}
//The homescreen displaying the loading message
@Composable
fun OnLoading(modifier: Modifier = Modifier){
Image(
modifier = modifier.size(200.dp),
painter = painterResource(id = R.drawable.loading_img),
contentDescription = stringResource(R. string.loading)
)
}
//The home screen displaying error message
@Composable
fun OnError(
retryAction: () -> Unit,
modifier: Modifier = Modifier
){
Column(
modifier = modifier,
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Image(
painter = painterResource(id = R.drawable.ic_connection_error) ,
contentDescription = ""
)
Text(stringResource(R.string.retry))
}
}
@Composable
fun KontakLayout(
kontak: Kontak,
modifier: Modifier = Modifier,
onDetailClick: (Kontak) -> Unit,
onDeleteClick: (Kontak) -> Unit = {}
){
LazyColumn(
modifier = modifier,
contentPadding = PaddingValues(16.dp),
verticalArrangement = Arrangement.spacedBy(16.dp)
){
items(kontak){kontak ->
KontakCard(kontak = kontak, modifier = Modifier
.fillMaxWidth()
.clickable { onDetailClick(kontak) },
onDeleteClick = {
onDeleteClick(kontak)
}
)
}
}
}
@Composable
fun KontakCard(
kontak: Kontak,
onDeleteClick: (Kontak) -> Unit = {},
modifier: Modifier = Modifier
){
Card(
modifier = modifier,
shape = MaterialTheme.shapes.medium,
elevation = CardDefaults.cardElevation(defaultElevation = 8.dp)
) {
Column(
modifier = Modifier.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(10.dp)
) {
Column (
modifier = Modifier.fillMaxWidth(),
horizontalAlignment = Alignment.CenterHorizontally
){
Row (
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
Icon(
imageVector = Icons.Default.Person,
contentDescription = null
)
Spacer(Modifier.padding(10.dp))
Text(
text = kontak.nama,
style = MaterialTheme.typography.titleLarge
)
}
Row (
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
){
Icon(
imageVector = Icons.Default.Phone,
contentDescription = null
)
Spacer(Modifier.padding(10.dp))
Text(
text = kontak.telpon,
style = MaterialTheme.typography.titleMedium
)
}
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
) {
Icon(
imageVector = Icons.Default.Email,
contentDescription = null
)
Spacer(Modifier.padding(10.dp))
Text(
text = kontak.alamat,
style = MaterialTheme.typography.titleMedium
)
}
}
Row (
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
){
Spacer(Modifier.weight(1f))
IconButton(onClick = {onDeleteClick(kontak)}) {
Icon(
imageVector = Icons.Default.Delete,
contentDescription = null
)
}
}
}
}
}
@Preview(showBackground = true)
@Composable
fun previewHomeScreen(){
Project8_ClassCTheme {
HomeScreen(navigateToItemEntry = {})
}
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/ui/PenyediaViewModel.kt | 2689688759 | package com.example.project8_classc.ui
import androidx.lifecycle.ViewModelProvider
import androidx.lifecycle.createSavedStateHandle
import androidx.lifecycle.viewmodel.CreationExtras
import androidx.lifecycle.viewmodel.initializer
import androidx.lifecycle.viewmodel.viewModelFactory
import com.example.project8_classc.KontakApplication
import com.example.project8_classc.ui.home.viewmodel.HomeViewModel
import com.example.project8_classc.ui.kontak.viewmodel.DetailsViewModel
import com.example.project8_classc.ui.kontak.viewmodel.EditViewModel
import com.example.project8_classc.ui.kontak.viewmodel.InsertViewModel
object PenyediaViewModel{
val Factory = viewModelFactory {
initializer {
HomeViewModel(aplikasiKontak().container.kontakRepository)
}
initializer {
InsertViewModel(aplikasiKontak().container.kontakRepository)
}
initializer {
DetailsViewModel(
createSavedStateHandle(),
kontakRepository = aplikasiKontak().container.kontakRepository
)
}
initializer {
EditViewModel(
createSavedStateHandle(),
kontakRepository = aplikasiKontak().container.kontakRepository
)
}
}
}
fun CreationExtras.aplikasiKontak(): KontakApplication =
(this[ViewModelProvider.AndroidViewModelFactory.APPLICATION_KEY] as KontakApplication) |
061_RestAPI/app/src/main/java/com/example/project8_classc/ui/KontakApp.kt | 2539957429 | package com.example.project8_classc.ui
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material3.CenterAlignedTopAppBar
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.material3.TopAppBarScrollBehavior
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.res.stringResource
import androidx.lifecycle.viewmodel.compose.viewModel
import com.example.project8_classc.R
import com.example.project8_classc.navigation.PengelolaHalaman
import com.example.project8_classc.ui.home.screen.HomeScreen
import com.example.project8_classc.ui.home.viewmodel.HomeViewModel
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun KontakApp(
homeViewModel: HomeViewModel = viewModel(factory = PenyediaViewModel.Factory)
){
val scrollBehavior = TopAppBarDefaults.exitUntilCollapsedScrollBehavior()
Scaffold(
modifier = Modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = { TopAppBar(scrollBehavior = scrollBehavior)}
){
Surface (
modifier = Modifier
.fillMaxSize()
.padding(it)
){
PengelolaHalaman()
}
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun TopAppBarKontak(
title: String,
canNavigasiBack: Boolean,
modifier: Modifier = Modifier,
scrollBehavior: TopAppBarScrollBehavior? = null,
navigateUp: () -> Unit = {}
){
CenterAlignedTopAppBar(title = { Text(title) },
modifier = modifier,
scrollBehavior = scrollBehavior,
navigationIcon = {
if (canNavigasiBack){
IconButton(onClick = navigateUp) {
Icon(
imageVector = Icons.Filled.ArrowBack,
contentDescription = ""
)
}
}
}
)
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun TopAppBar(
scrollBehavior: TopAppBarScrollBehavior,
modifier: Modifier = Modifier
){
CenterAlignedTopAppBar(
scrollBehavior = scrollBehavior,
title = {
Text(
text = stringResource(R.string.app_name),
style = MaterialTheme.typography.headlineSmall
)
},
modifier = modifier
)
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/ui/theme/Color.kt | 2894303581 | package com.example.project8_classc.ui.theme
import androidx.compose.ui.graphics.Color
val Purple80 = Color(0xFFD0BCFF)
val PurpleGrey80 = Color(0xFFCCC2DC)
val Pink80 = Color(0xFFEFB8C8)
val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260) |
061_RestAPI/app/src/main/java/com/example/project8_classc/ui/theme/Theme.kt | 1926112911 | package com.example.project8_classc.ui.theme
import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat
private val DarkColorScheme = darkColorScheme(
primary = Purple80,
secondary = PurpleGrey80,
tertiary = Pink80
)
private val LightColorScheme = lightColorScheme(
primary = Purple40,
secondary = PurpleGrey40,
tertiary = Pink40
/* Other default colors to override
background = Color(0xFFFFFBFE),
surface = Color(0xFFFFFBFE),
onPrimary = Color.White,
onSecondary = Color.White,
onTertiary = Color.White,
onBackground = Color(0xFF1C1B1F),
onSurface = Color(0xFF1C1B1F),
*/
)
@Composable
fun Project8_ClassCTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
content: @Composable () -> Unit
) {
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}
darkTheme -> DarkColorScheme
else -> LightColorScheme
}
val view = LocalView.current
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = colorScheme.primary.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
}
}
MaterialTheme(
colorScheme = colorScheme,
typography = Typography,
content = content
)
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/ui/theme/Type.kt | 3369396388 | package com.example.project8_classc.ui.theme
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
// Set of Material typography styles to start with
val Typography = Typography(
bodyLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
/* Other default text styles to override
titleLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 22.sp,
lineHeight = 28.sp,
letterSpacing = 0.sp
),
labelSmall = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Medium,
fontSize = 11.sp,
lineHeight = 16.sp,
letterSpacing = 0.5.sp
)
*/
) |
061_RestAPI/app/src/main/java/com/example/project8_classc/ui/kontak/viewmodel/InsertViewModel.kt | 1859275426 | package com.example.project8_classc.ui.kontak.viewmodel
import android.provider.ContactsContract.CommonDataKinds.Email
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.project8_classc.model.Kontak
import com.example.project8_classc.repository.KontakRepository
import kotlinx.coroutines.launch
class InsertViewModel (private val kontakRepository: KontakRepository) : ViewModel(){
var insertKontakState by mutableStateOf(InsertUiState())
private set
fun updateInsertKontakState(insertUiEvent: InsertUiEvent){
insertKontakState = InsertUiState(insertUiEvent = insertUiEvent)
}
suspend fun insertKontak(){
viewModelScope.launch {
try{
kontakRepository.insertKontak(insertKontakState.insertUiEvent.toKontak())
}catch (e: Exception){
e.printStackTrace()
}
}
}
}
data class InsertUiState(
val insertUiEvent: InsertUiEvent = InsertUiEvent(),
)
data class InsertUiEvent(
val id: Int = 0,
val nama: String = "",
val alamat: String = "",
val telpon: String = "",
)
fun InsertUiEvent.toKontak(): Kontak = Kontak(
id = id,
nama = nama,
alamat = alamat,
telpon = telpon,
)
fun Kontak.toUiStateKontak(): InsertUiState = InsertUiState(
insertUiEvent = toInsertUiEvent(),
)
fun Kontak.toInsertUiEvent(): InsertUiEvent = InsertUiEvent(
id = id,
nama = nama,
alamat = alamat,
telpon = telpon,
) |
061_RestAPI/app/src/main/java/com/example/project8_classc/ui/kontak/viewmodel/DetailsViewModel.kt | 1730767505 | package com.example.project8_classc.ui.kontak.viewmodel
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.project8_classc.model.Kontak
import com.example.project8_classc.repository.KontakRepository
import com.example.project8_classc.ui.kontak.screen.DetailsDestination
import kotlinx.coroutines.launch
sealed class DetailsKontakUiState{
data class Success(
val kontak: Kontak
) : DetailsKontakUiState()
object Error : DetailsKontakUiState()
object Loading : DetailsKontakUiState()
}
class DetailsViewModel (
savedStateHandle: SavedStateHandle,
private val kontakRepository: KontakRepository
): ViewModel(){
private val kontakId: Int = checkNotNull(savedStateHandle[DetailsDestination.kontakId])
var detailsKontakUiState: DetailsKontakUiState by mutableStateOf(DetailsKontakUiState.Loading)
private set
init {
getKontakById()
}
fun getKontakById(){
viewModelScope.launch {
detailsKontakUiState = DetailsKontakUiState.Loading
detailsKontakUiState = try {
DetailsKontakUiState.Success(
kontak = kontakRepository.getKontakById(kontakId)
)
}catch (e: Exception){
DetailsKontakUiState.Error
}
}
}
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/ui/kontak/viewmodel/EditViewModel.kt | 684621302 | package com.example.project8_classc.ui.kontak.viewmodel
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.setValue
import androidx.lifecycle.SavedStateHandle
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.example.project8_classc.repository.KontakRepository
import com.example.project8_classc.ui.kontak.screen.EditDestination
import kotlinx.coroutines.launch
class EditViewModel(
savedStateHandle: SavedStateHandle,
private val kontakRepository: KontakRepository
) : ViewModel(){
var editKontakState by mutableStateOf(InsertUiState())
private set
val kontakId: Int = checkNotNull(savedStateHandle[EditDestination.kontakId])
init {
viewModelScope.launch {
editKontakState = kontakRepository.getKontakById(kontakId).toUiStateKontak()
}
}
fun updateInsertKontakState(insertUiEvent: InsertUiEvent){
editKontakState = InsertUiState(insertUiEvent = insertUiEvent)
}
suspend fun updateKontak(){
viewModelScope.launch {
try {
kontakRepository.updateKontak(kontakId, editKontakState.insertUiEvent.toKontak())
}catch (e : Exception){
e.printStackTrace()
}
}
}
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/ui/kontak/screen/InsertScreen.kt | 2550263073 | package com.example.project8_classc.ui.kontak.screen
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.Divider
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.OutlinedTextField
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
import androidx.lifecycle.viewmodel.compose.viewModel
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.unit.dp
import com.example.project8_classc.navigation.DestinasiNavigasi
import com.example.project8_classc.ui.PenyediaViewModel
import com.example.project8_classc.ui.TopAppBarKontak
import com.example.project8_classc.ui.kontak.viewmodel.InsertUiEvent
import com.example.project8_classc.ui.kontak.viewmodel.InsertUiState
import com.example.project8_classc.ui.kontak.viewmodel.InsertViewModel
import kotlinx.coroutines.launch
object DestinasiEntry: DestinasiNavigasi{
override val route = "item_entry"
override val titleRes = "Entry Siswa"
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun EntryKontakScreen(
navigateBack: () -> Unit,
modifier: Modifier = Modifier,
viewModel: InsertViewModel = viewModel(factory = PenyediaViewModel.Factory),
){
val coroutineScope = rememberCoroutineScope()
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior()
Scaffold (
modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = {
TopAppBarKontak(
title = DestinasiEntry.titleRes ,
canNavigasiBack = true,
scrollBehavior = scrollBehavior,
navigateUp = navigateBack
)
}
){ innerPadding ->
EntryKontakBody(
insertUiState = viewModel.insertKontakState,
onSiswaValueChange = viewModel::updateInsertKontakState,
onSaveClick = {
coroutineScope.launch {
viewModel.insertKontak()
navigateBack()
}
},
modifier = Modifier
.padding(innerPadding)
.verticalScroll(rememberScrollState())
.fillMaxWidth()
)
}
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun FormInputSiswa(
insertUiEvent: InsertUiEvent,
modifier: Modifier = Modifier,
onValueChange: (InsertUiEvent) -> Unit = {},
enabled: Boolean = true
){
Column(
modifier = modifier,
verticalArrangement = Arrangement.spacedBy(12.dp)
) {
OutlinedTextField(
value = insertUiEvent.nama,
onValueChange = {onValueChange(insertUiEvent.copy(nama = it))},
label = { Text("Nama")},
modifier = Modifier.fillMaxWidth(),
enabled = enabled,
singleLine = true
)
OutlinedTextField(
value = insertUiEvent.alamat,
onValueChange = {onValueChange(insertUiEvent.copy(alamat = it))},
label = { Text("Email")},
modifier = Modifier.fillMaxWidth(),
enabled = enabled,
singleLine = true
)
OutlinedTextField(
value = insertUiEvent.telpon,
onValueChange = {onValueChange(insertUiEvent.copy(telpon = it))},
label = { Text("No Hp")},
modifier = Modifier.fillMaxWidth(),
enabled = enabled,
singleLine = true
)
if (enabled){
Text(
text = "Isi semua data",
modifier = Modifier.padding(start = 12.dp)
)
}
Divider(
thickness = 8.dp,
modifier = Modifier.padding(12.dp)
)
}
}
@Composable
fun EntryKontakBody(
insertUiState: InsertUiState,
onSiswaValueChange: (InsertUiEvent) -> Unit,
onSaveClick: () -> Unit,
modifier: Modifier = Modifier
){
Column(
verticalArrangement = Arrangement.spacedBy(18.dp),
modifier = modifier.padding(12.dp)
) {
FormInputSiswa(
insertUiEvent = insertUiState.insertUiEvent,
onValueChange = onSiswaValueChange,
modifier = Modifier.fillMaxWidth()
)
Button(
onClick = onSaveClick,
shape = MaterialTheme.shapes.small,
modifier = Modifier.fillMaxWidth()
) {
Text(text = "Simpan")
}
}
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/ui/kontak/screen/DetailsScreen.kt | 198524638 | package com.example.project8_classc.ui.kontak.screen
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.Phone
import androidx.compose.material3.Button
import androidx.compose.material3.Card
import androidx.compose.material3.CardDefaults
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBarDefaults
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.input.nestedscroll.nestedScroll
import androidx.compose.ui.unit.dp
import androidx.lifecycle.viewmodel.compose.viewModel
import com.example.project8_classc.model.Kontak
import com.example.project8_classc.navigation.DestinasiNavigasi
import com.example.project8_classc.ui.PenyediaViewModel
import com.example.project8_classc.ui.TopAppBarKontak
import com.example.project8_classc.ui.home.screen.DestinasiHome
import com.example.project8_classc.ui.home.screen.KontakLayout
import com.example.project8_classc.ui.home.screen.OnError
import com.example.project8_classc.ui.home.screen.OnLoading
import com.example.project8_classc.ui.kontak.viewmodel.DetailsKontakUiState
import com.example.project8_classc.ui.kontak.viewmodel.DetailsViewModel
object DetailsDestination : DestinasiNavigasi{
override val route = "item_details"
override val titleRes = "Detail Kontak"
const val kontakId = "itemId"
val routeWithArgs = "$route/{$kontakId}"
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun DetailsScreen(
onEditClick: (Int) -> Unit,
modifier: Modifier = Modifier,
navigateBack: () -> Unit,
detailsViewModel: DetailsViewModel = viewModel(factory = PenyediaViewModel.Factory)
){
val scrollBehavior = TopAppBarDefaults.enterAlwaysScrollBehavior()
Scaffold(
modifier = modifier.nestedScroll(scrollBehavior.nestedScrollConnection),
topBar = {
TopAppBarKontak(
title = DestinasiHome.titleRes ,
canNavigasiBack = true,
scrollBehavior = scrollBehavior,
navigateUp = navigateBack
)
},
) { innerPadding ->
DetailStatus(
kontakUiState = detailsViewModel.detailsKontakUiState,
retryAction = {
detailsViewModel.getKontakById()
},
modifier = Modifier
.padding(innerPadding)
.fillMaxSize(),
onEditClick = onEditClick
)
}
}
@Composable
fun DetailStatus(
kontakUiState: DetailsKontakUiState,
retryAction: () -> Unit,
modifier: Modifier = Modifier,
onEditClick: (Int) -> Unit
){
when(kontakUiState){
is DetailsKontakUiState.Success -> {
KontakLayout(
kontak = kontakUiState.kontak,
modifier = modifier.padding(16.dp),
onEditClick = {
onEditClick(it)
}
)
}
is DetailsKontakUiState.Loading ->{
OnLoading(modifier = modifier)
}
is DetailsKontakUiState.Error -> {
OnError(
retryAction = retryAction,
modifier = modifier
)
}
}
}
@Composable
fun KontakLayout(
kontak: Kontak,
modifier: Modifier = Modifier,
onEditClick: (Int) -> Unit = {},
){
Column (
modifier = modifier,
){
KontakCard(
kontak = kontak,
modifier = Modifier
.fillMaxWidth(),
)
Spacer(modifier = Modifier.padding(16.dp))
Button(
onClick = {
onEditClick(kontak.id)
},
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
) {
Text(text = "Edit")
}
}
}
@Composable
fun KontakCard(
kontak: Kontak,
modifier: Modifier = Modifier
){
Card (
modifier = modifier,
shape = MaterialTheme.shapes.medium,
elevation = CardDefaults.cardElevation(defaultElevation = 8.dp)
) {
Column(
modifier = Modifier.padding(16.dp),
verticalArrangement = Arrangement.spacedBy(8.dp)
) {
Row (
modifier = Modifier.fillMaxWidth(),
){
Text(
text = kontak.nama,
style = MaterialTheme.typography.titleLarge
)
Spacer(Modifier.weight(1f))
Icon(
imageVector = Icons.Default.Phone,
contentDescription = null
)
Text(
text = kontak.telpon,
style = MaterialTheme.typography.titleMedium
)
}
Row (
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically
){
Text(
text = kontak.alamat,
style = MaterialTheme.typography.titleMedium
)
Spacer(Modifier.weight(1f))
}
}
}
}
|
061_RestAPI/app/src/main/java/com/example/project8_classc/ui/kontak/screen/EditScreen.kt | 752514701 | package com.example.project8_classc.ui.kontak.screen
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Scaffold
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.Modifier
import com.example.project8_classc.navigation.DestinasiNavigasi
import com.example.project8_classc.ui.kontak.viewmodel.EditViewModel
import androidx.lifecycle.viewmodel.compose.viewModel
import com.example.project8_classc.ui.PenyediaViewModel
import com.example.project8_classc.ui.TopAppBarKontak
import com.example.project8_classc.ui.home.screen.DestinasiHome
import kotlinx.coroutines.launch
object EditDestination : DestinasiNavigasi {
override val route = "edit"
override val titleRes = "Edit Kontak"
const val kontakId = "itemId"
val routeWithArgs = "$route/{$kontakId}"
}
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ItemEditScreen(
navigateBack: () -> Unit,
onNavigateUp: () -> Unit,
modifier: Modifier = Modifier,
viewModel: EditViewModel = viewModel(factory = PenyediaViewModel.Factory)
){
val coroutineScope = rememberCoroutineScope()
Scaffold(
topBar = {
TopAppBarKontak(
title = DestinasiHome.titleRes,
canNavigasiBack = true,
navigateUp = navigateBack
)
},
modifier = modifier
) {innerPadding ->
EntryKontakBody(
insertUiState = viewModel.editKontakState,
onSiswaValueChange = viewModel::updateInsertKontakState,
onSaveClick = {
coroutineScope.launch {
viewModel.updateKontak()
onNavigateUp()
}
},
modifier = Modifier.padding(innerPadding)
)
}
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/repository/KontakContainer.kt | 1744303390 | package com.example.project8_classc.repository
import com.example.project8_classc.service_api.KontakService
import com.jakewharton.retrofit2.converter.kotlinx.serialization.asConverterFactory
import kotlinx.serialization.json.Json
import okhttp3.MediaType.Companion.toMediaType
import retrofit2.Retrofit
import retrofit2.create
interface AppContainer{
val kontakRepository: KontakRepository
}
class KontakContainer: AppContainer{
private val baseurl = "http://10.0.2.2:8080/"
private val json = Json { ignoreUnknownKeys = true }
private val retrofit: Retrofit = Retrofit.Builder()
.addConverterFactory(json.asConverterFactory("application/json".toMediaType()))
.baseUrl(baseurl)
.build()
private val kontakService: KontakService by lazy {
retrofit.create(KontakService::class.java)
}
override val kontakRepository: KontakRepository by lazy {
NetworkKontakRepository(kontakService)
}
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/repository/KontakRepository.kt | 834772617 | package com.example.project8_classc.repository
import com.example.project8_classc.model.Kontak
import com.example.project8_classc.service_api.KontakService
import java.io.IOException
interface KontakRepository{
suspend fun getKontak(): List<Kontak>
suspend fun insertKontak(kontak: Kontak)
suspend fun updateKontak(id: Int, kontak: Kontak)
suspend fun deleteKontak(id: Int)
suspend fun getKontakById(id: Int): Kontak
}
class NetworkKontakRepository(
private val kontakApiService: KontakService
): KontakRepository{
override suspend fun getKontak(): List<Kontak> = kontakApiService.getKontak()
override suspend fun insertKontak(kontak: Kontak) {
kontakApiService.insertKontak(kontak)
}
override suspend fun updateKontak(id: Int, kontak: Kontak) {
kontakApiService.updateKontak(id, kontak)
}
override suspend fun deleteKontak(id: Int) {
try {
val response = kontakApiService.deleteKontak(id)
if (!response.isSuccessful){
throw IOException("Failed to delete kontak. HTTP status code" +
"${response.code()}")
}
else{
response.message()
println(response.message())
}
}
catch (e:Exception){
throw e
}
}
override suspend fun getKontakById(id: Int): Kontak {
return kontakApiService.getKontakById(id)
}
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/MainActivity.kt | 461002883 | package com.example.project8_classc
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.tooling.preview.Preview
import com.example.project8_classc.ui.KontakApp
import com.example.project8_classc.ui.theme.Project8_ClassCTheme
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
Project8_ClassCTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
KontakApp()
}
}
}
}
}
@Composable
fun Greeting(name: String, modifier: Modifier = Modifier) {
Text(
text = "Hello $name!",
modifier = modifier
)
}
@Preview(showBackground = true)
@Composable
fun GreetingPreview() {
Project8_ClassCTheme {
Greeting("Android")
}
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/navigation/DestinasiNavigasi.kt | 2358947128 | package com.example.project8_classc.navigation
interface DestinasiNavigasi{
val route: String
val titleRes: String
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/navigation/PengelolaHalaman.kt | 706710282 | package com.example.project8_classc.navigation
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.navigation.NavHostController
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import androidx.navigation.navArgument
import com.example.project8_classc.ui.home.screen.DestinasiHome
import com.example.project8_classc.ui.home.screen.HomeScreen
import com.example.project8_classc.ui.kontak.screen.DestinasiEntry
import com.example.project8_classc.ui.kontak.screen.DetailsDestination
import com.example.project8_classc.ui.kontak.screen.DetailsScreen
import com.example.project8_classc.ui.kontak.screen.EditDestination
import com.example.project8_classc.ui.kontak.screen.EntryKontakScreen
import com.example.project8_classc.ui.kontak.screen.ItemEditScreen
@Composable
fun PengelolaHalaman(navController: NavHostController = rememberNavController()){
NavHost(
navController = navController,
startDestination = DestinasiHome.route,
modifier = Modifier,
){
composable(DestinasiHome.route){
HomeScreen(navigateToItemEntry = {
navController.navigate(DestinasiEntry.route)
},
onDetailClick = {itemId ->
navController.navigate("${DetailsDestination.route}/$itemId")
println(itemId)
}
)
}
composable(
DestinasiEntry.route
){
EntryKontakScreen(navigateBack = {
navController.navigate(
DestinasiHome.route
){
popUpTo(DestinasiHome.route){
inclusive = true
}
}
})
}
composable(
EditDestination.routeWithArgs,
arguments = listOf(navArgument(EditDestination.kontakId){
type = NavType.IntType
})
){
ItemEditScreen(
navigateBack = { navController.popBackStack() },
onNavigateUp = {
navController.navigate(DestinasiHome.route) {
popUpTo(DestinasiHome.route) {
inclusive = true
}
}
},
modifier = Modifier
)
}
composable(
DetailsDestination.routeWithArgs,
arguments = listOf(navArgument(DetailsDestination.kontakId) {
type = NavType.IntType
})
){backStackEntry ->
val itemId = backStackEntry.arguments?.getInt(DetailsDestination.kontakId)
itemId?.let {
DetailsScreen(
navigateBack = {
navController.navigateUp()
},
onEditClick = { itemId ->
navController.navigate("${EditDestination.route}/$itemId")
println(itemId)
}
)
}
}
composable(EditDestination.routeWithArgs,
arguments = listOf(navArgument(EditDestination.kontakId){
type = NavType.IntType
})
){
ItemEditScreen(
navigateBack = { navController.popBackStack() },
onNavigateUp = {
navController.navigate(DestinasiHome.route){
popUpTo(DestinasiHome.route){
inclusive = true
}
}
},
modifier = Modifier
)
}
}
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/KontakApplication.kt | 3481598037 | package com.example.project8_classc
import android.app.Application
import com.example.project8_classc.repository.AppContainer
import com.example.project8_classc.repository.KontakContainer
class KontakApplication : Application(){
lateinit var container: AppContainer
override fun onCreate(){
super.onCreate()
container = KontakContainer()
}
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/service_api/KontakService.kt | 3174791103 | package com.example.project8_classc.service_api
import com.example.project8_classc.model.Kontak
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.POST
import retrofit2.http.PUT
import retrofit2.http.Path
import retrofit2.http.Query
interface KontakService {
@Headers(
"Accept: application/json"
)
@GET("/kontak")
suspend fun getKontak():List<Kontak>
@GET("kontak/{id}")
suspend fun getKontakById(@Query("id")id:Int): Kontak
@POST("kontak")
suspend fun insertKontak(@Body kontak: Kontak)
@PUT("kontak/{id}")
suspend fun updateKontak(@Query("id") Id: Int, @Body kontak: Kontak)
@DELETE("kontak/{id}")
suspend fun deleteKontak(@Query("id") id:Int): Response<Void>
} |
061_RestAPI/app/src/main/java/com/example/project8_classc/model/Kontak.kt | 1550293065 | package com.example.project8_classc.model
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class Kontak(
val id: Int,
val nama: String,
@SerialName("nohp")
val telpon: String,
@SerialName("email")
val alamat: String,
)
|
Team_Project_GETISKIN_CV_spaghetti/app/src/androidTest/java/com/example/getiskin/ExampleInstrumentedTest.kt | 296536670 | package com.example.getiskin
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.getiskin", appContext.packageName)
}
} |
Team_Project_GETISKIN_CV_spaghetti/app/src/test/java/com/example/getiskin/ExampleUnitTest.kt | 1209641049 | package com.example.getiskin
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
} |
Team_Project_GETISKIN_CV_spaghetti/app/src/main/java/com/example/getiskin/ResultsScreen.kt | 3108069125 | package com.example.getiskin
import android.net.Uri
import android.util.Log
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.LocalContentColor
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.SpanStyle
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.withStyle
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
import coil.compose.rememberImagePainter
import coil.transform.CircleCropTransformation
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.storage.FirebaseStorage
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
import java.util.UUID
data class SkinAnalysisData(
val userID: String,
var timestamp: String,
val finalSkinType: String,
val skinType1: String,
val skinType2: String,
val skinType3: String,
val facePart1: String,
val facePart2: String,
val facePart3: String,
val imageUrl1: String,
val imageUrl2: String,
val imageUrl3: String,
) {
// 매개변수가 없는 기본 생성자
// firestore가 기본 생성자가 없으면 값을 못읽음... 생성필수라함
constructor() : this("", "", "", "", "", "", "", "", "", "", "", "")
}
fun saveSkinAnalysisData(skinAnalysisData: SkinAnalysisData) {
val db = FirebaseFirestore.getInstance()
// Add a new document with a generated ID
db.collection("skinAnalysis")
.add(skinAnalysisData)
.addOnSuccessListener { documentReference ->
println("DocumentSnapshot added with ID: ${documentReference.id}")
}
.addOnFailureListener { e ->
println("Error adding document: $e")
}
}
@Composable
fun HomeReturnButton2(
navController: NavController,
auth: FirebaseAuth,
uri1: Uri,
uri2: Uri,
uri3: Uri,
skinType1: String,
skinType2: String,
skinType3: String,
facePart1: String?,
facePart2: String?,
facePart3: String?,
finalSkinType: String?
) {
val user = auth.currentUser
val uid = user?.uid ?: "" //유저
var imageUrl1 by remember { mutableStateOf("") }
var imageUrl2 by remember { mutableStateOf("") }
var imageUrl3 by remember { mutableStateOf("") }
Box(
modifier = Modifier
.height(150.dp)
.padding(5.dp)
.clip(RoundedCornerShape(10))
.clickable {
val timestamp = SimpleDateFormat("yyyy-MM-dd HH:mm:ss", Locale.getDefault()).format(Date())
uploadRawDataToFirestorage(uri1, skinType1, facePart1,
onImageUploaded = {
Log.d("성공", "이미지 업로드 URL : $it")
})
uploadRawDataToFirestorage(uri2, skinType2, facePart2,
onImageUploaded = {
Log.d("성공", "이미지 업로드 URL : $it")
})
uploadRawDataToFirestorage(uri3, skinType3, facePart3,
onImageUploaded = {
Log.d("성공", "이미지 업로드 URL : $it")
})
uploadImageToFirestorage(uri1) { url1 ->
imageUrl1 = url1
Log.d("URL", "이미지 업로드 URL : $url1")
uploadImageToFirestorage(uri2) { url2 ->
imageUrl2 = url2
uploadImageToFirestorage(uri3) { url3 ->
imageUrl3 = url3
val skinAnalysis = SkinAnalysisData(
uid,
timestamp,
finalSkinType!!,
skinType1,
skinType2,
skinType3,
facePart1!!,
facePart2!!,
facePart3!!,
imageUrl1,
imageUrl2,
imageUrl3
)
saveSkinAnalysisData(skinAnalysis)
navController.navigate("home")
}
}
}
}
) {
// Image 등의 내용을 넣어줌
Image(
painter = painterResource(id = R.drawable.home),
contentDescription = null,
contentScale = ContentScale.Crop, // 이미지가 잘릴 수 있도록 설정
modifier = Modifier
.fillMaxSize() // 이미지를 꽉 채우도록 설정
.aspectRatio(1f)
.clip(RoundedCornerShape(10))
)
Text(
text = "결과 저장 및 홈으로",
textAlign = TextAlign.Center,
color = Color.White,
fontSize = 20.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier
.padding(16.dp)
.background(Color.Transparent) // 텍스트 배경을 투명하게 설정
)
}
}
fun uploadImageToFirestorage(imageUri: Uri, onImageUploaded: (String) -> Unit) {
val storage = FirebaseStorage.getInstance()
val storageRef = storage.reference
val imageRef = storageRef.child("images/${imageUri.lastPathSegment}")
imageRef.putFile(imageUri)
.addOnSuccessListener { taskSnapshot ->
taskSnapshot.metadata?.reference?.downloadUrl?.addOnSuccessListener { downloadUri ->
val imageUrl = downloadUri.toString()
onImageUploaded(imageUrl)
}
}
.addOnFailureListener {
// 이미지 업로드 실패 시 처리
Log.d("망함", "망함")
}
}
@Composable
fun ResultsScreen(
navController: NavController,
auth: FirebaseAuth,
predictOilHead: Int?,
predictOilNose: Int?,
predictOilCheek: Int?,
predictHead: Int?,
predictNose: Int?,
predictCheek: Int?,
headUriString: String?,
noseUriString: String?,
cheekUriString: String?
) {
val complexAd = "https://www.coupang.com/np/search?component=&q=%EB%B3%B5%ED%95%A9%EC%84%B1+%ED%99%94%EC%9E%A5%ED%92%88&channel=user"
val oilyAd = "https://www.coupang.com/np/search?component=&q=%EC%A7%80%EC%84%B1+%ED%99%94%EC%9E%A5%ED%92%88&channel=user"
val dryAd = "https://www.coupang.com/np/search?component=&q=%EA%B1%B4%EC%84%B1+%ED%99%94%EC%9E%A5%ED%92%88&channel=user"
val uri1 = Uri.parse(headUriString)
val uri2 = Uri.parse(noseUriString)
val uri3 = Uri.parse(cheekUriString)
val skinType1 = if (predictOilHead == 0) "건성" else "지성"
val skinType2 = if (predictOilNose == 0) "건성" else "지성"
val skinType3 = if (predictOilCheek == 0) "건성" else "지성"
val facePart1 = when (predictHead) {
0 -> "볼"
1 -> "이마"
2 -> "코"
else -> null // 또는 원하는 다른 처리를 수행할 수 있음
}
val facePart2 = when (predictNose) {
0 -> "볼"
1 -> "이마"
2 -> "코"
else -> null
}
val facePart3 = when (predictCheek) {
0 -> "볼"
1 -> "이마"
2 -> "코"
else -> null
}
val finalSkinType: String = when {
skinType1 == "건성" && skinType2 == "건성" && skinType3 == "건성" -> "건성"
skinType1 == "지성" && skinType2 == "지성" && skinType3 == "지성" -> "지성"
else -> "복합성"
}
Box(
modifier = Modifier
.fillMaxSize()
.background(Color(android.graphics.Color.parseColor("#ffffff")))
) {
// 상단 이미지
Image(
painter = painterResource(id = R.drawable.logo), // 이미지 리소스 ID로 변경
contentDescription = null, // contentDescription은 필요에 따라 추가
modifier = Modifier
.fillMaxWidth()
.height(100.dp) // 이미지 높이 조절
)
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
) {
Spacer(modifier = Modifier.height(80.dp))
// Text
Text(
text = "측 정 결 과",
modifier = Modifier
.fillMaxWidth()
.background(Color(android.graphics.Color.parseColor("#F7F1E5")))
.padding(20.dp)
.height(30.dp), // 여백 추가
textAlign = TextAlign.Center,
fontSize = 24.sp, // 원하는 크기로 조절
fontWeight = FontWeight.Bold,
color = Color(android.graphics.Color.parseColor("#e39368")) // 원하는 색상으로 조절
)
Spacer(modifier = Modifier.height(20.dp))
Box(
modifier = Modifier
.fillMaxWidth()
.background(Color(android.graphics.Color.parseColor("#F7F1E5"))) // 원하는 배경 색상으로 설정
.padding(16.dp)
) {
Column(
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.CenterHorizontally
) {
StyledSkinType(finalSkinType)
Spacer(modifier = Modifier.height(15.dp))
Row(
modifier = Modifier.fillMaxWidth(),
horizontalArrangement = Arrangement.SpaceEvenly
) {
Column(horizontalAlignment = Alignment.CenterHorizontally) {
LoadImageFromUri(uri1)
StyledText(facePart1!!, skinType1)
}
Column(horizontalAlignment = Alignment.CenterHorizontally) {
LoadImageFromUri(uri2)
StyledText(facePart2!!, skinType2)
}
Column(horizontalAlignment = Alignment.CenterHorizontally) {
LoadImageFromUri(uri3)
StyledText(facePart3!!, skinType3)
}
}
HomeReturnButton2(
navController,
auth,
uri1,
uri2,
uri3,
skinType1,
skinType2,
skinType3,
facePart1,
facePart2,
facePart3,
finalSkinType
)
AdPlaces("지성 화장품 광고", oilyAd)
AdPlaces("건성 화장품 광고", dryAd)
AdPlaces("복합성 화장품 광고", complexAd)
}
}
}
}
}
fun uploadRawDataToFirestorage(
imageUri: Uri,
skinType: String,
facePart: String?,
onImageUploaded: (String) -> Unit
) {
val storage = FirebaseStorage.getInstance()
val storageRef = storage.reference
// 이미지를 저장할 경로 및 이름 설정
val imageRef = storageRef.child("raw/${facePart}/${skinType}/${UUID.randomUUID()}.jpg")
imageRef.putFile(imageUri)
.addOnSuccessListener { taskSnapshot ->
taskSnapshot.metadata?.reference?.downloadUrl?.addOnSuccessListener { downloadUri ->
val imageUrl = downloadUri.toString()
onImageUploaded(imageUrl)
}
}
.addOnFailureListener {
Log.e("실패", "망함")
// 이미지 업로드 실패 시 처리
}
}
@Composable
fun LoadImageFromUri(uri: Uri) {
// Coil을 사용하여 이미지 로드
Image(
painter = rememberImagePainter(
data = uri,
builder = {
crossfade(true) // crossfade 효과 사용
transformations(CircleCropTransformation()) // 원형으로 자르기
}
),
contentDescription = null,
modifier = Modifier
.size(100.dp)
)
}
@Composable
fun StyledText(first: String, second: String) {
val boldFacePart1 = AnnotatedString.Builder().apply {
withStyle(style = SpanStyle(fontWeight = FontWeight.Bold)) {
append(first)
}
append(" : $second")
}.toAnnotatedString()
Text(text = boldFacePart1)
}
@Composable
fun StyledSkinType(finalSkinType: String, name: String = "당신") {
val color = when (finalSkinType) {
"건성" -> Color.Red
"지성" -> Color.Blue
"복합성" -> Color.Magenta
else -> LocalContentColor.current // 기본 색상
}
val styledText = AnnotatedString.Builder().apply {
withStyle(style = SpanStyle(color = color, fontWeight = FontWeight.Bold)) {
append("${name}의 피부는 \"$finalSkinType\" 입니다.")
}
}.toAnnotatedString()
Text(
text = styledText,
fontSize = 24.sp,
)
}
|
Team_Project_GETISKIN_CV_spaghetti/app/src/main/java/com/example/getiskin/ui/theme/Color.kt | 2417261522 | package com.example.getiskin.ui.theme
import androidx.compose.ui.graphics.Color
val Purple80 = Color(0xFFD0BCFF)
val PurpleGrey80 = Color(0xFFCCC2DC)
val Pink80 = Color(0xFFEFB8C8)
val Purple40 = Color(0xFF6650a4)
val PurpleGrey40 = Color(0xFF625b71)
val Pink40 = Color(0xFF7D5260)
val Orange = Color(0xFFED7D31) |
Team_Project_GETISKIN_CV_spaghetti/app/src/main/java/com/example/getiskin/ui/theme/Theme.kt | 875715004 | package com.example.getiskin.ui.theme
import android.app.Activity
import android.os.Build
import androidx.compose.foundation.isSystemInDarkTheme
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.SideEffect
import androidx.compose.ui.graphics.toArgb
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalView
import androidx.core.view.WindowCompat
private val DarkColorScheme = darkColorScheme(
primary = Purple80,
secondary = PurpleGrey80,
tertiary = Pink80
)
private val LightColorScheme = lightColorScheme(
primary = Purple40,
secondary = PurpleGrey40,
tertiary = Pink40
/* Other default colors to override
background = Color(0xFFFFFBFE),
surface = Color(0xFFFFFBFE),
onPrimary = Color.White,
onSecondary = Color.White,
onTertiary = Color.White,
onBackground = Color(0xFF1C1B1F),
onSurface = Color(0xFF1C1B1F),
*/
)
@Composable
fun GetiSkinTheme(
darkTheme: Boolean = isSystemInDarkTheme(),
// Dynamic color is available on Android 12+
dynamicColor: Boolean = true,
content: @Composable () -> Unit
) {
val colorScheme = when {
dynamicColor && Build.VERSION.SDK_INT >= Build.VERSION_CODES.S -> {
val context = LocalContext.current
if (darkTheme) dynamicDarkColorScheme(context) else dynamicLightColorScheme(context)
}
darkTheme -> DarkColorScheme
else -> LightColorScheme
}
val view = LocalView.current
if (!view.isInEditMode) {
SideEffect {
val window = (view.context as Activity).window
window.statusBarColor = colorScheme.primary.toArgb()
WindowCompat.getInsetsController(window, view).isAppearanceLightStatusBars = darkTheme
}
}
MaterialTheme(
colorScheme = colorScheme,
typography = Typography,
content = content
)
} |
Team_Project_GETISKIN_CV_spaghetti/app/src/main/java/com/example/getiskin/ui/theme/Type.kt | 491411481 | package com.example.getiskin.ui.theme
import androidx.compose.material3.Typography
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.font.FontFamily
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.unit.sp
// Set of Material typography styles to start with
val Typography = Typography(
bodyLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 16.sp,
lineHeight = 24.sp,
letterSpacing = 0.5.sp
)
/* Other default text styles to override
titleLarge = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Normal,
fontSize = 22.sp,
lineHeight = 28.sp,
letterSpacing = 0.sp
),
labelSmall = TextStyle(
fontFamily = FontFamily.Default,
fontWeight = FontWeight.Medium,
fontSize = 11.sp,
lineHeight = 16.sp,
letterSpacing = 0.5.sp
)
*/
) |
Team_Project_GETISKIN_CV_spaghetti/app/src/main/java/com/example/getiskin/ProductScreen.kt | 1892398895 | package com.example.getiskin
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxHeight
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentSize
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults.buttonColors
import androidx.compose.material3.Card
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.compose.rememberNavController
// Product 데이터 클래스 정의
data class Product(
val imageResourceId: Int,
val manufacturer: String,
val name: String,
val price: String,
val additionalInfo: String
)
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun ProductScreen() {
// 현재 선택된 피부 유형을 추적하는 변수
var selectedSkinType by remember { mutableStateOf("지성") }
// 피부 유형에 따른 상품 리스트
var productList by remember { mutableStateOf<List<Product>>(emptyList()) }
DisposableEffect(selectedSkinType) {
productList = generateProductList(selectedSkinType)
onDispose { /* Clean up if needed */ }
}
Column(
modifier = Modifier
.fillMaxSize()
.padding(16.dp)
) {
Image(
painter = painterResource(id = R.drawable.logo), // 이미지 리소스 ID로 변경
contentDescription = null, // contentDescription은 필요에 따라 추가
modifier = Modifier
.fillMaxWidth()
.height(100.dp) // 이미지 높이 조절
)
// Text
Text(
text = "제 품 추 천",
modifier = Modifier
.fillMaxWidth()
.background(Color(android.graphics.Color.parseColor("#F7F1E5")))
.padding(20.dp)
.height(30.dp), // 여백 추가
textAlign = TextAlign.Center,
fontSize = 24.sp, // 원하는 크기로 조절
fontWeight = FontWeight.Bold,
color = Color(android.graphics.Color.parseColor("#e39368")) // 원하는 색상으로 조절
)
Spacer(modifier = Modifier.height(8.dp))
TopAppBar(
title = {
Text(
text = selectedSkinType, // 선택된 피부 유형에 따라 타이틀 변경
modifier = Modifier
.fillMaxWidth()
.wrapContentSize(Alignment.Center)
.padding(10.dp),
textAlign = TextAlign.Center,
fontSize = 24.sp, // 원하는 크기로 조절
fontWeight = FontWeight.Bold,
color = Color(android.graphics.Color.parseColor("#e39368"))
)
},
modifier = Modifier
.height(56.dp)
.border(2.dp, Color(0xFFE39368), shape = RoundedCornerShape(16.dp))
)
// Divider(color = Color.Black, thickness = 1.dp)
// 피부 유형을 선택하는 버튼 행
Row(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
horizontalArrangement = Arrangement.SpaceBetween
) {
// 각 피부 유형 버튼
SkinTypeButton("지성", selectedSkinType, onSelectSkinType = { selectedSkinType = it })
SkinTypeButton("건성", selectedSkinType, onSelectSkinType = { selectedSkinType = it })
SkinTypeButton("복합성", selectedSkinType, onSelectSkinType = { selectedSkinType = it })
}
// 상품 리스트를 보여주는 LazyColumn
LazyColumn {
items(productList) { product ->
ProductCard(
imageResourceId = product.imageResourceId,
manufacturer = product.manufacturer,
name = product.name,
price = product.price,
additionalInfo = product.additionalInfo
)
}
}
}
}
// 피부 유형을 선택하는 버튼 Composable
@Composable
fun SkinTypeButton(skinType: String, selectedSkinType: String, onSelectSkinType: (String) -> Unit) {
// 피부 유형을 나타내는 버튼
Button(
onClick = { onSelectSkinType(skinType) },
colors = buttonColors(
containerColor = if (skinType == selectedSkinType) Color.Black else Color(0xFFE39368)
)
) {
Text(text = skinType, fontWeight = FontWeight.Bold)
}
}
@Composable
fun ProductCard(
imageResourceId: Int,
manufacturer: String,
name: String,
price: String,
additionalInfo: String
) {
Card(
modifier = Modifier
.fillMaxWidth()
.padding(8.dp)
.border(2.dp, Color(0xFFE39368), shape = RoundedCornerShape(16.dp))
) {
Box(
modifier = Modifier
.fillMaxSize()
.background(Color.White)
) {
Row(modifier = Modifier.padding(8.dp)) {
Image(
painter = painterResource(id = imageResourceId),
contentDescription = "image",
modifier = Modifier
.size(110.dp)
.fillMaxHeight()
)
Column(modifier = Modifier.padding(8.dp)) {
Text(
text = manufacturer,
color = Color.Gray,
fontWeight = FontWeight.Normal,
modifier = Modifier.align(Alignment.Start)
)
Text(
text = name,
fontWeight = FontWeight.Bold,
modifier = Modifier.align(Alignment.CenterHorizontally)
)
Text(
text = price,
fontWeight = FontWeight.Bold
)
Text(
text = additionalInfo,
color = Color.Gray,
fontWeight = FontWeight.Normal
)
}
}
}
}
}
fun generateProductList(skinType: String): List<Product> {
// 각 피부 유형에 따른 상품 리스트를 생성하는 로직
// (이 부분은 실제 서버에서 데이터를 가져오는 로직 등으로 변경할 수 있음)
return when (skinType) {
"지성" -> listOf(
Product(R.drawable.dokdo, "라운드랩", "1025 독도 토너", "19,900원", "300ml"),
Product(R.drawable.beplain, "비플레인", "녹두 약산성 클렌징폼", "18,900원", "120ml"),
Product(R.drawable.blemish, "닥터지", "레드 블레미쉬 클리어 수딩 크림", "26,600원", "50ml"),
Product(R.drawable.jajak, "라운드랩", "자작나무 수분 선크림", "19,900원", "80ml"),
Product(R.drawable.power, "잇츠스킨", "파워 10 감초줄렌 젤리패드", "27,500원", "120ml"),
Product(R.drawable.oil, "마녀공장", "퓨어 클렌징 오일", "24,500원", "400ml"),
// ...
)
"건성" -> listOf(
Product(R.drawable.toner, "이즈앤트리", "초저분자 히아루론산 토너", "14,900원", "300ml"),
Product(R.drawable.dalba_w, "달바", "화이트 트러플 더블 세럼 앤 크림", "78,000원", "70g"),
Product(R.drawable.dalba_s, "달바", "워터풀 선크림", "34,000원", "50ml"),
Product(R.drawable.snature, "에스네이처", "아쿠아 스쿠알란 수분크림", "29,900원", "160ml"),
Product(R.drawable.seramaid, "아이레시피", "세라마이드 유자 힐링 클렌징 밤", "48,000원", "120g"),
Product(R.drawable.carrot, "스킨푸드", "캐롯 카로틴 카밍워터 패드", "20,800원", "260g"),
)
"복합성" -> listOf(
Product(R.drawable.aqua, "에스네이처", "아쿠아 오아시스 토너", "19,900원", "300ml"),
Product(R.drawable.madagascar, "스킨1004", "마다가스카르 센텔라 히알루-시카 워터핏 선세럼", "14,000원", "50ml"),
Product(R.drawable.beplain, "비플레인", "녹두 약산성 클렌징폼", "18,900원", "120ml"),
Product(R.drawable.dokdo, "라운드랩", "1025 독도 토너", "19,900원", "300ml"),
Product(R.drawable.torriden, "토리든", "다이브인 저분자 히알루론산 수딩 크림", "14,500원", "100ml"),
Product(R.drawable.atoberrier, "에스트라", "아토베리어365크림", "23,250원", "80ml"),
// ...
)
else -> emptyList()
}
}
@Preview(showBackground = true)
@Composable
fun ProductScreenPreview() {
val navController = rememberNavController()
MaterialTheme {
ProductScreen()
}
}
|
Team_Project_GETISKIN_CV_spaghetti/app/src/main/java/com/example/getiskin/MainActivity.kt | 3897370662 | package com.example.getiskin
import android.os.Bundle
import android.util.Log
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.compose.setContent
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Surface
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.res.painterResource
import androidx.navigation.NavController
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
import androidx.navigation.compose.rememberNavController
import com.google.android.gms.auth.api.signin.GoogleSignIn
import com.google.android.gms.auth.api.signin.GoogleSignInClient
import com.google.android.gms.auth.api.signin.GoogleSignInOptions
import com.google.android.gms.common.api.ApiException
import com.google.android.gms.location.FusedLocationProviderClient
import com.google.android.gms.location.LocationServices
import com.google.android.libraries.places.api.Places
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.auth.FirebaseUser
import com.google.firebase.auth.GoogleAuthProvider
import com.google.firebase.firestore.FirebaseFirestore
import kotlinx.coroutines.delay
class MainActivity : ComponentActivity() {
private lateinit var mAuth: FirebaseAuth
private lateinit var googleSignInClient: GoogleSignInClient
private lateinit var fusedLocationClient: FusedLocationProviderClient
private lateinit var firestore: FirebaseFirestore
override fun onCreate(savedInstanceState: Bundle?) {
fusedLocationClient = LocationServices.getFusedLocationProviderClient(this)
Places.initialize(applicationContext, "AIzaSyBBi36Pj-bYMFFMQ9mAS-vwvOvusUqnglo")
super.onCreate(savedInstanceState)
mAuth = FirebaseAuth.getInstance()
firestore = FirebaseFirestore.getInstance()
// 구글 로그인 구현
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id)) // default_web_client_id 에러 시 rebuild
.requestEmail()
.build()
googleSignInClient = GoogleSignIn.getClient(this, gso)
setContent {
val navController = rememberNavController()
val signInIntent = googleSignInClient.signInIntent
val launcher =
rememberLauncherForActivityResult(contract = ActivityResultContracts.StartActivityForResult()) { result ->
val data = result.data
// result returned from launching the intent from GoogleSignInApi.getSignInIntent()
val task = GoogleSignIn.getSignedInAccountFromIntent(data)
val exception = task.exception
if (task.isSuccessful) {
try {
// Google SignIn was successful, authenticate with firebase
val account = task.getResult(ApiException::class.java)!!
firebaseAuthWithGoogle(account.idToken!!)
navController.popBackStack()
navController.navigate("home")
} catch (e: Exception) {
// Google SignIn failed
Log.d("SignIn", "로그인 실패")
}
} else {
Log.d("SignIn", exception.toString())
}
}
MaterialTheme {
Surface {
// NavHost를 사용하여 네비게이션 구조를 설정합니다.
NavHost(navController = navController, startDestination = "splash") {
composable("login") { LoginScreen(signInClicked = { launcher.launch(signInIntent) }) }
composable("home") { HomeScreen(navController, onClicked = { signOut(navController)}) }
composable("skin_analysis") { SkinAnalysisScreen(navController) }
composable("diary") { DiaryScreen(mAuth) }
composable("product") { ProductScreen() }
composable("clinic") { ClinicScreen(navController) }
composable("splash") { SplashContent(navController) }
composable("results/{headOil}/{noseOil}/{cheekOil}/{head}/{nose}/{cheek}/{headUri}/{noseUri}/{cheekUri}") {
val predictOily1 = it.arguments?.getString("headOil")?.toInt()
val predictOily2 = it.arguments?.getString("noseOil")?.toInt()
val predictOily3 = it.arguments?.getString("cheekOil")?.toInt()
val predictFace1 = it.arguments?.getString("head")?.toInt()
val predictFace2 = it.arguments?.getString("nose")?.toInt()
val predictFace3 = it.arguments?.getString("cheek")?.toInt()
val uri1 = it.arguments?.getString("headUri")
val uri2 = it.arguments?.getString("noseUri")
val uri3 = it.arguments?.getString("cheekUri")
ResultsScreen(
navController,
mAuth,
predictOily1,
predictOily2,
predictOily3,
predictFace1,
predictFace2,
predictFace3,
uri1,
uri2,
uri3
)
}
// 여기에 다른 화면들을 네비게이션 구조에 추가합니다.
}
}
}
}
}
@Composable
fun SplashContent(navController: NavController) {
var scale by remember { mutableStateOf(1f) }
var alpha by remember { mutableStateOf(1f) }
val user: FirebaseUser? = mAuth.currentUser
val startDestination = remember {
if (user == null) {
"login"
} else {
"home"
}
}
Box(
modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.colorScheme.primary),
contentAlignment = Alignment.Center
) {
// 스플래시 화면에 표시할 내용 (이미지, 로고 등)
Image(
painter =
painterResource(id = R.drawable.logo),
contentDescription = null,
modifier = Modifier
.graphicsLayer(
scaleX = animateFloatAsState(targetValue = scale, animationSpec = tween(durationMillis = 1000)).value,
scaleY = animateFloatAsState(targetValue = scale, animationSpec = tween(durationMillis = 1000)).value,
alpha = alpha
)
)
// 스플래시 화면에서 HomeScreen으로 Navigation
LaunchedEffect(true) {
delay(1000) // 초기 딜레이
scale = 1.5f
alpha = 0f
delay(1000) // 스케일 및 투명도 변경 후 딜레이
navController.navigate(startDestination)
}
}
}
private fun firebaseAuthWithGoogle(idToken: String) {
val credential = GoogleAuthProvider.getCredential(idToken, null)
mAuth.signInWithCredential(credential)
.addOnCompleteListener(this) { task ->
if (task.isSuccessful) {
// SignIn Successful
Toast.makeText(this, "로그인 성공", Toast.LENGTH_SHORT).show()
} else {
// SignIn Failed
Toast.makeText(this, "로그인 실패", Toast.LENGTH_SHORT).show()
}
}
}
private fun signOut(navController: NavController) {
// get the google account
val googleSignInClient: GoogleSignInClient
// configure Google SignIn
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(getString(R.string.default_web_client_id))
.requestEmail()
.build()
googleSignInClient = GoogleSignIn.getClient(this, gso)
// Sign Out of all accounts
mAuth.signOut()
googleSignInClient.signOut().addOnSuccessListener {
Toast.makeText(this, "로그아웃 성공", Toast.LENGTH_SHORT).show()
navController.navigate("login")
}.addOnFailureListener {
Toast.makeText(this, "로그아웃 실패", Toast.LENGTH_SHORT).show()
}
}
} |
Team_Project_GETISKIN_CV_spaghetti/app/src/main/java/com/example/getiskin/SkinAnalysisScreen.kt | 1048277111 | package com.example.getiskin
// 필요한 추가 import 문
import android.Manifest
import android.content.pm.PackageManager
import android.graphics.ImageDecoder
import android.net.Uri
import android.os.Build
import android.os.Environment
import android.provider.MediaStore
import android.util.Log
import android.widget.Toast
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.PickVisualMediaRequest
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Row
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Button
import androidx.compose.material3.ButtonDefaults
import androidx.compose.material3.Text
import androidx.compose.material3.TextButton
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.Color.Companion.Gray
import androidx.compose.ui.graphics.Color.Companion.White
import androidx.compose.ui.graphics.asImageBitmap
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.core.content.ContextCompat
import androidx.core.content.FileProvider
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import com.google.gson.Gson
import com.google.gson.annotations.SerializedName
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import okhttp3.MediaType
import okhttp3.MultipartBody
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody
import java.io.File
import java.io.IOException
import java.net.URLEncoder
import java.text.SimpleDateFormat
import java.util.*
@Composable
fun SkinAnalysisScreen(navController: NavController) {
val context = LocalContext.current
var imageUri by remember { mutableStateOf<Uri?>(null) }
var selectUris by remember { mutableStateOf<MutableList<Uri?>?>(mutableListOf()) }
val predictOliyList by remember { mutableStateOf<MutableList<Int>>(mutableListOf()) }
val predictFaceList by remember { mutableStateOf<MutableList<Int>>(mutableListOf()) }
val scope = rememberCoroutineScope()
val maxUrisSize = 3
//카메라 퍼미션 확인
var hasCameraPermission by remember {
mutableStateOf(
ContextCompat.checkSelfPermission(
context,
Manifest.permission.CAMERA
) == PackageManager.PERMISSION_GRANTED
)
}
//카메라 퍼미션 확인 런쳐
val cameraPermissionLauncher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.RequestPermission()
) { isGranted: Boolean ->
if (isGranted) {
hasCameraPermission = true
} else {
Toast.makeText(
context,
"Camera permission is required to take photos",
Toast.LENGTH_LONG
).show()
}
}
//카메라로 찍은 파일 Uri로 바꿔줌
fun createImageUri(): Uri {
val timestamp: String = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.US).format(Date())
val storageDir: File? = context.getExternalFilesDir(Environment.DIRECTORY_PICTURES)
return FileProvider.getUriForFile(
context,
"${context.packageName}.fileprovider",
File.createTempFile("JPEG_${timestamp}_", ".jpg", storageDir)
).also { uri ->
imageUri = uri
}
}
//카메라 런쳐
val cameraLauncher = rememberLauncherForActivityResult(
contract = ActivityResultContracts.TakePicture()
) { success: Boolean ->
if (success) {
// 사진 촬영 성공, imageUri에 이미지가 저장됨
scope.launch {
imageUri?.let { uri ->
//이미지 uri들을 selectUris에 하나씩 저장
selectUris?.let { uris ->
val newList = uris.toMutableList()
newList.add(uri)
selectUris = if (newList.size > maxUrisSize) {
newList.takeLast(maxUrisSize).toMutableList()
} else {
newList
}
}
//파일로 변경후 서버 모델에서 예측값 받아오기
val inputStream = context.contentResolver.openInputStream(uri)
val file = File(context.cacheDir, "image.png")
inputStream?.use { input ->
file.outputStream().use { output ->
input.copyTo(output)
}
}
val (predictedClassOliy, predictedClassFace) = uploadImage(file)
predictOliyList.add(predictedClassOliy)
predictFaceList.add(predictedClassFace)
while (predictOliyList.size > 3) {
predictOliyList.removeAt(0)
}
while (predictFaceList.size > 3) {
predictFaceList.removeAt(0)
}
}
}
} else {
Log.e("사진 촬영 실패", "실패실패실패실패실패실패")
}
}
//포토피커로 사진 여러장 가져오기
val multiPhotoLoader = rememberLauncherForActivityResult(
contract = ActivityResultContracts.PickMultipleVisualMedia(),
onResult = { uris ->
val selectedUris = uris.take(3)
// 현재의 selectUris 크기가 3을 초과하는 경우, 앞에서부터 제거
while (selectUris!!.size + selectedUris.size > 3) {
selectUris!!.removeAt(0)
}
selectUris!!.addAll(selectedUris)
scope.launch {
selectUris.let {
if (it != null) {
for (uri in it) {
if (uri != null) {
val inputStream = context.contentResolver.openInputStream(uri)
val file = File(context.cacheDir, "image.png")
inputStream?.use { input ->
file.outputStream().use { output ->
input.copyTo(output)
}
}
try {
val (predictedClassOliy, predictedClassFace) = uploadImage(file)
predictOliyList.add(predictedClassOliy)
predictFaceList.add(predictedClassFace)
while (predictOliyList.size > 3) {
predictOliyList.removeAt(0)
}
while (predictFaceList.size > 3) {
predictFaceList.removeAt(0)
}
Log.d("성공함", "예측값 추가됨: $predictedClassOliy, $predictedClassFace")
} catch (e: Exception) {
Log.e("예외 발생", e.toString())
}
}
}
}
}
}
}
)
Box(
modifier = Modifier
.fillMaxSize()
.background(Color(android.graphics.Color.parseColor("#ffffff")))
) {
// 상단 이미지
Image(
painter = painterResource(id = R.drawable.logo), // 이미지 리소스 ID로 변경
contentDescription = null, // contentDescription은 필요에 따라 추가
modifier = Modifier
.fillMaxWidth()
.height(100.dp) // 이미지 높이 조절
)
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp),
) {
Spacer(modifier = Modifier.height(80.dp))
// Text
Text(
text = "피 부 측 정",
modifier = Modifier
.fillMaxWidth()
.background(Color(android.graphics.Color.parseColor("#F7F1E5")))
.padding(20.dp)
.height(30.dp), // 여백 추가
textAlign = TextAlign.Center,
fontSize = 24.sp, // 원하는 크기로 조절
fontWeight = FontWeight.Bold,
color = Color(android.graphics.Color.parseColor("#e39368")) // 원하는 색상으로 조절
)
Spacer(modifier = Modifier.height(16.dp))
Column(
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.CenterHorizontally
) {
// 사진 보여주는곳
Row(modifier = Modifier.fillMaxWidth(), horizontalArrangement = Arrangement.SpaceBetween) {
for (uri in selectUris.orEmpty()) {
if (uri != null) {
val headBitmap = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
val decodeBitmap = ImageDecoder.decodeBitmap(
ImageDecoder.createSource(
context.contentResolver, uri
)
)
decodeBitmap
} else {
MediaStore.Images.Media.getBitmap(context.contentResolver, uri)
}
Image(
bitmap = headBitmap.asImageBitmap(), contentDescription = "", modifier = Modifier
.size(120.dp)
.clickable {
selectUris?.let { currentUris ->
// 클릭한 이미지의 uri를 제거
val updatedUris = currentUris
.filter { it != uri }
.toMutableList()
selectUris = updatedUris
}
}
)
}
}
}
Spacer(modifier = Modifier.height(16.dp))
Button(
onClick = {
if (hasCameraPermission) {
val uri = createImageUri()
cameraLauncher.launch(uri)
} else {
cameraPermissionLauncher.launch(Manifest.permission.CAMERA)
}
},
modifier = Modifier
.fillMaxWidth()
.height(200.dp)
.padding(10.dp)
.border(
1.dp,
Color(android.graphics.Color.parseColor("#e39368")),
shape = RoundedCornerShape(10)
),
colors = ButtonDefaults.buttonColors(
Color(0xFFE39368), // 버튼 배경색상 설정
contentColor = White // 버튼 내부 텍스트 색상 설정
),
shape = RoundedCornerShape(10)
) {
Text(
text = "카메라로 촬영하기",
textAlign = TextAlign.Center,
color = White,
fontSize = 18.sp,
fontWeight = FontWeight.Bold
)
}
Spacer(modifier = Modifier.height(20.dp))
Button(
onClick = {
// 앨범 런처를 실행합니다.
multiPhotoLoader.launch(PickVisualMediaRequest(ActivityResultContracts.PickVisualMedia.ImageAndVideo))
},
modifier = Modifier
.fillMaxWidth()
.height(200.dp)
.padding(10.dp)
.border(
1.dp,
Color(android.graphics.Color.parseColor("#e39368")),
shape = RoundedCornerShape(10)
),
colors = ButtonDefaults.buttonColors(
Color(0xFFE39368), // 버튼 배경색상 설정
contentColor = White // 버튼 내부 텍스트 색상 설정
),
shape = RoundedCornerShape(10)
) {
Text(
text = "앨범에서 사진 선택하기",
textAlign = TextAlign.Center,
color = White,
fontSize = 18.sp,
fontWeight = FontWeight.Bold
)
}
Spacer(modifier = Modifier.height(16.dp))
/*TODO 버튼 색변경 및 글씨 스타일링, list로 값 보내기*/
Button(
onClick = {
val headEncodedUri = URLEncoder.encode(selectUris?.get(0).toString(), "UTF-8")
val noseEncodedUri = URLEncoder.encode(selectUris?.get(1).toString(), "UTF-8")
val cheekEncodedUri = URLEncoder.encode(selectUris?.get(2).toString(), "UTF-8")
if (selectUris != null) {
navController.navigate(
"results/${predictOliyList[0]}/${predictOliyList[1]}/${predictOliyList[2]}/${predictFaceList[0]}/${predictFaceList[1]}/${predictFaceList[2]}/${headEncodedUri}/${noseEncodedUri}/${cheekEncodedUri}"
)
}
},
enabled = (selectUris?.size ?: 0) >= 3,
colors = ButtonDefaults.buttonColors(
Color(0xFFE39368), // 버튼 배경색상 설정
contentColor = White // 버튼 내부 텍스트 색상 설정
),
) {
Text(
text = "진단하기",
color = White,
fontSize = 18.sp,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center,
)
}
Spacer(modifier = Modifier.height(10.dp)) // 간격 조절
TextButton(
onClick = {
navController.navigate("home")
},
modifier = Modifier
.fillMaxWidth()
.height(50.dp)
) {
Text(
text = "홈으로",
color = Gray,
fontSize = 18.sp,
fontWeight = FontWeight.Bold,
textAlign = TextAlign.Center,
modifier = Modifier.fillMaxSize()
)
}
}
}
}
}
//서버와 통신하는 함수
//비동기 환경에서 처리
suspend fun uploadImage(file: File): Pair<Int, Int> = withContext(Dispatchers.IO) {
//서버가 열린 주소
val url = "http://192.168.1.111:5000/predict"
//ok3http 사용
val client = OkHttpClient()
//request(요청)보낼 파일(이미지)생성
val requestBody = MultipartBody.Builder()
.setType(MultipartBody.FORM)
//이름은 image, 파일이름은 image.png로 보냄
.addFormDataPart(
"image",
"image.png",
RequestBody.create(MediaType.parse("image/*"), file)
)
.build()
//request post
val request = Request.Builder()
//해당 서버주소
.url(url)
//파일 전송
.post(requestBody)
.build()
//오류 캐치를 위해
try {
//응답을 받아옴(요청에 대한값)
val response = client.newCall(request).execute()
if (response.isSuccessful) {
//응답이 온다면 string으로 만듦
val responseBody = response.body()?.string()
//json파일 pasing을 위한 함수 사용
val gson = Gson()
//응답을 PredictResponse에 값을 참조해옴
val predictResponse = gson.fromJson(responseBody, PredictResponse::class.java)
val intValue = Pair(predictResponse.predictedClassOliy, predictResponse.predictedClassFace)
Log.d("성공함", "이미지가 올라갔다? Respones : ${responseBody ?: "no data"}")
return@withContext intValue
} else {
Log.e("망함", "망함")
}
} catch (e: IOException) {
e.printStackTrace()
// Handle exception
} as Pair<Int, Int>
}
//서버에서 보낸 json에서 값을 추출
data class PredictResponse(
//이 이름을 찾음 @SeriallizedName
@SerializedName("predicted_class_oliy")
val predictedClassOliy: Int,
@SerializedName("predicted_class_face")
val predictedClassFace: Int,
)
@Preview
@Composable
fun SkinAnalysisScreenPreview() {
// You can create a preview of the HomeScreen here
// For example, you can use a NavController with a LocalCompositionLocalProvider
// to simulate the navigation.
// Note: This is a simplified example; you may need to adjust it based on your actual navigation setup.
val navController = rememberNavController()
SkinAnalysisScreen(navController = navController)
}
|
Team_Project_GETISKIN_CV_spaghetti/app/src/main/java/com/example/getiskin/DiaryScreen.kt | 2221702569 | package com.example.getiskin
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.lazy.LazyColumn
import androidx.compose.foundation.lazy.items
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material3.Card
import androidx.compose.material3.Divider
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import coil.compose.rememberImagePainter
import coil.transform.CircleCropTransformation
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.firestore.Query
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine
@Composable
fun DiaryScreen(auth: FirebaseAuth) {
var skinAnalysisList by remember { mutableStateOf<List<SkinAnalysisData>>(emptyList()) }
LaunchedEffect(Unit) {
// 코루틴을 사용하여 데이터를 비동기적으로 가져옴
skinAnalysisList = fetchDataFromFirestore(auth.currentUser?.uid ?: "")
}
Column(
modifier = Modifier
.fillMaxSize()
.padding(16.dp)
) {
Image(
painter = painterResource(id = R.drawable.logo), // 이미지 리소스 ID로 변경
contentDescription = null, // contentDescription은 필요에 따라 추가
modifier = Modifier
.fillMaxWidth()
.height(100.dp) // 이미지 높이 조절
)
Text(
text = "나 의 일 지",
modifier = Modifier
.fillMaxWidth()
.background(Color(android.graphics.Color.parseColor("#F7F1E5")))
.padding(20.dp)
.height(30.dp), // 여백 추가
textAlign = TextAlign.Center,
fontSize = 24.sp, // 원하는 크기로 조절
fontWeight = FontWeight.Bold,
color = Color(android.graphics.Color.parseColor("#e39368")) // 원하는 색상으로 조절
)
// Journal Entries
LazyColumn(modifier = Modifier.fillMaxSize()) {
items(skinAnalysisList) { entry ->
JournalEntryCard(entry = entry, auth)
}
}
}
}
@Composable
fun JournalEntryCard(entry: SkinAnalysisData, auth: FirebaseAuth) {
Card(
modifier = Modifier
.fillMaxWidth()
.padding(8.dp)
.border(2.dp, Color(0xFFE39368), shape = RoundedCornerShape(16.dp))
) {
// Box(
// modifier = Modifier
// .fillMaxSize()
// .background(Color(android.graphics.Color.parseColor("#F7F1E5")))
// ) {
val user = auth.currentUser
Column(
modifier = Modifier
.fillMaxWidth()
.background(Color(android.graphics.Color.parseColor("#F7F1E5")))
.padding(16.dp)
) {
Text(
text = entry.timestamp,
style = MaterialTheme.typography.titleMedium,
modifier = Modifier
.fillMaxWidth()
.padding(vertical = 4.dp)
.align(Alignment.CenterHorizontally)
)
Divider(color = Color.Black, thickness = 1.dp)
// 세로 구분선
Spacer(modifier = Modifier.height(8.dp))
Column(modifier = Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
// 내 피부상태
// Text(
// text = "피부상태: ${entry.finalSkinType}",
// style = MaterialTheme.typography.titleSmall
// )
user?.displayName?.let { StyledSkinType(entry.finalSkinType, "${it}님") }
// 세로 구분선
Spacer(modifier = Modifier.height(8.dp))
// 사진
Column(horizontalAlignment = Alignment.CenterHorizontally) {
LoadImageFromFirebase(entry.imageUrl1)
Spacer(modifier = Modifier.height(8.dp))
StyledText(entry.facePart1, entry.skinType1)
}
// 사진
Column(horizontalAlignment = Alignment.CenterHorizontally) {
LoadImageFromFirebase(entry.imageUrl2)
Spacer(modifier = Modifier.height(8.dp))
StyledText(entry.facePart2, entry.skinType2)
}
// 사진
Column(horizontalAlignment = Alignment.CenterHorizontally) {
LoadImageFromFirebase(entry.imageUrl3)
Spacer(modifier = Modifier.height(8.dp))
StyledText(entry.facePart3, entry.skinType3)
}
}
}
}
}
private suspend fun fetchDataFromFirestore(userId: String): List<SkinAnalysisData> = suspendCoroutine { continuation ->
val db = FirebaseFirestore.getInstance()
val result = mutableListOf<SkinAnalysisData>()
// "skinAnalysis" 컬렉션에서 데이터 가져오기
db.collection("skinAnalysis")
.orderBy("timestamp", Query.Direction.DESCENDING) // timestamp 기준으로 최신순으로 정렬
.get().addOnSuccessListener { querySnapshot ->
for (document in querySnapshot) {
val skinAnalysisData = document.toObject(SkinAnalysisData::class.java)
if (skinAnalysisData.userID == userId) {
result.add(skinAnalysisData)
}
}
continuation.resume(result)
}.addOnFailureListener { exception ->
println("Error getting documents: $exception")
continuation.resumeWithException(exception)
}
}
@Composable
fun LoadImageFromFirebase(imageUrl: String) {
val painter = rememberImagePainter(data = imageUrl, builder = {
crossfade(true)
transformations(CircleCropTransformation()) // 원형으로 자르기
})
Image(
painter = painter, contentDescription = null, modifier = Modifier
.fillMaxWidth()
.height(150.dp)
.clip(MaterialTheme.shapes.medium)
)
}
//@Preview(showBackground = true)
//@Composable
//fun DiaryScreenPreview() {
// val navController = rememberNavController()
// MaterialTheme {
// DiaryScreen(navController)
// }
//} |
Team_Project_GETISKIN_CV_spaghetti/app/src/main/java/com/example/getiskin/LoginScreen.kt | 1349731392 | package com.example.getiskin
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.size
import androidx.compose.material3.MaterialTheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
@Composable
fun LoginScreen(signInClicked: () -> Unit) {
Box(
modifier = Modifier
.fillMaxSize()
.background(MaterialTheme.colorScheme.primary),
contentAlignment = Alignment.Center
) {
Column(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Image(painter = painterResource(id = R.drawable.logo), contentDescription = null)
GoogleSignInButton(signInClicked)
}
}
}
@Composable
fun GoogleSignInButton(
signInClicked: () -> Unit
) {
Image(
painter = painterResource(id = R.drawable.google_login),
contentDescription = "구글로그인",
modifier = Modifier.size(250.dp, 100.dp).clickable { signInClicked() }
)
} |
Team_Project_GETISKIN_CV_spaghetti/app/src/main/java/com/example/getiskin/ClinicScreen.kt | 1436780175 | package com.example.getiskin
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.net.Uri
import androidx.activity.compose.rememberLauncherForActivityResult
import androidx.activity.result.contract.ActivityResultContracts
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.core.content.ContextCompat
import androidx.navigation.NavController
import androidx.navigation.compose.rememberNavController
import com.google.android.gms.location.FusedLocationProviderClient
import com.google.android.gms.location.LocationServices
import com.google.android.gms.maps.model.LatLng
@Composable
fun HomeReturnButton(navController: NavController) {
Box(
modifier = Modifier
.height(150.dp)
.padding(5.dp)
.clip(RoundedCornerShape(10))
.clickable {
navController.navigate("home")
}
) {
// Image 등의 내용을 넣어줌
Image(
painter = painterResource(id = R.drawable.home),
contentDescription = null,
contentScale = ContentScale.Crop, // 이미지가 잘릴 수 있도록 설정
modifier = Modifier
.fillMaxSize() // 이미지를 꽉 채우도록 설정
.aspectRatio(1f)
.clip(RoundedCornerShape(10))
)
Text(
text = "홈 화면으로",
textAlign = TextAlign.Center,
color = Color.White,
fontSize = 20.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier
.padding(16.dp)
.background(Color.Transparent) // 텍스트 배경을 투명하게 설정
)
}
}
@Composable
fun ClinicSearchButton() {
val searchText = "피부관리"
val fusedLocationClient: FusedLocationProviderClient =
LocationServices.getFusedLocationProviderClient(LocalContext.current)
val context = LocalContext.current
var isLocationPermissionGranted by remember { mutableStateOf(false) }
val requestLocationPermissionLauncher =
rememberLauncherForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted ->
isLocationPermissionGranted = isGranted
}
var isClicked by remember { mutableStateOf(false) }
Box(
modifier = Modifier
.height(150.dp)
.padding(5.dp)
.clip(RoundedCornerShape(10))
.clickable {
isClicked = true
}
) {
if (isClicked) {
// 클릭되었을 때의 UI
// 예를 들어, 광고 클릭 후에 할 작업을 여기에 추가
if (ContextCompat.checkSelfPermission(
context,
android.Manifest.permission.ACCESS_FINE_LOCATION
) == PackageManager.PERMISSION_GRANTED
) {
// 이미 권한이 있는 경우
isLocationPermissionGranted = true
if (isLocationPermissionGranted) {
// 위치 권한이 허용된 경우 위치 정보 가져오기 시도
fusedLocationClient.lastLocation.addOnSuccessListener { location ->
if (location != null) {
// 위치 정보 가져오기 성공
val currentLatLng =
LatLng(location.latitude, location.longitude)
// 검색어와 현재 위치 기반으로 Google Maps 열기
openGoogleMaps(context, currentLatLng, searchText)
} else {
// 위치 정보 없음
}
}.addOnFailureListener { exception ->
// 위치 정보 가져오기 실패
}
} else {
// 위치 권한이 거부된 경우 처리
// 여기에 권한이 거부되었을 때의 동작을 추가할 수 있습니다.
}
} else {
// 권한이 없는 경우
requestLocationPermissionLauncher.launch(android.Manifest.permission.ACCESS_FINE_LOCATION)
}
}
// Image 등의 내용을 넣어줌
Image(
painter = painterResource(id = R.drawable.clinics),
contentDescription = null,
contentScale = ContentScale.Crop, // 이미지가 잘릴 수 있도록 설정
modifier = Modifier
.fillMaxSize() // 이미지를 꽉 채우도록 설정
.aspectRatio(1f)
.clip(RoundedCornerShape(10))
)
Text(
text = "피부관리샵 찾기",
textAlign = TextAlign.Center,
color = Color.White,
fontSize = 20.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier
.padding(16.dp)
.background(Color.Transparent) // 텍스트 배경을 투명하게 설정
)
}
}
@Composable
fun ClinicScreen(navController: NavController) {
val complexAd = "https://www.coupang.com/np/search?component=&q=%EB%B3%B5%ED%95%A9%EC%84%B1+%ED%99%94%EC%9E%A5%ED%92%88&channel=user"
val hwahaeAd = "https://www.hwahae.co.kr/"
val searchText = "피부관리"
val fusedLocationClient: FusedLocationProviderClient =
LocationServices.getFusedLocationProviderClient(LocalContext.current)
val context = LocalContext.current
var isLocationPermissionGranted by remember { mutableStateOf(false) }
// 위치 권한 요청을 위한 런처
val requestLocationPermissionLauncher =
rememberLauncherForActivityResult(ActivityResultContracts.RequestPermission()) { isGranted ->
isLocationPermissionGranted = isGranted
}
Box(
modifier = Modifier
.fillMaxSize()
.background(Color(android.graphics.Color.parseColor("#ffffff")))
) {
// 상단 이미지
Image(
painter = painterResource(id = R.drawable.logo), // 이미지 리소스 ID로 변경
contentDescription = null, // contentDescription은 필요에 따라 추가
modifier = Modifier
.fillMaxWidth()
.height(100.dp) // 이미지 높이 조절
)
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
) {
Spacer(modifier = Modifier.height(80.dp))
// Text
Text(
text = "C L I N I C",
modifier = Modifier
.fillMaxWidth()
.background(Color(android.graphics.Color.parseColor("#F7F1E5")))
.padding(20.dp)
.height(30.dp), // 여백 추가
textAlign = TextAlign.Center,
fontSize = 24.sp, // 원하는 크기로 조절
fontWeight = FontWeight.Bold,
color = Color(android.graphics.Color.parseColor("#e39368")) // 원하는 색상으로 조절
)
// 중앙 컨텐츠
Column(
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.CenterHorizontally,
verticalArrangement = Arrangement.Center
) {
AdPlaces("복합성 화장품 광고", complexAd)
Spacer(modifier = Modifier.height(80.dp))
// Button
ClinicSearchButton()
Spacer(modifier = Modifier.height(20.dp))
HomeReturnButton(navController)
Spacer(modifier = Modifier.height(70.dp))
AdPlaces("화해 광고", hwahaeAd)
}
}
}
}
// Google Maps 열기 함수
private fun openGoogleMaps(context: Context, destinationLatLng: LatLng, searchText: String) {
val mapIntent = Intent(
Intent.ACTION_VIEW,
Uri.parse("geo:${destinationLatLng.latitude},${destinationLatLng.longitude}?q=$searchText")
)
// Google Maps 앱이 설치되어 있는 경우 Google Maps 앱에서 지도를 엽니다.
// 설치되어 있지 않은 경우 웹 브라우저에서 지도를 엽니다.
mapIntent.setPackage("com.google.android.apps.maps")
context.startActivity(mapIntent)
}
@Composable
fun PreviewClinicScreen() {
// 여기서는 NavController를 mock으로 사용하거나, 필요에 따라 빈 NavController를 생성할 수 있습니다.
val navController = rememberNavController() // 빈 NavController 생성
// 미리보기에서 사용할 가상의 데이터 등을 여기에 추가할 수 있습니다.
ClinicScreen(navController = navController)
}
@Preview
@Composable
fun ClinicScreenPreview() {
PreviewClinicScreen()
} |
Team_Project_GETISKIN_CV_spaghetti/app/src/main/java/com/example/getiskin/HomeScreen.kt | 84876724 | package com.example.getiskin
import android.content.Intent
import android.net.Uri
import android.widget.Toast
import androidx.compose.foundation.Image
import androidx.compose.foundation.background
import androidx.compose.foundation.border
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.aspectRatio
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.width
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.draw.clip
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.layout.ContentScale
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.navigation.NavController
@Composable
fun ShowToasts(message: String) {
val context = LocalContext.current
val toast = remember { Toast.makeText(context, message, Toast.LENGTH_SHORT) }
toast.show()
}
@Composable
fun SkinButton(navController: NavController) {
Box(
modifier = Modifier
.height(150.dp)
.padding(5.dp)
.clip(RoundedCornerShape(10))
.clickable {
navController.navigate("skin_analysis")
}
) {
// Image 등의 내용을 넣어줌
Image(
painter = painterResource(id = R.drawable.skin),
contentDescription = null,
contentScale = ContentScale.Crop, // 이미지가 잘릴 수 있도록 설정
modifier = Modifier
.fillMaxSize() // 이미지를 꽉 채우도록 설정
.aspectRatio(1f)
.clip(RoundedCornerShape(10))
)
Text(
text = "피부 진단",
textAlign = TextAlign.Center,
color = Color.White,
fontSize = 20.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier
.padding(16.dp)
.background(Color.Transparent) // 텍스트 배경을 투명하게 설정
)
}
}
@Composable
fun DiaryButton(navController: NavController) {
Box(
modifier = Modifier
.height(150.dp)
.padding(5.dp)
.clip(RoundedCornerShape(10))
.clickable {
navController.navigate("diary")
}
) {
// Image 등의 내용을 넣어줌
Image(
painter = painterResource(id = R.drawable.newdiary),
contentDescription = null,
contentScale = ContentScale.Crop, // 이미지가 잘릴 수 있도록 설정
modifier = Modifier
.fillMaxSize() // 이미지를 꽉 채우도록 설정
.aspectRatio(1f)
.clip(RoundedCornerShape(10))
)
Text(
text = "나의 일지",
textAlign = TextAlign.Center,
color = Color.White,
fontSize = 20.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier
.padding(16.dp)
.background(Color.Transparent) // 텍스트 배경을 투명하게 설정
)
}
}
@Composable
fun ShopButton(navController: NavController) {
Box(
modifier = Modifier
.height(150.dp)
.padding(5.dp)
.clip(RoundedCornerShape(10))
.clickable {
navController.navigate("product")
}
) {
// Image 등의 내용을 넣어줌
Image(
painter = painterResource(id = R.drawable.cosmetics),
contentDescription = null,
contentScale = ContentScale.Crop, // 이미지가 잘릴 수 있도록 설정
modifier = Modifier
.fillMaxSize() // 이미지를 꽉 채우도록 설정
.aspectRatio(1f)
.clip(RoundedCornerShape(10))
)
Text(
text = "상품 추천",
textAlign = TextAlign.Center,
color = Color.White,
fontSize = 20.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier
.padding(16.dp)
.background(Color.Transparent) // 텍스트 배경을 투명하게 설정
)
}
}
@Composable
fun ClinicButton(navController: NavController) {
Box(
modifier = Modifier
.height(150.dp)
.padding(5.dp)
.clip(RoundedCornerShape(10))
.clickable {
navController.navigate("clinic")
}
) {
// Image 등의 내용을 넣어줌
Image(
painter = painterResource(id = R.drawable.clinics),
contentDescription = null,
contentScale = ContentScale.Crop, // 이미지가 잘릴 수 있도록 설정
modifier = Modifier
.fillMaxSize() // 이미지를 꽉 채우도록 설정
.aspectRatio(1f)
.clip(RoundedCornerShape(10))
)
Text(
text = "피부관리샵 찾기",
textAlign = TextAlign.Center,
color = Color.White,
fontSize = 20.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier
.padding(16.dp)
.background(Color.Transparent) // 텍스트 배경을 투명하게 설정
)
}
}
@Composable
fun AdPlaces(adName: String, uriString: String) {
var isClicked by remember { mutableStateOf(false) }
val context = LocalContext.current
Box(
modifier = Modifier
.fillMaxWidth()
.height(100.dp)
.padding(10.dp)
.border(
1.dp,
Color(android.graphics.Color.parseColor("#e39368")),
shape = RoundedCornerShape(10)
)
.clickable {
// 광고를 클릭할 때 수행할 작업 추가
isClicked = true
val intent = Intent(Intent.ACTION_VIEW, Uri.parse(uriString))
context.startActivity(intent)
}
) {
if (isClicked) {
// 클릭되었을 때의 UI
// 예를 들어, 광고 클릭 후에 할 작업을 여기에 추가
ShowToasts("업체 웹페이지로 이동합니다")
}
Image(
painter = painterResource(id = R.drawable.analysis), // 가상 이미지 리소스 ID로 변경
contentDescription = null,
contentScale = ContentScale.Crop,
modifier = Modifier
.fillMaxSize()
.border(
1.dp,
Color(android.graphics.Color.parseColor("#e39368")),
shape = RoundedCornerShape(10)
)
)
// 광고 텍스트
Text(
text = adName,
textAlign = TextAlign.Center,
color = Color.White,
fontSize = 18.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier
.padding(16.dp)
.background(Color.Transparent) // 텍스트 배경을 투명하게 설정
)
}
}
@Composable
fun HomeScreen(navController: NavController, onClicked: () -> Unit) {
val oilyAd = "https://www.coupang.com/np/search?component=&q=%EC%A7%80%EC%84%B1+%ED%99%94%EC%9E%A5%ED%92%88&channel=user"
val dryAd = "https://www.coupang.com/np/search?component=&q=%EA%B1%B4%EC%84%B1+%ED%99%94%EC%9E%A5%ED%92%88&channel=user"
Box(
modifier = Modifier
.fillMaxSize()
.background(Color(android.graphics.Color.parseColor("#ffffff")))
) {
// 상단 이미지
Image(
painter = painterResource(id = R.drawable.logo), // 이미지 리소스 ID로 변경
contentDescription = null, // contentDescription은 필요에 따라 추가
modifier = Modifier
.fillMaxWidth()
.height(100.dp) // 이미지 높이 조절
)
Column(
modifier = Modifier
.fillMaxWidth()
.padding(16.dp)
) {
Spacer(modifier = Modifier.height(80.dp))
// Text
Text(
text = "H O M E",
modifier = Modifier
.fillMaxWidth()
.background(Color(android.graphics.Color.parseColor("#F7F1E5")))
.padding(20.dp)
.height(30.dp), // 여백 추가
textAlign = TextAlign.Center,
fontSize = 24.sp, // 원하는 크기로 조절
fontWeight = FontWeight.Bold,
color = Color(android.graphics.Color.parseColor("#e39368")) // 원하는 색상으로 조절
)
Spacer(modifier = Modifier.height(20.dp))
Box(
modifier = Modifier
.fillMaxWidth()
.background(Color(android.graphics.Color.parseColor("#F7F1E5"))) // 원하는 배경 색상으로 설정
.padding(16.dp)
) {
Column(
modifier = Modifier
.fillMaxSize()
.verticalScroll(rememberScrollState()),
horizontalAlignment = Alignment.CenterHorizontally
) {
SkinButton(
navController
)
Spacer(modifier = Modifier.width(15.dp))
DiaryButton(
navController
)
ShopButton(
navController
)
ClinicButton(
navController
)
LogoutButton(onClicked)
AdPlaces("지성 화장품 광고", oilyAd)
AdPlaces("건성 화장품 광고", dryAd)
}
}
}
}
}
@Composable
fun LogoutButton(onClicked: () -> Unit) {
Box(
modifier = Modifier
.height(150.dp)
.padding(5.dp)
.clip(RoundedCornerShape(10))
.clickable {
onClicked()
}
) {
// Image 등의 내용을 넣어줌
Image(
painter = painterResource(id = R.drawable.logout),
contentDescription = null,
contentScale = ContentScale.Crop, // 이미지가 잘릴 수 있도록 설정
modifier = Modifier
.fillMaxSize() // 이미지를 꽉 채우도록 설정
.aspectRatio(1f)
.clip(RoundedCornerShape(10))
)
Text(
text = "로그아웃",
textAlign = TextAlign.Center,
color = Color.White,
fontSize = 20.sp,
fontWeight = FontWeight.Bold,
modifier = Modifier
.padding(16.dp)
.background(Color.Transparent) // 텍스트 배경을 투명하게 설정
)
}
}
//@Preview
//@Composable
//fun HomeScreenPreview() {
// // You can create a preview of the HomeScreen here
// // For example, you can use a NavController with a LocalCompositionLocalProvider
// // to simulate the navigation.
// // Note: This is a simplified example; you may need to adjust it based on your actual navigation setup.
// val navController = rememberNavController()
// HomeScreen(navController = navController)
//} |
development-android/KotlinTouch/app/src/androidTest/java/com/example/kotlintouch/ExampleInstrumentedTest.kt | 2790145276 | package com.example.kotlintouch
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.kotlintouch", appContext.packageName)
}
} |
development-android/KotlinTouch/app/src/test/java/com/example/kotlintouch/ExampleUnitTest.kt | 562460317 | package com.example.kotlintouch
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
} |
development-android/KotlinTouch/app/src/main/java/com/example/kotlintouch/MainActivity.kt | 801340519 | package com.example.kotlintouch
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
} |
Hospel/app/src/androidTest/java/com/example/hospel/ExampleInstrumentedTest.kt | 337941962 | package com.example.hospel
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.Assert.*
/**
* Instrumented test, which will execute on an Android device.
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
@RunWith(AndroidJUnit4::class)
class ExampleInstrumentedTest {
@Test
fun useAppContext() {
// Context of the app under test.
val appContext = InstrumentationRegistry.getInstrumentation().targetContext
assertEquals("com.example.hospel", appContext.packageName)
}
} |
Hospel/app/src/test/java/com/example/hospel/ExampleUnitTest.kt | 4013971528 | package com.example.hospel
import org.junit.Test
import org.junit.Assert.*
/**
* Example local unit test, which will execute on the development machine (host).
*
* See [testing documentation](http://d.android.com/tools/testing).
*/
class ExampleUnitTest {
@Test
fun addition_isCorrect() {
assertEquals(4, 2 + 2)
}
} |
Hospel/app/src/main/java/com/example/hospel/Akun.kt | 2406438528 | package com.example.hospel
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.example.hospel.databinding.ActivityAkunBinding
class Akun : AppCompatActivity() {
private lateinit var binding: ActivityAkunBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityAkunBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.backAkun.setOnClickListener {
onBackPressed()
}
binding.ubahPassword.setOnClickListener {
val intent = Intent(this@Akun, UbahPassword::class.java)
startActivity(intent)
}
binding.ubahEmail.setOnClickListener {
val intent = Intent(this@Akun, UbahEmail::class.java)
startActivity(intent)
}
}
} |
Hospel/app/src/main/java/com/example/hospel/MainActivity.kt | 1907887446 | package com.example.hospel
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import com.example.hospel.databinding.ActivityMainBinding
class MainActivity : AppCompatActivity() {
private lateinit var binding : ActivityMainBinding
val fragHome : Fragment = HomeFragment()
val fragProfil : Fragment = ProfilFragment()
val fragPesan : Fragment = PesanFragment()
var hideHomeFragment : Fragment = fragHome
var hideProfilFragment : Fragment = fragProfil
var hidePesanFragment : Fragment = fragPesan
val fm : FragmentManager = supportFragmentManager
override fun onCreate(savedInstanceState: Bundle?) {
binding = ActivityMainBinding.inflate(layoutInflater)
super.onCreate(savedInstanceState)
setContentView(binding.root)
fm.beginTransaction().add(R.id.fragmentContainerView, fragHome).show(fragHome).commit()
fm.beginTransaction().add(R.id.fragmentContainerView, fragProfil).hide(fragProfil).commit()
fm.beginTransaction().add(R.id.fragmentContainerView, fragPesan).hide(fragPesan).commit()
binding.bottomNavigationView.setOnItemSelectedListener {
when(it.itemId){
R.id.homeFragment -> replaceFragment(HomeFragment())
R.id.settingsFragment -> replaceFragment(ProfilFragment())
R.id.pesanFragment -> replaceFragment(PesanFragment())
else ->{
}
}
true
}
}
private fun replaceFragment(fragment : Fragment){
val fragmentManager = supportFragmentManager
val fragmentTransaction = fragmentManager.beginTransaction()
fragmentTransaction.replace(R.id.fragmentContainerView, fragment)
fragmentTransaction.addToBackStack(null)
fragmentTransaction.commit()
}
} |
Hospel/app/src/main/java/com/example/hospel/PesanFragment.kt | 3561067102 | package com.example.hospel
import android.os.Bundle
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.example.hospel.databinding.FragmentPesanBinding
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.firestore.FirebaseFirestore
class PesanFragment : Fragment() {
private lateinit var recyclerView: RecyclerView
private lateinit var pesanList: ArrayList<DataListPesan?> // Tetapkan tipe data pesanList menjadi ArrayList<DataListPesan?>
private lateinit var binding: FragmentPesanBinding
private val firestore = FirebaseFirestore.getInstance()
private val auth = FirebaseAuth.getInstance()
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
binding = FragmentPesanBinding.inflate(layoutInflater, container, false)
recyclerView = binding.recyclerViewPesan
pesanList = ArrayList<DataListPesan?>()
// Ambil data dari Firestore
val currentUser = auth.currentUser
if (currentUser != null) {
val uid = currentUser.uid
firestore.collection("users")
.document(uid)
.get()
.addOnSuccessListener { userDocument ->
val nama = userDocument.getString("nama") ?: ""
val email = userDocument.getString("email") ?: ""
val alamat = userDocument.getString("alamat") ?: ""
val nomor = userDocument.getString("nomor") ?: ""
// Tambahkan data dari koleksi "users" ke pesanList
pesanList.add(DataListPesan(nama, email, alamat, nomor, "", "", "", "", ""))
// Ambil data dari subkoleksi "nota" yang berada di dalam koleksi "users"
firestore.collection("users")
.document(uid)
.collection("nota")
.get()
.addOnSuccessListener { notaQuerySnapshot ->
for (notaDocument in notaQuerySnapshot) {
val kelas_nota = notaDocument.getString("kelas_hotel") ?: ""
val kamar_nota = notaDocument.getString("kamar_hotel") ?: ""
val jumlah_hari_nota = notaDocument.getString("jumlah_hari") ?: ""
val total_nota = notaDocument.getString("total") ?: ""
val status_nota = notaDocument.getString("status") ?: ""
// Tambahkan data dari subkoleksi "nota" ke pesanList
pesanList.add(DataListPesan(nama, email,alamat,nomor, kelas_nota, kamar_nota,jumlah_hari_nota, total_nota, status_nota))
if (isAdded && activity != null) {
populateData()
}
}
}
.addOnFailureListener { notaException ->
// Handle kesalahan jika terjadi saat mengambil data dari subkoleksi "nota"
Log.e("PesanFragment", "Gagal menampilkan nota pembayaran", notaException)
}
}
.addOnFailureListener { userException ->
// Handle kesalahan jika terjadi saat mengambil data dari koleksi "users"
Log.e("PesanFragment", "Gagal menampilkan data pengguna", userException)
}
}
return binding.root
}
private fun populateData() {
val linearLayout = LinearLayoutManager(activity)
linearLayout.stackFromEnd = true
linearLayout.reverseLayout = true
recyclerView.layoutManager = linearLayout
// Gunakan pesanList untuk inisialisasi adapter
val adp = AdapterListPesan(requireActivity(), pesanList)
recyclerView.adapter = adp
}
}
|
Hospel/app/src/main/java/com/example/hospel/TentangKami.kt | 3859760316 | package com.example.hospel
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.example.hospel.databinding.ActivityEditProfilBinding
import com.example.hospel.databinding.ActivityTentangKamiBinding
class TentangKami : AppCompatActivity() {
private lateinit var binding: ActivityTentangKamiBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityTentangKamiBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.backTentangKami.setOnClickListener {
onBackPressed()
}
}
} |
Hospel/app/src/main/java/com/example/hospel/UbahEmail.kt | 2762206459 | package com.example.hospel
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import com.example.hospel.databinding.ActivityUbahEmailBinding
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.auth.GoogleAuthProvider
import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.firestore.SetOptions
class UbahEmail : AppCompatActivity() {
private lateinit var binding: ActivityUbahEmailBinding
private val auth = FirebaseAuth.getInstance()
private val firestore = FirebaseFirestore.getInstance()
override fun onCreate(savedInstanceState: Bundle?) {
binding = ActivityUbahEmailBinding.inflate(layoutInflater)
super.onCreate(savedInstanceState)
setContentView(binding.root)
binding.backUbahEmail.setOnClickListener {
onBackPressed()
}
val currentUser = auth.currentUser
if (currentUser != null) {
val uid = currentUser.uid
firestore.collection("users")
.document(uid)
.get()
.addOnSuccessListener { document ->
if (document.exists()) {
val email = if (isGoogleSignIn()) {
currentUser.email
} else {
document.getString("email") // Gunakan email dari Firestore
}
binding.etUbahEmail.setText(email)
}
}
}
binding.buttonSimpanUbahEmail.setOnClickListener {
val updatedEmail = if (isGoogleSignIn()) {
auth.currentUser?.email // Gunakan email dari Google
} else {
binding.etUbahEmail.text.toString() // Gunakan email dari formulir jika bukan Google SignIn
}
// Simpan perubahan ke Firestore
val user = auth.currentUser
if (user != null) {
val uid = user.uid
if (user.providerData.any { it.providerId == GoogleAuthProvider.PROVIDER_ID }) {
// Pengguna login menggunakan Google, buat data baru di Firestore
val userMap = hashMapOf(
"email" to user.email // Gunakan email dari Google
)
firestore.collection("users")
.document(uid)
.set(userMap as Map<String, Any>, SetOptions.merge())
.addOnSuccessListener {
Toast.makeText(this, "Data berhasil disimpan.", Toast.LENGTH_SHORT).show()
onBackPressed()
finish()
}
.addOnFailureListener { e ->
Toast.makeText(this, "Data gagal disimpan, silakan coba lagi.", Toast.LENGTH_SHORT).show()
}
} else {
val userMap = hashMapOf(
"email" to updatedEmail
)
firestore.collection("users")
.document(uid)
.update(userMap as Map<String, Any>)
.addOnSuccessListener {
Toast.makeText(this, "Data berhasil disimpan.", Toast.LENGTH_SHORT).show()
onBackPressed()
finish()
}
.addOnFailureListener { e ->
Toast.makeText(this, "Data gagal disimpan, silakan coba lagi.", Toast.LENGTH_SHORT).show()
}
}
}
}
}
private fun isGoogleSignIn(): Boolean {
val currentUser = auth.currentUser
return currentUser != null && currentUser.providerData.any { it.providerId == GoogleAuthProvider.PROVIDER_ID }
}
} |
Hospel/app/src/main/java/com/example/hospel/ProfilFragment.kt | 267524918 | package com.example.hospel
import android.app.Activity
import android.app.AlertDialog
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.provider.MediaStore
import android.util.Log
import androidx.fragment.app.Fragment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.example.hospel.databinding.FragmentProfilBinding
import com.google.android.gms.auth.api.signin.GoogleSignIn
import com.google.android.gms.auth.api.signin.GoogleSignInOptions
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.storage.FirebaseStorage
import com.google.firebase.storage.StorageReference
import com.squareup.picasso.Picasso
class ProfilFragment : Fragment() {
private lateinit var binding: FragmentProfilBinding
private var auth = FirebaseAuth.getInstance()
private val firestore = FirebaseFirestore.getInstance()
private val storage = FirebaseStorage.getInstance()
private val storageReference: StorageReference = storage.reference
override fun onCreateView(
inflater: LayoutInflater, container: ViewGroup?,
savedInstanceState: Bundle?
): View {
binding = FragmentProfilBinding.inflate(layoutInflater, container, false)
auth = FirebaseAuth.getInstance()
binding.gantiProfil.setOnClickListener {
selectImage()
}
val currentUser = auth.currentUser
if (currentUser != null) {
val uid = currentUser.uid
val userDocRef = firestore.collection("users").document(uid)
userDocRef.addSnapshotListener { document, error ->
if (error != null) {
return@addSnapshotListener
}
if (document != null && document.exists()) {
val displayName = document.getString("nama")
val email = document.getString("email")
val profileImageURL = document.getString("profile_image")
if (profileImageURL != null) {
Picasso.get()
.load(profileImageURL)
.into(binding.gambarProfilPengaturan)
}
binding.usernamePengaturan.text = displayName
binding.emailPengaturan.text = email
}
}
}
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.editProfil.setOnClickListener {
val intent = Intent(requireContext(), EditProfil::class.java)
startActivity(intent)
}
binding.tentangKami.setOnClickListener {
val intent = Intent(requireContext(), TentangKami::class.java)
startActivity(intent)
}
binding.dukungan.setOnClickListener {
val intent = Intent(requireContext(), Dukungan::class.java)
startActivity(intent)
}
binding.setting.setOnClickListener {
val intent = Intent(requireContext(), Akun::class.java)
startActivity(intent)
}
binding.exit.setOnClickListener {
showLogoutConfirmationDialog()
}
}
// Metode untuk memilih gambar dari penyimpanan perangkat
private fun selectImage() {
val intent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
intent.type = "image/*"
startActivityForResult(intent, 1)
}
// Metode untuk menangani hasil pemilihan gambar
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
if (requestCode == 1 && resultCode == Activity.RESULT_OK && data != null && data.data != null) {
val imageUri = data.data
// Upload gambar ke Firebase Storage
if (imageUri != null) {
uploadImage(imageUri)
}
}
}
// Metode untuk mengunggah gambar ke Firebase Storage
private fun uploadImage(imageUri: Uri) {
val currentUser = auth.currentUser
if (currentUser != null) {
val uid = currentUser.uid
// Hapus foto profil lama dari Firebase Storage
deleteOldProfileImage(uid)
// Upload gambar ke Firebase Storage
val profileImageRef = storageReference.child("profile_images/$uid.jpg")
profileImageRef.putFile(imageUri)
.addOnSuccessListener { taskSnapshot ->
profileImageRef.downloadUrl.addOnSuccessListener { uri ->
val imageUrl = uri.toString()
// Simpan URL gambar baru di Firestore
firestore.collection("users")
.document(uid)
.update("profile_image", imageUrl)
.addOnSuccessListener {
// Berhasil mengunggah dan menyimpan URL baru
}
.addOnFailureListener {
// Gagal menyimpan URL baru
}
}
}
.addOnFailureListener { exception ->
// Gagal mengunggah gambar baru
}
}
}
// Metode untuk menghapus foto profil lama dari Firebase Storage
private fun deleteOldProfileImage(uid: String) {
val oldProfileImageRef = storageReference.child("profile_images/$uid.jpg")
oldProfileImageRef.delete()
.addOnSuccessListener {
// Foto profil lama berhasil dihapus
Log.d("StorageDelete", "Foto profil lama berhasil dihapus")
}
.addOnFailureListener { exception ->
// Gagal menghapus foto profil lama
Log.e("StorageDelete", "Gagal menghapus foto profil lama: ${exception.message}")
}
}
private fun showLogoutConfirmationDialog() {
val builder = AlertDialog.Builder(requireContext())
builder.setTitle("Konfirmasi Keluar")
builder.setMessage("Apakah Anda ingin keluar dari aplikasi?")
builder.setPositiveButton("Ya") { _, _ ->
logoutUser()
}
builder.setNegativeButton("Tidak", null)
builder.show()
}
private fun logoutUser() {
if (auth.currentUser != null) {
// Sign out from Firebase
auth.signOut()
// Sign out from Google
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN).build()
val googleSignInClient = GoogleSignIn.getClient(requireContext(), gso)
googleSignInClient.signOut()
// Redirect to Login activity
val intent = Intent(requireContext(), Login::class.java)
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK
startActivity(intent)
requireActivity().finish()
}
}
} |
Hospel/app/src/main/java/com/example/hospel/SyaratDanKetentuanActivity.kt | 2576249205 | package com.example.hospel
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Button
import android.widget.ImageView
class SyaratDanKetentuanActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.syarat_dan_ketentuan)
val back = findViewById<ImageView>(R.id.back_sdk)
back.setOnClickListener {
val intent = Intent(this@SyaratDanKetentuanActivity, Daftar::class.java)
startActivity(intent)
}
val buttonSyarat = findViewById<Button>(R.id.button_syarat)
buttonSyarat.setOnClickListener {
val intent = Intent(this@SyaratDanKetentuanActivity, Daftar::class.java)
intent.putExtra("CHECKBOX_STATUS", true)
startActivity(intent)
}
}
} |
Hospel/app/src/main/java/com/example/hospel/Login.kt | 1000283253 | package com.example.hospel
import android.app.Activity
import android.content.Intent
import android.os.Bundle
import android.text.TextUtils
import android.util.Log
import android.util.Patterns
import android.view.View
import android.widget.ProgressBar
import android.widget.Toast
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AppCompatActivity
import com.example.hospel.databinding.ActivityLoginBinding
import com.google.android.gms.auth.api.signin.GoogleSignIn
import com.google.android.gms.auth.api.signin.GoogleSignInAccount
import com.google.android.gms.auth.api.signin.GoogleSignInClient
import com.google.android.gms.auth.api.signin.GoogleSignInOptions
import com.google.android.gms.tasks.Task
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.auth.GoogleAuthProvider
import com.google.firebase.auth.ktx.auth
import com.google.firebase.ktx.Firebase
class Login : AppCompatActivity() {
private lateinit var binding: ActivityLoginBinding
private lateinit var auth: FirebaseAuth
private lateinit var googleSignInClient: GoogleSignInClient
private var loadingProgressBar: ProgressBar? = null
override fun onCreate(savedInstanceState: Bundle?) {
Log.d("LoginActivity", "onCreate called")
super.onCreate(savedInstanceState)
binding = ActivityLoginBinding.inflate(layoutInflater)
setContentView(binding.root)
loadingProgressBar = findViewById(R.id.loadingProgressBar)
auth = Firebase.auth
binding.emailLogin.background = null
binding.passwordLogin.background = null
binding.daftarLogin.setOnClickListener {
val intent = Intent(this@Login, Daftar::class.java)
startActivity(intent)
}
if (auth.currentUser != null) {
startActivity(Intent(this, MainActivity::class.java))
finish()
}
if (auth.currentUser != null) {
startActivity(Intent(this, MainActivity::class.java))
finish()
} else {
val webClientId = getString(R.string.default_web_client_id)
if (webClientId.isNotEmpty()) {
val gso = GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestIdToken(webClientId)
.requestEmail()
.build()
googleSignInClient = GoogleSignIn.getClient(this, gso)
} else {
Toast.makeText(this, "Web client ID is empty or null", Toast.LENGTH_SHORT).show()
loadingProgressBar?.visibility = View.VISIBLE
}
binding.buttonLogin.setOnClickListener {
signInUser()
}
binding.loginGoogle.setOnClickListener {
signInWithGoogle()
}
}
}
override fun onResume() {
super.onResume()
if (auth.currentUser != null && !isTaskRoot) {
startActivity(Intent(this, MainActivity::class.java))
finish()
}
}
private var loginAttempts = 0
private fun signInUser() {
val email = binding.emailLogin.text.toString()
val password = binding.passwordLogin.text.toString()
clearErrors()
if (validateForm(email, password)) {
auth.signInWithEmailAndPassword(email, password)
.addOnCompleteListener { task ->
if (task.isSuccessful) {
loginAttempts = 0
startActivity(Intent(this, MainActivity::class.java))
intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK
finish()
} else {
loginAttempts++
if (loginAttempts >= 6) {
Toast.makeText(
this,
"Percobaan login gagal terlalu banyak. Akun diblokir.",
Toast.LENGTH_SHORT
).show()
loadingProgressBar?.visibility = View.VISIBLE
} else {
Toast.makeText(this, "Login gagal. Silakan coba lagi.", Toast.LENGTH_SHORT)
.show()
loadingProgressBar?.visibility = View.VISIBLE
}
}
}
}
}
private fun signInWithGoogle() {
val signInIntent = googleSignInClient.signInIntent
launcher.launch(signInIntent)
}
private val launcher =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
if (result.resultCode == Activity.RESULT_OK) {
val task = GoogleSignIn.getSignedInAccountFromIntent(result.data)
handleResult(task)
}
}
private fun handleResult(task: Task<GoogleSignInAccount>) {
if (task.isSuccessful) {
val account: GoogleSignInAccount? = task.result
account?.let {
Log.d("GoogleSignIn", "Google Sign-In Successful. Account: ${it.displayName}")
updateUI(it)
loadingProgressBar?.visibility = View.VISIBLE
}
} else {
Log.e("GoogleSignIn", "Google Sign-In Failed", task.exception)
Toast.makeText(this, "Login gagal, silakan coba lagi", Toast.LENGTH_SHORT).show()
loadingProgressBar?.visibility = View.VISIBLE
}
}
private fun updateUI(account: GoogleSignInAccount) {
val credential = GoogleAuthProvider.getCredential(account.idToken, null)
auth.signInWithCredential(credential).addOnCompleteListener {
if (it.isSuccessful) {
Log.d("GoogleSignIn", "Firebase Sign-In Successful")
startActivity(Intent(this, MainActivity::class.java))
finish()
loadingProgressBar?.visibility = View.VISIBLE
} else {
Log.e("GoogleSignIn", "Firebase Sign-In Failed", it.exception)
Toast.makeText(this, "Login Gagal!", Toast.LENGTH_SHORT).show()
loadingProgressBar?.visibility = View.VISIBLE
}
}
}
private fun validateForm(email: String, password: String): Boolean {
var isValid = true
if (TextUtils.isEmpty(email) || !Patterns.EMAIL_ADDRESS.matcher(email).matches()) {
binding.pkEmailLogin.visibility = View.VISIBLE
isValid = false
} else {
binding.pkEmailLogin.visibility = View.INVISIBLE
}
if (TextUtils.isEmpty(password) || password.length < 8) {
binding.pkPasswordLogin.visibility = View.VISIBLE
isValid = false
} else {
binding.pkPasswordLogin.visibility = View.INVISIBLE
}
return isValid
}
private fun clearErrors() {
binding.pkEmailLogin.visibility = View.INVISIBLE
binding.pkPasswordLogin.visibility = View.INVISIBLE
}
}
|
Hospel/app/src/main/java/com/example/hospel/BookingKamar.kt | 2760926316 | package com.example.hospel
import android.content.Intent
import android.os.Bundle
import android.widget.TextView
import android.widget.Toast
import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import com.example.hospel.databinding.ActivityBookingKamarBinding
import com.google.firebase.firestore.FirebaseFirestore
class BookingKamar : AppCompatActivity() {
private lateinit var binding: ActivityBookingKamarBinding
private val firestore = FirebaseFirestore.getInstance()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityBookingKamarBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.backBookingKamar.setOnClickListener {
onBackPressed()
}
binding.btnBookingKamar.setOnClickListener {
val documentId = intent.getStringExtra("documentId")
if (documentId != null) {
load(documentId)
}
}
val documentId = intent.getStringExtra("documentId")
if (documentId != null) {
loadNomorKamar(documentId)
}
}
private fun loadNomorKamar(documentId: String) {
firestore.collection("kamar_hotel")
.document(documentId)
.collection("nomer_kamar")
.addSnapshotListener { snapshot, error ->
if (error != null) {
Toast.makeText(this, "Terjadi kesalahan saat memuat nomor kamar", Toast.LENGTH_SHORT).show()
return@addSnapshotListener
}
if (snapshot != null && !snapshot.isEmpty) {
for (document in snapshot.documents) {
val statusKamar1 = document.getString("status_kamar1") ?: ""
val statusKamar2 = document.getString("status_kamar2") ?: ""
val statusKamar3 = document.getString("status_kamar3") ?: ""
val statusKamar4 = document.getString("status_kamar4") ?: ""
val statusKamar5 = document.getString("status_kamar5") ?: ""
val statusKamar6 = document.getString("status_kamar6") ?: ""
val statusKamar7 = document.getString("status_kamar7") ?: ""
val statusKamar8 = document.getString("status_kamar8") ?: ""
val statusKamar9 = document.getString("status_kamar9") ?: ""
val statusKamar10 = document.getString("status_kamar10") ?: ""
setBackgroundCompat(binding.btnNo1, statusKamar1)
setBackgroundCompat(binding.btnNo2, statusKamar2)
setBackgroundCompat(binding.btnNo3, statusKamar3)
setBackgroundCompat(binding.btnNo4, statusKamar4)
setBackgroundCompat(binding.btnNo5, statusKamar5)
setBackgroundCompat(binding.btnNo6, statusKamar6)
setBackgroundCompat(binding.btnNo7, statusKamar7)
setBackgroundCompat(binding.btnNo8, statusKamar8)
setBackgroundCompat(binding.btnNo9, statusKamar9)
setBackgroundCompat(binding.btnNo10, statusKamar10)
}
}
}
}
private fun setBackgroundCompat(textView: TextView, status: String) {
val colorResource = when (status) {
"Kosong" -> R.color.bg_rounded_green
"Penuh" -> R.color.bg_rounded_red
else -> {
R.color.bg_rounded_white // Default color for unexpected status
}
}
val color = ContextCompat.getColor(this, colorResource)
textView.setBackgroundColor(color)
}
private fun load(documentId: String) {
val intent = Intent(this@BookingKamar, Reservasi::class.java)
intent.putExtra("documentId", documentId)
startActivity(intent)
}
}
|
Hospel/app/src/main/java/com/example/hospel/InformasiHotel.kt | 3031837319 | package com.example.hospel
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.example.hospel.databinding.ActivityInformasiHotelBinding
class InformasiHotel : AppCompatActivity() {
private lateinit var binding : ActivityInformasiHotelBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityInformasiHotelBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.backInformasiHotel.setOnClickListener {
onBackPressed()
}
}
} |
Hospel/app/src/main/java/com/example/hospel/Dukungan.kt | 1038547112 | package com.example.hospel
import android.content.Intent
import android.net.Uri
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import com.example.hospel.databinding.ActivityDukunganBinding
class Dukungan : AppCompatActivity() {
private lateinit var binding: ActivityDukunganBinding
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityDukunganBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.backDukungan.setOnClickListener {
onBackPressed()
}
binding.buttonDukungan.setOnClickListener {
val url = "https://docs.google.com/forms/d/e/1FAIpQLSfTrclf5wxcU9EbAtAswVp_VFPyiYwP6K1W3NCQcMpK13eIVg/viewform?vc=0&c=0&w=1&flr=0"
val intent = Intent(Intent.ACTION_VIEW)
intent.data = Uri.parse(url)
startActivity(intent)
}
}
} |
Hospel/app/src/main/java/com/example/hospel/UbahPassword.kt | 860761243 | package com.example.hospel
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.Toast
import com.example.hospel.databinding.ActivityUbahPasswordBinding
import com.google.firebase.auth.EmailAuthProvider
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.auth.FirebaseUser
class UbahPassword : AppCompatActivity() {
private lateinit var binding: ActivityUbahPasswordBinding
private val auth = FirebaseAuth.getInstance()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityUbahPasswordBinding.inflate(layoutInflater)
setContentView(binding.root)
binding.backUbahPassword.setOnClickListener {
onBackPressed()
}
binding.buttonSimpanUbahPassword.setOnClickListener {
ubahPassword()
}
}
private fun ubahPassword() {
val passwordSaatIni = binding.etPasswordSaatIni.text.toString()
val passwordBaru = binding.etPasswordBaru.text.toString()
val konfirmasiPasswordBaru = binding.etKonfirmasiPasswordBaru.text.toString()
val user: FirebaseUser? = auth.currentUser
if (user != null && user.email != null) {
// Memeriksa apakah password saat ini sesuai
val credential = EmailAuthProvider.getCredential(user.email!!, passwordSaatIni)
user.reauthenticate(credential)
.addOnSuccessListener {
// Password saat ini sesuai, lanjutkan dengan memeriksa kondisi lainnya
if (passwordBaru == passwordSaatIni) {
// Password baru tidak boleh sama dengan password saat ini
Toast.makeText(this, "Password baru tidak boleh sama dengan password saat ini", Toast.LENGTH_SHORT).show()
} else if (passwordBaru != konfirmasiPasswordBaru) {
// Konfirmasi password harus sama dengan password baru
Toast.makeText(this, "Konfirmasi password harus sama dengan password baru", Toast.LENGTH_SHORT).show()
} else {
// Lakukan perubahan password
user.updatePassword(passwordBaru)
.addOnSuccessListener {
Toast.makeText(this, "Password berhasil diubah", Toast.LENGTH_SHORT).show()
onBackPressed()
}
.addOnFailureListener { e ->
Toast.makeText(this, "Gagal mengubah password: ${e.message}", Toast.LENGTH_SHORT).show()
}
}
}
.addOnFailureListener { e ->
// Password saat ini tidak sesuai
Toast.makeText(this, "Password saat ini salah", Toast.LENGTH_SHORT).show()
}
}
}
} |
Hospel/app/src/main/java/com/example/hospel/AdapterListPesan.kt | 2455620154 | package com.example.hospel
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView
import com.google.firebase.auth.FirebaseAuth
class AdapterListPesan (val context: Context, val homeList: ArrayList<DataListPesan?>): RecyclerView.Adapter<AdapterListPesan.MyViewHolder>() {
private val auth = FirebaseAuth.getInstance()
class MyViewHolder(view: View) : RecyclerView.ViewHolder(view) {
val nama_nota = view.findViewById<TextView>(R.id.nama_nota)
val email_nota = view.findViewById<TextView>(R.id.email_nota)
val alamat_nota = view.findViewById<TextView>(R.id.alamat_nota)
val nomor_nota = view.findViewById<TextView>(R.id.nomor_nota)
val kelas_nota = view.findViewById<TextView>(R.id.kelas_nota)
val kamar_nota = view.findViewById<TextView>(R.id.kamar_nota)
val jumlah_hari_nota = view.findViewById<TextView>(R.id.jumlah_hari_nota)
val total_nota = view.findViewById<TextView>(R.id.total_nota)
val status_nota = view.findViewById<TextView>(R.id.status_nota)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): MyViewHolder {
val view = LayoutInflater.from(context).inflate(R.layout.fetch_list_pesan, parent, false)
return AdapterListPesan.MyViewHolder(view)
}
override fun onBindViewHolder(holder: MyViewHolder, position: Int) {
val currentItem = homeList[position]
val userId = auth.currentUser?.uid
if (userId != null) {
holder.nama_nota.text = currentItem?.nama_nota
holder.email_nota.text = currentItem?.email_nota
holder.alamat_nota.text = currentItem?.alamat_nota
holder.nomor_nota.text = currentItem?.nomor_nota
holder.kelas_nota.text = currentItem?.kelas_nota
holder.kamar_nota.text = currentItem?.kamar_nota
holder.jumlah_hari_nota.text = currentItem?.jumlah_hari_nota
holder.total_nota.text = currentItem?.total_nota
holder.status_nota.text = currentItem?.status_nota
// Set warna teks berdasarkan status
when (currentItem?.status_nota) {
"Sudah dibayar" -> holder.status_nota.setTextColor(ContextCompat.getColor(context, R.color.green)) // Sesuaikan dengan ID warna hijau
"Menunggu pembayaran" -> holder.status_nota.setTextColor(ContextCompat.getColor(context, R.color.red)) // Sesuaikan dengan ID warna merah
}
}
}
override fun getItemCount(): Int {
return homeList.size
}
} |
Hospel/app/src/main/java/com/example/hospel/Reservasi.kt | 920612144 | package com.example.hospel
import android.content.Intent
import android.os.Bundle
import android.widget.Toast
import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity
import com.example.hospel.databinding.ActivityReservasiBinding
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.firestore.FirebaseFirestore
import com.google.firebase.firestore.SetOptions
class Reservasi : AppCompatActivity() {
private lateinit var binding: ActivityReservasiBinding
private val firestore = FirebaseFirestore.getInstance()
private val auth = FirebaseAuth.getInstance()
private var total: String = ""
private var kelasKamar: String = ""
private var isProcessing = false // Variable untuk memastikan tidak ada proses ganda
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityReservasiBinding.inflate(layoutInflater)
setContentView(binding.root)
val currentUser = auth.currentUser
if (currentUser != null) {
val uid = currentUser.uid
firestore.collection("users")
.document(uid)
.get()
.addOnSuccessListener { document ->
if (document.exists()) {
val fullname = document.getString("nama")
val email = document.getString("email")
val nomor = document.getString("nomor")
val alamat = document.getString("alamat")
// Isi formulir dengan data saat ini
binding.namaReservasi.setText(fullname)
binding.emailReservasi.setText(email)
binding.etNomorReservasi.setText(nomor)
binding.etAlamatReservasi.setText(alamat)
}
}
}
binding.btnSimpanReservasi.setOnClickListener {
if (isProcessing) {
// Jika sedang dalam proses, keluar dari fungsi
return@setOnClickListener
}
// Menampilkan kotak dialog konfirmasi
showConfirmationDialog()
}
}
private fun showConfirmationDialog() {
val builder = AlertDialog.Builder(this)
val title =
"Transfer ke BCA no rek : 1234567890 Atas Nama : Aditya Yuda Pamungkas. Transfer sesuai total yang harus dibayarkan yang tampil di menu Pesan"
val message = "Apakah anda ingin melanjutkan pembayaran?"
builder.setTitle("Perhatian")
builder.setMessage("$title\n\n$message")
builder.setPositiveButton("Lanjutkan") { dialog, which ->
// Eksekusi prosesnya
executeReservationProcess()
executeReservationProcess2()
}
builder.setNegativeButton("Tidak") { dialog, which ->
// Tindakan jika memilih "Tidak"
// Di sini Anda dapat menambahkan tindakan yang sesuai, jika diperlukan
Toast.makeText(this, "Pemesanan dibatalkan", Toast.LENGTH_SHORT).show()
}
builder.show()
}
private fun executeReservationProcess() {
// Mengunci proses
isProcessing = true
val jumlahHari = binding.teksJumlahHari.text.toString()
val nomorKamar = binding.etNomorKamarReservasi.text.toString()
// Memastikan tidak ada nilai yang kosong
if (jumlahHari.isEmpty() || nomorKamar.isEmpty()) {
Toast.makeText(this, "Harap isi semua kolom!", Toast.LENGTH_SHORT).show()
// Membuka kunci setelah proses selesai
isProcessing = false
return
}
// Simpan perubahan ke Firestore
val user = auth.currentUser
if (user != null) {
val uid = user.uid
val userMap = hashMapOf(
"jumlah_hari" to jumlahHari,
"kamar_hotel" to nomorKamar,
"status" to "Menunggu pembayaran"
)
// Update data in the "users" collection
firestore.collection("users")
.document(uid)
.set(userMap as Map<String, Any>, SetOptions.merge())
.addOnSuccessListener {
// Continue to save data to the "nota" subcollection
firestore.collection("users")
.document(uid)
.collection("nota")
.add(userMap)
.addOnSuccessListener {
// Jika sukses, pindah ke MainActivity
val intent = Intent(this, MainActivity::class.java)
startActivity(intent)
Toast.makeText(
this,
"Pemesanan berhasil! Lakukan pembayaran, dan mohon tunggu sedang diverifikasi oleh admin",
Toast.LENGTH_SHORT
).show()
finish()
}
.addOnFailureListener { e ->
Toast.makeText(this, "Pemesanan gagal!", Toast.LENGTH_SHORT).show()
}
.addOnCompleteListener {
// Membuka kunci setelah proses selesai
isProcessing = false
}
}
.addOnFailureListener { e ->
Toast.makeText(this, "Pemesanan gagal!", Toast.LENGTH_SHORT).show()
// Membuka kunci setelah proses selesai (termasuk jika ada kegagalan)
isProcessing = false
}
}
}
private fun executeReservationProcess2() {
// Mengunci proses
isProcessing = true
val documentId = intent.getStringExtra("documentId")
if (documentId != null) {
loadKamar(documentId)
}
// Ambil nilai dari binding dan simpan di dalam variabel
total = binding.total.text.toString()
kelasKamar = binding.kelasKamar.text.toString()
// Simpan perubahan ke Firestore
val user = auth.currentUser
if (user != null) {
val uid = user.uid
val userMap = hashMapOf(
"kelas_hotel" to total,
"total" to kelasKamar
)
// Update data in the "users" collection
firestore.collection("users")
.document(uid)
.set(userMap as Map<String, Any>, SetOptions.merge())
.addOnSuccessListener {
// Continue to save data to the "nota" subcollection
firestore.collection("users")
.document(uid)
.collection("nota")
.add(userMap)
.addOnSuccessListener {
// Jika sukses, pindah ke MainActivity
val intent = Intent(this, MainActivity::class.java)
startActivity(intent)
Toast.makeText(
this,
"Pemesanan berhasil! Lakukan pembayaran, dan mohon tunggu sedang diverifikasi oleh admin",
Toast.LENGTH_SHORT
).show()
finish()
}
.addOnFailureListener { e ->
Toast.makeText(this, "Pemesanan gagal!", Toast.LENGTH_SHORT).show()
}
.addOnCompleteListener {
// Membuka kunci setelah proses selesai
isProcessing = false
}
}
.addOnFailureListener { e ->
Toast.makeText(this, "Pemesanan gagal!", Toast.LENGTH_SHORT).show()
// Membuka kunci setelah proses selesai (termasuk jika ada kegagalan)
isProcessing = false
}
}
}
private fun loadKamar(documentId: String) {
firestore.collection("kamar_hotel")
.document(documentId)
.addSnapshotListener { snapshot, error ->
if (error != null) {
Toast.makeText(
this,
"Terjadi kesalahan saat memuat nomor kamar",
Toast.LENGTH_SHORT
).show()
return@addSnapshotListener
}
if (snapshot != null && snapshot.exists()) {
total = snapshot.getString("harga_kamar") ?: ""
kelasKamar = snapshot.getString("nama_kamar") ?: ""
binding.total.setText(total)
binding.kelasKamar.setText(kelasKamar)
}
}
}
}
|
Hospel/app/src/main/java/com/example/hospel/SplashScreen.kt | 202410141 | package com.example.hospel
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.os.Handler
class SplashScreen : AppCompatActivity() {
private val splashTimeOut : Long = 2000
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_splash_screen)
Handler().postDelayed({
startActivity(Intent(this, Login::class.java))
finish()
}, splashTimeOut)
}
} |
Hospel/app/src/main/java/com/example/hospel/KelasHotel.kt | 1898794359 | package com.example.hospel
import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.view.View
import android.widget.ProgressBar
import com.example.hospel.databinding.ActivityKelasHotelBinding
import com.google.firebase.auth.FirebaseAuth
import com.google.firebase.firestore.FirebaseFirestore
import com.squareup.picasso.Picasso
class KelasHotel : AppCompatActivity() {
private lateinit var binding: ActivityKelasHotelBinding
private var auth = FirebaseAuth.getInstance()
private var loadingProgressBar: ProgressBar? = null
private val firestore = FirebaseFirestore.getInstance()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
binding = ActivityKelasHotelBinding.inflate(layoutInflater)
loadingProgressBar = findViewById(R.id.loadingProgressBar)
auth = FirebaseAuth.getInstance()
setContentView(binding.root)
binding.backKelasHotel.setOnClickListener {
onBackPressed()
}
binding.kelasEkonomi.setOnClickListener {
loadDetailKamar("LSdCMTBu4paaSG7iM1kd")
}
binding.kelasMenengah.setOnClickListener {
loadDetailKamar("s8aHBMm2duKrtxWTcSBo")
}
binding.kelasPremium.setOnClickListener {
loadDetailKamar("3y4YsQAaSS1YARn94Ugp")
}
binding.kelasEksklusif.setOnClickListener {
loadDetailKamar("jTev6AGwKLzTmS8cZ6uj")
}
firestore.collection("kamar_hotel")
.document("LSdCMTBu4paaSG7iM1kd") // Ganti dengan ID dokumen yang sesuai
.addSnapshotListener { dokumen, error ->
if (error != null) {
return@addSnapshotListener
}
if (dokumen != null && dokumen.exists()) {
val namaHotel = dokumen.getString("nama_kamar")
val hargaHotel = dokumen.getString("harga_kamar")
val gambarHotel = dokumen.getString("hotel_image")
binding.teksKelasEkonomi.text = namaHotel
binding.hargaEkonomi.text = hargaHotel
// Gunakan Picasso atau library pemuatan gambar lainnya untuk memuat gambar ke dalam ImageView
if (gambarHotel != null && gambarHotel.isNotEmpty()) {
Picasso.get().load(gambarHotel).into(binding.gambarEkonomi)
}
loadingProgressBar?.visibility = View.VISIBLE
}
}
firestore.collection("kamar_hotel")
.document("s8aHBMm2duKrtxWTcSBo") // Ganti dengan ID dokumen yang sesuai
.addSnapshotListener { dokumen, error ->
if (error != null) {
return@addSnapshotListener
}
if (dokumen != null && dokumen.exists()) {
val namaHotel = dokumen.getString("nama_kamar")
val hargaHotel = dokumen.getString("harga_kamar")
val gambarHotel = dokumen.getString("hotel_image")
binding.teksKelasMenengah.text = namaHotel
binding.hargaMenengah.text = hargaHotel
// Gunakan Picasso atau library pemuatan gambar lainnya untuk memuat gambar ke dalam ImageView
if (gambarHotel != null && gambarHotel.isNotEmpty()) {
Picasso.get().load(gambarHotel).into(binding.gambarMenengah)
}
loadingProgressBar?.visibility = View.VISIBLE
}
}
firestore.collection("kamar_hotel")
.document("3y4YsQAaSS1YARn94Ugp") // Ganti dengan ID dokumen yang sesuai
.addSnapshotListener { dokumen, error ->
if (error != null) {
return@addSnapshotListener
}
if (dokumen != null && dokumen.exists()) {
val namaHotel = dokumen.getString("nama_kamar")
val hargaHotel = dokumen.getString("harga_kamar")
val gambarHotel = dokumen.getString("hotel_image")
binding.teksKelasPremium.text = namaHotel
binding.hargaPremium.text = hargaHotel
// Gunakan Picasso atau library pemuatan gambar lainnya untuk memuat gambar ke dalam ImageView
if (gambarHotel != null && gambarHotel.isNotEmpty()) {
Picasso.get().load(gambarHotel).into(binding.gambarPremium)
loadingProgressBar?.visibility = View.VISIBLE
}
}
}
firestore.collection("kamar_hotel")
.document("jTev6AGwKLzTmS8cZ6uj") // Ganti dengan ID dokumen yang sesuai
.addSnapshotListener { dokumen, error ->
if (error != null) {
return@addSnapshotListener
}
if (dokumen != null && dokumen.exists()) {
val namaHotel = dokumen.getString("nama_kamar")
val hargaHotel = dokumen.getString("harga_kamar")
val gambarHotel = dokumen.getString("hotel_image")
binding.teksKelasEksklusif.text = namaHotel
binding.hargaEksklusif.text = hargaHotel
// Gunakan Picasso atau library pemuatan gambar lainnya untuk memuat gambar ke dalam ImageView
if (gambarHotel != null && gambarHotel.isNotEmpty()) {
Picasso.get().load(gambarHotel).into(binding.gambarEksklusif)
loadingProgressBar?.visibility = View.VISIBLE
}
}
}
}
private fun loadDetailKamar(documentId: String) {
val intent = Intent(this@KelasHotel, DetailKamarEkonomi::class.java)
intent.putExtra("documentId", documentId)
startActivity(intent)
}
} |
Hospel/app/src/main/java/com/example/hospel/DataListPesan.kt | 3060571669 | package com.example.hospel
data class DataListPesan(
val nama_nota: String,
val email_nota: String,
val alamat_nota: String,
var nomor_nota: String?,
var kelas_nota: String?,
var kamar_nota: String?,
var jumlah_hari_nota: String?,
var total_nota: String?,
var status_nota: String?
)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.