mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-06-07 16:29:55 +00:00
Reformatted code
This commit is contained in:
parent
b0cec7d768
commit
f79d666219
@ -10,7 +10,8 @@ import com.looker.droidify.utility.extension.text.debug
|
||||
class QueryBuilder {
|
||||
companion object {
|
||||
fun trimQuery(query: String): String {
|
||||
return query.lines().map { it.trim() }.filter { it.isNotEmpty() }.joinToString(separator = " ")
|
||||
return query.lines().map { it.trim() }.filter { it.isNotEmpty() }
|
||||
.joinToString(separator = " ")
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,8 +39,10 @@ class QueryBuilder {
|
||||
if (BuildConfig.DEBUG) {
|
||||
synchronized(QueryBuilder::class.java) {
|
||||
debug(query)
|
||||
db.rawQuery("EXPLAIN QUERY PLAN $query", arguments).use { it.asSequence()
|
||||
.forEach { debug(":: ${it.getString(it.getColumnIndex("detail"))}") } }
|
||||
db.rawQuery("EXPLAIN QUERY PLAN $query", arguments).use {
|
||||
it.asSequence()
|
||||
.forEach { debug(":: ${it.getString(it.getColumnIndex("detail"))}") }
|
||||
}
|
||||
}
|
||||
}
|
||||
return db.rawQuery(query, arguments, signal)
|
||||
|
@ -8,18 +8,18 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.core.Observable
|
||||
import io.reactivex.rxjava3.disposables.Disposable
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
import com.looker.droidify.R
|
||||
import com.looker.droidify.database.CursorOwner
|
||||
import com.looker.droidify.database.Database
|
||||
import com.looker.droidify.entity.ProductItem
|
||||
import com.looker.droidify.utility.RxUtils
|
||||
import com.looker.droidify.widget.RecyclerFastScroller
|
||||
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
|
||||
import io.reactivex.rxjava3.core.Observable
|
||||
import io.reactivex.rxjava3.disposables.Disposable
|
||||
import io.reactivex.rxjava3.schedulers.Schedulers
|
||||
|
||||
class ProductsFragment(): ScreenFragment(), CursorOwner.Callback {
|
||||
class ProductsFragment() : ScreenFragment(), CursorOwner.Callback {
|
||||
companion object {
|
||||
private const val EXTRA_SOURCE = "source"
|
||||
|
||||
@ -35,7 +35,7 @@ class ProductsFragment(): ScreenFragment(), CursorOwner.Callback {
|
||||
UPDATES(R.string.updates, false, false)
|
||||
}
|
||||
|
||||
constructor(source: Source): this() {
|
||||
constructor(source: Source) : this() {
|
||||
arguments = Bundle().apply {
|
||||
putString(EXTRA_SOURCE, source.name)
|
||||
}
|
||||
@ -63,13 +63,25 @@ class ProductsFragment(): ScreenFragment(), CursorOwner.Callback {
|
||||
val section = if (source.sections) section else ProductItem.Section.All
|
||||
val order = if (source.order) order else ProductItem.Order.NAME
|
||||
return when (source) {
|
||||
Source.AVAILABLE -> CursorOwner.Request.ProductsAvailable(searchQuery, section, order)
|
||||
Source.INSTALLED -> CursorOwner.Request.ProductsInstalled(searchQuery, section, order)
|
||||
Source.AVAILABLE -> CursorOwner.Request.ProductsAvailable(
|
||||
searchQuery,
|
||||
section,
|
||||
order
|
||||
)
|
||||
Source.INSTALLED -> CursorOwner.Request.ProductsInstalled(
|
||||
searchQuery,
|
||||
section,
|
||||
order
|
||||
)
|
||||
Source.UPDATES -> CursorOwner.Request.ProductsUpdates(searchQuery, section, order)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
return RecyclerView(requireContext()).apply {
|
||||
id = android.R.id.list
|
||||
layoutManager = LinearLayoutManager(context)
|
||||
@ -88,7 +100,8 @@ class ProductsFragment(): ScreenFragment(), CursorOwner.Callback {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
currentSearchQuery = savedInstanceState?.getString(STATE_CURRENT_SEARCH_QUERY).orEmpty()
|
||||
currentSection = savedInstanceState?.getParcelable(STATE_CURRENT_SECTION) ?: ProductItem.Section.All
|
||||
currentSection =
|
||||
savedInstanceState?.getParcelable(STATE_CURRENT_SECTION) ?: ProductItem.Section.All
|
||||
currentOrder = savedInstanceState?.getString(STATE_CURRENT_ORDER)
|
||||
?.let(ProductItem.Order::valueOf) ?: ProductItem.Order.NAME
|
||||
layoutManagerState = savedInstanceState?.getParcelable(STATE_LAYOUT_MANAGER)
|
||||
|
Loading…
x
Reference in New Issue
Block a user