...
This commit is contained in:
parent
dc69070823
commit
5a6dad2f24
@ -418,15 +418,22 @@ function gotoNext() {
|
||||
if (document.querySelector('[class="btn-group"]')) {
|
||||
time2 = setTimeout(function () {
|
||||
clearTimeout(time2)
|
||||
var targetElement = null
|
||||
document.querySelector('[class="btn-group"]').querySelectorAll('a').forEach(function(e){
|
||||
if(e.hasAttribute("href") &&
|
||||
(
|
||||
(e.getAttribute("href").search("page=2") > -1 && location.href.search("page") < 0) ||
|
||||
(e.getAttribute("href").search("page=3") > -1 && location.href.search("page=2") > 0)
|
||||
)) {
|
||||
e.click()
|
||||
targetElement = e
|
||||
|
||||
}
|
||||
})
|
||||
if(targetElement !== null) {
|
||||
targetElement.click()
|
||||
} else {
|
||||
location.href = "https://naver.com"
|
||||
}
|
||||
}, 5000);
|
||||
}
|
||||
} catch (e) {
|
||||
|
||||
@ -602,6 +602,15 @@ internal class LauncherActivity : CommonActivity() {
|
||||
binding.tabs.setOnCheckedChangeListener { g, id ->
|
||||
showContents(id)
|
||||
}
|
||||
binding.hidden.setOnLongClickListener {
|
||||
supportFragmentManager.beginTransaction()
|
||||
.replace(R.id.fragment_container, RssHome().apply {
|
||||
arguments = Bundle().apply {
|
||||
putBoolean("HIDDEN", true)
|
||||
}}
|
||||
).commit()
|
||||
true
|
||||
}
|
||||
|
||||
/* handle navigation back events */
|
||||
handleBackPress()
|
||||
|
||||
@ -112,6 +112,11 @@ class GeckoWeb : BWebview {
|
||||
var mPort: WebExtension.Port? = null
|
||||
var mCaache : WebExtension.Port? = null
|
||||
var privateMode = false
|
||||
set(value) {
|
||||
Blog.LOGE("Current Mode = $field")
|
||||
Blog.LOGE("Current Mode = $value")
|
||||
field = value
|
||||
}
|
||||
object WebExtensionInfo {
|
||||
val mPortNam = "browser"
|
||||
val extPath = "resource://android/assets/extensions/my_extension/"
|
||||
|
||||
@ -29,9 +29,11 @@ import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.PointerIcon
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.CheckBox
|
||||
import android.widget.EditText
|
||||
import android.widget.ImageView
|
||||
import android.widget.Toast
|
||||
@ -83,6 +85,7 @@ import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.launch
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.Date
|
||||
import kotlin.time.TimeSource
|
||||
|
||||
|
||||
internal class RssHome : Fragment() {
|
||||
@ -203,9 +206,14 @@ internal class RssHome : Fragment() {
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
var useHiddenMenu = false
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
arguments?.let {
|
||||
if(it.containsKey("HIDDEN") && it.getBoolean("HIDDEN")) {
|
||||
useHiddenMenu = true
|
||||
}
|
||||
}
|
||||
home = this
|
||||
}
|
||||
|
||||
@ -279,6 +287,12 @@ internal class RssHome : Fragment() {
|
||||
val viewInflated: View = LayoutInflater.from(requireContext())
|
||||
.inflate(R.layout.text_inpu_password, binding.root as ViewGroup?, false)
|
||||
val input = viewInflated.findViewById<View>(R.id.input) as EditText
|
||||
val privateMode = viewInflated.findViewById<CheckBox>(R.id.parivate_mode) as CheckBox
|
||||
privateMode.setOnCheckedChangeListener { v,c->
|
||||
binding.geckoWeb.privateMode = c
|
||||
}
|
||||
privateMode.isChecked = true
|
||||
binding.geckoWeb.privateMode = true
|
||||
builder.setView(viewInflated)
|
||||
builder.setPositiveButton(
|
||||
android.R.string.ok,
|
||||
@ -306,13 +320,13 @@ internal class RssHome : Fragment() {
|
||||
fun openGecko(originPage: String? = null, rssData: RssData? = null) {
|
||||
if (!imageView) {
|
||||
originPage?.let {
|
||||
binding.geckoWeb.privateMode = false
|
||||
rssId = originPage
|
||||
targetList.clear()
|
||||
|
||||
var setString = hashSetOf<String>()
|
||||
setString.addAll(rssList)
|
||||
setString.removeAll { it.equals(rssId) }
|
||||
|
||||
targetList.addAll(setString)
|
||||
binding.geckoWeb.loadUrl(rssId)
|
||||
}
|
||||
@ -399,13 +413,28 @@ internal class RssHome : Fragment() {
|
||||
vote()
|
||||
}
|
||||
}
|
||||
binding.test.setOnClickListener {
|
||||
if (binding.geckoWeb.isVisible) {
|
||||
Blog.LOGE("useHiddenMenu >>> $useHiddenMenu")
|
||||
if (useHiddenMenu) {
|
||||
binding.search.setOnLongClickListener {
|
||||
if (binding.geckoWeb.isVisible) {
|
||||
binding.geckoWeb.visibility = View.GONE
|
||||
}
|
||||
binding.geckoWeb.visibility = View.GONE
|
||||
|
||||
ask()
|
||||
true
|
||||
}
|
||||
binding.geckoWeb.visibility = View.GONE
|
||||
ask()
|
||||
binding.privateBtn.setOnClickListener {
|
||||
queryPrevate(true)
|
||||
}
|
||||
binding.privateBtn.setOnLongClickListener {
|
||||
queryPrevate(false)
|
||||
true
|
||||
}
|
||||
binding.privateBtn.visibility = View.VISIBLE
|
||||
binding.search.visibility = View.VISIBLE
|
||||
} else {
|
||||
binding.privateBtn.visibility = View.GONE
|
||||
binding.search.visibility = View.GONE
|
||||
}
|
||||
|
||||
binding.hide.setOnClickListener {
|
||||
@ -439,9 +468,7 @@ internal class RssHome : Fragment() {
|
||||
binding.layoutRssSummary.root.visibility = View.GONE
|
||||
queryVotes()
|
||||
}
|
||||
binding.prv.setOnClickListener {
|
||||
queryPrevate()
|
||||
}
|
||||
|
||||
binding.layoutRssSummary.link.setOnClickListener {
|
||||
(it.tag as? RssData)?.let {
|
||||
appendReadCount(it, 1, true)
|
||||
@ -564,12 +591,12 @@ internal class RssHome : Fragment() {
|
||||
flow.collect { changes: ResultsChange<RssData> ->
|
||||
// when (changes) {
|
||||
// is InitialResults -> {
|
||||
commandHandler.removeCallbacks(infoUpdate)
|
||||
WorkersDb.getRealm().apply {
|
||||
lasted.clear()
|
||||
lasted.addAll(copyFromRealm(changes.list))
|
||||
}
|
||||
commandHandler.post(infoUpdate)
|
||||
commandHandler.removeCallbacks(infoUpdate)
|
||||
WorkersDb.getRealm().apply {
|
||||
lasted.clear()
|
||||
lasted.addAll(copyFromRealm(changes.list))
|
||||
}
|
||||
commandHandler.post(infoUpdate)
|
||||
// }
|
||||
//
|
||||
// is UpdatedResults -> {
|
||||
@ -587,10 +614,10 @@ internal class RssHome : Fragment() {
|
||||
}
|
||||
}
|
||||
|
||||
fun queryPrevate() {
|
||||
fun queryPrevate(filter: Boolean = true) {
|
||||
imageView = true
|
||||
beforeQuery()
|
||||
updateQuery(WorkersDb.getPrivate())
|
||||
updateQuery(WorkersDb.getPrivate(filter))
|
||||
}
|
||||
|
||||
fun queryVotes() {
|
||||
@ -733,10 +760,28 @@ internal class RssHome : Fragment() {
|
||||
override fun onPause() {
|
||||
super.onPause()
|
||||
}
|
||||
|
||||
var lOnTouchListener = object : View.OnTouchListener{
|
||||
override fun onTouch(
|
||||
v: View,
|
||||
event: MotionEvent
|
||||
): Boolean {
|
||||
when(event.action) {
|
||||
MotionEvent.ACTION_DOWN,MotionEvent.ACTION_MOVE->{
|
||||
v.alpha = Math.min(v.alpha + 0.01f, 1f)
|
||||
}
|
||||
else -> {
|
||||
v.alpha = 0.05f
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
fun loadImage(imageView: ImageView, url: String?, retryCount: Int = 3) {
|
||||
Picasso.get().cancelRequest(imageView)
|
||||
with(imageView) {
|
||||
Picasso.get().cancelRequest(this)
|
||||
setOnTouchListener(null)
|
||||
}
|
||||
url?.let { url ->
|
||||
if (url.length > 4) {
|
||||
try {
|
||||
@ -747,7 +792,9 @@ internal class RssHome : Fragment() {
|
||||
.load(url)
|
||||
.into(imageView, object : com.squareup.picasso.Callback {
|
||||
override fun onSuccess() {
|
||||
imageView.visibility = View.VISIBLE
|
||||
imageView.setAlpha(0.05f)
|
||||
imageView.setOnTouchListener(lOnTouchListener)
|
||||
Blog.LOGE("Picasso load into onSuccess URL:$url")
|
||||
}
|
||||
|
||||
|
||||
@ -216,6 +216,7 @@ object WorkersDb {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun prvClear() {
|
||||
getRealm().writeBlocking {
|
||||
var results = query<RssData>().query("category == $0 ",
|
||||
@ -223,8 +224,14 @@ object WorkersDb {
|
||||
delete(results)
|
||||
}
|
||||
}
|
||||
fun getPrivate() = getRealm().query<RssData>().query("category == $0 ",
|
||||
RssDataType.PRIVATE.name).distinct("originPage", "title").query("read < $0", 5).query("vote != $0", true)
|
||||
|
||||
fun getPrivate(filter : Boolean) : RealmQuery<RssData> {
|
||||
var rq = getRealm().query<RssData>().query("category == $0 ",RssDataType.PRIVATE.name).distinct("originPage", "title")
|
||||
if (filter) {
|
||||
rq = rq.query("read < $0", 5).query("vote != $0", true)
|
||||
}
|
||||
return rq
|
||||
}
|
||||
|
||||
fun getVotedRss() = getRealm().query<RssData>().query("vote == $0", true).distinct("originPage", "title")
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="@color/finestSilver" android:state_checked="true"></item>
|
||||
<item android:color="@color/black" ></item>
|
||||
<item android:color="@color/finestSilver" android:state_checked="true"/>
|
||||
<item android:color="@color/black" />
|
||||
</selector>
|
||||
@ -19,58 +19,51 @@
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@id/tabs"/>
|
||||
app:layout_constraintBottom_toTopOf="@id/tabs_sc"/>
|
||||
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/tabs"
|
||||
android:orientation="horizontal"
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/tabs_sc"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:singleSelection="true"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginBottom="@dimen/_14sp"
|
||||
android:layout_height="wrap_content">
|
||||
<androidx.appcompat.widget.AppCompatRadioButton
|
||||
android:text="feeds"
|
||||
android:id="@+id/feeds"
|
||||
android:layout_weight="1"
|
||||
android:button="@null"
|
||||
android:background="@color/tabs_black"
|
||||
android:gravity="center"
|
||||
android:textColor="@color/white"
|
||||
<RadioGroup
|
||||
android:id="@+id/tabs"
|
||||
android:orientation="horizontal"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:singleSelection="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<androidx.appcompat.widget.AppCompatRadioButton
|
||||
android:text="booktoki"
|
||||
android:id="@+id/books"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/tabs_black"
|
||||
android:textColor="@color/white"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<androidx.appcompat.widget.AppCompatRadioButton
|
||||
android:text="newtoki"
|
||||
android:id="@+id/webtoons"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/tabs_black"
|
||||
android:textColor="@color/white"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<androidx.appcompat.widget.AppCompatRadioButton
|
||||
android:text="manatoki"
|
||||
android:id="@+id/comics"
|
||||
android:button="@null"
|
||||
android:gravity="center"
|
||||
android:layout_weight="1"
|
||||
android:background="@color/tabs_black"
|
||||
android:textColor="@color/white"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</RadioGroup>
|
||||
|
||||
android:layout_height="35dp">
|
||||
<androidx.appcompat.widget.AppCompatRadioButton
|
||||
android:text="feeds"
|
||||
android:id="@+id/feeds"
|
||||
style="@style/tabItem"
|
||||
android:layout_height="match_parent"/>
|
||||
<androidx.appcompat.widget.AppCompatRadioButton
|
||||
android:text="booktoki"
|
||||
android:id="@+id/books"
|
||||
style="@style/tabItem"
|
||||
android:layout_height="match_parent"/>
|
||||
<androidx.appcompat.widget.AppCompatRadioButton
|
||||
android:text="newtoki"
|
||||
android:id="@+id/webtoons"
|
||||
style="@style/tabItem"
|
||||
android:layout_height="match_parent"/>
|
||||
<androidx.appcompat.widget.AppCompatRadioButton
|
||||
android:text="manatoki"
|
||||
android:id="@+id/comics"
|
||||
style="@style/tabItem"
|
||||
android:layout_height="match_parent"/>
|
||||
<Button
|
||||
android:text="hidden"
|
||||
android:id="@+id/hidden"
|
||||
style="@style/tabItem"
|
||||
android:layout_height="match_parent"/>
|
||||
</RadioGroup>
|
||||
</HorizontalScrollView>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
@ -8,20 +8,22 @@
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageButton
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/home"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:id="@+id/test"
|
||||
app:layout_constraintBottom_toBottomOf="@id/home"
|
||||
android:id="@+id/search"
|
||||
android:alpha="0.5"
|
||||
android:scaleType="fitCenter"
|
||||
android:adjustViewBounds="true"
|
||||
android:visibility="visible"
|
||||
android:background="@null"
|
||||
android:src="@drawable/ic_search"
|
||||
android:layout_width="40dp"
|
||||
android:tint="@color/white"
|
||||
android:foregroundTint="@color/white"
|
||||
android:layout_width="30dp"
|
||||
android:tint="@color/finestSilver"
|
||||
android:foregroundTint="@color/finestSilver"
|
||||
tools:ignore="ContentDescription,UseAppTint"
|
||||
android:layout_height="40dp" />
|
||||
android:layout_height="30dp" />
|
||||
|
||||
<ImageButton
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
@ -79,18 +81,20 @@
|
||||
android:layout_height="40dp"/>
|
||||
<ImageButton
|
||||
android:layout_marginLeft="10dp"
|
||||
android:id="@+id/prv"
|
||||
app:layout_constraintBottom_toBottomOf="@id/bookmark"
|
||||
android:id="@+id/privateBtn"
|
||||
app:layout_constraintTop_toTopOf="@id/home"
|
||||
app:layout_constraintBottom_toBottomOf="@id/home"
|
||||
app:layout_constraintLeft_toRightOf="@id/bookmark"
|
||||
android:src="@drawable/bookmark"
|
||||
android:scaleType="fitCenter"
|
||||
android:background="@null"
|
||||
android:layout_width="10dp"
|
||||
android:alpha="0.2"
|
||||
android:layout_width="20dp"
|
||||
android:tint="@color/finestSilver"
|
||||
android:foregroundTint="@color/finestSilver"
|
||||
android:alpha="0.2"
|
||||
android:adjustViewBounds="true"
|
||||
tools:ignore="ContentDescription"
|
||||
android:layout_height="10dp"/>
|
||||
tools:ignore="ContentDescription,UseAppTint"
|
||||
android:layout_height="20dp"/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||
|
||||
@ -106,4 +106,12 @@
|
||||
<item name="android:textSize">14dp</item>
|
||||
<item name="android:textAlignment">textStart</item>
|
||||
</style>
|
||||
|
||||
<style name="tabItem">
|
||||
<item name="android:button">@null</item>>
|
||||
<item name="android:gravity">center</item>>
|
||||
<item name="android:background">@color/tabs_black</item>>
|
||||
<item name="android:textColor">@color/white</item>>
|
||||
<item name="android:layout_width">120dp</item>>
|
||||
</style>
|
||||
</resources>
|
||||
Loading…
x
Reference in New Issue
Block a user