This repository has been archived by the owner on Sep 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Develop/country support (#40) * Added country code picker on login * Added settings menu in video player, added support for multiple subtitles and definitions * Removed bedtime mode button, added idle dialog * Close dialog after timer end * Updated release.md * Added Off description to settings caption item
- Loading branch information
1 parent
e1aa252
commit 2c3b0bd
Showing
73 changed files
with
1,353 additions
and
242 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
# Watcher v2.9 | ||
# Watcher v2.10 | ||
|
||
## What's New | ||
- Added More Error Toasts | ||
- Removed annoying update notification on start | ||
- Added double click on item to Remove video from Watch History | ||
- Added other Countries for OTP Login | ||
- Added support for other languages for subtitles | ||
- Removed other button controls Video Player | ||
- Added new Settings menu for Video Player to change subtitles, definition, and playback speed | ||
- Removed bedtime mode and added new Idle Dialog |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
110 changes: 110 additions & 0 deletions
110
app/src/main/java/com/medina/juanantonio/watcher/data/adapters/SettingsAdapter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
package com.medina.juanantonio.watcher.data.adapters | ||
|
||
import android.annotation.SuppressLint | ||
import android.graphics.Color | ||
import android.view.LayoutInflater | ||
import android.view.ViewGroup | ||
import androidx.core.view.isVisible | ||
import androidx.recyclerview.widget.RecyclerView | ||
import com.medina.juanantonio.watcher.R | ||
import com.medina.juanantonio.watcher.data.models.settings.SettingsItem | ||
import com.medina.juanantonio.watcher.data.models.settings.SettingsScreen | ||
import com.medina.juanantonio.watcher.data.models.settings.SettingsSelectionItem | ||
import com.medina.juanantonio.watcher.databinding.ItemSettingsScreenBinding | ||
import com.medina.juanantonio.watcher.databinding.ItemSettingsSelectionBinding | ||
|
||
class SettingsAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() { | ||
private val _settingsItemList = arrayListOf<SettingsItem>() | ||
private var _onClickListener: (SettingsItem) -> Unit = {} | ||
|
||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { | ||
return when (viewType) { | ||
R.layout.item_settings_screen -> SettingsScreenViewHolder( | ||
ItemSettingsScreenBinding.inflate( | ||
LayoutInflater.from(parent.context), | ||
parent, | ||
false | ||
) | ||
) | ||
else -> SettingsSelectionItemViewHolder( | ||
ItemSettingsSelectionBinding.inflate( | ||
LayoutInflater.from(parent.context), | ||
parent, | ||
false | ||
) | ||
) | ||
} | ||
} | ||
|
||
override fun getItemCount() = _settingsItemList.size | ||
|
||
override fun getItemViewType(position: Int): Int { | ||
return _settingsItemList[position].viewType | ||
} | ||
|
||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { | ||
when (val item = _settingsItemList[position]) { | ||
is SettingsScreen -> (holder as? SettingsScreenViewHolder)?.bind(item) | ||
is SettingsSelectionItem -> (holder as? SettingsSelectionItemViewHolder)?.bind(item) | ||
} | ||
} | ||
|
||
@SuppressLint("NotifyDataSetChanged") | ||
fun setSettingsItems( | ||
settingsItemList: List<SettingsItem>, | ||
onClickListener: (SettingsItem) -> Unit = {} | ||
) { | ||
_settingsItemList.clear() | ||
_settingsItemList.addAll(settingsItemList) | ||
_onClickListener = onClickListener | ||
notifyDataSetChanged() | ||
} | ||
|
||
inner class SettingsScreenViewHolder( | ||
private val binding: ItemSettingsScreenBinding | ||
) : RecyclerView.ViewHolder(binding.root) { | ||
|
||
fun bind(item: SettingsScreen) { | ||
binding.root.setOnFocusChangeListener { _, onFocus -> | ||
binding.textViewTitle.setTextColor(if (onFocus) Color.BLACK else Color.WHITE) | ||
binding.imageViewIcon.setColorFilter(if (onFocus) Color.BLACK else Color.WHITE) | ||
binding.imageViewArrow.setColorFilter(if (onFocus) Color.BLACK else Color.WHITE) | ||
} | ||
|
||
binding.root.setOnClickListener { | ||
_onClickListener(item) | ||
} | ||
|
||
binding.imageViewIcon.setImageResource(item.icon) | ||
binding.textViewTitle.text = item.title | ||
binding.textViewDescription.apply { | ||
isVisible = !item.description.isNullOrBlank() | ||
text = item.description | ||
} | ||
} | ||
} | ||
|
||
inner class SettingsSelectionItemViewHolder( | ||
private val binding: ItemSettingsSelectionBinding | ||
) : RecyclerView.ViewHolder(binding.root) { | ||
|
||
fun bind(item: SettingsSelectionItem) { | ||
binding.root.setOnFocusChangeListener { _, onFocus -> | ||
binding.textViewTitle.setTextColor(if (onFocus) Color.BLACK else Color.WHITE) | ||
binding.imageViewIcon.setColorFilter(if (onFocus) Color.BLACK else Color.WHITE) | ||
binding.imageViewSelected.setColorFilter(if (onFocus) Color.BLACK else Color.WHITE) | ||
} | ||
|
||
binding.root.setOnClickListener { | ||
_onClickListener(item) | ||
} | ||
|
||
binding.textViewTitle.text = item.title | ||
binding.textViewDescription.apply { | ||
isVisible = !item.description.isNullOrBlank() | ||
text = item.description | ||
} | ||
binding.imageViewSelected.isVisible = item.isSelected | ||
} | ||
} | ||
} |
5 changes: 5 additions & 0 deletions
5
app/src/main/java/com/medina/juanantonio/watcher/data/models/settings/SettingsItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package com.medina.juanantonio.watcher.data.models.settings | ||
|
||
interface SettingsItem { | ||
val viewType: Int | ||
} |
15 changes: 15 additions & 0 deletions
15
app/src/main/java/com/medina/juanantonio/watcher/data/models/settings/SettingsScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package com.medina.juanantonio.watcher.data.models.settings | ||
|
||
import androidx.annotation.DrawableRes | ||
import com.medina.juanantonio.watcher.R | ||
|
||
data class SettingsScreen( | ||
val key: String, | ||
val title: String, | ||
val description: String?, | ||
@DrawableRes val icon: Int | ||
): SettingsItem { | ||
|
||
override val viewType: Int | ||
get() = R.layout.item_settings_screen | ||
} |
19 changes: 19 additions & 0 deletions
19
...rc/main/java/com/medina/juanantonio/watcher/data/models/settings/SettingsSelectionItem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.medina.juanantonio.watcher.data.models.settings | ||
|
||
data class SettingsSelectionItem( | ||
val title: String, | ||
val description: String?, | ||
val isSelected: Boolean, | ||
val key: String, | ||
val type: Type | ||
): SettingsItem { | ||
|
||
override val viewType: Int | ||
get() = 1 | ||
|
||
enum class Type { | ||
QUALITY, | ||
CAPTIONS, | ||
PLAYBACK_SPEED | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
75 changes: 75 additions & 0 deletions
75
app/src/main/java/com/medina/juanantonio/watcher/features/dialog/IdleDialogFragment.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
package com.medina.juanantonio.watcher.features.dialog | ||
|
||
import android.content.DialogInterface | ||
import android.graphics.Color | ||
import android.os.Bundle | ||
import android.view.LayoutInflater | ||
import android.view.View | ||
import android.view.ViewGroup | ||
import com.medina.juanantonio.watcher.R | ||
import com.medina.juanantonio.watcher.databinding.FragmentIdleDialogBinding | ||
import com.medina.juanantonio.watcher.shared.utils.autoCleared | ||
|
||
class IdleDialogFragment : androidx.fragment.app.DialogFragment() { | ||
|
||
companion object { | ||
private const val TITLE_KEY = "TITLE_KEY" | ||
private var onClickListener: (IdleDialogButton) -> Unit = {} | ||
|
||
fun getInstance( | ||
title: String, | ||
onClickListener: (IdleDialogButton) -> Unit = {} | ||
): IdleDialogFragment { | ||
this.onClickListener = onClickListener | ||
|
||
return IdleDialogFragment().apply { | ||
arguments = Bundle().apply { | ||
putString(TITLE_KEY, title) | ||
} | ||
} | ||
} | ||
} | ||
|
||
private var binding: FragmentIdleDialogBinding by autoCleared() | ||
|
||
override fun onCreateView( | ||
inflater: LayoutInflater, | ||
container: ViewGroup?, | ||
savedInstanceState: Bundle? | ||
): View { | ||
binding = FragmentIdleDialogBinding.inflate(inflater, container, false) | ||
dialog?.window?.decorView?.setBackgroundColor(Color.TRANSPARENT) | ||
return binding.root | ||
} | ||
|
||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { | ||
super.onViewCreated(view, savedInstanceState) | ||
|
||
val title = arguments?.getString(TITLE_KEY) | ||
binding.textViewPromptTitle.text = getString(R.string.are_you_still_watching_title, title) | ||
binding.buttonAskAgainLater.setOnClickListener { | ||
onClickListener(IdleDialogButton.ASK_AGAIN) | ||
dismiss() | ||
} | ||
binding.buttonPlayWithoutAskingAgain.setOnClickListener { | ||
onClickListener(IdleDialogButton.PLAY_WITHOUT_ASKING) | ||
dismiss() | ||
} | ||
binding.buttonImDone.setOnClickListener { | ||
onClickListener(IdleDialogButton.DONE) | ||
dismiss() | ||
} | ||
} | ||
|
||
override fun onDismiss(dialog: DialogInterface) { | ||
super.onDismiss(dialog) | ||
onClickListener(IdleDialogButton.ASK_AGAIN) | ||
onClickListener = {} | ||
} | ||
} | ||
|
||
enum class IdleDialogButton { | ||
ASK_AGAIN, | ||
PLAY_WITHOUT_ASKING, | ||
DONE | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.