Merge branch 'master' of gitlab.futo.org:videostreaming/grayjay into landscape

This commit is contained in:
Koen J 2024-11-21 10:46:39 +01:00
commit 561d9ae987
90 changed files with 593 additions and 261 deletions

View file

@ -49,9 +49,23 @@ We encourage developers to write their own plugins. Please refer to the "Getting
## Contributing to Core
**We are currently not accepting contributions to the core.**
The core is currently licensed under the FUTO Temporary License (FTL). The licensing and ownership of contributions to the core are complex topics that we are still working on. We'll update these guidelines when we have more clarity.
### License
The core is currently licensed under the [Source First License 1.1](./LICENSE.md). All contributors have to sign FUTO Individual Contributor License Agreement before contributions can be accepted. You can read more about it at [https://cla.futo.org/](https://cla.futo.org/).
### How to Contribute
1. Fork the core repository.
2. Clone your fork.
3. Make your changes.
4. Commit and push your changes.
5. Open a pull request.
### Guidelines
- Ensure your code adheres to the existing style.
- Include documentation and unit tests (where applicable).
---

View file

@ -144,7 +144,6 @@ class Settings : FragmentedStorageFileJson() {
fun import() {
val act = SettingsActivity.getActivity() ?: return;
val intent = MainActivity.getImportOptionsIntent(act);
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK;
act.startActivity(intent);
}
@ -906,7 +905,7 @@ class Settings : FragmentedStorageFileJson() {
var enabled: Boolean = true;
@FormField(R.string.broadcast, FieldForm.TOGGLE, R.string.broadcast_description, 1)
var broadcast: Boolean = true;
var broadcast: Boolean = false;
@FormField(R.string.connect_discovered, FieldForm.TOGGLE, R.string.connect_discovered_description, 2)
var connectDiscovered: Boolean = true;

View file

@ -6,6 +6,7 @@ import android.content.Context
import android.content.Intent
import android.graphics.Color
import android.net.Uri
import android.text.Layout
import android.text.method.ScrollingMovementMethod
import android.util.TypedValue
import android.view.Gravity
@ -198,7 +199,6 @@ class UIDialogs {
dialog.show();
}
fun showDialog(context: Context, icon: Int, text: String, textDetails: String? = null, code: String? = null, defaultCloseAction: Int, vararg actions: Action) {
val builder = AlertDialog.Builder(context);
val view = LayoutInflater.from(context).inflate(R.layout.dialog_multi_button, null);
@ -214,18 +214,20 @@ class UIDialogs {
this.text = text;
};
view.findViewById<TextView>(R.id.dialog_text_details).apply {
if(textDetails == null)
if (textDetails == null)
this.visibility = View.GONE;
else
else {
this.text = textDetails;
this.textAlignment = View.TEXT_ALIGNMENT_VIEW_START
}
};
view.findViewById<TextView>(R.id.dialog_text_code).apply {
if(code == null)
this.visibility = View.GONE;
if (code == null) this.visibility = View.GONE;
else {
this.text = code;
this.movementMethod = ScrollingMovementMethod.getInstance();
this.visibility = View.VISIBLE;
this.textAlignment = View.TEXT_ALIGNMENT_VIEW_START
}
};
view.findViewById<LinearLayout>(R.id.dialog_buttons).apply {

View file

@ -32,6 +32,7 @@ import com.futo.platformplayer.BuildConfig
import com.futo.platformplayer.R
import com.futo.platformplayer.Settings
import com.futo.platformplayer.UIDialogs
import com.futo.platformplayer.api.http.ManagedHttpClient
import com.futo.platformplayer.casting.StateCasting
import com.futo.platformplayer.constructs.Event1
import com.futo.platformplayer.fragment.mainactivity.bottombar.MenuBottomBarFragment
@ -80,6 +81,7 @@ import com.futo.platformplayer.states.StatePlayer
import com.futo.platformplayer.states.StatePlaylists
import com.futo.platformplayer.states.StateSubscriptions
import com.futo.platformplayer.stores.FragmentedStorage
import com.futo.platformplayer.stores.StringStorage
import com.futo.platformplayer.stores.SubscriptionStorage
import com.futo.platformplayer.stores.v2.ManagedStore
import com.futo.platformplayer.views.ToastView
@ -87,11 +89,14 @@ import com.futo.polycentric.core.ApiMethods
import com.google.gson.JsonParser
import com.google.zxing.integration.android.IntentIntegrator
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.Job
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import kotlinx.serialization.Serializable
import kotlinx.serialization.encodeToString
import kotlinx.serialization.json.Json
import java.io.File
import java.io.PrintWriter
@ -101,7 +106,6 @@ import java.util.LinkedList
import java.util.Queue
import java.util.concurrent.ConcurrentLinkedQueue
class MainActivity : AppCompatActivity, IWithResultLauncher {
//TODO: Move to dimensions
@ -109,7 +113,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
private val HEIGHT_VIDEO_MINIMIZED_DP = 60f;
//Containers
lateinit var rootView : MotionLayout;
lateinit var rootView: MotionLayout;
private lateinit var _overlayContainer: FrameLayout;
private lateinit var _toastView: ToastView;
@ -166,11 +170,11 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
lateinit var _fragVideoDetail: VideoDetailFragment;
//State
private val _queue : Queue<Pair<MainFragment, Any?>> = LinkedList();
lateinit var fragCurrent : MainFragment private set;
private val _queue: Queue<Pair<MainFragment, Any?>> = LinkedList();
lateinit var fragCurrent: MainFragment private set;
private var _parameterCurrent: Any? = null;
var fragBeforeOverlay : MainFragment? = null; private set;
var fragBeforeOverlay: MainFragment? = null; private set;
val onNavigated = Event1<MainFragment>();
@ -216,15 +220,15 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
Logger.e("Application", "Uncaught", excp);
//Resolve invocation chains
while(excp is InvocationTargetException || excp is java.lang.RuntimeException) {
while (excp is InvocationTargetException || excp is java.lang.RuntimeException) {
val before = excp;
if(excp is InvocationTargetException)
if (excp is InvocationTargetException)
excp = excp.targetException ?: excp.cause ?: excp;
else if(excp is java.lang.RuntimeException)
else if (excp is java.lang.RuntimeException)
excp = excp.cause ?: excp;
if(excp == before)
if (excp == before)
break;
}
writer.write((excp.message ?: "Empty error") + "\n\n");
@ -255,7 +259,8 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
setContentView(R.layout.activity_main);
setNavigationBarColorAndIcons();
if (Settings.instance.playback.allowVideoToGoUnderCutout)
window.attributes.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
window.attributes.layoutInDisplayCutoutMode =
WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES
runBlocking {
StatePlatform.instance.updateAvailableClients(this@MainActivity);
@ -329,10 +334,12 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
updateSegmentPaddings();
};
_fragVideoDetail.onTransitioning.subscribe {
if(it || _fragVideoDetail.state != VideoDetailFragment.State.MINIMIZED)
_fragContainerOverlay.elevation = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15f, resources.displayMetrics);
if (it || _fragVideoDetail.state != VideoDetailFragment.State.MINIMIZED)
_fragContainerOverlay.elevation =
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 15f, resources.displayMetrics);
else
_fragContainerOverlay.elevation = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5f, resources.displayMetrics);
_fragContainerOverlay.elevation =
TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5f, resources.displayMetrics);
}
_fragVideoDetail.onCloseEvent.subscribe {
@ -349,40 +356,39 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
_buttonIncognito.alpha = 0f;
StateApp.instance.privateModeChanged.subscribe {
//Messing with visibility causes some issues with layout ordering?
if(it) {
if (it) {
_buttonIncognito.elevation = 99f;
_buttonIncognito.alpha = 1f;
}
else {
} else {
_buttonIncognito.elevation = -99f;
_buttonIncognito.alpha = 0f;
}
}
_buttonIncognito.setOnClickListener {
if(!StateApp.instance.privateMode)
if (!StateApp.instance.privateMode)
return@setOnClickListener;
UIDialogs.showDialog(this, R.drawable.ic_disabled_visible_purple, "Disable Privacy Mode",
UIDialogs.showDialog(
this, R.drawable.ic_disabled_visible_purple, "Disable Privacy Mode",
"Do you want to disable privacy mode? New videos will be tracked again.", null, 0,
UIDialogs.Action("Cancel", {
StateApp.instance.setPrivacyMode(true);
}, UIDialogs.ActionStyle.NONE),
UIDialogs.Action("Disable", {
StateApp.instance.setPrivacyMode(false);
}, UIDialogs.ActionStyle.DANGEROUS));
}, UIDialogs.ActionStyle.DANGEROUS)
);
};
_fragVideoDetail.onFullscreenChanged.subscribe {
Logger.i(TAG, "onFullscreenChanged ${it}");
if(it) {
if (it) {
_buttonIncognito.elevation = -99f;
_buttonIncognito.alpha = 0f;
}
else {
if(StateApp.instance.privateMode) {
} else {
if (StateApp.instance.privateMode) {
_buttonIncognito.elevation = 99f;
_buttonIncognito.alpha = 1f;
}
else {
} else {
_buttonIncognito.elevation = -99f;
_buttonIncognito.alpha = 0f;
}
@ -395,7 +401,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
return@subscribe;
}
if(_fragVideoDetail.state == VideoDetailFragment.State.CLOSED) {
if (_fragVideoDetail.state == VideoDetailFragment.State.CLOSED) {
if (fragCurrent !is VideoDetailFragment) {
val toPlay = StatePlayer.instance.getCurrentQueueItem();
navigate(_fragVideoDetail, toPlay);
@ -443,11 +449,12 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
_fragSubGroupList.topBar = _fragTopBarAdd;
_fragBrowser.topBar = _fragTopBarNavigation;
fragCurrent = _fragMainHome;
val defaultTab = Settings.instance.tabs.mapNotNull {
val buttonDefinition = MenuBottomBarFragment.buttonDefinitions.firstOrNull { bd -> it.id == bd.id };
val buttonDefinition =
MenuBottomBarFragment.buttonDefinitions.firstOrNull { bd -> it.id == bd.id };
if (buttonDefinition == null) {
return@mapNotNull null;
} else {
@ -506,7 +513,8 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
//startActivity(Intent(this, TestActivity::class.java));
val sharedPreferences = getSharedPreferences("GrayjayFirstBoot", Context.MODE_PRIVATE)
val sharedPreferences =
getSharedPreferences("GrayjayFirstBoot", Context.MODE_PRIVATE)
val isFirstBoot = sharedPreferences.getBoolean("IsFirstBoot", true)
if (isFirstBoot) {
UIDialogs.showConfirmationDialog(this, getString(R.string.do_you_want_to_see_the_tutorials_you_can_find_them_at_any_time_through_the_more_button), {
@ -518,6 +526,64 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
_fragVideoDetail.detectWindowSize()
_fragVideoDetail.updateOrientation()
val submissionStatus = FragmentedStorage.get<StringStorage>("subscriptionSubmissionStatus")
val numSubscriptions = StateSubscriptions.instance.getSubscriptionCount()
val subscriptionsThreshold = 20
if (
submissionStatus.value == ""
&& StateApp.instance.getCurrentNetworkState() != StateApp.NetworkState.DISCONNECTED
&& numSubscriptions >= subscriptionsThreshold
) {
UIDialogs.showDialog(
this,
R.drawable.ic_internet,
getString(R.string.contribute_personal_subscriptions_list),
getString(R.string.contribute_personal_subscriptions_list_description),
null,
0,
UIDialogs.Action("Cancel", {
submissionStatus.setAndSave("dismissed")
}, UIDialogs.ActionStyle.NONE),
UIDialogs.Action("Upload", {
submissionStatus.setAndSave("submitted")
GlobalScope.launch(Dispatchers.IO) {
@Serializable
data class CreatorInfo(val pluginId: String, val url: String)
val subscriptions =
StateSubscriptions.instance.getSubscriptions().map { original ->
CreatorInfo(
pluginId = original.channel.id.pluginId ?: "",
url = original.channel.url
)
}
val json = Json.encodeToString(subscriptions)
val url = "https://data.grayjay.app/donate-subscription-list"
val client = ManagedHttpClient();
val headers = hashMapOf(
"Content-Type" to "application/json"
)
try {
val response = client.post(url, json, headers)
// if it failed retry one time
if (!response.isOk) {
client.post(url, json, headers)
}
} catch (e: Exception) {
Logger.i(TAG, "Failed to submit subscription list.", e)
}
}
}, UIDialogs.ActionStyle.PRIMARY)
)
}
}
/*
@ -582,39 +648,45 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
}
private fun handleIntent(intent: Intent?) {
if(intent == null)
if (intent == null)
return;
Logger.i(TAG, "handleIntent started by " + intent.action);
var targetData: String? = null;
when(intent.action) {
when (intent.action) {
Intent.ACTION_SEND -> {
targetData = intent.getStringExtra(Intent.EXTRA_STREAM) ?: intent.getStringExtra(Intent.EXTRA_TEXT);
targetData = intent.getStringExtra(Intent.EXTRA_STREAM)
?: intent.getStringExtra(Intent.EXTRA_TEXT);
Logger.i(TAG, "Share Received: " + targetData);
}
Intent.ACTION_VIEW -> {
targetData = intent.dataString
if(!targetData.isNullOrEmpty()) {
if (!targetData.isNullOrEmpty()) {
Logger.i(TAG, "View Received: " + targetData);
}
}
"VIDEO" -> {
val url = intent.getStringExtra("VIDEO");
navigate(_fragVideoDetail, url);
}
"IMPORT_OPTIONS" -> {
UIDialogs.showImportOptionsDialog(this);
}
"ACTION" -> {
val action = intent.getStringExtra("ACTION");
StateDeveloper.instance.testState = "TestPlayback";
StateDeveloper.instance.testPlayback();
}
"TAB" -> {
when(intent.getStringExtra("TAB")){
when (intent.getStringExtra("TAB")) {
"Sources" -> {
runBlocking {
StatePlatform.instance.updateAvailableClients(this@MainActivity, true) //Ideally this is not needed..
@ -625,7 +697,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
navigate(_fragBrowser, BrowserFragment.NavigateOptions("https://plugins.grayjay.app/phone.html", mapOf(
Pair("grayjay") { req ->
StateApp.instance.contextOrNull?.let {
if(it is MainActivity) {
if (it is MainActivity) {
runBlocking {
it.handleUrlAll(req.url.toString());
}
@ -644,8 +716,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
handleUrlAll(targetData)
}
}
}
catch(ex: Throwable) {
} catch (ex: Throwable) {
UIDialogs.showGeneralErrorDialog(this, getString(R.string.failed_to_handle_file), ex);
}
}
@ -654,35 +725,31 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
val uri = Uri.parse(url)
when (uri.scheme) {
"grayjay" -> {
if(url.startsWith("grayjay://license/")) {
if(StatePayment.instance.setPaymentLicenseUrl(url))
{
if (url.startsWith("grayjay://license/")) {
if (StatePayment.instance.setPaymentLicenseUrl(url)) {
UIDialogs.showDialogOk(this, R.drawable.ic_check, getString(R.string.your_license_key_has_been_set_an_app_restart_might_be_required));
if(fragCurrent is BuyFragment)
if (fragCurrent is BuyFragment)
closeSegment(fragCurrent);
}
else
} else
UIDialogs.toast(getString(R.string.invalid_license_format));
}
else if(url.startsWith("grayjay://plugin/")) {
} else if (url.startsWith("grayjay://plugin/")) {
val intent = Intent(this, AddSourceActivity::class.java).apply {
data = Uri.parse(url.substring("grayjay://plugin/".length));
};
startActivity(intent);
}
else if(url.startsWith("grayjay://video/")) {
} else if (url.startsWith("grayjay://video/")) {
val videoUrl = url.substring("grayjay://video/".length);
navigate(_fragVideoDetail, videoUrl);
}
else if(url.startsWith("grayjay://channel/")) {
} else if (url.startsWith("grayjay://channel/")) {
val channelUrl = url.substring("grayjay://channel/".length);
navigate(_fragMainChannel, channelUrl);
}
}
"content" -> {
if(!handleContent(url, intent.type)) {
if (!handleContent(url, intent.type)) {
UIDialogs.showSingleButtonDialog(
this,
R.drawable.ic_play,
@ -691,8 +758,9 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
{ });
}
}
"file" -> {
if(!handleFile(url)) {
if (!handleFile(url)) {
UIDialogs.showSingleButtonDialog(
this,
R.drawable.ic_play,
@ -701,8 +769,9 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
{ });
}
}
"polycentric" -> {
if(!handlePolycentric(url)) {
if (!handlePolycentric(url)) {
UIDialogs.showSingleButtonDialog(
this,
R.drawable.ic_play,
@ -711,8 +780,9 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
{ });
}
}
"fcast" -> {
if(!handleFCast(url)) {
if (!handleFCast(url)) {
UIDialogs.showSingleButtonDialog(
this,
R.drawable.ic_cast,
@ -721,6 +791,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
{ });
}
}
else -> {
if (!handleUrl(url)) {
UIDialogs.showSingleButtonDialog(
@ -742,7 +813,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
if (StatePlatform.instance.hasEnabledVideoClient(url)) {
Logger.i(TAG, "handleUrl(url=$url) found video client");
lifecycleScope.launch(Dispatchers.Main) {
if(position > 0)
if (position > 0)
navigate(_fragVideoDetail, UrlVideoWithTime(url, position.toLong(), true));
else
navigate(_fragVideoDetail, url);
@ -770,24 +841,25 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
return@withContext false;
}
}
fun handleContent(file: String, mime: String? = null): Boolean {
Logger.i(TAG, "handleContent(url=$file)");
val data = readSharedContent(file);
if(file.lowercase().endsWith(".json") || mime == "application/json") {
if (file.lowercase().endsWith(".json") || mime == "application/json") {
var recon = String(data);
if(!recon.trim().startsWith("["))
if (!recon.trim().startsWith("["))
return handleUnknownJson(recon);
var reconLines = Json.decodeFromString<List<String>>(recon);
val cacheStr = reconLines.find { it.startsWith("__CACHE:") }?.substring("__CACHE:".length);
val cacheStr =
reconLines.find { it.startsWith("__CACHE:") }?.substring("__CACHE:".length);
reconLines = reconLines.filter { !it.startsWith("__CACHE:") }; //TODO: constant prefix
var cache: ImportCache? = null;
try {
if(cacheStr != null)
if (cacheStr != null)
cache = Json.decodeFromString(cacheStr);
}
catch(ex: Throwable) {
} catch (ex: Throwable) {
Logger.e(TAG, "Failed to deserialize cache");
}
@ -796,32 +868,31 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
Logger.i(TAG, "Opened shared playlist reconstruction\n${recon}");
handleReconstruction(recon, cache);
return true;
}
else if(file.lowercase().endsWith(".zip") || mime == "application/zip") {
} else if (file.lowercase().endsWith(".zip") || mime == "application/zip") {
StateBackup.importZipBytes(this, lifecycleScope, data);
return true;
}
else if(file.lowercase().endsWith(".txt") || mime == "text/plain") {
} else if (file.lowercase().endsWith(".txt") || mime == "text/plain") {
return handleUnknownText(String(data));
}
return false;
}
fun handleFile(file: String): Boolean {
Logger.i(TAG, "handleFile(url=$file)");
if(file.lowercase().endsWith(".json")) {
if (file.lowercase().endsWith(".json")) {
var recon = String(readSharedFile(file));
if(!recon.startsWith("["))
if (!recon.startsWith("["))
return handleUnknownJson(recon);
var reconLines = Json.decodeFromString<List<String>>(recon);
val cacheStr = reconLines.find { it.startsWith("__CACHE:") }?.substring("__CACHE:".length);
val cacheStr =
reconLines.find { it.startsWith("__CACHE:") }?.substring("__CACHE:".length);
reconLines = reconLines.filter { !it.startsWith("__CACHE:") }; //TODO: constant prefix
var cache: ImportCache? = null;
try {
if(cacheStr != null)
if (cacheStr != null)
cache = Json.decodeFromString(cacheStr);
}
catch(ex: Throwable) {
} catch (ex: Throwable) {
Logger.e(TAG, "Failed to deserialize cache");
}
recon = reconLines.joinToString("\n");
@ -829,19 +900,18 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
Logger.i(TAG, "Opened shared playlist reconstruction\n${recon}");
handleReconstruction(recon, cache);
return true;
}
else if(file.lowercase().endsWith(".zip")) {
} else if (file.lowercase().endsWith(".zip")) {
StateBackup.importZipBytes(this, lifecycleScope, readSharedFile(file));
return true;
}
else if(file.lowercase().endsWith(".txt")) {
} else if (file.lowercase().endsWith(".txt")) {
return handleUnknownText(String(readSharedFile(file)));
}
return false;
}
fun handleReconstruction(recon: String, cache: ImportCache? = null) {
val type = ManagedStore.getReconstructionIdentifier(recon);
val store: ManagedStore<*> = when(type) {
val store: ManagedStore<*> = when (type) {
"Playlist" -> StatePlaylists.instance.playlistStore
else -> {
UIDialogs.toast(getString(R.string.unknown_reconstruction_type) + " ${type}", false);
@ -849,13 +919,15 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
};
};
val name = when(type) {
"Playlist" -> recon.split("\n").filter { !it.startsWith(ManagedStore.RECONSTRUCTION_HEADER_OPERATOR) }.firstOrNull() ?: type;
val name = when (type) {
"Playlist" -> recon.split("\n")
.filter { !it.startsWith(ManagedStore.RECONSTRUCTION_HEADER_OPERATOR) }
.firstOrNull() ?: type;
else -> type
}
if(!type.isNullOrEmpty()) {
if (!type.isNullOrEmpty()) {
UIDialogs.showImportDialog(this, store, name, listOf(recon), cache) {
}
@ -864,18 +936,18 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
fun handleUnknownText(text: String): Boolean {
try {
if(text.startsWith("@/Subscription") || text.startsWith("Subscriptions")) {
if (text.startsWith("@/Subscription") || text.startsWith("Subscriptions")) {
val lines = text.split("\n").map { it.trim() }.drop(1).filter { it.isNotEmpty() };
navigate(_fragImportSubscriptions, lines);
return true;
}
}
catch(ex: Throwable) {
} catch (ex: Throwable) {
Logger.e(TAG, ex.message, ex);
UIDialogs.showGeneralErrorDialog(this, getString(R.string.failed_to_parse_text_file), ex);
}
return false;
}
fun handleUnknownJson(json: String): Boolean {
val context = this;
@ -887,8 +959,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
return false;//throw IllegalArgumentException("Invalid NewPipe json structure found");
StateBackup.importNewPipeSubs(this, newPipeSubsParsed);
}
catch(ex: Exception) {
} catch (ex: Exception) {
Logger.e(TAG, ex.message, ex);
UIDialogs.showGeneralErrorDialog(context, getString(R.string.failed_to_parse_newpipe_subscriptions), ex);
}
@ -934,7 +1005,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
private fun readSharedFile(filePath: String): ByteArray {
val dataFile = File(filePath);
if(!dataFile.exists())
if (!dataFile.exists())
throw IllegalArgumentException("Opened file does not exist or not permitted");
val data = dataFile.readBytes();
return data;
@ -943,13 +1014,13 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
override fun onBackPressed() {
Logger.i(TAG, "onBackPressed")
if(_fragBotBarMenu.onBackPressed())
if (_fragBotBarMenu.onBackPressed())
return;
if(_fragVideoDetail.state == VideoDetailFragment.State.MAXIMIZED && _fragVideoDetail.onBackPressed())
if (_fragVideoDetail.state == VideoDetailFragment.State.MAXIMIZED && _fragVideoDetail.onBackPressed())
return;
if(!fragCurrent.onBackPressed())
if (!fragCurrent.onBackPressed())
closeSegment();
}
@ -957,7 +1028,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
super.onUserLeaveHint();
Logger.i(TAG, "onUserLeaveHint")
if(_fragVideoDetail.state == VideoDetailFragment.State.MAXIMIZED || _fragVideoDetail.state == VideoDetailFragment.State.MINIMIZED)
if (_fragVideoDetail.state == VideoDetailFragment.State.MAXIMIZED || _fragVideoDetail.state == VideoDetailFragment.State.MINIMIZED)
_fragVideoDetail.onUserLeaveHint();
}
@ -993,12 +1064,12 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
fun navigate(segment: MainFragment, parameter: Any? = null, withHistory: Boolean = true, isBack: Boolean = false) {
Logger.i(TAG, "Navigate to $segment (parameter=$parameter, withHistory=$withHistory, isBack=$isBack)")
if(segment != fragCurrent) {
if(segment is VideoDetailFragment) {
if(_fragContainerVideoDetail.visibility != View.VISIBLE)
if (segment != fragCurrent) {
if (segment is VideoDetailFragment) {
if (_fragContainerVideoDetail.visibility != View.VISIBLE)
_fragContainerVideoDetail.visibility = View.VISIBLE;
when(segment.state) {
when (segment.state) {
VideoDetailFragment.State.MINIMIZED -> segment.maximizeVideoDetail()
VideoDetailFragment.State.CLOSED -> segment.maximizeVideoDetail()
else -> {}
@ -1006,11 +1077,10 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
segment.onShown(parameter, isBack);
return;
}
fragCurrent.onHide();
if(segment.isMainView) {
if (segment.isMainView) {
var transaction = supportFragmentManager.beginTransaction();
if (segment.topBar != null) {
if (segment.topBar != fragCurrent.topBar) {
@ -1019,8 +1089,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
.replace(R.id.fragment_top_bar, segment.topBar as Fragment);
fragCurrent.topBar?.onHide();
}
}
else if(fragCurrent.topBar != null)
} else if (fragCurrent.topBar != null)
transaction.hide(fragCurrent.topBar as Fragment);
transaction = transaction.replace(R.id.fragment_main, segment);
@ -1028,25 +1097,24 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
if (segment.hasBottomBar) {
if (!fragCurrent.hasBottomBar)
transaction = transaction.show(_fragBotBarMenu);
}
else {
if(fragCurrent.hasBottomBar)
} else {
if (fragCurrent.hasBottomBar)
transaction = transaction.hide(_fragBotBarMenu);
}
transaction.commitNow();
} else {
if(!segment.hasBottomBar) {
if (!segment.hasBottomBar) {
supportFragmentManager.beginTransaction()
.hide(_fragBotBarMenu)
.commitNow();
}
}
if(fragCurrent.isHistory && withHistory && _queue.lastOrNull() != fragCurrent)
if (fragCurrent.isHistory && withHistory && _queue.lastOrNull() != fragCurrent)
_queue.add(Pair(fragCurrent, _parameterCurrent));
if(segment.isOverlay && !fragCurrent.isOverlay && withHistory)// && fragCurrent.isHistory)
if (segment.isOverlay && !fragCurrent.isOverlay && withHistory)// && fragCurrent.isHistory)
fragBeforeOverlay = fragCurrent;
@ -1064,12 +1132,12 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
* If called with a non-null fragment, it will only close if the current fragment is the provided one
*/
fun closeSegment(fragment: MainFragment? = null) {
if(fragment is VideoDetailFragment) {
if (fragment is VideoDetailFragment) {
fragment.onHide();
return;
}
if((fragment?.isOverlay ?: false) && fragBeforeOverlay != null) {
if ((fragment?.isOverlay ?: false) && fragBeforeOverlay != null) {
navigate(fragBeforeOverlay!!, null, false, true);
} else {
val last = _queue.lastOrNull();
@ -1091,8 +1159,8 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
/**
* Provides the fragment instance for the provided fragment class
*/
inline fun <reified T : Fragment> getFragment() : T {
return when(T::class) {
inline fun <reified T : Fragment> getFragment(): T {
return when (T::class) {
HomeFragment::class -> _fragMainHome as T;
TutorialFragment::class -> _fragMainTutorial as T;
ContentSearchResultsFragment::class -> _fragMainVideoSearchResults as T;
@ -1129,15 +1197,21 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
private fun updateSegmentPaddings() {
var paddingBottom = 0f;
if(fragCurrent.hasBottomBar)
if (fragCurrent.hasBottomBar)
paddingBottom += HEIGHT_MENU_DP;
_fragContainerOverlay.setPadding(0,0,0, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, paddingBottom - HEIGHT_MENU_DP, resources.displayMetrics).toInt());
_fragContainerOverlay.setPadding(
0, 0, 0, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, paddingBottom - HEIGHT_MENU_DP, resources.displayMetrics)
.toInt()
);
if(_fragVideoDetail.state == VideoDetailFragment.State.MINIMIZED)
if (_fragVideoDetail.state == VideoDetailFragment.State.MINIMIZED)
paddingBottom += HEIGHT_VIDEO_MINIMIZED_DP;
_fragContainerMain.setPadding(0,0,0, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, paddingBottom, resources.displayMetrics).toInt());
_fragContainerMain.setPadding(
0, 0, 0, TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, paddingBottom, resources.displayMetrics)
.toInt()
);
}
@ -1153,14 +1227,18 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
ContextCompat.checkSelfPermission(this, notifPermission) == PackageManager.PERMISSION_GRANTED -> {
}
ActivityCompat.shouldShowRequestPermissionRationale(this, notifPermission) -> {
UIDialogs.showDialog(this, R.drawable.ic_notifications, "Notifications Required",
UIDialogs.showDialog(
this, R.drawable.ic_notifications, "Notifications Required",
reason, null, 0,
UIDialogs.Action("Cancel", {}),
UIDialogs.Action("Enable", {
requestPermissionLauncher.launch(notifPermission);
}, UIDialogs.ActionStyle.PRIMARY));
}, UIDialogs.ActionStyle.PRIMARY)
);
}
else -> {
requestPermissionLauncher.launch(notifPermission);
}
@ -1172,15 +1250,16 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
fun showAppToast(toast: ToastView.Toast) {
synchronized(_toastQueue) {
_toastQueue.add(toast);
if(_toastJob?.isActive != true)
if (_toastJob?.isActive != true)
_toastJob = lifecycleScope.launch(Dispatchers.Default) {
launchAppToastJob();
};
}
}
private suspend fun launchAppToastJob() {
Logger.i(TAG, "Starting appToast loop");
while(!_toastQueue.isEmpty()) {
while (!_toastQueue.isEmpty()) {
val toast = _toastQueue.poll() ?: continue;
Logger.i(TAG, "Showing next toast (${toast.msg})");
@ -1193,7 +1272,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
_toastView.setToastAnimated(toast);
}
}
if(toast.long)
if (toast.long)
delay(5000);
else
delay(3000);
@ -1207,18 +1286,19 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
//TODO: Only calls last handler due to missing request codes on ActivityResultLaunchers.
private var resultLauncherMap = mutableMapOf<Int, (ActivityResult)->Unit>();
private var resultLauncherMap = mutableMapOf<Int, (ActivityResult) -> Unit>();
private var requestCode: Int? = -1;
private val resultLauncher: ActivityResultLauncher<Intent> = registerForActivityResult(
ActivityResultContracts.StartActivityForResult()) {
result: ActivityResult ->
ActivityResultContracts.StartActivityForResult()
) { result: ActivityResult ->
val handler = synchronized(resultLauncherMap) {
resultLauncherMap.remove(requestCode);
}
if(handler != null)
if (handler != null)
handler(result);
};
override fun launchForResult(intent: Intent, code: Int, handler: (ActivityResult)->Unit) {
override fun launchForResult(intent: Intent, code: Int, handler: (ActivityResult) -> Unit) {
synchronized(resultLauncherMap) {
resultLauncherMap[code] = handler;
}
@ -1229,32 +1309,34 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
companion object {
private val TAG = "MainActivity"
fun getTabIntent(context: Context, tab: String) : Intent {
fun getTabIntent(context: Context, tab: String): Intent {
val sourcesIntent = Intent(context, MainActivity::class.java);
sourcesIntent.action = "TAB";
sourcesIntent.putExtra("TAB", tab);
sourcesIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
sourcesIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
return sourcesIntent;
}
fun getVideoIntent(context: Context, videoUrl: String) : Intent {
fun getVideoIntent(context: Context, videoUrl: String): Intent {
val sourcesIntent = Intent(context, MainActivity::class.java);
sourcesIntent.action = "VIDEO";
sourcesIntent.putExtra("VIDEO", videoUrl);
sourcesIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
sourcesIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
return sourcesIntent;
}
fun getActionIntent(context: Context, action: String) : Intent {
fun getActionIntent(context: Context, action: String): Intent {
val sourcesIntent = Intent(context, MainActivity::class.java);
sourcesIntent.action = "ACTION";
sourcesIntent.putExtra("ACTION", action);
sourcesIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
sourcesIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
return sourcesIntent;
}
fun getImportOptionsIntent(context: Context): Intent {
val sourcesIntent = Intent(context, MainActivity::class.java);
sourcesIntent.action = "IMPORT_OPTIONS";
sourcesIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
sourcesIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
return sourcesIntent;
}
}

View file

@ -933,7 +933,7 @@ class VideoDetailView : ConstraintLayout {
val device = devices.first();
UIDialogs.showConfirmationDialog(context, "Would you like to open\n[${videoToSend.name}]\non ${device.remotePublicKey}" , {
fragment.lifecycleScope.launch(Dispatchers.IO) {
device.sendJson(GJSyncOpcodes.sendToDevices, SendToDevicePackage(videoToSend.url, (lastPositionMilliseconds/1000).toInt()));
device.sendJsonData(GJSyncOpcodes.sendToDevices, SendToDevicePackage(videoToSend.url, (lastPositionMilliseconds/1000).toInt()));
}
})
}
@ -1362,11 +1362,9 @@ class VideoDetailView : ConstraintLayout {
me._playbackTracker = null;
} catch (ex: Throwable) {
Logger.e(TAG, "Playback tracker failed", ex);
if (me.video?.isLive == true) withContext(Dispatchers.Main) {
UIDialogs.toast(
context,
context.getString(R.string.failed_to_get_playback_tracker)
);
if(me.video?.isLive == true || ex.message?.contains("Unable to resolve host") == true) withContext(Dispatchers.Main) {
UIDialogs.toast(context, context.getString(R.string.failed_to_get_playback_tracker));
};
else withContext(Dispatchers.Main) {
UIDialogs.showGeneralErrorDialog(
@ -1759,7 +1757,7 @@ class VideoDetailView : ConstraintLayout {
});
else
_player.setArtwork(null);
_player.setSource(videoSource, audioSource, _playWhenReady, false);
_player.setSource(videoSource, audioSource, _playWhenReady, false, resume = resumePositionMs > 0);
if(subtitleSource != null)
_player.swapSubtitles(fragment.lifecycleScope, subtitleSource);
_player.seekTo(resumePositionMs);
@ -2915,13 +2913,15 @@ class VideoDetailView : ConstraintLayout {
.exception<Throwable> {
Logger.w(ChannelFragment.TAG, "Failed to load video.", it);
handleErrorOrCall {
_retryCount = 0;
_retryJob?.cancel();
_retryJob = null;
_liveTryJob?.cancel();
_liveTryJob = null;
UIDialogs.showGeneralRetryErrorDialog(context, context.getString(R.string.failed_to_load_video), it, ::fetchVideo, null, fragment);
if(!(it.message?.contains("Unable to resolve host") ?: false && nextVideo())){
handleErrorOrCall {
_retryCount = 0;
_retryJob?.cancel();
_retryJob = null;
_liveTryJob?.cancel();
_liveTryJob = null;
UIDialogs.showGeneralRetryErrorDialog(context, context.getString(R.string.failed_to_load_video), it, ::fetchVideo, null, fragment);
}
}
} else TaskHandler(IPlatformVideoDetails::class.java, {fragment.lifecycleScope});

View file

@ -26,6 +26,7 @@ import com.futo.platformplayer.stores.FragmentedStorage
import com.futo.platformplayer.stores.SearchHistoryStorage
class SearchTopBarFragment : TopFragment() {
@Suppress("PrivatePropertyName")
private val TAG = "SearchTopBarFragment"
private var _editSearch: EditText? = null;
@ -191,29 +192,32 @@ class SearchTopBarFragment : TopFragment() {
}
private fun onDone() {
val editSearch = _editSearch;
val editSearch = _editSearch
if (editSearch != null) {
val text = editSearch.text.toString();
if (text.length < 3) {
UIDialogs.toast(getString(R.string.please_use_at_least_3_characters));
return;
val text = editSearch.text.toString()
if (text.isEmpty()) {
UIDialogs.toast(getString(R.string.please_use_at_least_1_character))
return
}
editSearch.clearFocus();
_inputMethodManager?.hideSoftInputFromWindow(editSearch.windowToken, 0);
editSearch.clearFocus()
_inputMethodManager?.hideSoftInputFromWindow(editSearch.windowToken, 0)
if (Settings.instance.search.searchHistory) {
val storage = FragmentedStorage.get<SearchHistoryStorage>();
storage.add(text);
val storage = FragmentedStorage.get<SearchHistoryStorage>()
storage.add(text)
}
if (_searchType == SearchType.CREATOR) {
onSearch.emit(text);
onSearch.emit(text)
} else {
onSearch.emit(text);
onSearch.emit(text)
}
} else {
Logger.w(TAG, "Unexpected condition happened where done is edit search is null but done is triggered.");
Logger.w(
TAG,
"Unexpected condition happened where done is edit search is null but done is triggered."
)
}
}

View file

@ -182,13 +182,14 @@ class HLS {
private fun parseAttributes(content: String): Map<String, String> {
val attributes = mutableMapOf<String, String>()
val attributePairs = content.substringAfter(":").splitToSequence(',')
val maybeAttributePairs = content.substringAfter(":").splitToSequence(',')
var currentPair = StringBuilder()
for (pair in attributePairs) {
for (pair in maybeAttributePairs) {
currentPair.append(pair)
if (currentPair.count { it == '\"' } % 2 == 0) { // Check if the number of quotes is even
val (key, value) = currentPair.toString().split('=')
val key = currentPair.toString().substringBefore("=")
val value = currentPair.toString().substringAfter("=")
attributes[key.trim()] = value.trim().removeSurrounding("\"")
currentPair = StringBuilder() // Reset for the next attribute
} else {

View file

@ -89,7 +89,7 @@ class StateHistory {
StateApp.instance.scopeOrNull?.launch(Dispatchers.IO) {
if(StateSync.instance.hasAtLeastOneOnlineDevice()) {
Logger.i(TAG, "SyncHistory playback broadcasted (${liveObj.name}: ${position})");
StateSync.instance.broadcastJson(
StateSync.instance.broadcastJsonData(
GJSyncOpcodes.syncHistory,
listOf(historyVideo)
);

View file

@ -537,7 +537,7 @@ class StatePlatform {
else getSortedEnabledClient().filter { if (it is JSClient) it.enableInSearch else true };
clients.parallelStream().forEach {
val searchCapabilities = it.getSearchCapabilities();
val searchCapabilities = it.getSearchChannelContentsCapabilities();
val mappedFilters = filters.map { pair -> Pair(pair.key, pair.value.map { v -> searchCapabilities.filters.first { g -> g.idOrName == pair.key }.filters.first { f -> f.idOrName == v }.value }) }.toMap();
if (it.isChannelUrl(channelUrl)) {

View file

@ -198,7 +198,7 @@ class StatePlaylists {
StateApp.instance.scopeOrNull?.launch(Dispatchers.IO) {
if(StateSync.instance.hasAtLeastOneOnlineDevice()) {
Logger.i(StateSubscriptionGroups.TAG, "SyncPlaylist (${playlist.name})");
StateSync.instance.broadcastJson(
StateSync.instance.broadcastJsonData(
GJSyncOpcodes.syncPlaylists,
SyncPlaylistsPackage(listOf(playlist), mapOf())
);
@ -217,7 +217,7 @@ class StatePlaylists {
StateApp.instance.scopeOrNull?.launch(Dispatchers.IO) {
if(StateSync.instance.hasAtLeastOneOnlineDevice()) {
Logger.i(StateSubscriptionGroups.TAG, "SyncPlaylist (${playlist.name})");
StateSync.instance.broadcastJson(
StateSync.instance.broadcastJsonData(
GJSyncOpcodes.syncPlaylists,
SyncPlaylistsPackage(listOf(), mapOf(Pair(playlist.id, OffsetDateTime.now().toEpochSecond())))
);

View file

@ -81,7 +81,7 @@ class StateSubscriptionGroups {
StateApp.instance.scopeOrNull?.launch(Dispatchers.IO) {
if(StateSync.instance.hasAtLeastOneOnlineDevice()) {
Logger.i(TAG, "SyncSubscriptionGroup (${subGroup.name})");
StateSync.instance.broadcastJson(
StateSync.instance.broadcastJsonData(
GJSyncOpcodes.syncSubscriptionGroups,
SyncSubscriptionGroupsPackage(listOf(subGroup), mapOf())
);
@ -100,7 +100,7 @@ class StateSubscriptionGroups {
StateApp.instance.scopeOrNull?.launch(Dispatchers.IO) {
if(StateSync.instance.hasAtLeastOneOnlineDevice()) {
Logger.i(TAG, "SyncSubscriptionGroup delete (${group.name})");
StateSync.instance.broadcastJson(
StateSync.instance.broadcastJsonData(
GJSyncOpcodes.syncSubscriptionGroups,
SyncSubscriptionGroupsPackage(listOf(), mapOf(Pair(id, OffsetDateTime.now().toEpochSecond())))
);

View file

@ -250,7 +250,7 @@ class StateSubscriptions {
StateApp.instance.scopeOrNull?.launch(Dispatchers.IO) {
try {
StateSync.instance.broadcast(
StateSync.instance.broadcastData(
GJSyncOpcodes.syncSubscriptions, Json.encodeToString(
SyncSubscriptionsPackage(
listOf(subObj),
@ -299,7 +299,7 @@ class StateSubscriptions {
StateApp.instance.scopeOrNull?.launch(Dispatchers.IO) {
try {
StateSync.instance.broadcast(
StateSync.instance.broadcastData(
GJSyncOpcodes.syncSubscriptions, Json.encodeToString(
SyncSubscriptionsPackage(
listOf(),

View file

@ -370,26 +370,29 @@ class StateSync {
Logger.i(TAG, "Connection authorized for ${remotePublicKey} because initiator")
}
},
onData = { s, opcode, data ->
session?.handlePacket(s, opcode, data)
onData = { s, opcode, subOpcode, data ->
session?.handlePacket(s, opcode, subOpcode, data)
})
}
inline fun <reified T> broadcastJson(opcode: UByte, data: T) {
broadcast(opcode, Json.encodeToString(data));
inline fun <reified T> broadcastJsonData(subOpcode: UByte, data: T) {
broadcast(SyncSocketSession.Opcode.DATA.value, subOpcode, Json.encodeToString(data));
}
fun broadcast(opcode: UByte, data: String) {
broadcast(opcode, data.toByteArray(Charsets.UTF_8));
fun broadcastData(subOpcode: UByte, data: String) {
broadcast(SyncSocketSession.Opcode.DATA.value, subOpcode, data.toByteArray(Charsets.UTF_8));
}
fun broadcast(opcode: UByte, data: ByteArray) {
fun broadcast(opcode: UByte, subOpcode: UByte, data: String) {
broadcast(opcode, subOpcode, data.toByteArray(Charsets.UTF_8));
}
fun broadcast(opcode: UByte, subOpcode: UByte, data: ByteArray) {
for(session in getSessions()) {
try {
if (session.isAuthorized && session.connected) {
session.send(opcode, data);
session.send(opcode, subOpcode, data);
}
}
catch(ex: Exception) {
Logger.w(TAG, "Failed to broadcast ${opcode} to ${session.remotePublicKey}: ${ex.message}}", ex);
Logger.w(TAG, "Failed to broadcast (opcode = ${opcode}, subOpcode = ${subOpcode}) to ${session.remotePublicKey}: ${ex.message}}", ex);
}
}
}
@ -398,7 +401,7 @@ class StateSync {
val time = measureTimeMillis {
//val export = StateBackup.export();
//session.send(GJSyncOpcodes.syncExport, export.asZip());
session.send(GJSyncOpcodes.syncStateExchange, getSyncSessionDataString(session.remotePublicKey));
session.sendData(GJSyncOpcodes.syncStateExchange, getSyncSessionDataString(session.remotePublicKey));
}
Logger.i(TAG, "Generated and sent sync export in ${time}ms");
}

View file

@ -45,6 +45,7 @@ class SyncSession : IAuthorizable {
private val _onConnectedChanged: (session: SyncSession, connected: Boolean) -> Unit
val remotePublicKey: String
override val isAuthorized get() = _authorized && _remoteAuthorized
private var _wasAuthorized = false
var connected: Boolean = false
private set(v) {
@ -94,8 +95,10 @@ class SyncSession : IAuthorizable {
}
private fun checkAuthorized() {
if (isAuthorized)
if (!_wasAuthorized && isAuthorized) {
_wasAuthorized = true
_onAuthorized.invoke(this)
}
}
fun removeSocketSession(socketSession: SyncSocketSession) {
@ -117,29 +120,34 @@ class SyncSession : IAuthorizable {
_onClose.invoke(this)
}
fun handlePacket(socketSession: SyncSocketSession, opcode: UByte, data: ByteBuffer) {
Logger.i(TAG, "Handle packet (opcode: ${opcode}, data.length: ${data.remaining()})")
when (opcode) {
Opcode.NOTIFY_AUTHORIZED.value -> {
_remoteAuthorized = true
checkAuthorized()
}
Opcode.NOTIFY_UNAUTHORIZED.value -> {
_remoteAuthorized = false
_onUnauthorized(this)
}
//TODO: Handle any kind of packet (that is not necessarily authorized)
}
if (!isAuthorized) {
return
}
Logger.i(TAG, "Received ${opcode} (${data.remaining()} bytes)")
//TODO: Abstract this out
fun handlePacket(socketSession: SyncSocketSession, opcode: UByte, subOpcode: UByte, data: ByteBuffer) {
try {
Logger.i(TAG, "Handle packet (opcode: ${opcode}, subOpcode: ${subOpcode}, data.length: ${data.remaining()})")
when (opcode) {
Opcode.NOTIFY_AUTHORIZED.value -> {
_remoteAuthorized = true
checkAuthorized()
}
Opcode.NOTIFY_UNAUTHORIZED.value -> {
_remoteAuthorized = false
_onUnauthorized(this)
}
//TODO: Handle any kind of packet (that is not necessarily authorized)
}
if (!isAuthorized) {
return
}
if (opcode != Opcode.DATA.value) {
Logger.w(TAG, "Unknown opcode received: (opcode = ${opcode}, subOpcode = ${subOpcode})}")
return
}
Logger.i(TAG, "Received (opcode = ${opcode}, subOpcode = ${subOpcode}) (${data.remaining()} bytes)")
//TODO: Abstract this out
when (subOpcode) {
GJSyncOpcodes.sendToDevices -> {
StateApp.instance.scopeOrNull?.launch(Dispatchers.Main) {
val context = StateApp.instance.contextOrNull;
@ -164,13 +172,13 @@ class SyncSession : IAuthorizable {
Logger.i(TAG, "Received SyncSessionData from " + remotePublicKey);
send(GJSyncOpcodes.syncSubscriptions, StateSubscriptions.instance.getSyncSubscriptionsPackageString());
send(GJSyncOpcodes.syncSubscriptionGroups, StateSubscriptionGroups.instance.getSyncSubscriptionGroupsPackageString());
send(GJSyncOpcodes.syncPlaylists, StatePlaylists.instance.getSyncPlaylistsPackageString())
sendData(GJSyncOpcodes.syncSubscriptions, StateSubscriptions.instance.getSyncSubscriptionsPackageString());
sendData(GJSyncOpcodes.syncSubscriptionGroups, StateSubscriptionGroups.instance.getSyncSubscriptionGroupsPackageString());
sendData(GJSyncOpcodes.syncPlaylists, StatePlaylists.instance.getSyncPlaylistsPackageString())
val recentHistory = StateHistory.instance.getRecentHistory(syncSessionData.lastHistory);
if(recentHistory.size > 0)
sendJson(GJSyncOpcodes.syncHistory, recentHistory);
sendJsonData(GJSyncOpcodes.syncHistory, recentHistory);
}
GJSyncOpcodes.syncExport -> {
@ -338,16 +346,19 @@ class SyncSession : IAuthorizable {
}
inline fun <reified T> sendJson(opcode: UByte, data: T) {
send(opcode, Json.encodeToString<T>(data));
inline fun <reified T> sendJsonData(subOpcode: UByte, data: T) {
send(Opcode.DATA.value, subOpcode, Json.encodeToString<T>(data));
}
fun send(opcode: UByte, data: String) {
send(opcode, data.toByteArray(Charsets.UTF_8));
fun sendData(subOpcode: UByte, data: String) {
send(Opcode.DATA.value, subOpcode, data.toByteArray(Charsets.UTF_8));
}
fun send(opcode: UByte, data: ByteArray) {
fun send(opcode: UByte, subOpcode: UByte, data: String) {
send(opcode, subOpcode, data.toByteArray(Charsets.UTF_8));
}
fun send(opcode: UByte, subOpcode: UByte, data: ByteArray) {
val sock = _socketSessions.firstOrNull();
if(sock != null){
sock.send(opcode, ByteBuffer.wrap(data));
sock.send(opcode, subOpcode, ByteBuffer.wrap(data));
}
else
throw IllegalStateException("Session has no active sockets");

View file

@ -2,6 +2,7 @@ package com.futo.platformplayer.sync.internal
import com.futo.platformplayer.LittleEndianDataInputStream
import com.futo.platformplayer.LittleEndianDataOutputStream
import com.futo.platformplayer.ensureNotMainThread
import com.futo.platformplayer.logging.Logger
import com.futo.platformplayer.noise.protocol.CipherStatePair
import com.futo.platformplayer.noise.protocol.DHState
@ -18,7 +19,8 @@ class SyncSocketSession {
NOTIFY_UNAUTHORIZED(3u),
STREAM_START(4u),
STREAM_DATA(5u),
STREAM_END(6u)
STREAM_END(6u),
DATA(7u)
}
private val _inputStream: LittleEndianDataInputStream
@ -41,12 +43,12 @@ class SyncSocketSession {
private val _localKeyPair: DHState
private var _localPublicKey: String
val localPublicKey: String get() = _localPublicKey
private val _onData: (session: SyncSocketSession, opcode: UByte, data: ByteBuffer) -> Unit
private val _onData: (session: SyncSocketSession, opcode: UByte, subOpcode: UByte, data: ByteBuffer) -> Unit
var authorizable: IAuthorizable? = null
val remoteAddress: String
constructor(remoteAddress: String, localKeyPair: DHState, inputStream: LittleEndianDataInputStream, outputStream: LittleEndianDataOutputStream, onClose: (session: SyncSocketSession) -> Unit, onHandshakeComplete: (session: SyncSocketSession) -> Unit, onData: (session: SyncSocketSession, opcode: UByte, data: ByteBuffer) -> Unit) {
constructor(remoteAddress: String, localKeyPair: DHState, inputStream: LittleEndianDataInputStream, outputStream: LittleEndianDataOutputStream, onClose: (session: SyncSocketSession) -> Unit, onHandshakeComplete: (session: SyncSocketSession) -> Unit, onData: (session: SyncSocketSession, opcode: UByte, subOpcode: UByte, data: ByteBuffer) -> Unit) {
_inputStream = inputStream
_outputStream = outputStream
_onClose = onClose
@ -159,10 +161,11 @@ class SyncSocketSession {
}
private fun performVersionCheck() {
_outputStream.writeInt(1)
val CURRENT_VERSION = 2
_outputStream.writeInt(CURRENT_VERSION)
val version = _inputStream.readInt()
Logger.i(TAG, "performVersionCheck (version = $version)")
if (version != 1)
if (version != CURRENT_VERSION)
throw Exception("Invalid version")
}
@ -205,8 +208,9 @@ class SyncSocketSession {
throw Exception("Handshake finished without completing")
}
fun send(opcode: UByte, subOpcode: UByte, data: ByteBuffer) {
ensureNotMainThread()
fun send(opcode: UByte, data: ByteBuffer) {
if (data.remaining() + HEADER_SIZE > MAXIMUM_PACKET_SIZE) {
val segmentSize = MAXIMUM_PACKET_SIZE - HEADER_SIZE
val segmentData = ByteArray(segmentSize)
@ -223,8 +227,8 @@ class SyncSocketSession {
if (sendOffset == 0) {
segmentOpcode = Opcode.STREAM_START.value
bytesToSend = segmentSize - 4 - 4 - 1
segmentPacketSize = bytesToSend + 4 + 4 + 1
bytesToSend = segmentSize - 4 - 4 - 1 - 1
segmentPacketSize = bytesToSend + 4 + 4 + 1 + 1
} else {
bytesToSend = minOf(segmentSize - 4 - 4, bytesRemaining)
segmentOpcode = if (bytesToSend >= bytesRemaining) Opcode.STREAM_END.value else Opcode.STREAM_DATA.value
@ -236,18 +240,20 @@ class SyncSocketSession {
putInt(if (segmentOpcode == Opcode.STREAM_START.value) data.remaining() else sendOffset)
if (segmentOpcode == Opcode.STREAM_START.value) {
put(opcode.toByte())
put(subOpcode.toByte())
}
put(data.array(), data.position() + sendOffset, bytesToSend)
}
send(segmentOpcode, ByteBuffer.wrap(segmentData, 0, segmentPacketSize))
send(segmentOpcode, 0u, ByteBuffer.wrap(segmentData, 0, segmentPacketSize))
sendOffset += bytesToSend
}
} else {
synchronized(_sendLockObject) {
ByteBuffer.wrap(_sendBuffer).order(ByteOrder.LITTLE_ENDIAN).apply {
putInt(data.remaining() + 1)
putInt(data.remaining() + 2)
put(opcode.toByte())
put(subOpcode.toByte())
put(data.array(), data.position(), data.remaining())
}
@ -260,12 +266,15 @@ class SyncSocketSession {
}
}
fun send(opcode: UByte) {
synchronized(_sendLockObject) {
ByteBuffer.wrap(_sendBuffer, 0, 4).order(ByteOrder.LITTLE_ENDIAN).putInt(1)
_sendBuffer.asUByteArray()[4] = opcode
fun send(opcode: UByte, subOpcode: UByte = 0u) {
ensureNotMainThread()
//Logger.i(TAG, "Encrypting message (size = ${HEADER_SIZE})")
synchronized(_sendLockObject) {
ByteBuffer.wrap(_sendBuffer, 0, 4).order(ByteOrder.LITTLE_ENDIAN).putInt(2)
_sendBuffer.asUByteArray()[4] = opcode
_sendBuffer.asUByteArray()[5] = subOpcode
//Logger.i(TAG, "Encrypting message (opcode = ${opcode}, subOpcode = ${subOpcode}, size = ${HEADER_SIZE})")
val len = _cipherStatePair!!.sender.encryptWithAd(null, _sendBuffer, 0, _sendBufferEncrypted, 0, HEADER_SIZE)
//Logger.i(TAG, "Sending encrypted message (size = ${len})")
@ -277,19 +286,19 @@ class SyncSocketSession {
private fun handleData(data: ByteArray, length: Int) {
if (length < HEADER_SIZE)
throw Exception("Packet must be at least 5 bytes (header size)")
throw Exception("Packet must be at least 6 bytes (header size)")
val size = ByteBuffer.wrap(data, 0, 4).order(ByteOrder.LITTLE_ENDIAN).int
if (size != length - 4)
throw Exception("Incomplete packet received")
val opcode = data.asUByteArray()[4]
val packetData = ByteBuffer.wrap(data, HEADER_SIZE, size - 1)
handlePacket(opcode, packetData.order(ByteOrder.LITTLE_ENDIAN))
val subOpcode = data.asUByteArray()[5]
val packetData = ByteBuffer.wrap(data, HEADER_SIZE, size - 2)
handlePacket(opcode, subOpcode, packetData.order(ByteOrder.LITTLE_ENDIAN))
}
private fun handlePacket(opcode: UByte, data: ByteBuffer) {
private fun handlePacket(opcode: UByte, subOpcode: UByte, data: ByteBuffer) {
when (opcode) {
Opcode.PING.value -> {
send(Opcode.PONG.value)
@ -302,7 +311,7 @@ class SyncSocketSession {
}
Opcode.NOTIFY_AUTHORIZED.value,
Opcode.NOTIFY_UNAUTHORIZED.value -> {
_onData.invoke(this, opcode, data)
_onData.invoke(this, opcode, subOpcode, data)
return
}
}
@ -316,8 +325,9 @@ class SyncSocketSession {
val id = data.int
val expectedSize = data.int
val op = data.get().toUByte()
val subOp = data.get().toUByte()
val syncStream = SyncStream(expectedSize, op)
val syncStream = SyncStream(expectedSize, op, subOp)
if (data.remaining() > 0) {
syncStream.add(data.array(), data.position(), data.remaining())
}
@ -362,10 +372,13 @@ class SyncSocketSession {
throw Exception("After sync stream end, the stream must be complete")
}
handlePacket(syncStream.opcode, syncStream.getBytes().let { ByteBuffer.wrap(it).order(ByteOrder.LITTLE_ENDIAN) })
handlePacket(syncStream.opcode, syncStream.subOpcode, syncStream.getBytes().let { ByteBuffer.wrap(it).order(ByteOrder.LITTLE_ENDIAN) })
}
Opcode.DATA.value -> {
_onData.invoke(this, opcode, subOpcode, data)
}
else -> {
_onData.invoke(this, opcode, data)
Logger.w(TAG, "Unknown opcode received (opcode = ${opcode}, subOpcode = ${subOpcode})")
}
}
}
@ -374,6 +387,6 @@ class SyncSocketSession {
private const val TAG = "SyncSocketSession"
const val MAXIMUM_PACKET_SIZE = 65535 - 16
const val MAXIMUM_PACKET_SIZE_ENCRYPTED = MAXIMUM_PACKET_SIZE + 16
const val HEADER_SIZE = 5
const val HEADER_SIZE = 6
}
}

View file

@ -1,6 +1,6 @@
package com.futo.platformplayer.sync.internal
class SyncStream(expectedSize: Int, val opcode: UByte) {
class SyncStream(expectedSize: Int, val opcode: UByte, val subOpcode: UByte) {
companion object {
const val MAXIMUM_SIZE = 10_000_000
}

View file

@ -327,8 +327,8 @@ abstract class FutoVideoPlayerBase : RelativeLayout {
return _chapters?.let { chaps -> chaps.find { pos.toDouble() / 1000 > it.timeStart && pos.toDouble() / 1000 < it.timeEnd && (toIgnore.isEmpty() || !toIgnore.contains(it)) } };
}
fun setSource(videoSource: IVideoSource?, audioSource: IAudioSource? = null, play: Boolean = false, keepSubtitles: Boolean = false) {
swapSources(videoSource, audioSource,false, play, keepSubtitles);
fun setSource(videoSource: IVideoSource?, audioSource: IAudioSource? = null, play: Boolean = false, keepSubtitles: Boolean = false, resume: Boolean = false) {
swapSources(videoSource, audioSource,resume, play, keepSubtitles);
}
fun swapSources(videoSource: IVideoSource?, audioSource: IAudioSource?, resume: Boolean = true, play: Boolean = true, keepSubtitles: Boolean = false): Boolean {
var videoSourceUsed = videoSource;

View file

@ -22,6 +22,7 @@
android:id="@+id/button_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_back"
android:paddingRight="20dp"
app:srcCompat="@drawable/ic_back_thin_white_16dp" />

View file

@ -22,6 +22,7 @@
android:id="@+id/button_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_back"
android:paddingRight="20dp"
app:srcCompat="@drawable/ic_back_thin_white_16dp" />

View file

@ -22,6 +22,7 @@
android:id="@+id/button_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_back"
android:paddingRight="20dp"
app:srcCompat="@drawable/ic_back_thin_white_16dp" />

View file

@ -10,6 +10,7 @@
android:id="@+id/button_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_back"
android:padding="10dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_back_thin_white_16dp"

View file

@ -14,6 +14,7 @@
android:id="@+id/button_close"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_close"
android:scaleType="fitCenter"
android:padding="10dp"
app:layout_constraintLeft_toLeftOf="parent"

View file

@ -75,6 +75,7 @@
android:id="@+id/incognito_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_incognito_button"
android:src="@drawable/ic_disabled_visible_purple"
android:background="@drawable/background_button_round_black"
android:scaleType="fitCenter"

View file

@ -21,6 +21,7 @@
android:id="@+id/button_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_back"
android:paddingRight="20dp"
app:srcCompat="@drawable/ic_back_thin_white_16dp" />

View file

@ -9,6 +9,7 @@
android:id="@+id/button_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_back"
android:padding="10dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_back_thin_white_16dp"
@ -19,6 +20,7 @@
android:id="@+id/button_help"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/cd_button_help"
app:srcCompat="@drawable/ic_help"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View file

@ -10,6 +10,7 @@
android:id="@+id/button_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_back"
android:padding="10dp"
android:scaleType="fitCenter"
app:layout_constraintLeft_toLeftOf="parent"

View file

@ -9,6 +9,7 @@
android:id="@+id/button_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_back"
android:padding="10dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_back_thin_white_16dp"
@ -19,6 +20,7 @@
android:id="@+id/button_help"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/cd_button_help"
app:srcCompat="@drawable/ic_help"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View file

@ -9,6 +9,7 @@
android:id="@+id/button_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_back"
android:padding="10dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_back_thin_white_16dp"
@ -19,6 +20,7 @@
android:id="@+id/button_help"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_help"
app:srcCompat="@drawable/ic_help"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />

View file

@ -10,6 +10,7 @@
android:id="@+id/button_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_back"
android:padding="10dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_back_thin_white_16dp"
@ -20,6 +21,7 @@
android:id="@+id/button_help"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/cd_button_help"
app:srcCompat="@drawable/ic_help"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -28,6 +30,7 @@
android:id="@+id/image_polycentric"
android:layout_height="80dp"
android:layout_width="80dp"
android:contentDescription="@string/cd_image_polycentric"
android:scaleType="centerCrop"
app:shapeAppearanceOverlay="@style/roundedCorners_40dp"
app:srcCompat="@drawable/placeholder_profile"

View file

@ -10,6 +10,7 @@
android:id="@+id/button_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_back"
android:padding="10dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_back_thin_white_16dp"

View file

@ -24,6 +24,7 @@
android:id="@+id/button_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_back"
android:paddingRight="20dp"
app:srcCompat="@drawable/ic_back_thin_white_16dp" />

View file

@ -10,6 +10,7 @@
android:id="@+id/button_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_back"
android:padding="10dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_back_thin_white_16dp"

View file

@ -10,6 +10,7 @@
android:id="@+id/button_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_back"
android:padding="10dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_back_thin_white_16dp"

View file

@ -14,6 +14,7 @@
android:id="@+id/button_back"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_back"
android:padding="10dp"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_back_thin_white_16dp"

View file

@ -27,6 +27,7 @@
android:id="@+id/button_cancel"
android:layout_width="20dp"
android:layout_height="20dp"
android:contentDescription="@string/cd_button_close"
app:srcCompat="@drawable/ic_close_thin"
app:tint="#888888"
android:layout_marginEnd="30dp" />

View file

@ -97,6 +97,7 @@
android:id="@+id/button_scan_qr"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_button_scan_qr"
android:scaleType="centerCrop"
app:srcCompat="@drawable/ic_qr"
app:tint="@color/primary" />
@ -109,6 +110,7 @@
android:id="@+id/button_add"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_button_add"
android:scaleType="centerCrop"
app:srcCompat="@drawable/ic_add"
app:tint="@color/primary"

View file

@ -58,6 +58,7 @@
android:id="@+id/image_device"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="@string/cd_image_device"
app:srcCompat="@drawable/ic_chromecast"
android:scaleType="fitCenter"
app:layout_constraintLeft_toLeftOf="parent"
@ -197,6 +198,7 @@
android:id="@id/button_previous"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/cd_button_previous"
android:scaleType="centerCrop"
android:clickable="true"
android:padding="10dp"
@ -206,6 +208,7 @@
android:id="@+id/button_play"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/cd_button_play"
android:padding="20dp"
android:scaleType="fitCenter"
android:clickable="true"
@ -215,6 +218,7 @@
android:id="@+id/button_pause"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/cd_button_pause"
android:padding="10dp"
android:scaleType="fitCenter"
android:clickable="true"
@ -224,6 +228,7 @@
android:id="@+id/button_stop"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/cd_button_stop"
android:scaleType="fitCenter"
android:padding="5dp"
android:clickable="true"
@ -233,6 +238,7 @@
android:id="@id/button_next"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/cd_button_next"
android:clickable="true"
android:scaleType="centerCrop"
android:padding="10dp"

View file

@ -23,6 +23,7 @@
android:id="@+id/update_spinner"
android:layout_width="100dp"
android:layout_height="100dp"
android:contentDescription="@string/cd_update_spinner"
app:srcCompat="@drawable/ic_update_animated" />
<TextView

View file

@ -11,6 +11,7 @@
android:id="@+id/app_icon"
android:layout_width="35dp"
android:layout_height="35dp"
android:contentDescription="@string/cd_app_icon"
android:layout_marginStart="16dp"
android:layout_marginEnd="4dp"
android:scaleType="fitCenter"
@ -72,6 +73,7 @@
android:id="@+id/button_cast"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_cast_button"
android:paddingStart="16dp"
android:paddingEnd="12dp"
android:paddingTop="12dp"
@ -84,6 +86,7 @@
android:id="@+id/button_add"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_add"
android:paddingStart="5dp"
android:paddingEnd="12dp"
android:paddingTop="7dp"

View file

@ -62,6 +62,7 @@
android:background="@drawable/rounded_outline"
android:layout_width="35dp"
android:layout_height="35dp"
android:contentDescription="@string/cd_creator_thumbnail"
android:layout_marginStart="8dp"
android:scaleType="fitCenter"
app:layout_constraintLeft_toLeftOf="parent"
@ -103,6 +104,7 @@
android:id="@+id/button_sub_settings"
android:layout_width="30dp"
android:layout_height="30dp"
android:contentDescription="@string/cd_button_settings"
android:layout_marginTop="3dp"
android:layout_marginRight="10dp"
android:scaleType="fitCenter"
@ -114,6 +116,7 @@
android:id="@+id/button_subscribe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/cd_button_subscribe"
android:layout_marginEnd="4dp"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -17,6 +17,7 @@
android:id="@+id/image_channel_thumbnail"
android:layout_width="80dp"
android:layout_height="80dp"
android:contentDescription="@string/cd_creator_thumbnail"
app:srcCompat="@drawable/ic_peertube"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"

View file

@ -48,6 +48,7 @@
android:id="@+id/button_clear_search"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_clear_search"
android:paddingStart="18dp"
android:paddingEnd="18dp"
android:layout_gravity="right|center_vertical"

View file

@ -41,6 +41,7 @@
<ImageView
android:layout_width="26dp"
android:layout_height="match_parent"
android:contentDescription="@string/cd_search_icon"
app:srcCompat="@drawable/ic_search_thin"
android:scaleType="fitCenter"
android:layout_marginStart="10dp"
@ -65,6 +66,7 @@
android:id="@+id/button_clear_search"
android:layout_width="46dp"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_clear_search"
android:scaleType="fitCenter"
app:srcCompat="@drawable/ic_close_thin"
app:tint="@color/gray_ac"

View file

@ -11,6 +11,7 @@
android:id="@+id/button_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_back"
android:paddingLeft="16dp"
android:paddingRight="8dp"
app:srcCompat="@drawable/ic_back_nav" />

View file

@ -11,6 +11,7 @@
android:id="@+id/button_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_back"
android:paddingLeft="16dp"
android:paddingRight="8dp"
app:srcCompat="@drawable/ic_back_nav" />
@ -34,6 +35,7 @@
android:id="@+id/button_cast"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_cast_button"
android:paddingStart="4dp"
android:paddingEnd="4dp"
android:paddingTop="9dp"

View file

@ -10,6 +10,7 @@
android:id="@+id/app_icon"
android:layout_width="35dp"
android:layout_height="35dp"
android:contentDescription="@string/cd_app_icon"
android:layout_marginStart="16dp"
android:layout_marginEnd="4dp"
android:scaleType="fitCenter"
@ -37,6 +38,7 @@
android:id="@+id/button_cast"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_cast_button"
android:paddingStart="16dp"
android:paddingEnd="12dp"
android:paddingTop="12dp"
@ -49,6 +51,7 @@
android:id="@+id/button_search"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_search"
android:paddingStart="5dp"
android:paddingEnd="12dp"
android:paddingTop="11dp"

View file

@ -34,6 +34,7 @@
android:id="@+id/image_history"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/cd_icon_history"
app:srcCompat="@drawable/ic_clock_white"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
@ -119,6 +120,7 @@
android:id="@+id/button_create_playlist"
android:layout_width="35dp"
android:layout_height="20dp"
android:contentDescription="@string/cd_button_create_playlist"
app:srcCompat="@drawable/ic_add_white_16dp"
android:paddingEnd="15dp"
android:paddingStart="15dp"

View file

@ -58,6 +58,7 @@
android:id="@+id/button_share"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_button_share"
android:background="@drawable/background_button_round"
android:gravity="center"
android:layout_marginStart="5dp"

View file

@ -13,6 +13,7 @@
android:id="@+id/button_back"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_back"
android:paddingLeft="16dp"
android:paddingRight="16dp"
app:srcCompat="@drawable/ic_back_white_24dp" />
@ -27,6 +28,7 @@
android:id="@+id/edit_search"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:hint="Search"
android:layout_weight="1"
android:inputType="text"
android:imeOptions="actionDone"
@ -37,6 +39,7 @@
android:id="@+id/button_clear_search"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_clear_search"
android:paddingStart="18dp"
android:paddingEnd="18dp"
android:layout_gravity="right|center_vertical"
@ -48,6 +51,7 @@
android:id="@+id/button_filter"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_filter"
android:paddingStart="8dp"
android:paddingEnd="8dp"
android:scaleType="fitCenter"

View file

@ -43,6 +43,7 @@
android:id="@+id/button_delete"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_delete"
android:layout_marginLeft="5dp"
android:layout_marginRight="0dp"
android:src="@drawable/ic_trash"
@ -56,6 +57,7 @@
android:id="@+id/button_settings"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_settings"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:src="@drawable/ic_settings"
@ -69,6 +71,7 @@
android:id="@+id/image_group"
android:layout_width="110dp"
android:layout_height="70dp"
android:contentDescription="@string/cd_image_group"
android:adjustViewBounds="true"
app:circularflow_defaultRadius="10dp"
android:layout_marginLeft="30dp"
@ -90,6 +93,7 @@
<ImageButton
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/cd_edit_image"
android:padding="5dp"
android:clickable="false"
android:scaleType="fitCenter"
@ -121,6 +125,7 @@
<ImageButton
android:layout_width="20dp"
android:layout_height="20dp"
android:contentDescription="@string/cd_button_edit"
android:padding="2dp"
android:layout_marginStart="5dp"
android:layout_marginBottom="-5dp"

View file

@ -58,6 +58,7 @@
android:id="@+id/button_share"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_button_share"
android:background="@drawable/background_button_round"
android:gravity="center"
android:layout_marginStart="5dp"
@ -162,6 +163,7 @@
android:id="@+id/button_edit"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_button_edit"
android:background="@drawable/background_button_round"
android:gravity="center"
android:layout_marginStart="5dp"
@ -177,6 +179,7 @@
android:id="@+id/button_download"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_button_download"
android:background="@drawable/background_button_round"
android:gravity="center"
android:layout_marginStart="10dp"

View file

@ -36,7 +36,8 @@
<com.futo.platformplayer.views.others.CreatorThumbnail
android:id="@+id/creator_thumbnail"
android:layout_width="27dp"
android:layout_height="27dp" />
android:layout_height="27dp"
android:contentDescription="@string/cd_creator_thumbnail" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
@ -128,6 +129,7 @@
android:id="@+id/image_like_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:contentDescription="@string/cd_image_like_icon"
app:srcCompat="@drawable/ic_thumb_up" />
<TextView
@ -144,6 +146,7 @@
android:id="@+id/image_dislike_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:contentDescription="@string/cd_image_dislike_icon"
android:layout_marginStart="8dp"
android:layout_marginTop="2dp"
app:srcCompat="@drawable/ic_thumb_down" />
@ -285,6 +288,7 @@
android:id="@+id/button_share"
android:layout_width="32dp"
android:layout_height="32dp"
android:contentDescription="@string/cd_button_share"
android:background="@drawable/background_button_round"
android:gravity="center"
android:layout_marginStart="5dp"

View file

@ -103,6 +103,7 @@
android:id="@+id/minimize_play"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_minimize_play"
android:padding="10dp"
android:clickable="true"
android:scaleType="fitCenter"
@ -111,6 +112,7 @@
android:id="@+id/minimize_pause"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_minimize_pause"
android:padding="5dp"
android:scaleType="fitCenter"
android:clickable="true"
@ -119,6 +121,7 @@
android:id="@+id/minimize_close"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_minimize_close"
android:padding="5dp"
android:scaleType="fitCenter"
android:layout_marginStart="2dp"
@ -337,7 +340,8 @@
<com.futo.platformplayer.views.others.CreatorThumbnail
android:id="@+id/creator_thumbnail"
android:layout_width="35dp"
android:layout_height="35dp" />
android:layout_height="35dp"
android:contentDescription="@string/cd_creator_thumbnail" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"

View file

@ -59,6 +59,7 @@
android:id="@+id/donation_amount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/cd_donation_amount"
android:gravity="center"
tools:text="$100" />
</LinearLayout>

View file

@ -100,6 +100,7 @@
android:id="@+id/image_like_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:contentDescription="@string/cd_image_like_icon"
app:srcCompat="@drawable/ic_thumb_up" />
<TextView
@ -116,6 +117,7 @@
android:id="@+id/image_dislike_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:contentDescription="@string/cd_image_dislike_icon"
android:layout_marginStart="8dp"
android:layout_marginTop="2dp"
app:srcCompat="@drawable/ic_thumb_down" />
@ -134,6 +136,7 @@
android:id="@+id/button_replies"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/cd_button_replies"
app:pillIcon="@drawable/ic_forum"
app:pillText="55 Replies"
android:layout_marginStart="15dp" />

View file

@ -91,6 +91,7 @@
android:id="@+id/button_replies"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/cd_button_replies"
app:pillIcon="@drawable/ic_forum"
app:pillText="55 Replies"
android:layout_marginStart="15dp" />
@ -112,6 +113,7 @@
android:id="@+id/pill_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_delete"
android:textColor="@color/white"
android:textSize="13dp"
android:gravity="center_vertical"

View file

@ -56,6 +56,7 @@
android:id="@+id/button_subscribe"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:contentDescription="@string/cd_button_subscribe"
android:layout_marginTop="10dp"
app:layout_constraintTop_toBottomOf="@id/text_channel_metadata"
app:layout_constraintLeft_toLeftOf="parent"
@ -65,6 +66,7 @@
android:id="@+id/platform_indicator"
android:layout_width="24dp"
android:layout_height="24dp"
android:contentDescription="@string/cd_platform_indicator"
android:layout_marginTop="18dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"

View file

@ -10,6 +10,7 @@
android:id="@+id/image_device"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="@string/cd_image_device"
app:srcCompat="@drawable/ic_chromecast"
android:scaleType="fitCenter"
app:layout_constraintLeft_toLeftOf="parent"
@ -63,6 +64,7 @@
android:id="@+id/image_loader"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="@string/cd_image_loader"
app:srcCompat="@drawable/ic_loader_animated"
android:layout_marginEnd="8dp"/>

View file

@ -20,6 +20,7 @@
android:id="@+id/donation_author_image"
android:layout_width="20dp"
android:layout_height="20dp"
android:contentDescription="@string/cd_donation_author_image"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"

View file

@ -173,6 +173,7 @@
android:id="@+id/image_trash"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_button_delete"
app:srcCompat="@drawable/ic_trash_18dp"
android:scaleType="fitCenter"
android:paddingTop="10dp"

View file

@ -45,7 +45,8 @@
<com.futo.platformplayer.views.platform.PlatformIndicator
android:id="@+id/platform"
android:layout_width="25dp"
android:layout_height="25dp" />
android:layout_height="25dp"
android:contentDescription="@string/cd_platform_indicator" />
</LinearLayout>
</LinearLayout>

View file

@ -194,6 +194,7 @@
android:id="@+id/creator_thumbnail"
android:layout_width="32dp"
android:layout_height="32dp"
android:contentDescription="@string/cd_creator_thumbnail"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="10dp"
@ -272,6 +273,7 @@
android:id="@+id/thumbnail_platform"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="@string/cd_platform_indicator"
android:scaleType="centerInside"
tools:src="@drawable/ic_peertube"/>
</LinearLayout>

View file

@ -306,6 +306,7 @@
android:id="@+id/thumbnail_platform"
android:layout_width="20dp"
android:layout_height="20dp"
android:contentDescription="@string/cd_platform_indicator"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_margin="4dp" />

View file

@ -14,6 +14,7 @@
android:id="@+id/image_drag_drop"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_drag_drop"
app:srcCompat="@drawable/ic_dragdrop_white"
android:scaleType="fitCenter"
android:paddingTop="10dp"
@ -116,6 +117,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:contentDescription="@string/cd_download_indicator"
app:srcCompat="@drawable/download_for_offline" />
</FrameLayout>
</FrameLayout>
@ -174,6 +176,7 @@
android:id="@+id/image_trash"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_button_delete"
app:srcCompat="@drawable/ic_trash_18dp"
android:scaleType="fitCenter"
android:paddingTop="10dp"

View file

@ -41,6 +41,7 @@
android:id="@+id/thumbnail_platform"
android:layout_width="20dp"
android:layout_height="20dp"
android:contentDescription="@string/cd_platform_indicator"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_gravity="end"

View file

@ -108,6 +108,7 @@
android:id="@+id/creator_thumbnail"
android:layout_width="32dp"
android:layout_height="32dp"
android:contentDescription="@string/cd_creator_thumbnail"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="10dp"
@ -161,6 +162,7 @@
android:id="@+id/thumbnail_platform"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="@string/cd_platform_indicator"
android:scaleType="centerInside" />
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View file

@ -72,6 +72,7 @@
android:id="@+id/button_trash"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_delete"
app:srcCompat="@drawable/ic_trash"
android:padding="10dp"
android:scaleType="fitCenter"

View file

@ -90,6 +90,7 @@
android:id="@+id/platform_indicator"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="@string/cd_platform_indicator"
android:scaleType="centerInside"
android:layout_marginEnd="8dp"
app:layout_constraintTop_toTopOf="@id/image_author_thumbnail"
@ -157,6 +158,7 @@
android:id="@+id/image_like_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:contentDescription="@string/cd_image_like_icon"
app:srcCompat="@drawable/ic_thumb_up" />
<TextView
@ -173,6 +175,7 @@
android:id="@+id/image_dislike_icon"
android:layout_width="18dp"
android:layout_height="18dp"
android:contentDescription="@string/cd_image_dislike_icon"
android:layout_marginStart="8dp"
android:layout_marginTop="2dp"
app:srcCompat="@drawable/ic_thumb_down" />
@ -202,6 +205,7 @@
android:id="@+id/image_comments"
android:layout_width="18dp"
android:layout_height="18dp"
android:contentDescription="@string/Replies"
android:layout_marginStart="8dp"
android:layout_marginTop="2dp"
app:srcCompat="@drawable/ic_forum" />

View file

@ -90,6 +90,7 @@
android:id="@+id/platform_indicator"
android:layout_width="20dp"
android:layout_height="20dp"
android:contentDescription="@string/cd_platform_indicator"
android:scaleType="centerInside"
tools:src="@drawable/ic_peertube"
android:layout_marginEnd="8dp"

View file

@ -24,6 +24,7 @@
android:id="@+id/image_source"
android:layout_width="35dp"
android:layout_height="35dp"
android:contentDescription="@string/cd_platform_indicator"
app:srcCompat="@drawable/ic_peertube"
android:scaleType="fitCenter" />

View file

@ -24,6 +24,7 @@
android:id="@+id/image_source"
android:layout_width="35dp"
android:layout_height="35dp"
android:contentDescription="@string/cd_platform_indicator"
app:srcCompat="@drawable/ic_peertube"
android:scaleType="fitCenter" />

View file

@ -15,6 +15,7 @@
android:id="@+id/image_drag_drop"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_drag_drop"
app:srcCompat="@drawable/ic_dragdrop_white"
android:scaleType="fitCenter"
android:paddingTop="10dp"
@ -34,6 +35,7 @@
android:id="@+id/image_source"
android:layout_width="35dp"
android:layout_height="35dp"
android:contentDescription="@string/cd_platform_indicator"
app:srcCompat="@drawable/ic_peertube"
android:scaleType="fitCenter" />

View file

@ -14,6 +14,7 @@
android:id="@+id/creator_thumbnail"
android:layout_width="46dp"
android:layout_height="46dp"
android:contentDescription="@string/cd_creator_thumbnail"
android:layout_marginStart="20dp"/>
<LinearLayout
@ -42,7 +43,8 @@
<com.futo.platformplayer.views.platform.PlatformIndicator
android:id="@+id/platform"
android:layout_width="25dp"
android:layout_height="25dp" />
android:layout_height="25dp"
android:contentDescription="@string/cd_platform_indicator" />
<TextView
android:id="@+id/text_meta"
android:layout_width="wrap_content"
@ -60,6 +62,7 @@
android:id="@+id/button_settings"
android:layout_width="50dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_button_settings"
app:srcCompat="@drawable/ic_settings"
android:scaleType="fitCenter"
android:paddingStart="5dp"
@ -70,6 +73,7 @@
android:id="@+id/button_trash"
android:layout_width="60dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_button_delete"
app:srcCompat="@drawable/ic_trash"
android:scaleType="fitCenter"
android:paddingStart="5dp"

View file

@ -13,6 +13,7 @@
android:id="@+id/thumb"
android:layout_width="50dp"
android:layout_height="match_parent"
android:contentDescription="@string/cd_drag_drop"
android:padding="12dp"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
@ -25,6 +26,7 @@
android:id="@+id/image"
android:layout_width="75dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_image_group"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toRightOf="@id/thumb"
@ -77,6 +79,7 @@
android:id="@+id/button_trash"
android:layout_width="50dp"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_delete"
android:layout_marginRight="10dp"
android:padding="10dp"
android:scaleType="fitCenter"

View file

@ -17,6 +17,7 @@
android:id="@+id/image_drag_drop"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_drag_drop"
app:srcCompat="@drawable/ic_dragdrop_white"
android:scaleType="fitCenter"
android:paddingTop="10dp"

View file

@ -134,6 +134,7 @@
android:id="@+id/creator_thumbnail"
android:layout_width="32dp"
android:layout_height="32dp"
android:contentDescription="@string/cd_creator_thumbnail"
android:layout_marginStart="10dp"
android:layout_marginTop="10dp"
app:layout_constraintLeft_toLeftOf="parent"
@ -205,6 +206,7 @@
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_download"
android:scaleType="fitXY"
app:srcCompat="@drawable/download_for_offline" />
</FrameLayout>
@ -213,6 +215,7 @@
android:id="@+id/thumbnail_platform"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="@string/cd_platform_indicator"
android:scaleType="centerInside"
tools:src="@drawable/ic_peertube" />
</LinearLayout>
@ -230,6 +233,7 @@
android:id="@+id/button_add_to_watch_later"
android:layout_width="30dp"
android:layout_height="30dp"
android:contentDescription="@string/cd_button_add_to_watch_later"
android:layout_marginEnd="5dp"
android:background="@drawable/edit_text_background"
app:srcCompat="@drawable/ic_clock_white" />

View file

@ -40,6 +40,7 @@
android:id="@+id/thumbnail_platform_nested"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="@string/cd_platform_indicator"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_margin="5dp"
@ -173,6 +174,7 @@
android:id="@+id/creator_thumbnail"
android:layout_width="32dp"
android:layout_height="32dp"
android:contentDescription="@string/cd_creator_thumbnail"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginStart="10dp"
@ -242,6 +244,7 @@
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/cd_button_download"
android:scaleType="fitXY"
app:srcCompat="@drawable/download_for_offline" />
</FrameLayout>
@ -250,6 +253,7 @@
android:id="@+id/thumbnail_platform"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="@string/cd_platform_indicator"
android:scaleType="centerInside"
tools:src="@drawable/ic_peertube"/>
</LinearLayout>
@ -267,6 +271,7 @@
android:id="@+id/button_add_to_watch_later"
android:layout_width="30dp"
android:layout_height="30dp"
android:contentDescription="@string/cd_button_add_to_watch_later"
android:layout_marginEnd="5dp"
android:background="@drawable/edit_text_background"
app:srcCompat="@drawable/ic_clock_white" />

View file

@ -104,6 +104,7 @@
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/cd_download_indicator"
android:scaleType="fitXY"
app:srcCompat="@drawable/download_for_offline" />
</FrameLayout>
@ -112,6 +113,7 @@
android:id="@+id/thumbnail_platform"
android:layout_width="20dp"
android:layout_height="20dp"
android:contentDescription="@string/cd_platform_indicator"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_gravity="end"
@ -188,6 +190,7 @@
android:id="@+id/button_add_to_watch_later"
android:layout_width="wrap_content"
android:layout_height="27dp"
android:contentDescription="@string/cd_button_add_to_watch_later"
android:src="@drawable/ic_clock_white"
android:paddingTop="7dp"
android:paddingBottom="6dp"

View file

@ -104,6 +104,7 @@
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:contentDescription="@string/cd_download_indicator"
android:scaleType="fitXY"
app:srcCompat="@drawable/download_for_offline" />
</FrameLayout>
@ -112,6 +113,7 @@
android:id="@+id/thumbnail_platform"
android:layout_width="20dp"
android:layout_height="20dp"
android:contentDescription="@string/cd_platform_indicator"
android:layout_alignParentStart="true"
android:layout_alignParentBottom="true"
android:layout_gravity="end"
@ -227,6 +229,7 @@
android:id="@+id/button_add_to_watch_later"
android:layout_width="wrap_content"
android:layout_height="27dp"
android:contentDescription="@string/cd_button_add_to_watch_later"
android:src="@drawable/ic_clock_white"
android:paddingTop="7dp"
android:paddingBottom="6dp"
@ -320,6 +323,7 @@
android:id="@+id/thumbnail_platform_nested"
android:layout_width="20dp"
android:layout_height="20dp"
android:contentDescription="@string/cd_platform_indicator"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:layout_margin="4dp" />

View file

@ -66,6 +66,7 @@
android:id="@+id/button_close"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_button_close"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_margin="7dp"
@ -126,6 +127,7 @@
android:scaleType="fitCenter"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_creator_thumbnail"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_margin="20dp"
@ -159,6 +161,7 @@
android:id="@+id/donation_amount"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:contentDescription="@string/cd_donation_amount"
android:gravity="center"
tools:text="$100" />
</LinearLayout>
@ -229,6 +232,7 @@
android:scaleType="fitCenter"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_creator_thumbnail"
android:layout_marginEnd="10dp"
android:layout_marginStart="-20dp"
android:src="@drawable/placeholder_profile" />

View file

@ -56,6 +56,7 @@
android:id="@+id/button_close"
android:layout_width="40dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_button_close"
android:padding="5dp"
android:src="@drawable/ic_close" />
</LinearLayout>

View file

@ -25,6 +25,7 @@
android:id="@+id/thumbnail_player_unmute"
android:layout_width="34dp"
android:layout_height="34dp"
android:contentDescription="@string/cd_thumbnail_player_unmute"
android:padding="7dp"
android:layout_gravity="center_vertical"
android:background="@color/transparent"

View file

@ -14,6 +14,7 @@
android:id="@+id/button_minimize"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_minimize"
android:scaleType="fitCenter"
android:clickable="true"
android:padding="3dp"
@ -33,6 +34,7 @@
android:id="@+id/button_autoplay"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_autoplay"
android:scaleType="fitCenter"
android:clickable="true"
android:padding="12dp"
@ -41,6 +43,7 @@
android:id="@+id/button_cast"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_cast_button"
android:scaleType="fitCenter"
android:clickable="true"
android:padding="12dp"
@ -49,6 +52,7 @@
android:id="@+id/button_rotate_lock"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_rotate_lock"
android:scaleType="fitCenter"
android:clickable="true"
android:padding="12dp"
@ -57,6 +61,7 @@
android:id="@+id/button_loop"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_loop"
android:scaleType="fitCenter"
android:clickable="true"
android:padding="12dp"
@ -65,6 +70,7 @@
android:id="@+id/button_settings"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_settings"
android:scaleType="fitCenter"
android:clickable="true"
android:padding="12dp"
@ -75,6 +81,7 @@
android:id="@+id/button_previous"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/cd_button_previous"
android:scaleType="centerCrop"
android:clickable="true"
android:layout_marginRight="40dp"
@ -118,6 +125,7 @@
android:id="@+id/button_next"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/cd_button_next"
android:clickable="true"
android:scaleType="centerCrop"
android:padding="5dp"
@ -131,6 +139,7 @@
android:id="@+id/button_fullscreen"
android:layout_width="55dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_button_fullscreen"
android:clickable="true"
app:srcCompat="@drawable/ic_expand"
app:layout_constraintRight_toRightOf="parent"

View file

@ -13,6 +13,7 @@
android:id="@+id/button_minimize"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_minimize"
android:layout_centerVertical="true"
android:layout_centerHorizontal="true"
android:scaleType="fitCenter"
@ -61,6 +62,7 @@
android:id="@+id/button_autoplay"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_autoplay"
android:scaleType="fitCenter"
android:clickable="true"
android:padding="12dp"
@ -69,6 +71,7 @@
android:id="@+id/button_cast"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_cast_button"
android:scaleType="fitCenter"
android:clickable="true"
android:padding="12dp"
@ -77,6 +80,7 @@
android:id="@+id/button_rotate_lock"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_rotate_lock"
android:scaleType="fitCenter"
android:clickable="true"
android:padding="12dp"
@ -85,6 +89,7 @@
android:id="@+id/button_loop"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_loop"
android:scaleType="fitCenter"
android:clickable="true"
android:padding="12dp"
@ -93,6 +98,7 @@
android:id="@+id/button_settings"
android:layout_width="50dp"
android:layout_height="50dp"
android:contentDescription="@string/cd_button_settings"
android:scaleType="fitCenter"
android:clickable="true"
android:padding="12dp"
@ -103,6 +109,7 @@
android:id="@+id/button_previous"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/cd_button_previous"
android:scaleType="centerCrop"
android:clickable="true"
android:layout_marginRight="40dp"
@ -146,6 +153,7 @@
android:id="@+id/button_next"
android:layout_width="60dp"
android:layout_height="60dp"
android:contentDescription="@string/cd_button_next"
android:clickable="true"
android:scaleType="centerCrop"
android:padding="5dp"
@ -159,6 +167,7 @@
android:id="@+id/button_fullscreen"
android:layout_width="55dp"
android:layout_height="40dp"
android:contentDescription="@string/cd_button_fullscreen"
android:clickable="true"
app:srcCompat="@drawable/ic_expand"
app:layout_constraintRight_toRightOf="parent"

View file

@ -727,7 +727,7 @@
<string name="not_yet_available_retrying_in_time_s">Not yet available, retrying in {time}s</string>
<string name="failed_to_retry_for_live_stream">Failed to retry for live stream</string>
<string name="this_app_is_in_development_please_submit_bug_reports_and_understand_that_many_features_are_incomplete">This app is in development. Please submit bug reports and understand that many features are incomplete.</string>
<string name="please_use_at_least_3_characters">Please use at least 3 characters</string>
<string name="please_use_at_least_1_character">Please use at least 1 character</string>
<string name="are_you_sure_you_want_to_delete_this_video">Are you sure you want to delete this video?</string>
<string name="tap_to_open">Tap to open</string>
<string name="update_available_exclamation">Update available!</string>
@ -811,6 +811,58 @@
<string name="scroll_to_top">Scroll to top</string>
<string name="disable_battery_optimization">Disable Battery Optimization</string>
<string name="click_to_go_to_battery_optimization_settings_disabling_battery_optimization_will_prevent_the_os_from_killing_media_sessions">Click to go to battery optimization settings. Disabling battery optimization will prevent the OS from killing media sessions.</string>
<string name="contribute_personal_subscriptions_list">Contribute Personal Subscriptions List</string>
<string name="contribute_personal_subscriptions_list_description">\nWould you liked to contribute your current creator subscriptions list to FUTO?\n\nThe data will be handled according to the Grayjay privacy policy. That is the list will be anonymized and stored without any reference to whomever the list of creators belonged to.\n\nThe intention is for Grayjay and FUTO to use these data to build a cross platform creator recommendation system to make it easier to find new creators you might like from within Grayjay.</string>
<string name="cd_cast_button">Cast button</string>
<string name="cd_incognito_button">Incognito button</string>
<string name="cd_creator_thumbnail">Creator thumbnail</string>
<string name="cd_button_clear_search">Clear search</string>
<string name="cd_button_search">Search</string>
<string name="cd_search_icon">Search icon</string>
<string name="cd_button_back">Back button</string>
<string name="cd_app_icon">App icon</string>
<string name="cd_icon_history">History icon</string>
<string name="cd_button_create_playlist">Create playlist</string>
<string name="cd_button_share">Share</string>
<string name="cd_button_filter">Filter</string>
<string name="cd_button_delete">Delete</string>
<string name="cd_button_settings">Settings</string>
<string name="cd_image_group">Group image</string>
<string name="cd_button_edit">Edit</string>
<string name="cd_button_download">Download</string>
<string name="cd_minimize_close">Close</string>
<string name="cd_minimize_pause">Pause</string>
<string name="cd_minimize_play">Play</string>
<string name="cd_donation_amount">Donation amount</string>
<string name="cd_button_replies">Replies</string>
<string name="cd_image_like_icon">Like</string>
<string name="cd_image_dislike_icon">Dislike</string>
<string name="cd_button_subscribe">Subscribe</string>
<string name="cd_platform_indicator">Platform indicator</string>
<string name="cd_image_device">Device icon</string>
<string name="cd_image_loader">Loader</string>
<string name="cd_donation_author_image">Donation author image</string>
<string name="cd_edit_image">Edit image</string>
<string name="cd_button_add">Add</string>
<string name="cd_download_indicator">Download indicator</string>
<string name="cd_drag_drop">Drag and drop</string>
<string name="cd_button_add_to_watch_later">Add to Watch Later</string>
<string name="cd_button_close">Close</string>
<string name="cd_thumbnail_player_unmute">Unmute</string>
<string name="cd_button_minimize">Minimize</string>
<string name="cd_button_rotate_lock">Lock rotation</string>
<string name="cd_button_loop">Loop</string>
<string name="cd_button_previous">Previous</string>
<string name="cd_button_next">Next</string>
<string name="cd_button_fullscreen">Fullscreen</string>
<string name="cd_button_autoplay">Autoplay</string>
<string name="cd_update_spinner">Update spinner</string>
<string name="cd_button_play">Play</string>
<string name="cd_button_pause">Pause</string>
<string name="cd_button_stop">Stop</string>
<string name="cd_button_scan_qr">Scan QR code</string>
<string name="cd_button_help">Help</string>
<string name="cd_image_polycentric">Change Polycentric profile picture</string>
<string-array name="home_screen_array">
<item>Recommendations</item>
<item>Subscriptions</item>

@ -1 +1 @@
Subproject commit 58ea77229dcdb5c9ce8f1bd642baf29486d0bf21
Subproject commit 543a727d781fe5780fd0e8f20d53f6a53b285446

@ -1 +1 @@
Subproject commit 80c9b4d3b48739170b40b313be930329dcc59fe4
Subproject commit 0ce91be276681ab82d26f9471523beab6b2a0a00

View file

@ -524,8 +524,8 @@ class NoiseProtocolTest {
println("Initiator handshake complete")
handshakeLatch.countDown() // Handshake complete for initiator
},
onData = { session, opcode, data ->
println("Initiator received: Opcode $opcode, Data Length: ${data.remaining()}")
onData = { session, opcode, subOpcode, data ->
println("Initiator received: Opcode: $opcode, SubOpcode: $subOpcode, Data Length: ${data.remaining()}")
when (data.remaining()) {
randomBytesExactlyOnePacket.remaining() -> {
@ -556,8 +556,8 @@ class NoiseProtocolTest {
println("Responder handshake complete")
handshakeLatch.countDown() // Handshake complete for responder
},
onData = { session, opcode, data ->
println("Responder received: Opcode $opcode, Data Length: ${data.remaining()}")
onData = { session, opcode, subOpcode, data ->
println("Responder received: Opcode $opcode, SubOpcode $subOpcode, Data Length: ${data.remaining()}")
when (data.remaining()) {
randomBytesExactlyOnePacket.remaining() -> {
@ -590,12 +590,12 @@ class NoiseProtocolTest {
responderSession.send(SyncSocketSession.Opcode.PONG.value)
// Test data transfer
responderSession.send(SyncSocketSession.Opcode.NOTIFY_AUTHORIZED.value, randomBytesExactlyOnePacket)
initiatorSession.send(SyncSocketSession.Opcode.NOTIFY_AUTHORIZED.value, randomBytes)
responderSession.send(SyncSocketSession.Opcode.DATA.value, 0u, randomBytesExactlyOnePacket)
initiatorSession.send(SyncSocketSession.Opcode.DATA.value, 1u, randomBytes)
// Send large data to test stream handling
val start = System.currentTimeMillis()
responderSession.send(SyncSocketSession.Opcode.NOTIFY_AUTHORIZED.value, randomBytesBig)
responderSession.send(SyncSocketSession.Opcode.DATA.value, 0u, randomBytesBig)
println("Sent 10MB in ${System.currentTimeMillis() - start}ms")
// Wait for a brief period to simulate delay and allow communication

@ -1 +1 @@
Subproject commit 58ea77229dcdb5c9ce8f1bd642baf29486d0bf21
Subproject commit 543a727d781fe5780fd0e8f20d53f6a53b285446

@ -1 +1 @@
Subproject commit 80c9b4d3b48739170b40b313be930329dcc59fe4
Subproject commit 0ce91be276681ab82d26f9471523beab6b2a0a00