...
This commit is contained in:
parent
8121813434
commit
3e8c29346d
@ -379,7 +379,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
infosJob?.start()
|
infosJob?.start()
|
||||||
}
|
}
|
||||||
|
|
||||||
fun queryInfos(keyword : String, category : String? = null) {
|
fun queryInfos(keyword : String, category : ArrayList<String> = arrayListOf()) {
|
||||||
BLog.LOGE("${this} ::::: queryInfos >>>> ${keyword}")
|
BLog.LOGE("${this} ::::: queryInfos >>>> ${keyword}")
|
||||||
try { infosJob?.cancel() } catch (e:Exception) {e.printStackTrace()}
|
try { infosJob?.cancel() } catch (e:Exception) {e.printStackTrace()}
|
||||||
mRssDataResult = null
|
mRssDataResult = null
|
||||||
@ -406,6 +406,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
keyword
|
keyword
|
||||||
)
|
)
|
||||||
}else {
|
}else {
|
||||||
|
|
||||||
rQ = rQ.query(
|
rQ = rQ.query(
|
||||||
"title CONTAINS $0 OR title CONTAINS $1",
|
"title CONTAINS $0 OR title CONTAINS $1",
|
||||||
keyword.toUpperCase(),
|
keyword.toUpperCase(),
|
||||||
@ -413,10 +414,16 @@ internal class LauncherHome : Fragment() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var queryString = ""
|
||||||
category?.let {
|
category.forEachIndexed { idx , it ->
|
||||||
rQ = rQ.query("category == $0", it)
|
if (idx == 0) {
|
||||||
|
queryString = queryString.plus("category == '${it}'")
|
||||||
|
} else {
|
||||||
|
queryString = queryString.plus(" OR category == '${it}' ")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
rQ = rQ.query(queryString)
|
||||||
BLog.LOGE("queryInfos rQ.description() >>>>> ${rQ.description()}")
|
BLog.LOGE("queryInfos rQ.description() >>>>> ${rQ.description()}")
|
||||||
//limit(1000)
|
//limit(1000)
|
||||||
mRssDataResult = rQ.sort("pubDate ", Sort.DESCENDING).find()
|
mRssDataResult = rQ.sort("pubDate ", Sort.DESCENDING).find()
|
||||||
@ -566,10 +573,17 @@ internal class LauncherHome : Fragment() {
|
|||||||
var tb = TableRow(requireContext())
|
var tb = TableRow(requireContext())
|
||||||
it.forEach { c ->
|
it.forEach { c ->
|
||||||
if(c.equals(RssDataType.NO_DATA) == false) {
|
if(c.equals(RssDataType.NO_DATA) == false) {
|
||||||
tb.addView(RadioButton(requireContext()).apply {
|
tb.addView(
|
||||||
|
RadioButton(requireContext()).apply {
|
||||||
this.tag = c.name
|
this.tag = c.name
|
||||||
this.text = c.name
|
this.text = c.name
|
||||||
})
|
setOnClickListener {
|
||||||
|
(it as? RadioButton)?.let {
|
||||||
|
it.isChecked = !it.isChecked
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
categoryz.addView(tb)
|
categoryz.addView(tb)
|
||||||
@ -579,12 +593,12 @@ internal class LauncherHome : Fragment() {
|
|||||||
builder.setPositiveButton(android.R.string.ok,
|
builder.setPositiveButton(android.R.string.ok,
|
||||||
DialogInterface.OnClickListener { dialog, which ->
|
DialogInterface.OnClickListener { dialog, which ->
|
||||||
dialog.dismiss()
|
dialog.dismiss()
|
||||||
var category : String? = null
|
var category = arrayListOf<String>()
|
||||||
categoryz.children.forEach {
|
categoryz.children.forEach {
|
||||||
if(it is TableRow) {
|
if(it is TableRow) {
|
||||||
it.children.forEach {
|
it.children.forEach {
|
||||||
if (it is RadioButton && it.isChecked) {
|
if (it is RadioButton && it.isChecked) {
|
||||||
(it.tag as? String)?.let { category = it }
|
(it.tag as? String)?.let { category.add(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user