Added click events to room database for:
LiveTv, Home1Fragment, Home2Fragment, SideMenu, bottom_navigation bar, ExploreWokaActivity, MoreActivity, MyListFragment (For every module) Profile Edit activity : Updating gender with api. Guest, Parent and child check to show NoSignInDialog at : SupportActivity, cart opening, ProductFragment (Add to cart button) OrderActivity: Created all views, adapters and integrated orders api (mvvm) Integrated api for order tracking and cached.
This commit is contained in:
@@ -26,7 +26,7 @@ class AudioBookViewModel: ViewModel() {
|
||||
val audioContinueLiveData: LiveData<ApiResult<List<ContinueAudioData>>>
|
||||
get() = _audioContinueLiveData
|
||||
|
||||
fun loadKaraokeSongs() {
|
||||
fun loadAudioSongs() {
|
||||
viewModelScope.launch {
|
||||
_audioBookData.postValue(ApiResult.Loading())
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ class AudioBooksActivity : WokaBaseActivity() {
|
||||
setObservers()
|
||||
|
||||
if (!viewModel.audioBookLiveData.isInitialized){
|
||||
viewModel.loadKaraokeSongs()
|
||||
viewModel.loadAudioSongs()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,11 +138,11 @@ class AudioBooksActivity : WokaBaseActivity() {
|
||||
}
|
||||
|
||||
retryBtn.setOnClickListener {
|
||||
viewModel.loadKaraokeSongs()
|
||||
viewModel.loadAudioSongs()
|
||||
}
|
||||
|
||||
loadMoreBtn.setOnClickListener {
|
||||
viewModel.loadKaraokeSongs()
|
||||
viewModel.loadAudioSongs()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,9 +10,14 @@ import kotlinx.coroutines.launch
|
||||
object ClicksHelper {
|
||||
private val clicksDao: ClicksDao? = appDatabase?.clicksDao()
|
||||
|
||||
fun upsertClickEvent(contentType: ContentType, postId: Int = 0, categoryId: Int = 0){
|
||||
fun upsertClickEvent(contentType: ContentType, postId: Int? = 0, categoryId: String? = null){
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
clicksDao?.upsertClickEvent(contentType, postId, categoryId)
|
||||
val categoryInt = try {
|
||||
categoryId?.toIntOrNull()?:0
|
||||
}catch (e: Exception){
|
||||
0
|
||||
}
|
||||
clicksDao?.upsertClickEvent(contentType, postId?:0, categoryInt)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,6 +20,8 @@ import com.bumptech.glide.Glide
|
||||
import com.woka.R
|
||||
import com.woka.WokaApp.Companion.userPrefs
|
||||
import com.woka.audiobooks.views.AudioBooksActivity
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.databinding.FragmentHome1Binding
|
||||
import com.woka.home.models.TimePeriod
|
||||
import com.woka.home.viewmodels.HomeViewModel
|
||||
@@ -56,6 +58,8 @@ class Home1Fragment : Fragment() {
|
||||
|
||||
private lateinit var progressView: ProgressView
|
||||
|
||||
private val clickHelper = ClicksHelper
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
@@ -213,36 +217,48 @@ class Home1Fragment : Fragment() {
|
||||
Intent(it, MoreHomeActivity::class.java),
|
||||
ActivityOptions.makeSceneTransitionAnimation(it).toBundle()
|
||||
)
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
webSeries.setOnClickListener {
|
||||
activity?.let {
|
||||
startActivity(Intent(it, WebSeriesActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
audioBooks.setOnClickListener {
|
||||
activity?.let {
|
||||
startActivity(Intent(it, AudioBooksActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
play.setOnClickListener {
|
||||
activity?.let {
|
||||
startActivity(Intent(it, GamesActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
karaoke.setOnClickListener {
|
||||
activity?.let {
|
||||
startActivity(Intent(it, KaraokeActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
shop.setOnClickListener {
|
||||
activity?.let {
|
||||
startActivity(Intent(it, ShopActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@ import com.jwplayer.pub.api.media.playlists.PlaylistItem
|
||||
import com.woka.R
|
||||
import com.woka.WokaApp
|
||||
import com.woka.audiobooks.views.AudioBooksActivity
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.databinding.FragmentHome2Binding
|
||||
import com.woka.home.viewmodels.HomeViewModel
|
||||
import com.woka.home.views.FMActivity
|
||||
@@ -37,6 +39,8 @@ class Home2Fragment : Fragment() {
|
||||
|
||||
private lateinit var progressView: ProgressView
|
||||
|
||||
private val clickHelper = ClicksHelper
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
@@ -97,24 +101,32 @@ class Home2Fragment : Fragment() {
|
||||
webSeries.setOnClickListener {
|
||||
activity?.let {
|
||||
startActivity(Intent(it, WebSeriesActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
audioBooks.setOnClickListener {
|
||||
activity?.let {
|
||||
startActivity(Intent(it, AudioBooksActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
playGames.setOnClickListener {
|
||||
activity?.let {
|
||||
startActivity(Intent(it, GamesActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
karaoke.setOnClickListener {
|
||||
activity?.let {
|
||||
startActivity(Intent(it, KaraokeActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,6 +150,8 @@ class Home2Fragment : Fragment() {
|
||||
)
|
||||
putExtra(PlayerActivity.EXTRA_PLAY_INDEX, 0)
|
||||
})
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.TEASER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,6 +25,8 @@ import com.woka.R
|
||||
import com.woka.WokaApp.Companion.userPrefs
|
||||
import com.woka.audiobooks.AudioBookRepository
|
||||
import com.woka.audiobooks.models.audiodata.AudioBookData
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.databinding.DialogModuleShowerBinding
|
||||
import com.woka.databinding.FragmentMyListBinding
|
||||
import com.woka.home.mylist.MyListRepository
|
||||
@@ -40,6 +42,8 @@ import com.woka.home.mylist.models.PostType
|
||||
import com.woka.home.viewmodels.HomeViewModel
|
||||
import com.woka.karaoke.KaraokeRepository
|
||||
import com.woka.karaoke.models.listing.KaraokeData
|
||||
import com.woka.karaoke.player.KaraokePlayerActivity
|
||||
import com.woka.karaoke.player.KaraokePlayerData
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.onboard.views.OnboardActivity
|
||||
import com.woka.players.models.VideoPlayList
|
||||
@@ -79,6 +83,8 @@ class MyListFragment : Fragment() {
|
||||
private lateinit var dialogBinding: DialogModuleShowerBinding
|
||||
private lateinit var moduleShowerDialog: Dialog
|
||||
|
||||
private val clickHelper = ClicksHelper
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
@@ -154,6 +160,8 @@ class MyListFragment : Fragment() {
|
||||
context?.startActivity(Intent(context, OnboardActivity::class.java).apply {
|
||||
putExtra(OnboardActivity.ONBOARD_ACTIVITY_INTENT, OnboardActivity.LOG_IN_INTENT)
|
||||
})
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -331,7 +339,11 @@ class MyListFragment : Fragment() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
dialogBinding.close.setOnClickListener { moduleShowerDialog.dismiss() }
|
||||
dialogBinding.close.setOnClickListener {
|
||||
moduleShowerDialog.dismiss()
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
private fun onListGotEmpty(postType: PostType, isEng: Boolean = true){
|
||||
@@ -365,6 +377,8 @@ class MyListFragment : Fragment() {
|
||||
putExtra(EXTRA_SHOW_DATA, ShowData(showData))
|
||||
putExtra(EXTRA_SHOW_CATEGORY, categoryId)
|
||||
})
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.SERIES, showData.id, categoryId)
|
||||
}
|
||||
|
||||
private fun onWebShowItemChanged(showId: Int){
|
||||
@@ -490,6 +504,8 @@ class MyListFragment : Fragment() {
|
||||
moduleShowerDialog.show()
|
||||
}
|
||||
}
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.AUDIO, audioBookData.id)
|
||||
}
|
||||
|
||||
private fun onAudioItemChanged(id: Int) {
|
||||
@@ -540,6 +556,8 @@ class MyListFragment : Fragment() {
|
||||
)
|
||||
putExtra(PlayerActivity.EXTRA_PLAY_INDEX, 0)
|
||||
})
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.AUDIO, audioBookData.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -613,6 +631,8 @@ class MyListFragment : Fragment() {
|
||||
startActivity(Intent(activity, GamePlayerActivity::class.java).apply {
|
||||
putExtra(GamePlayerActivity.EXTRA_GAME_PLAYER_DATA, GamePlayerData(it, gameData.screen_orientation == "Landscape"))
|
||||
})
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.GAME, gameData.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -661,6 +681,8 @@ class MyListFragment : Fragment() {
|
||||
moduleShowerDialog.show()
|
||||
}
|
||||
}
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.GAME, gameData.id)
|
||||
}
|
||||
|
||||
private fun onGameChanged(id: Int) {
|
||||
@@ -736,7 +758,14 @@ class MyListFragment : Fragment() {
|
||||
watchCard.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_mic, 0, 0, 0)
|
||||
watchCard.text = getString(R.string.sing_now)
|
||||
watchCard.setOnClickListener {
|
||||
|
||||
activity?.let {activity ->
|
||||
karaokeData.video_url?.let {
|
||||
startActivity(Intent(activity, KaraokePlayerActivity::class.java).apply {
|
||||
putExtra(KaraokePlayerActivity.EXTRA_KARAOKE_DATA, KaraokePlayerData(it, karaokeData.title))
|
||||
})
|
||||
}
|
||||
}
|
||||
clickHelper.upsertClickEvent(ContentType.KARAOKE_VIDEO, karaokeData.id)
|
||||
}
|
||||
|
||||
like.setOnClickListener {
|
||||
@@ -783,6 +812,8 @@ class MyListFragment : Fragment() {
|
||||
moduleShowerDialog.show()
|
||||
}
|
||||
}
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.KARAOKE_VIDEO, karaokeData.id)
|
||||
}
|
||||
|
||||
private fun onKaraokeChanged(id: Int) {
|
||||
|
||||
@@ -6,11 +6,13 @@ import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.userdata.UserRepository
|
||||
import com.woka.utils.Gender
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class ProfileViewModel: ViewModel() {
|
||||
|
||||
var currentFullName: String? = null
|
||||
var currentGender: Gender = Gender.NONE
|
||||
|
||||
private val _updateProfileLiveData = MutableLiveData<ApiResult<Any>>()
|
||||
val updateProfileLiveData: LiveData<ApiResult<Any>>
|
||||
|
||||
@@ -11,11 +11,11 @@ import com.bumptech.glide.Glide
|
||||
import com.woka.R
|
||||
import com.woka.WokaApp.Companion.userPrefs
|
||||
import com.woka.databinding.ActivityUserProfileBinding
|
||||
import com.woka.userdata.userDataModels.UserData
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.userdata.userDataModels.UserData
|
||||
import com.woka.utils.Gender
|
||||
import com.woka.utils.ProgressView
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.utils.WokaBaseActivity
|
||||
import com.woka.utils.hide
|
||||
import com.woka.utils.toast
|
||||
@@ -88,7 +88,7 @@ class UserProfileActivity : WokaBaseActivity() {
|
||||
|
||||
private fun setObservers() {
|
||||
binding.fullName.addTextChangedListener {
|
||||
enableUpdateBtn(viewModel.currentFullName != it.toString())
|
||||
enableUpdateBtn()
|
||||
}
|
||||
|
||||
userPrefs?.userLiveData?.observe(this){
|
||||
@@ -101,6 +101,7 @@ class UserProfileActivity : WokaBaseActivity() {
|
||||
is ApiResult.Success -> {
|
||||
it.data?.result?.let { userData ->
|
||||
viewModel.currentFullName = userData.fullname
|
||||
viewModel.currentGender = if (userData.gender_data?.id == 2) Gender.MALE else Gender.FEMALE
|
||||
updateUserData(userData)
|
||||
}
|
||||
}
|
||||
@@ -119,8 +120,15 @@ class UserProfileActivity : WokaBaseActivity() {
|
||||
progressView.hide()
|
||||
toast(it.message)
|
||||
|
||||
val genderData = if (selectedGender == Gender.MALE){
|
||||
com.woka.userdata.userDataModels.Gender("Boy", 2)
|
||||
}else{
|
||||
com.woka.userdata.userDataModels.Gender("Girl", 1)
|
||||
}
|
||||
|
||||
val userData = userPrefs?.userData?.copy(
|
||||
fullname = binding.fullName.text.toString()
|
||||
fullname = binding.fullName.text.toString(),
|
||||
gender_data = genderData
|
||||
)
|
||||
userPrefs?.updateUserData(userData)
|
||||
}
|
||||
@@ -152,7 +160,7 @@ class UserProfileActivity : WokaBaseActivity() {
|
||||
val userName = ", ${userData.username}"
|
||||
userUsername.text = userName
|
||||
|
||||
userData.avtar?.let {
|
||||
userData.avtar_url?.let {
|
||||
Glide.with(this@UserProfileActivity)
|
||||
.load(it)
|
||||
.placeholder(android.R.color.darker_gray)
|
||||
@@ -164,9 +172,14 @@ class UserProfileActivity : WokaBaseActivity() {
|
||||
|
||||
email.text = userData.email
|
||||
|
||||
selectGender(
|
||||
if (userData.gender_data?.id == 2) Gender.MALE
|
||||
else Gender.FEMALE
|
||||
)
|
||||
|
||||
birthdate.text = userData.birthdate
|
||||
|
||||
enableUpdateBtn(viewModel.currentFullName != fullName.text.toString())
|
||||
enableUpdateBtn()
|
||||
|
||||
}
|
||||
}
|
||||
@@ -201,10 +214,13 @@ class UserProfileActivity : WokaBaseActivity() {
|
||||
}
|
||||
|
||||
selectedGender = gender
|
||||
enableUpdateBtn()
|
||||
}
|
||||
|
||||
private fun enableUpdateBtn(enable: Boolean){
|
||||
binding.update.isEnabled = enable
|
||||
binding.update.alpha = if (enable) 1f else 0.5f
|
||||
private fun enableUpdateBtn(){
|
||||
val dataChanged = viewModel.currentGender != selectedGender || viewModel.currentFullName != binding.fullName.text.toString()
|
||||
|
||||
binding.update.isEnabled = dataChanged
|
||||
binding.update.alpha = if (dataChanged) 1f else 0.5f
|
||||
}
|
||||
}
|
||||
@@ -19,6 +19,7 @@ import com.woka.utils.ProgressView
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.utils.WokaBaseActivity
|
||||
import com.woka.utils.hide
|
||||
import com.woka.utils.show
|
||||
import com.woka.utils.toast
|
||||
|
||||
|
||||
@@ -81,10 +82,20 @@ class SupportActivity : WokaBaseActivity() {
|
||||
private fun initViews() {
|
||||
binding.apply {
|
||||
|
||||
if (userPrefs?.userType != UserType.GUEST){
|
||||
// user is logged in
|
||||
nameView.hide()
|
||||
emailView.hide()
|
||||
when (userPrefs?.userType) {
|
||||
UserType.GUEST -> {
|
||||
supportView.show()
|
||||
}
|
||||
UserType.CHILD -> {
|
||||
childView.show()
|
||||
}
|
||||
UserType.GUARDIAN -> {
|
||||
supportView.show()
|
||||
|
||||
nameView.hide()
|
||||
emailView.hide()
|
||||
}
|
||||
else -> {}
|
||||
}
|
||||
|
||||
val adapter: ArrayAdapter<*> = ArrayAdapter(
|
||||
|
||||
@@ -11,6 +11,8 @@ import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import com.woka.R
|
||||
import com.woka.audiobooks.views.AudioBooksActivity
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.databinding.ActivityExploreWokaBinding
|
||||
import com.woka.karaoke.views.KaraokeActivity
|
||||
import com.woka.modules.blogs.view.BlogsActivity
|
||||
@@ -30,6 +32,8 @@ class ExploreWokaActivity : WokaBaseActivity() {
|
||||
|
||||
private lateinit var progressView: ProgressView
|
||||
|
||||
private val clickHelper = ClicksHelper
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
with(window){
|
||||
@@ -58,6 +62,11 @@ class ExploreWokaActivity : WokaBaseActivity() {
|
||||
setObservers()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
private fun clickEvents() {
|
||||
binding.apply {
|
||||
closeBtn.setOnClickListener {
|
||||
@@ -70,26 +79,38 @@ class ExploreWokaActivity : WokaBaseActivity() {
|
||||
|
||||
webSeries.setOnClickListener {
|
||||
startActivity(Intent(this@ExploreWokaActivity, WebSeriesActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
audioBooks.setOnClickListener {
|
||||
startActivity(Intent(this@ExploreWokaActivity, AudioBooksActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
games.setOnClickListener {
|
||||
startActivity(Intent(this@ExploreWokaActivity, GamesActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
karaoke.setOnClickListener {
|
||||
startActivity(Intent(this@ExploreWokaActivity, KaraokeActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
blogs.setOnClickListener {
|
||||
startActivity(Intent(this@ExploreWokaActivity, BlogsActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
shop.setOnClickListener {
|
||||
startActivity(Intent(this@ExploreWokaActivity, ShopActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -59,8 +59,6 @@ class FMActivity : WokaBaseActivity() {
|
||||
fmId = intent.getIntExtra(EXTRA_FM_ID, -1)
|
||||
upsertClickEvent()
|
||||
|
||||
Log.d(TAG, "onCreate: $fmUrl $fmId")
|
||||
|
||||
player = ExoPlayer.Builder(this).build()
|
||||
|
||||
initPlayer()
|
||||
@@ -139,8 +137,7 @@ class FMActivity : WokaBaseActivity() {
|
||||
|
||||
clickHelper.upsertClickEvent(
|
||||
ContentType.FM,
|
||||
fmId,
|
||||
0
|
||||
fmId
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ import com.bumptech.glide.Glide
|
||||
import com.woka.BuildConfig
|
||||
import com.woka.R
|
||||
import com.woka.WokaApp.Companion.userPrefs
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.databinding.ActivityHomeBinding
|
||||
import com.woka.home.fragments.Home1Fragment
|
||||
import com.woka.home.fragments.Home2Fragment
|
||||
@@ -64,6 +66,7 @@ import com.woka.utils.WokaBaseActivity
|
||||
import com.woka.utils.changeLocale
|
||||
import com.woka.utils.hide
|
||||
import com.woka.utils.lightStatusBar
|
||||
import com.woka.utils.setVisibility
|
||||
import com.woka.utils.show
|
||||
import com.woka.utils.toast
|
||||
import kotlin.math.min
|
||||
@@ -81,6 +84,8 @@ class HomeActivity : WokaBaseActivity(),
|
||||
private var minuteReceiver: BroadcastReceiver? = null
|
||||
private var currentBackground: TimePeriod? = null
|
||||
|
||||
private val clickHelper = ClicksHelper
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
@@ -288,30 +293,44 @@ class HomeActivity : WokaBaseActivity(),
|
||||
|
||||
notifications.setOnClickListener {
|
||||
startActivity(Intent(this@HomeActivity, NotificationsActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sideMenu.setOnClickListener {
|
||||
homeDrawer.openDrawer(GravityCompat.END)
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
closeDrawer.setOnClickListener {
|
||||
homeDrawer.closeDrawer(GravityCompat.END)
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbTheme1.setOnClickListener {
|
||||
selectTheme(Theme.THEME_ONE)
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbTheme2.setOnClickListener {
|
||||
selectTheme(Theme.THEME_TWO)
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbEnglish.setOnClickListener {
|
||||
selectLanguage(LOCALE_ENGLISH)
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbHindi.setOnClickListener {
|
||||
selectLanguage(LOCALE_HINDI)
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbBtn.setOnClickListener {
|
||||
@@ -332,25 +351,35 @@ class HomeActivity : WokaBaseActivity(),
|
||||
show()
|
||||
}
|
||||
}
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbAboutWokaCard.setOnClickListener {
|
||||
startActivity(Intent(this@HomeActivity, AboutActivity::class.java),
|
||||
ActivityOptions.makeSceneTransitionAnimation(this@HomeActivity).toBundle())
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbFaqCard.setOnClickListener {
|
||||
startActivity(Intent(this@HomeActivity, FaqActivity::class.java),
|
||||
ActivityOptions.makeSceneTransitionAnimation(this@HomeActivity).toBundle())
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbWokaSupportCard.setOnClickListener {
|
||||
startActivity(Intent(this@HomeActivity, SupportActivity::class.java),
|
||||
ActivityOptions.makeSceneTransitionAnimation(this@HomeActivity).toBundle())
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbMyProfileCard.setOnClickListener {
|
||||
startActivity(Intent(this@HomeActivity, UserProfileActivity::class.java))
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbAddChildCard.setOnClickListener {
|
||||
@@ -358,6 +387,8 @@ class HomeActivity : WokaBaseActivity(),
|
||||
.apply {
|
||||
putExtra(ONBOARD_ACTIVITY_INTENT, ADD_CHILD_INTENT)
|
||||
})
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbDeActivateAccountCard.setOnClickListener {
|
||||
@@ -371,6 +402,8 @@ class HomeActivity : WokaBaseActivity(),
|
||||
setNegativeButton(getString(R.string.no))
|
||||
show()
|
||||
}
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbTermsNConditionsCard.setOnClickListener {
|
||||
@@ -380,6 +413,8 @@ class HomeActivity : WokaBaseActivity(),
|
||||
putExtra(WEB_VIEW_TITLE, getString(R.string.terms_conditions))
|
||||
}
|
||||
)
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbPrivacyNPolicyCard.setOnClickListener {
|
||||
@@ -389,18 +424,24 @@ class HomeActivity : WokaBaseActivity(),
|
||||
putExtra(WEB_VIEW_TITLE, getString(R.string.privacy_policy))
|
||||
}
|
||||
)
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbDisclaimerCard.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(this@HomeActivity, DisclaimerActivity::class.java)
|
||||
)
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
sbMyOrdersCard.setOnClickListener {
|
||||
startActivity(
|
||||
Intent(this@HomeActivity, MyOrdersActivity::class.java)
|
||||
)
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -472,13 +513,15 @@ class HomeActivity : WokaBaseActivity(),
|
||||
|
||||
// on bottom navigation tab is selected
|
||||
override fun onBottomTabSelected(tab: Int) {
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
|
||||
when (tab){
|
||||
HOME -> {
|
||||
if (userPrefs?.appTheme == Theme.THEME_TWO){
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.fc_home, Home2Fragment.getInstance())
|
||||
.runOnCommit {
|
||||
binding.notifications.show()
|
||||
binding.notifications.setVisibility(userPrefs?.userType == UserType.GUARDIAN || userPrefs?.userType == UserType.CHILD)
|
||||
window.lightStatusBar()
|
||||
|
||||
binding.root.backgroundTintList = ColorStateList.valueOf(getColor(R.color.color_primary))
|
||||
@@ -491,7 +534,7 @@ class HomeActivity : WokaBaseActivity(),
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.fc_home, Home1Fragment.getInstance())
|
||||
.runOnCommit {
|
||||
binding.notifications.show()
|
||||
binding.notifications.setVisibility(userPrefs?.userType == UserType.GUARDIAN || userPrefs?.userType == UserType.CHILD)
|
||||
window.lightStatusBar()
|
||||
|
||||
binding.root.backgroundTintList = null
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.woka.home.views
|
||||
|
||||
import android.app.Dialog
|
||||
import android.content.Intent
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.graphics.drawable.InsetDrawable
|
||||
@@ -13,8 +14,11 @@ import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.media3.common.MediaItem
|
||||
import androidx.recyclerview.widget.SimpleItemAnimator
|
||||
import com.jwplayer.pub.api.media.playlists.PlaylistItem
|
||||
import com.woka.R
|
||||
import com.woka.WokaApp.Companion.userPrefs
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.databinding.ActivityMoreHomeBinding
|
||||
import com.woka.databinding.DialogBlogsBinding
|
||||
import com.woka.modules.blogs.BlogsAdapter
|
||||
@@ -23,6 +27,8 @@ import com.woka.modules.blogs.models.Blog
|
||||
import com.woka.modules.wokasongs.WokaSongsAdapter
|
||||
import com.woka.modules.wokasongs.WokaSongsRepository
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.players.models.VideoPlayList
|
||||
import com.woka.players.views.PlayerActivity
|
||||
import com.woka.utils.WokaBaseActivity
|
||||
import com.woka.utils.hide
|
||||
import com.woka.utils.lightStatusBar
|
||||
@@ -40,6 +46,8 @@ class MoreHomeActivity : WokaBaseActivity() {
|
||||
private lateinit var blogBinding: DialogBlogsBinding
|
||||
private lateinit var blogDialog: Dialog
|
||||
|
||||
private val clickHelper = ClicksHelper
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
with(window) {
|
||||
@@ -76,6 +84,8 @@ class MoreHomeActivity : WokaBaseActivity() {
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
songsAdapter.releasePlayer()
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
private fun initBlogDialog(){
|
||||
@@ -101,7 +111,11 @@ class MoreHomeActivity : WokaBaseActivity() {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
blogBinding.close.setOnClickListener { blogDialog.dismiss() }
|
||||
blogBinding.close.setOnClickListener {
|
||||
blogDialog.dismiss()
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
|
||||
private fun clickEvents() {
|
||||
@@ -109,6 +123,29 @@ class MoreHomeActivity : WokaBaseActivity() {
|
||||
more.setOnClickListener {
|
||||
onBackPressedDispatcher.onBackPressed()
|
||||
}
|
||||
|
||||
playTrailer.setOnClickListener {
|
||||
startActivity(Intent(this@MoreHomeActivity, PlayerActivity::class.java).apply {
|
||||
putExtra(
|
||||
PlayerActivity.EXTRA_PLAY_LIST,
|
||||
VideoPlayList(
|
||||
ArrayList<PlaylistItem>().apply {
|
||||
add(
|
||||
PlaylistItem.Builder()
|
||||
.file("https://cdn.jwplayer.com/manifests/Iygt11AD.m3u8")
|
||||
.image("https://cdn.jwplayer.com/manifests/Iygt11AD.m3u8")
|
||||
.title("Masila")
|
||||
.build()
|
||||
)
|
||||
},
|
||||
null
|
||||
)
|
||||
)
|
||||
putExtra(PlayerActivity.EXTRA_PLAY_INDEX, 0)
|
||||
})
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.TEASER)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -239,5 +276,7 @@ class MoreHomeActivity : WokaBaseActivity() {
|
||||
}
|
||||
|
||||
blogDialog.show()
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
@@ -13,6 +13,8 @@ import androidx.media3.exoplayer.ExoPlayer
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder
|
||||
import com.woka.R
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.databinding.WokaSongViewHolderBinding
|
||||
import com.woka.modules.wokasongs.models.SongData
|
||||
import com.woka.utils.formatTime
|
||||
@@ -188,6 +190,7 @@ class WokaSongsAdapter(context: Context): RecyclerView.Adapter<WokaSongsAdapter.
|
||||
}
|
||||
|
||||
root.setOnClickListener {
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
if (currentPlayingPos == holder.absoluteAdapterPosition){
|
||||
if (player.isLoading){
|
||||
return@setOnClickListener
|
||||
|
||||
@@ -169,8 +169,7 @@ class LiveStreamPlayerActivity : AppCompatActivity(), FullscreenHandler {
|
||||
|
||||
clickHelper.upsertClickEvent(
|
||||
ContentType.LIVE_TV,
|
||||
liveTvId,
|
||||
0
|
||||
liveTvId
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,8 @@ import com.woka.shop.models.couponlisting.CouponsResponse
|
||||
import com.woka.shop.models.createorder.CreateOrderRequestData
|
||||
import com.woka.shop.models.createorder.CreateOrderResponse
|
||||
import com.woka.shop.models.edd.EDDResponse
|
||||
import com.woka.shop.models.orders.OrderListingResponse
|
||||
import com.woka.shop.models.ordertrack.OrderTrackResponse
|
||||
import com.woka.shop.models.productlisting.ProductListingResponse
|
||||
import com.woka.shop.models.productlisting.ShopProduct
|
||||
import com.woka.shop.models.subcategorylisting.SubCategoryResponse
|
||||
@@ -20,6 +22,8 @@ import retrofit2.Response
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Path
|
||||
import retrofit2.http.Query
|
||||
|
||||
interface ShopApiService {
|
||||
|
||||
@@ -69,4 +73,11 @@ interface ShopApiService {
|
||||
|
||||
@POST("create_new_order")
|
||||
suspend fun createOrder(@Body withCoupon: CreateOrderRequestData.WithoutCoupon): Response<ApiResponse<CreateOrderResponse>>
|
||||
|
||||
// orders
|
||||
@POST("order_listing")
|
||||
suspend fun ordersListing(@Query("page") pageNo: Int, @Query("limit") limit: Int): Response<ApiResponse<OrderListingResponse>>
|
||||
|
||||
@GET("order_status_track/{order_id}")
|
||||
suspend fun orderTracking(@Path("order_id") orderId: String): Response<ApiResponse<OrderTrackResponse>>
|
||||
}
|
||||
@@ -16,6 +16,8 @@ import com.woka.shop.models.couponlisting.CouponsResponse
|
||||
import com.woka.shop.models.createorder.CreateOrderRequestData
|
||||
import com.woka.shop.models.createorder.CreateOrderResponse
|
||||
import com.woka.shop.models.edd.EDDResponse
|
||||
import com.woka.shop.models.orders.OrderListingResponse
|
||||
import com.woka.shop.models.ordertrack.OrderTrackResponse
|
||||
import com.woka.shop.models.productlisting.ProductListingResponse
|
||||
import com.woka.shop.models.productlisting.ShopProduct
|
||||
import com.woka.shop.models.subcategorylisting.SubCategoryResponse
|
||||
@@ -245,4 +247,16 @@ object ShopRepository {
|
||||
apiService.createOrder(withoutCoupon)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun ordersListing(pageNo: Int, limit: Int): ApiResult<OrderListingResponse> {
|
||||
return handleApiCall {
|
||||
apiService.ordersListing(pageNo, limit)
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun orderTracking(orderId: String): ApiResult<OrderTrackResponse> {
|
||||
return handleApiCall {
|
||||
apiService.orderTracking(orderId)
|
||||
}
|
||||
}
|
||||
}
|
||||
60
app/src/main/java/com/woka/shop/adapters/OrdersAdapter.kt
Normal file
60
app/src/main/java/com/woka/shop/adapters/OrdersAdapter.kt
Normal file
@@ -0,0 +1,60 @@
|
||||
package com.woka.shop.adapters
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.AsyncDifferConfig
|
||||
import androidx.recyclerview.widget.DiffUtil
|
||||
import androidx.recyclerview.widget.ListAdapter
|
||||
import androidx.recyclerview.widget.RecyclerView.ViewHolder
|
||||
import com.woka.databinding.OrdersViewHolderBinding
|
||||
import com.woka.shop.models.orders.OrderData
|
||||
import java.util.concurrent.Executors
|
||||
|
||||
class OrdersAdapter: ListAdapter<OrderData, OrdersAdapter.OrderViewHolder>(ASYNC_DIFF_UTIL){
|
||||
|
||||
companion object{
|
||||
private val DIFF_UTIL = object : DiffUtil.ItemCallback<OrderData>(){
|
||||
override fun areItemsTheSame(oldItem: OrderData, newItem: OrderData): Boolean = oldItem.id == newItem.id
|
||||
override fun areContentsTheSame(oldItem: OrderData, newItem: OrderData): Boolean = oldItem == newItem
|
||||
}
|
||||
|
||||
private val ASYNC_DIFF_UTIL = AsyncDifferConfig.Builder(DIFF_UTIL)
|
||||
.setBackgroundThreadExecutor(Executors.newSingleThreadExecutor())
|
||||
.build()
|
||||
}
|
||||
|
||||
inner class OrderViewHolder(val binding: OrdersViewHolderBinding): ViewHolder(binding.root)
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): OrderViewHolder {
|
||||
return OrderViewHolder(
|
||||
OrdersViewHolderBinding.inflate(
|
||||
LayoutInflater.from(parent.context),
|
||||
parent,
|
||||
false
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: OrderViewHolder, position: Int) {
|
||||
val order = getItem(holder.absoluteAdapterPosition)
|
||||
|
||||
holder.binding.apply {
|
||||
orderId.text = "${order.order_id}"
|
||||
|
||||
val priceVal = "INR ${order.grand_total}"
|
||||
price.text = priceVal
|
||||
|
||||
val orderedDate = try {
|
||||
order.order_booked_date_time?.split(" ")?.first()
|
||||
}catch (e: Exception){
|
||||
order.order_booked_date_time
|
||||
}
|
||||
|
||||
placedOn.text = "$orderedDate"
|
||||
|
||||
airwayBillNo.text = "${order.airwaybilno}"
|
||||
|
||||
courier.text = "${order.courier}"
|
||||
}
|
||||
}
|
||||
}
|
||||
20
app/src/main/java/com/woka/shop/models/orders/OrderData.kt
Normal file
20
app/src/main/java/com/woka/shop/models/orders/OrderData.kt
Normal file
@@ -0,0 +1,20 @@
|
||||
package com.woka.shop.models.orders
|
||||
|
||||
data class OrderData(
|
||||
val airwaybilno: Any?,
|
||||
val branch_code: Any?,
|
||||
val courier: Any?,
|
||||
val delivery_success_status: Int?,
|
||||
val dispatch_label_url: Any?,
|
||||
val edd: String?,
|
||||
val grand_total: Int?,
|
||||
val id: Int?,
|
||||
val number_of_products: Int?,
|
||||
val order_booked_date_time: String?,
|
||||
val order_id: String?,
|
||||
val order_status: String?,
|
||||
val payment_mode: String?,
|
||||
val payment_status: String?,
|
||||
val shipment_latest_status: String?,
|
||||
val shipment_latest_status_code: String?
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.woka.shop.models.orders
|
||||
|
||||
data class OrderListingResponse(
|
||||
val result: Result?
|
||||
)
|
||||
6
app/src/main/java/com/woka/shop/models/orders/Result.kt
Normal file
6
app/src/main/java/com/woka/shop/models/orders/Result.kt
Normal file
@@ -0,0 +1,6 @@
|
||||
package com.woka.shop.models.orders
|
||||
|
||||
data class Result(
|
||||
val `data`: List<OrderData?>?,
|
||||
val total: Int?
|
||||
)
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.woka.shop.models.ordertrack
|
||||
|
||||
data class OrderTrack(
|
||||
val awbno: String?,
|
||||
val edd: String?,
|
||||
val orderno: String?,
|
||||
val ordertype: String?,
|
||||
val scan_detail: List<ScanDetail?>?,
|
||||
val shipment_latest_status: String?,
|
||||
val shipment_latest_status_code: String?
|
||||
)
|
||||
@@ -0,0 +1,5 @@
|
||||
package com.woka.shop.models.ordertrack
|
||||
|
||||
data class OrderTrackResponse(
|
||||
val result: List<OrderTrack?>?
|
||||
)
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.woka.shop.models.ordertrack
|
||||
|
||||
data class ScanDetail(
|
||||
val awbno: String?,
|
||||
val exp_delivery: String?,
|
||||
val location: String?,
|
||||
val orderno: String?,
|
||||
val reason_code: String?,
|
||||
val remarks: String?,
|
||||
val status: String?,
|
||||
val status_code: String?,
|
||||
val updated_date: String?
|
||||
)
|
||||
@@ -1,9 +1,13 @@
|
||||
package com.woka.shop.viewmodels
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.shop.ShopRepository
|
||||
import com.woka.shop.models.orders.OrderData
|
||||
import com.woka.shop.models.ordertrack.OrderTrack
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
class OrdersViewModel: ViewModel() {
|
||||
@@ -17,4 +21,55 @@ class OrdersViewModel: ViewModel() {
|
||||
}
|
||||
return repository.cartCountLiveData
|
||||
}
|
||||
|
||||
// orders listing
|
||||
private val _ordersData = MutableLiveData<ApiResult<MutableList<OrderData>>>()
|
||||
val ordersLiveData: LiveData<ApiResult<MutableList<OrderData>>>
|
||||
get() = _ordersData
|
||||
|
||||
private val ordersList = ArrayList<OrderData>()
|
||||
|
||||
private var nextPageToLoad: Int = 0
|
||||
private var quantity: Int = 1
|
||||
var lastPage = false
|
||||
fun loadOrders() {
|
||||
viewModelScope.launch {
|
||||
_ordersData.postValue(ApiResult.Loading())
|
||||
|
||||
when (val value = repository.ordersListing(nextPageToLoad, quantity)) {
|
||||
is ApiResult.Error -> _ordersData.postValue(
|
||||
ApiResult.Error(
|
||||
value.errorMessage,
|
||||
value.error
|
||||
)
|
||||
)
|
||||
|
||||
is ApiResult.Loading -> _ordersData.postValue(ApiResult.Loading())
|
||||
is ApiResult.Success -> {
|
||||
value.data?.let {
|
||||
it.result?.data?.filterNotNull()?.let { newList ->
|
||||
ordersList.addAll(newList)
|
||||
|
||||
lastPage = ordersList.size == it.result.total
|
||||
|
||||
_ordersData.postValue(ApiResult.Success(ordersList))
|
||||
nextPageToLoad++
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private val _orderTrackingLiveData = MutableLiveData<ApiResult<MutableList<OrderData>>>()
|
||||
val orderTrackingLiveData: LiveData<ApiResult<MutableList<OrderData>>>
|
||||
get() = _orderTrackingLiveData
|
||||
|
||||
private val orderTrackingMap = HashMap<String, OrderTrack>()
|
||||
|
||||
suspend fun trackOrder(orderId: String): ApiResult.Success<OrderTrack> {
|
||||
if (orderTrackingMap.containsKey(orderId)){
|
||||
return ApiResult.Success(orderTrackingMap[orderId])
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,18 +7,28 @@ import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.woka.R
|
||||
import com.woka.WokaApp
|
||||
import com.woka.databinding.ActivityMyOrdersBinding
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.shop.adapters.OrdersAdapter
|
||||
import com.woka.shop.viewmodels.OrdersViewModel
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.utils.NoSignInDialog
|
||||
import com.woka.utils.WokaBaseActivity
|
||||
import com.woka.utils.hide
|
||||
import com.woka.utils.lightStatusBar
|
||||
import com.woka.utils.setVisibility
|
||||
import com.woka.utils.show
|
||||
|
||||
class MyOrdersActivity : WokaBaseActivity() {
|
||||
|
||||
private lateinit var binding: ActivityMyOrdersBinding
|
||||
|
||||
private lateinit var viewModel: OrdersViewModel
|
||||
|
||||
private lateinit var noSignInDialog: NoSignInDialog
|
||||
|
||||
private lateinit var adapter: OrdersAdapter
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
@@ -31,13 +41,28 @@ class MyOrdersActivity : WokaBaseActivity() {
|
||||
}
|
||||
|
||||
viewModel = ViewModelProvider(this)[OrdersViewModel::class.java]
|
||||
noSignInDialog = NoSignInDialog(this)
|
||||
|
||||
adapter = OrdersAdapter()
|
||||
|
||||
window.navigationBarColor = getColor(R.color.my_orders_img_color)
|
||||
window.lightStatusBar(true)
|
||||
|
||||
initViews()
|
||||
|
||||
clickEvents()
|
||||
|
||||
setObservers()
|
||||
|
||||
if (!viewModel.ordersLiveData.isInitialized){
|
||||
viewModel.loadOrders()
|
||||
}
|
||||
}
|
||||
|
||||
private fun initViews(){
|
||||
binding.apply {
|
||||
rvOrders.adapter = adapter
|
||||
}
|
||||
}
|
||||
|
||||
private fun clickEvents() {
|
||||
@@ -47,7 +72,15 @@ class MyOrdersActivity : WokaBaseActivity() {
|
||||
}
|
||||
|
||||
cart.setOnClickListener {
|
||||
startActivity(Intent(this@MyOrdersActivity, CartActivity::class.java))
|
||||
if (WokaApp.userPrefs?.userType == UserType.GUEST){
|
||||
noSignInDialog.show()
|
||||
}else{
|
||||
startActivity(Intent(this@MyOrdersActivity, CartActivity::class.java))
|
||||
}
|
||||
}
|
||||
|
||||
loadMoreBtn.setOnClickListener {
|
||||
viewModel.loadOrders()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,5 +90,54 @@ class MyOrdersActivity : WokaBaseActivity() {
|
||||
binding.cartCount.text = "$it"
|
||||
binding.cartCountView.setVisibility(it > 0)
|
||||
}
|
||||
|
||||
viewModel.ordersLiveData.observe(this){
|
||||
binding.apply {
|
||||
when (it){
|
||||
is ApiResult.Error -> {
|
||||
if (adapter.currentList.isEmpty()){
|
||||
// no orders at all
|
||||
dataView.hide()
|
||||
noData.show()
|
||||
}else{
|
||||
// load more orders failed
|
||||
dataView.show()
|
||||
shimmer.hide()
|
||||
|
||||
loadMoreBtn.text = getString(R.string.retry)
|
||||
loadMoreBtn.show()
|
||||
}
|
||||
}
|
||||
is ApiResult.Loading -> {
|
||||
noData.hide()
|
||||
|
||||
dataView.show()
|
||||
shimmer.show()
|
||||
|
||||
loadMoreBtn.hide()
|
||||
}
|
||||
is ApiResult.Success -> {
|
||||
it.data?.let {ordersList ->
|
||||
noData.hide()
|
||||
|
||||
dataView.show()
|
||||
shimmer.hide()
|
||||
|
||||
loadMoreBtn.text = getString(R.string.load_more)
|
||||
loadMoreBtn.setVisibility(!viewModel.lastPage)
|
||||
|
||||
if (adapter.currentList.isEmpty()){
|
||||
adapter.submitList(ordersList)
|
||||
}else{
|
||||
adapter.notifyItemRangeInserted(
|
||||
adapter.currentList.size,
|
||||
ordersList.size
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,9 +9,12 @@ import androidx.core.view.ViewCompat
|
||||
import androidx.core.view.WindowInsetsCompat
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import com.woka.R
|
||||
import com.woka.WokaApp.Companion.userPrefs
|
||||
import com.woka.databinding.ActivityShopBinding
|
||||
import com.woka.shop.viewmodels.ShopViewModel
|
||||
import com.woka.shop.views.CartActivity.Companion.EXTRA_CURRENT_PRODUCT
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.utils.NoSignInDialog
|
||||
import com.woka.utils.WokaBaseActivity
|
||||
import com.woka.utils.lightStatusBar
|
||||
import com.woka.utils.setVisibility
|
||||
@@ -23,6 +26,8 @@ class ShopActivity : WokaBaseActivity() {
|
||||
|
||||
private lateinit var cartLauncher: ActivityResultLauncher<Intent>
|
||||
|
||||
private lateinit var noSignInDialog: NoSignInDialog
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
enableEdgeToEdge()
|
||||
@@ -35,6 +40,7 @@ class ShopActivity : WokaBaseActivity() {
|
||||
}
|
||||
|
||||
viewModel = ViewModelProvider(this)[ShopViewModel::class.java]
|
||||
noSignInDialog = NoSignInDialog(this)
|
||||
|
||||
window.navigationBarColor = getColor(R.color.orders_bg)
|
||||
window.lightStatusBar(false)
|
||||
@@ -61,9 +67,13 @@ class ShopActivity : WokaBaseActivity() {
|
||||
}
|
||||
|
||||
cart.setOnClickListener {
|
||||
cartLauncher.launch(Intent(this@ShopActivity, CartActivity::class.java).apply {
|
||||
putExtra(EXTRA_CURRENT_PRODUCT, viewModel.currentProductId)
|
||||
})
|
||||
if (userPrefs?.userType == UserType.GUEST){
|
||||
noSignInDialog.show()
|
||||
}else{
|
||||
cartLauncher.launch(Intent(this@ShopActivity, CartActivity::class.java).apply {
|
||||
putExtra(EXTRA_CURRENT_PRODUCT, viewModel.currentProductId)
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,11 +12,14 @@ import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.woka.R
|
||||
import com.woka.WokaApp.Companion.userPrefs
|
||||
import com.woka.databinding.FragmentCartBinding
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.shop.adapters.CartAdapter
|
||||
import com.woka.shop.viewmodels.CartViewModel
|
||||
import com.woka.shop.views.CartActivity.Companion.EXTRA_CURRENT_PRODUCT
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.utils.DecisionDialog
|
||||
import com.woka.utils.ProgressView
|
||||
import com.woka.utils.TAG
|
||||
import com.woka.utils.hide
|
||||
@@ -32,6 +35,7 @@ class CartFragment: Fragment() {
|
||||
private lateinit var viewModel: CartViewModel
|
||||
|
||||
private lateinit var progressDialog: ProgressView
|
||||
private lateinit var decisionDialog: DecisionDialog
|
||||
|
||||
private var currentProductId: Int? = null
|
||||
|
||||
@@ -44,6 +48,7 @@ class CartFragment: Fragment() {
|
||||
viewModel = ViewModelProvider(requireActivity())[CartViewModel::class.java]
|
||||
adapter = CartAdapter()
|
||||
progressDialog = ProgressView(requireContext())
|
||||
decisionDialog = DecisionDialog(requireContext())
|
||||
|
||||
currentProductId = requireActivity().intent.getIntExtra(EXTRA_CURRENT_PRODUCT, -1)
|
||||
|
||||
@@ -116,8 +121,14 @@ class CartFragment: Fragment() {
|
||||
}
|
||||
|
||||
binding.checkout.setOnClickListener {
|
||||
viewModel.clearAppliedCoupon()
|
||||
findNavController().navigate(R.id.action_cartFragment_to_orderSummaryFragment)
|
||||
if (userPrefs?.userType == UserType.CHILD){
|
||||
decisionDialog.setPositiveButton(getString(R.string.ok_caps)){}
|
||||
decisionDialog.show(getString(R.string.purchase),
|
||||
getString(R.string.children_cannot_purchase_this_product_please_contact_your_guardian))
|
||||
}else{
|
||||
viewModel.clearAppliedCoupon()
|
||||
findNavController().navigate(R.id.action_cartFragment_to_orderSummaryFragment)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,11 +11,14 @@ import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.navArgs
|
||||
import com.google.android.material.tabs.TabLayoutMediator
|
||||
import com.woka.R
|
||||
import com.woka.WokaApp.Companion.userPrefs
|
||||
import com.woka.databinding.FragmentProductBinding
|
||||
import com.woka.networking.ApiResult
|
||||
import com.woka.shop.adapters.ProductImagesAdapter
|
||||
import com.woka.shop.models.productlisting.ShopProduct
|
||||
import com.woka.shop.viewmodels.ShopViewModel
|
||||
import com.woka.userPreference.UserType
|
||||
import com.woka.utils.NoSignInDialog
|
||||
import com.woka.utils.ProgressView
|
||||
import com.woka.utils.hide
|
||||
import com.woka.utils.show
|
||||
@@ -31,6 +34,8 @@ class ProductFragment : Fragment() {
|
||||
|
||||
private var mShopProduct: ShopProduct? = null
|
||||
|
||||
private lateinit var noSignInDialog: NoSignInDialog
|
||||
|
||||
private val args: ProductFragmentArgs by navArgs()
|
||||
private val productId: Int by lazy { args.productId }
|
||||
|
||||
@@ -42,6 +47,8 @@ class ProductFragment : Fragment() {
|
||||
viewModel = ViewModelProvider(requireActivity())[ShopViewModel::class.java]
|
||||
progressView = ProgressView(requireContext(), getString(R.string.please_wait))
|
||||
|
||||
noSignInDialog = NoSignInDialog(requireContext())
|
||||
|
||||
imageAdapter = ProductImagesAdapter()
|
||||
|
||||
return binding.root
|
||||
@@ -148,39 +155,43 @@ class ProductFragment : Fragment() {
|
||||
}
|
||||
|
||||
addToCart.setOnClickListener {
|
||||
lifecycleScope.launch {
|
||||
progressView.show()
|
||||
if (userPrefs?.userType == UserType.GUEST){
|
||||
noSignInDialog.show()
|
||||
}else{
|
||||
lifecycleScope.launch {
|
||||
progressView.show()
|
||||
|
||||
if (shopProduct.added_to_cart == false) {
|
||||
when (val response = viewModel.addToCart(shopProduct)) {
|
||||
is ApiResult.Error -> {
|
||||
progressView.hide()
|
||||
toast(response.errorMessage)
|
||||
if (shopProduct.added_to_cart == false) {
|
||||
when (val response = viewModel.addToCart(shopProduct)) {
|
||||
is ApiResult.Error -> {
|
||||
progressView.hide()
|
||||
toast(response.errorMessage)
|
||||
}
|
||||
|
||||
is ApiResult.Loading -> {}
|
||||
is ApiResult.Success -> {
|
||||
progressView.hide()
|
||||
toast(response.message)
|
||||
|
||||
shopProduct.added_to_cart = true
|
||||
addToCart.text = getString(R.string.remove_from_cart)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
when (val response = viewModel.removeFromCart(productId)) {
|
||||
is ApiResult.Error -> {
|
||||
progressView.hide()
|
||||
toast(response.errorMessage)
|
||||
}
|
||||
|
||||
is ApiResult.Loading -> {}
|
||||
is ApiResult.Success -> {
|
||||
progressView.hide()
|
||||
toast(response.message)
|
||||
is ApiResult.Loading -> {}
|
||||
is ApiResult.Success -> {
|
||||
progressView.hide()
|
||||
toast(response.message)
|
||||
|
||||
shopProduct.added_to_cart = true
|
||||
addToCart.text = getString(R.string.remove_from_cart)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
when (val response = viewModel.removeFromCart(productId)) {
|
||||
is ApiResult.Error -> {
|
||||
progressView.hide()
|
||||
toast(response.errorMessage)
|
||||
}
|
||||
|
||||
is ApiResult.Loading -> {}
|
||||
is ApiResult.Success -> {
|
||||
progressView.hide()
|
||||
toast(response.message)
|
||||
|
||||
shopProduct.added_to_cart = false
|
||||
addToCart.text = getString(R.string.add_to_cart)
|
||||
shopProduct.added_to_cart = false
|
||||
addToCart.text = getString(R.string.add_to_cart)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import android.graphics.drawable.InsetDrawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View.VISIBLE
|
||||
import android.view.WindowManager
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.databinding.LayoutDecisionDialogBinding
|
||||
|
||||
class DecisionDialog(context: Context) {
|
||||
@@ -15,6 +17,8 @@ class DecisionDialog(context: Context) {
|
||||
|
||||
private val dialog: Dialog
|
||||
|
||||
private val clickHelper = ClicksHelper
|
||||
|
||||
var title: String
|
||||
get() = binding.title.text.toString()
|
||||
set(value) {
|
||||
@@ -60,6 +64,8 @@ class DecisionDialog(context: Context) {
|
||||
setOnClickListener {
|
||||
click()
|
||||
dialog.dismiss()
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -71,6 +77,8 @@ class DecisionDialog(context: Context) {
|
||||
setOnClickListener {
|
||||
click?.invoke()
|
||||
dialog.dismiss()
|
||||
|
||||
clickHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,6 +8,8 @@ import android.graphics.drawable.ColorDrawable
|
||||
import android.graphics.drawable.InsetDrawable
|
||||
import android.view.LayoutInflater
|
||||
import android.view.WindowManager
|
||||
import com.woka.database.helpers.ClicksHelper
|
||||
import com.woka.database.models.clicks.ContentType
|
||||
import com.woka.databinding.LayoutNoSignInDialogBinding
|
||||
import com.woka.onboard.views.OnboardActivity
|
||||
|
||||
@@ -30,9 +32,15 @@ class NoSignInDialog(context: Context) {
|
||||
context.startActivity(Intent(context, OnboardActivity::class.java).apply {
|
||||
putExtra(OnboardActivity.ONBOARD_ACTIVITY_INTENT, OnboardActivity.LOG_IN_INTENT)
|
||||
})
|
||||
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
binding.closeBtn.setOnClickListener { dismiss() }
|
||||
binding.closeBtn.setOnClickListener {
|
||||
dismiss()
|
||||
|
||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||
}
|
||||
|
||||
try {
|
||||
val back = ColorDrawable(Color.TRANSPARENT)
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
android:textColor="@color/white"
|
||||
|
||||
android:textSize="@dimen/_13ssp"
|
||||
android:visibility="gone"
|
||||
android:visibility="visible"
|
||||
|
||||
/>
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
android:layout_marginHorizontal="15dp"
|
||||
|
||||
android:layout_marginTop="5dp"
|
||||
android:visibility="gone"
|
||||
android:visibility="visible"
|
||||
|
||||
app:cardBackgroundColor="@color/white"
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
android:src="@drawable/img_masila_tn_small" />
|
||||
|
||||
<com.woka.utils.PressableCard
|
||||
android:id="@+id/play_trailer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerInParent="true"
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
tools:context=".shop.views.MyOrdersActivity">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/toolbar_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="?actionBarSize"
|
||||
android:background="@android:color/transparent"
|
||||
@@ -103,6 +104,117 @@
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/no_data"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_horizontal"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="100dp"
|
||||
android:layout_height="100dp"
|
||||
android:contentDescription="@string/image"
|
||||
android:src="@drawable/img_support"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/no_data_txt"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/no_orders_found"
|
||||
android:fontFamily="@font/exo_2_bold"
|
||||
android:textColor="@color/color_primary"
|
||||
android:textSize="@dimen/_14ssp"
|
||||
|
||||
android:layout_marginTop="10dp"
|
||||
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
android:id="@+id/data_view"
|
||||
android:visibility="visible"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:translationZ="1dp"
|
||||
app:layout_constraintTop_toBottomOf="@id/toolbar_view"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rv_orders"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
tools:listitem="@layout/orders_view_holder"
|
||||
tools:itemCount="3"
|
||||
|
||||
android:visibility="visible"
|
||||
/>
|
||||
|
||||
<com.facebook.shimmer.ShimmerFrameLayout
|
||||
android:id="@+id/shimmer"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:shimmer_auto_start="true"
|
||||
app:shimmer_duration="1500"
|
||||
app:shimmer_highlight_alpha="0.5"
|
||||
>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<include layout="@layout/orders_place_holder"/>
|
||||
<include layout="@layout/orders_place_holder"/>
|
||||
<include layout="@layout/orders_place_holder"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</com.facebook.shimmer.ShimmerFrameLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/load_more_btn"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/load_more"
|
||||
android:fontFamily="@font/exo_2_bold"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_12ssp"
|
||||
|
||||
android:paddingHorizontal="25dp"
|
||||
android:layout_marginVertical="15dp"
|
||||
|
||||
android:background="@drawable/round_25"
|
||||
android:backgroundTint="@color/night_status"
|
||||
|
||||
android:layout_gravity="center_horizontal"
|
||||
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
|
||||
<androidx.constraintlayout.widget.Guideline
|
||||
android:id="@+id/g1"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -73,180 +73,206 @@
|
||||
android:layout_marginBottom="25dp"
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/email_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:fontFamily="@font/exo_2_bold"
|
||||
android:text="@string/email"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_12ssp"
|
||||
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/_37sdp"
|
||||
|
||||
android:background="@drawable/round_25"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:paddingHorizontal="15dp"
|
||||
|
||||
android:inputType="textEmailAddress"
|
||||
|
||||
android:hint="@string/enter_your_email"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textSize="@dimen/_13ssp"
|
||||
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/name_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_marginTop="15dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:fontFamily="@font/exo_2_bold"
|
||||
android:text="@string/name"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_12ssp"
|
||||
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/_37sdp"
|
||||
|
||||
android:background="@drawable/round_25"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:paddingHorizontal="15dp"
|
||||
|
||||
android:inputType="textPersonName|textCapWords"
|
||||
|
||||
android:hint="@string/enter_your_name"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textSize="@dimen/_13ssp"
|
||||
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/child_view"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:fontFamily="@font/exo_2_bold"
|
||||
android:text="@string/subject"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_12ssp"
|
||||
|
||||
android:layout_marginTop="15dp"
|
||||
|
||||
/>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
|
||||
app:cardCornerRadius="25dp"
|
||||
>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/subject_spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/_37sdp"
|
||||
|
||||
android:layout_marginStart="5dp"
|
||||
|
||||
android:popupBackground="@drawable/round_25"
|
||||
/>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/message"
|
||||
android:fontFamily="@font/exo_2_bold"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_12ssp"
|
||||
|
||||
android:layout_marginTop="15dp"
|
||||
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/_150sdp"
|
||||
|
||||
android:background="@drawable/round_25"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
|
||||
android:paddingVertical="15dp"
|
||||
android:paddingHorizontal="20dp"
|
||||
|
||||
android:autofillHints="@null"
|
||||
|
||||
android:hint="@string/enter_your_message"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_13ssp"
|
||||
|
||||
android:inputType="textMultiLine|textCapSentences"
|
||||
|
||||
android:gravity="top"
|
||||
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/submit"
|
||||
android:text="@string/please_ask_your_guardian_to_contact_us_for_assistance"
|
||||
android:fontFamily="@font/exo_2_bold"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_14ssp"
|
||||
|
||||
android:background="@drawable/gradient_btn_bg_2"
|
||||
android:textAlignment="center"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginVertical="@dimen/_50sdp" />
|
||||
|
||||
/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/support_view"
|
||||
android:visibility="gone"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/email_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:fontFamily="@font/exo_2_bold"
|
||||
android:text="@string/email"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_12ssp"
|
||||
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/email"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/_37sdp"
|
||||
|
||||
android:background="@drawable/round_25"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:paddingHorizontal="15dp"
|
||||
|
||||
android:inputType="textEmailAddress"
|
||||
|
||||
android:hint="@string/enter_your_email"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textSize="@dimen/_13ssp"
|
||||
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/name_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_horizontal"
|
||||
android:layout_marginTop="15dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:fontFamily="@font/exo_2_bold"
|
||||
android:text="@string/name"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_12ssp"
|
||||
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/_37sdp"
|
||||
|
||||
android:background="@drawable/round_25"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:paddingHorizontal="15dp"
|
||||
|
||||
android:inputType="textPersonName|textCapWords"
|
||||
|
||||
android:hint="@string/enter_your_name"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
|
||||
android:textColor="@color/black"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textSize="@dimen/_13ssp"
|
||||
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:fontFamily="@font/exo_2_bold"
|
||||
android:text="@string/subject"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_12ssp"
|
||||
|
||||
android:layout_marginTop="15dp"
|
||||
|
||||
/>
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
|
||||
app:cardCornerRadius="25dp"
|
||||
>
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/subject_spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/_37sdp"
|
||||
|
||||
android:layout_marginStart="5dp"
|
||||
|
||||
android:popupBackground="@drawable/round_25"
|
||||
/>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/message"
|
||||
android:fontFamily="@font/exo_2_bold"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_12ssp"
|
||||
|
||||
android:layout_marginTop="15dp"
|
||||
|
||||
/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/message"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/_150sdp"
|
||||
|
||||
android:background="@drawable/round_25"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginTop="10dp"
|
||||
|
||||
android:paddingVertical="15dp"
|
||||
android:paddingHorizontal="20dp"
|
||||
|
||||
android:autofillHints="@null"
|
||||
|
||||
android:hint="@string/enter_your_message"
|
||||
android:textColorHint="@android:color/darker_gray"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textColor="@color/black"
|
||||
android:textSize="@dimen/_13ssp"
|
||||
|
||||
android:inputType="textMultiLine|textCapSentences"
|
||||
|
||||
android:gravity="top"
|
||||
|
||||
/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/submit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/submit"
|
||||
android:fontFamily="@font/exo_2_bold"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_14ssp"
|
||||
|
||||
android:background="@drawable/gradient_btn_bg_2"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginVertical="@dimen/_50sdp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
53
app/src/main/res/layout/orders_place_holder.xml
Normal file
53
app/src/main/res/layout/orders_place_holder.xml
Normal file
@@ -0,0 +1,53 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
|
||||
app:cardBackgroundColor="@color/white"
|
||||
app:cardCornerRadius="15dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginVertical="15dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="15dp"
|
||||
|
||||
android:alpha="0.7"
|
||||
android:background="@drawable/round_25"
|
||||
|
||||
android:backgroundTint="@android:color/darker_gray" />
|
||||
|
||||
<View
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="15dp"
|
||||
|
||||
android:layout_marginTop="10dp"
|
||||
android:alpha="0.7"
|
||||
|
||||
android:background="@drawable/round_25"
|
||||
android:backgroundTint="@android:color/darker_gray" />
|
||||
|
||||
<View
|
||||
android:layout_width="200dp"
|
||||
android:layout_height="15dp"
|
||||
|
||||
android:layout_marginTop="10dp"
|
||||
android:alpha="0.7"
|
||||
android:background="@drawable/round_25"
|
||||
|
||||
android:backgroundTint="@android:color/darker_gray" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
237
app/src/main/res/layout/orders_view_holder.xml
Normal file
237
app/src/main/res/layout/orders_view_holder.xml
Normal file
@@ -0,0 +1,237 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
|
||||
android:layout_marginHorizontal="15dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_marginTop="1dp"
|
||||
|
||||
app:cardCornerRadius="15dp"
|
||||
app:cardBackgroundColor="@color/white">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="10dp"
|
||||
android:layout_marginVertical="15dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/order_id_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/order_id"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textColor="@color/color_primary"
|
||||
android:textSize="@dimen/_11ssp"
|
||||
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/order_id"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
tools:text="M2974823HFY28283482"
|
||||
android:fontFamily="@font/exo_2_bold"
|
||||
android:textColor="@color/color_primary"
|
||||
android:textSize="@dimen/_11ssp"
|
||||
|
||||
android:layout_marginStart="5dp"
|
||||
android:layout_marginEnd="15dp"
|
||||
|
||||
app:layout_constraintTop_toTopOf="@id/order_id_tag"
|
||||
app:layout_constraintStart_toEndOf="@id/order_id_tag"
|
||||
app:layout_constraintEnd_toStartOf="@id/price"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/price"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
tools:text="INR 1"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textColor="@color/color_primary"
|
||||
android:textSize="@dimen/_11ssp"
|
||||
|
||||
app:layout_constraintTop_toTopOf="@id/order_id_tag"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<View
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@android:color/darker_gray"
|
||||
|
||||
android:layout_marginVertical="5dp"
|
||||
/>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/placed_on_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/placed_on"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textColor="@android:color/darker_gray"
|
||||
android:textSize="@dimen/_11ssp"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/placed_on"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
tools:text="02-09-2001"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textColor="@color/color_primary"
|
||||
android:textSize="@dimen/_11ssp"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/placed_on_tag"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:visibility="gone"
|
||||
android:contentDescription="@string/image"
|
||||
android:src="@drawable/ic_half_arrow_up"
|
||||
android:scaleType="fitXY"
|
||||
app:tint="@color/color_primary"
|
||||
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<View
|
||||
android:id="@+id/v1"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0.5dp"
|
||||
android:background="@android:color/darker_gray"
|
||||
|
||||
android:layout_marginTop="5dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/airline_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/airline_bill_number"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textColor="@android:color/darker_gray"
|
||||
android:textSize="@dimen/_11ssp"
|
||||
|
||||
android:layout_marginTop="5dp"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/v1"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/airway_bill_no"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
tools:text="1384802481039482309"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textColor="@color/color_primary"
|
||||
android:textSize="@dimen/_11ssp"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/airline_tag"
|
||||
app:layout_constraintEnd_toStartOf="@id/track_btn"
|
||||
|
||||
android:layout_marginEnd="10dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/courier_tag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/courier"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textColor="@android:color/darker_gray"
|
||||
android:textSize="@dimen/_11ssp"
|
||||
|
||||
android:layout_marginTop="3dp"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/airway_bill_no"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/courier"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
tools:text="1384802481039482309"
|
||||
android:fontFamily="@font/exo_2"
|
||||
android:textColor="@color/color_primary"
|
||||
android:textSize="@dimen/_11ssp"
|
||||
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/courier_tag"
|
||||
app:layout_constraintEnd_toStartOf="@id/track_btn"
|
||||
|
||||
android:layout_marginEnd="10dp"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/track_btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
android:text="@string/track"
|
||||
android:fontFamily="@font/exo_2_bold"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/_10ssp"
|
||||
android:textAlignment="center"
|
||||
android:background="@drawable/round_25"
|
||||
android:backgroundTint="@color/color_primary"
|
||||
|
||||
android:paddingHorizontal="15dp"
|
||||
android:paddingVertical="5dp"
|
||||
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
@@ -284,4 +284,13 @@
|
||||
<string name="remove_from_cart">REMOVE</string>
|
||||
<string name="view_cart">view cart</string>
|
||||
<string name="order_placed_successfully">Order placed successfully</string>
|
||||
<string name="purchase">Purchase</string>
|
||||
<string name="children_cannot_purchase_this_product_please_contact_your_guardian">Children cannot purchase this product. Please contact your Guardian.</string>
|
||||
<string name="please_ask_your_guardian_to_contact_us_for_assistance">Please ask your guardian to contact us for assistance</string>
|
||||
<string name="order_id">Order ID :</string>
|
||||
<string name="placed_on">PLACED ON</string>
|
||||
<string name="airline_bill_number">AIRWAY BILL NUMBER</string>
|
||||
<string name="courier">COURIER</string>
|
||||
<string name="track">TRACK</string>
|
||||
<string name="no_orders_found">No orders found</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user