Solving some warning

This commit is contained in:
Kelvin 2023-12-11 13:26:13 +01:00
parent fa12f8277c
commit f31b6c50e9
7 changed files with 11 additions and 20 deletions

View file

@ -1,5 +1,6 @@
package com.futo.platformplayer.activities
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
@ -852,6 +853,7 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
* Navigate takes a MainFragment, and makes them the current main visible view
* A parameter can be provided which becomes available in the onShow of said fragment
*/
@SuppressLint("CommitTransaction")
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)")
@ -897,11 +899,6 @@ class MainActivity : AppCompatActivity, IWithResultLauncher {
}
transaction.commitNow();
} else {
//Special cases
if(segment is VideoDetailFragment) {
_fragContainerVideoDetail.visibility = View.VISIBLE;
_fragVideoDetail.maximizeVideoDetail();
}
if(!segment.hasBottomBar) {
supportFragmentManager.beginTransaction()

View file

@ -191,7 +191,7 @@ class ManagedHttpServer(private val _requestedPort: Int = 0) {
}
}
fun addBridgeHandlers(obj: Any, tag: String? = null) {
val tagToUse = tag ?: obj.javaClass.name;
//val tagToUse = tag ?: obj.javaClass.name;
val getMethods = obj::class.java.declaredMethods
.filter { it.getAnnotation(HttpGET::class.java) != null }
.map { Pair<Method, HttpGET>(it, it.getAnnotation(HttpGET::class.java)!!) }

View file

@ -41,7 +41,7 @@ class SingleAsyncItemPager<T> {
fun getCurrentItem(scope: CoroutineScope) : Deferred<T?>? {
synchronized(_requestedPageItems) {
if (_currentResultPos >= _requestedPageItems.size) {
val startPos = fillDeferredUntil(_currentResultPos);
fillDeferredUntil(_currentResultPos);
if(!_pager.hasMorePages()) {
Logger.i("SingleAsyncItemPager", "end of async page reached");
completeRemainder { it?.complete(null) };
@ -49,7 +49,7 @@ class SingleAsyncItemPager<T> {
if(_isRequesting)
return _requestedPageItems[_currentResultPos];
_isRequesting = true;
StateApp.instance.scopeOrNull?.launch(Dispatchers.IO) {
scope.launch(Dispatchers.IO) {
try {
Logger.i("SingleAsyncItemPager", "Started Pager");
val timeForPage = measureTimeMillis { _pager.nextPage() };

View file

@ -269,7 +269,7 @@ class V8Plugin {
throwExceptionFromV8(
config,
result.getOrThrow(config, "plugin_type", "V8Plugin"),
result.getOrThrow(config, "message", "V8Plugin"),
context + ":" + result.getOrThrow(config, "message", "V8Plugin"),
null,
null,
codeStripped
@ -280,7 +280,7 @@ class V8Plugin {
return result;
}
catch(scriptEx: JavetCompilationException) {
throw ScriptCompilationException(config, "Compilation: ${scriptEx.message}\n(${scriptEx.scriptingError.lineNumber})[${scriptEx.scriptingError.startColumn}-${scriptEx.scriptingError.endColumn}]: ${scriptEx.scriptingError.sourceLine}", null, codeStripped);
throw ScriptCompilationException(config, "Compilation: [${context}]: ${scriptEx.message}\n(${scriptEx.scriptingError.lineNumber})[${scriptEx.scriptingError.startColumn}-${scriptEx.scriptingError.endColumn}]: ${scriptEx.scriptingError.sourceLine}", null, codeStripped);
}
catch(executeEx: JavetExecutionException) {
if(executeEx.scriptingError?.context?.containsKey("plugin_type") == true) {

View file

@ -731,7 +731,6 @@ class StateApp {
StatePlatform.instance.reloadClient(context, client.config.id);
} catch (e: Throwable) {
Logger.e(SourceDetailFragment.TAG, "Failed to reload client.", e)
return@launch;
}
}
}

View file

@ -676,7 +676,7 @@ class StatePlatform {
}
}
fun getChannelContent(baseClient: IPlatformClient, channelUrl: String, isSubscriptionOptimized: Boolean = false, usePooledClients: Int = 0, ignorePlugins: List<String>? = null): IPager<IPlatformContent> {
fun getChannelContent(baseClient: IPlatformClient, channelUrl: String, isSubscriptionOptimized: Boolean = false, usePooledClients: Int = 0): IPager<IPlatformContent> {
val clientCapabilities = baseClient.getChannelCapabilities();
val client = if(usePooledClients > 1)
_channelClientPool.getClientPooled(baseClient, usePooledClients);
@ -796,7 +796,7 @@ class StatePlatform {
fun getChannelContent(channelUrl: String, isSubscriptionOptimized: Boolean = false, usePooledClients: Int = 0, ignorePlugins: List<String>? = null): IPager<IPlatformContent> {
Logger.i(TAG, "Platform - getChannelVideos");
val baseClient = getChannelClient(channelUrl, ignorePlugins);
return getChannelContent(baseClient, channelUrl, isSubscriptionOptimized, usePooledClients, ignorePlugins);
return getChannelContent(baseClient, channelUrl, isSubscriptionOptimized, usePooledClients);
}
fun getChannelContent(channelUrl: String, type: String?, ordering: String = ResultCapabilities.ORDER_CHONOLOGICAL): IPager<IPlatformContent> {
val client = getChannelClient(channelUrl);
@ -899,18 +899,13 @@ class StatePlatform {
devId = newClient.devID;
try {
StateDeveloper.instance.initializeDev(devId!!);
var didEnable = false;
if (isPrimary) {
_primaryClientObj = newClient;
_enabledClients.add(0, newClient);
newClient.initialize();
didEnable = true;
} else if (isEnabled) {
_enabledClients.add(newClient);
if(!didEnable) {
newClient.initialize();
didEnable = true;
}
newClient.initialize();
}
_availableClients.add(newClient);
} catch (ex: Exception) {

View file

@ -153,7 +153,7 @@ class SimpleSubscriptionAlgorithm(
try {
val platformClient = StatePlatform.instance.getChannelClientOrNull(url, toIgnore) ?: continue;
val time = measureTimeMillis {
pager = StatePlatform.instance.getChannelContent(platformClient, url, true, threadPool.poolSize, toIgnore);
pager = StatePlatform.instance.getChannelContent(platformClient, url, true, threadPool.poolSize);
pager = StateCache.cachePagerResults(scope, pager!!) {
onNewCacheHit.emit(sub, it);
};