Skip to content

Commit

Permalink
Fix lint (fourth batch)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShareASmile committed Nov 5, 2023
1 parent 1fc0d67 commit 72da350
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 39 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,18 @@ abstract class SubscriptionDAO : BasicDAO<SubscriptionEntity> {
abstract override fun getAll(): Flowable<List<SubscriptionEntity>>

@Query(
"""
"""
SELECT * FROM subscriptions
WHERE name LIKE '%' || :filter || '%'
ORDER BY name COLLATE NOCASE ASC
"""
)
)
abstract fun getSubscriptionsFiltered(filter: String): Flowable<List<SubscriptionEntity>>

@Query(
"""
"""
SELECT * FROM subscriptions s
LEFT JOIN feed_group_subscription_join fgs
Expand All @@ -42,13 +42,13 @@ abstract class SubscriptionDAO : BasicDAO<SubscriptionEntity> {
ORDER BY name COLLATE NOCASE ASC
"""
)
)
abstract fun getSubscriptionsOnlyUngrouped(
currentGroupId: Long
): Flowable<List<SubscriptionEntity>>

@Query(
"""
"""
SELECT * FROM subscriptions s
LEFT JOIN feed_group_subscription_join fgs
Expand All @@ -59,7 +59,7 @@ abstract class SubscriptionDAO : BasicDAO<SubscriptionEntity> {
ORDER BY name COLLATE NOCASE ASC
"""
)
)
abstract fun getSubscriptionsOnlyUngroupedFiltered(
currentGroupId: Long,
filter: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,9 +262,9 @@ class FeedFragment : BaseListFragment<FeedState, Unit>() {

if (loadedState.itemsErrors.isNotEmpty()) {
showSnackBarError(
loadedState.itemsErrors, UserAction.REQUESTED_FEED,
loadedState.itemsErrors, UserAction.REQUESTED_FEED,
"none", "Loading feed", R.string.general_error
)
)
}

if (loadedState.items.isEmpty()) {
Expand Down Expand Up @@ -308,10 +308,10 @@ class FeedFragment : BaseListFragment<FeedState, Unit>() {

private fun triggerUpdate() {
getActivity()?.startService(
Intent(requireContext(), FeedLoadService::class.java).apply {
Intent(requireContext(), FeedLoadService::class.java).apply {
putExtra(FeedLoadService.EXTRA_GROUP_ID, groupId)
}
)
)
listState = null
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ class FeedViewModel(applicationContext: Context, val groupId: Long = FeedGroupEn
oldestUpdate?.let { Calendar.getInstance().apply { time = it } }

mutableStateLiveData.postValue(
when (event) {
when (event) {
is IdleEvent -> FeedState.LoadedState(listFromDB, oldestUpdateCalendar, notLoadedCount)
is ProgressEvent -> FeedState.ProgressState(event.currentProgress, event.maxProgress, event.progressMessage)
is SuccessResultEvent -> FeedState.LoadedState(listFromDB, oldestUpdateCalendar, notLoadedCount, event.itemsErrors)
is ErrorResultEvent -> FeedState.ErrorState(event.error)
}
)
)

if (event is ErrorResultEvent || event is SuccessResultEvent) {
FeedEventManager.reset()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,13 @@ import io.reactivex.processors.PublishProcessor
import io.reactivex.schedulers.Schedulers
import org.reactivestreams.Subscriber
import org.reactivestreams.Subscription
import org.schabi.newpipe.extractor.ListInfo
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipelegacy.App
import org.schabi.newpipelegacy.MainActivity.DEBUG
import org.schabi.newpipelegacy.R
import org.schabi.newpipelegacy.database.feed.model.FeedGroupEntity
import org.schabi.newpipe.extractor.ListInfo
import org.schabi.newpipe.extractor.exceptions.ReCaptchaException
import org.schabi.newpipe.extractor.stream.StreamInfoItem
import org.schabi.newpipelegacy.local.feed.FeedDatabaseManager
import org.schabi.newpipelegacy.local.feed.service.FeedEventManager.Event.ErrorResultEvent
import org.schabi.newpipelegacy.local.feed.service.FeedEventManager.Event.IdleEvent
Expand Down Expand Up @@ -110,10 +110,10 @@ class FeedLoadService : Service() {
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
if (DEBUG) {
Log.d(
TAG,
"onStartCommand() called with: intent = [" + intent + "]," +
TAG,
"onStartCommand() called with: intent = [" + intent + "]," +
" flags = [" + flags + "], startId = [" + startId + "]"
)
)
}

if (intent == null || loadingSubscription != null) {
Expand Down Expand Up @@ -219,7 +219,7 @@ class FeedLoadService : Service() {
ExtractorHelper
.getChannelInfo(subscriptionEntity.serviceId, subscriptionEntity.url, true)
.blockingGet()
} as ListInfo<StreamInfoItem>
} as ListInfo<StreamInfoItem>

return@map Notification.createOnNext(Pair(subscriptionEntity.uid, listInfo))
} catch (e: Throwable) {
Expand Down Expand Up @@ -280,7 +280,7 @@ class FeedLoadService : Service() {
postEvent(ProgressEvent(R.string.feed_processing_message))

disposables.add(
Single
Single
.fromCallable {
feedResultsHolder.ready()

Expand All @@ -300,7 +300,7 @@ class FeedLoadService : Service() {
}
stopService()
}
)
)
}
}

Expand Down Expand Up @@ -372,9 +372,9 @@ class FeedLoadService : Service() {

private fun createNotification(): NotificationCompat.Builder {
val cancelActionIntent = PendingIntent.getBroadcast(
this,
this,
NOTIFICATION_ID, Intent(ACTION_CANCEL), 0
)
)

return NotificationCompat.Builder(this, getString(R.string.notification_channel_id))
.setOngoing(true)
Expand All @@ -394,11 +394,11 @@ class FeedLoadService : Service() {
}

disposables.add(
notificationUpdater
notificationUpdater
.publish(throttleAfterFirstEmission)
.observeOn(AndroidSchedulers.mainThread())
.subscribe(this::updateNotificationProgress)
)
)
}

private fun updateNotificationProgress(updateDescription: String?) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,18 +209,18 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
Toast.makeText(activity, R.string.invalid_directory, Toast.LENGTH_SHORT).show()
} else {
activity.startService(
Intent(activity, SubscriptionsExportService::class.java)
Intent(activity, SubscriptionsExportService::class.java)
.putExtra(KEY_FILE_PATH, exportFile.absolutePath)
)
)
}
} else if (requestCode == REQUEST_IMPORT_CODE) {
val path = Utils.getFileForUri(data.data!!).absolutePath
ImportConfirmationDialog.show(
this,
Intent(activity, SubscriptionsImportService::class.java)
this,
Intent(activity, SubscriptionsImportService::class.java)
.putExtra(KEY_MODE, PREVIOUS_EXPORT_MODE)
.putExtra(KEY_VALUE, path)
)
)
}
}
}
Expand Down Expand Up @@ -269,7 +269,7 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
{ onImportFromServiceSelected(it) },
{ onExportSelected() },
importExportItemExpandedState ?: false
)
)
groupAdapter.add(Section(importExportItem, listOf(subscriptionsSection)))
}

Expand Down Expand Up @@ -315,10 +315,10 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {

private fun deleteChannel(selectedItem: ChannelInfoItem) {
disposables.add(
subscriptionManager.deleteSubscription(selectedItem.serviceId, selectedItem.url).subscribe {
subscriptionManager.deleteSubscription(selectedItem.serviceId, selectedItem.url).subscribe {
Toast.makeText(requireContext(), getString(R.string.channel_unsubscribed), Toast.LENGTH_SHORT).show()
}
)
)
}

override fun doInitialLoadLogic() = Unit
Expand All @@ -341,9 +341,9 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {

private val listenerChannelItem = object : OnClickGesture<ChannelInfoItem>() {
override fun selected(selectedItem: ChannelInfoItem) = NavigationHelper.openChannelFragment(
fm,
fm,
selectedItem.serviceId, selectedItem.url, selectedItem.name
)
)

override fun held(selectedItem: ChannelInfoItem) = showLongTapDialog(selectedItem)
}
Expand Down Expand Up @@ -437,9 +437,9 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
val configuration = resources.configuration

(
configuration.orientation == Configuration.ORIENTATION_LANDSCAPE &&
configuration.orientation == Configuration.ORIENTATION_LANDSCAPE &&
configuration.isLayoutSizeAtLeast(Configuration.SCREENLAYOUT_SIZE_LARGE)
)
)
}
getString(R.string.list_view_mode_grid_key) -> true
else -> false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class SubscriptionManager(context: Context) {
return if (showOnlyUngrouped) {
subscriptionTable.getSubscriptionsOnlyUngroupedFiltered(
currentGroupId, filterQuery
)
)
} else {
subscriptionTable.getSubscriptionsFiltered(filterQuery)
}
Expand All @@ -46,7 +46,7 @@ class SubscriptionManager(context: Context) {
fun upsertAll(infoList: List<ChannelInfo>): List<SubscriptionEntity> {
val listEntities = subscriptionTable.upsertAll(
infoList.map { SubscriptionEntity.from(it) }
)
)

database.runInTransaction {
infoList.forEachIndexed { index, info ->
Expand Down

0 comments on commit 72da350

Please sign in to comment.