..
This commit is contained in:
parent
b17d4a0411
commit
3d65f30516
@ -118,7 +118,7 @@ dependencies {
|
||||
|
||||
|
||||
implementation ("androidx.media:media:1.7.0")
|
||||
implementation(project(":sdk"))
|
||||
// implementation(project(":sdk"))
|
||||
// implementation ("me.everything:providers-android:1.0.1")
|
||||
// implementation ("me.everything:providers-core:1.0.1")
|
||||
// implementation ("androidx.window:window:1.0.0")
|
||||
|
||||
@ -109,11 +109,11 @@
|
||||
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".PhotoFilter"
|
||||
android:label="@string/lunar_settings"
|
||||
android:exported="true">
|
||||
</activity>
|
||||
<!-- <activity-->
|
||||
<!-- android:name=".PhotoFilter"-->
|
||||
<!-- android:label="@string/lunar_settings"-->
|
||||
<!-- android:exported="true">-->
|
||||
<!-- </activity>-->
|
||||
<activity
|
||||
android:name=".feeds.Feeds"
|
||||
android:label="@string/lunar_settings"
|
||||
|
||||
@ -123,6 +123,7 @@ import bums.lunatic.launcher.workers.YoutubeGetter.Companion.YT_WORK_TAG
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||
import io.realm.kotlin.ext.query
|
||||
import io.realm.kotlin.query.Sort
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
@ -311,17 +312,7 @@ internal class LauncherActivity : CommonActivity() {
|
||||
}
|
||||
}
|
||||
KEYCODE_BUTTON_X->{
|
||||
WorkersDb.getRealm().apply {
|
||||
writeBlocking {
|
||||
var ddd = copyFromRealm(WorkersDb.getRssQuery("", RssDataType.getAdts(),false).limit(100).find()).map { it.originPage() }
|
||||
var origin = ddd.first()
|
||||
RssViewBuilder(lActivity!!)
|
||||
.setRssList(arrayListOf<String>().apply { this.addAll(ddd) })
|
||||
.setRssId(origin)
|
||||
.showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1)
|
||||
.show(origin)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
KEYCODE_BUTTON_A->{
|
||||
WorkersDb.getRealm().apply {
|
||||
@ -337,11 +328,11 @@ internal class LauncherActivity : CommonActivity() {
|
||||
}
|
||||
}
|
||||
KEYCODE_BUTTON_B->{
|
||||
RssViewBuilder(lActivity!!)
|
||||
.setRssId("https://jav.guru")
|
||||
.webViewJavaScriptEnabled(true)
|
||||
.showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1)
|
||||
.show("https://jav.guru")
|
||||
// RssViewBuilder(lActivity!!)
|
||||
// .setRssId("https://jav.guru")
|
||||
// .webViewJavaScriptEnabled(true)
|
||||
// .showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1)
|
||||
// .show("https://jav.guru")
|
||||
}
|
||||
KEYCODE_DPAD_DOWN->{
|
||||
|
||||
@ -381,9 +372,21 @@ internal class LauncherActivity : CommonActivity() {
|
||||
|
||||
|
||||
fun onClickCenterButton() {
|
||||
|
||||
WorkersDb.getRealm().apply {
|
||||
writeBlocking {
|
||||
var ddd = copyFromRealm(WorkersDb.getRssQuery("", RssDataType.getExcAdt(),false).limit(100).query("read == $0", 0).query("vote != $0", true).find()).map { it.originPage() }
|
||||
delete(
|
||||
query<RssData>()
|
||||
.query("pubDate < $0",
|
||||
bums.lunatic.launcher.utils.beforeDay(28)
|
||||
)
|
||||
.query("vote != $0", true).apply {
|
||||
Blog.LOGE("onClickCenterButton DELETE >> ${this.description()}")
|
||||
}.find()
|
||||
)
|
||||
var ddd = copyFromRealm(WorkersDb.getRssQuery("", RssDataType.getExcAdt(),false).limit(100).query("read == $0", 0).query("vote != $0", true).apply {
|
||||
Blog.LOGE("onClickCenterButton SELECT >> ${this.description()}")
|
||||
}.find()).map { it.originPage() }
|
||||
var origin = ddd.first()
|
||||
var jjjj = hashSetOf<String>()
|
||||
jjjj.addAll(ddd)
|
||||
|
||||
@ -1,139 +1,108 @@
|
||||
package bums.lunatic.launcher
|
||||
|
||||
import bums.lunatic.launcher.common.CommonActivity
|
||||
import android.Manifest
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.content.pm.PackageManager
|
||||
import android.graphics.Bitmap
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.provider.MediaStore
|
||||
import android.widget.Button
|
||||
import android.widget.ImageView
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import bums.lunatic.launcher.utils.Blog
|
||||
import org.opencv.android.OpenCVLoader
|
||||
import org.opencv.android.Utils
|
||||
import org.opencv.core.Mat
|
||||
import org.opencv.photo.Photo
|
||||
|
||||
class PhotoFilter : CommonActivity() {
|
||||
private lateinit var originalImageView: ImageView
|
||||
private lateinit var filteredImageView: ImageView
|
||||
private lateinit var selectImageButton: Button
|
||||
private val PICK_IMAGE_REQUEST = 1
|
||||
private val PERMISSION_REQUEST_CODE = 200
|
||||
|
||||
init {
|
||||
OpenCVLoader.initDebug()
|
||||
}
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.photo_filter)
|
||||
|
||||
originalImageView = findViewById(R.id.originalImageView)
|
||||
filteredImageView = findViewById(R.id.filteredImageView)
|
||||
selectImageButton = findViewById(R.id.selectImageButton)
|
||||
|
||||
selectImageButton.setOnClickListener {
|
||||
Blog.LOGE("imagePickerLauncher checkPermission() ${checkPermission()}")
|
||||
if (checkPermission()) {
|
||||
openGallery()
|
||||
} else {
|
||||
requestPermission()
|
||||
}
|
||||
}
|
||||
|
||||
imagePickerLauncher = registerForActivityResult(
|
||||
ActivityResultContracts.GetContent(),
|
||||
{result ->
|
||||
Blog.LOGE("imagePickerLauncher result ${result}")
|
||||
if (result != null) {
|
||||
// Handle the selected image
|
||||
FilePathUri = result;
|
||||
try {
|
||||
var bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), FilePathUri)
|
||||
Blog.LOGE("imagePickerLauncher result ${result} 2")
|
||||
originalImageView.setImageBitmap(bitmap)
|
||||
Blog.LOGE("imagePickerLauncher result ${result} 3")
|
||||
val filteredBitmap = applyCartoonFilter(bitmap)
|
||||
Blog.LOGE("imagePickerLauncher result ${result} 4")
|
||||
filteredImageView.setImageBitmap(filteredBitmap)
|
||||
} catch (e : Exception ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
var FilePathUri : Uri? = null
|
||||
|
||||
private var imagePickerLauncher : ActivityResultLauncher<String>? = null
|
||||
|
||||
|
||||
private fun openGallery() {
|
||||
// val intent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
|
||||
// startActivityForResult(intent, PICK_IMAGE_REQUEST)
|
||||
|
||||
imagePickerLauncher?.launch("image/*");
|
||||
Blog.LOGE("imagePickerLauncher ")
|
||||
|
||||
}
|
||||
|
||||
// override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
|
||||
// super.onActivityResult(requestCode, resultCode, data)
|
||||
// if (requestCode == PICK_IMAGE_REQUEST && resultCode == Activity.RESULT_OK && data != null) {
|
||||
// val selectedImage = data.data
|
||||
// val bitmap = MediaStore.Images.Media.getBitmap(contentResolver, selectedImage)
|
||||
// originalImageView.setImageBitmap(bitmap)
|
||||
//package bums.lunatic.launcher
|
||||
//
|
||||
// val filteredBitmap = applyCartoonFilter(bitmap)
|
||||
// filteredImageView.setImageBitmap(filteredBitmap)
|
||||
// }
|
||||
// }
|
||||
|
||||
private fun applyCartoonFilter(inputBitmap: Bitmap): Bitmap {
|
||||
Blog.LOGE("applyCartoonFilter")
|
||||
val src = Mat()
|
||||
Blog.LOGE("applyCartoonFilter 2")
|
||||
Utils.bitmapToMat(inputBitmap, src)
|
||||
Blog.LOGE("applyCartoonFilter 3")
|
||||
val dst = Mat()
|
||||
Blog.LOGE("applyCartoonFilter 4")
|
||||
Photo.stylization(src, dst, 60f, 0.07f)
|
||||
|
||||
val resultBitmap = Bitmap.createBitmap(inputBitmap.width, inputBitmap.height, Bitmap.Config.ARGB_8888)
|
||||
Utils.matToBitmap(dst, resultBitmap)
|
||||
|
||||
return resultBitmap
|
||||
}
|
||||
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
||||
private fun checkPermission(): Boolean {
|
||||
return ContextCompat.checkSelfPermission(this, Manifest.permission.READ_MEDIA_IMAGES) == PackageManager.PERMISSION_GRANTED
|
||||
}
|
||||
|
||||
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
||||
private fun requestPermission() {
|
||||
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.READ_MEDIA_IMAGES), PERMISSION_REQUEST_CODE)
|
||||
}
|
||||
|
||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
if (requestCode == PERMISSION_REQUEST_CODE) {
|
||||
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
openGallery()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//import bums.lunatic.launcher.common.CommonActivity
|
||||
//import android.Manifest
|
||||
//import android.app.Activity
|
||||
//import android.content.Intent
|
||||
//import android.content.pm.PackageManager
|
||||
//import android.graphics.Bitmap
|
||||
//import android.net.Uri
|
||||
//import android.os.Build
|
||||
//import android.os.Bundle
|
||||
//import android.provider.MediaStore
|
||||
//import android.widget.Button
|
||||
//import android.widget.ImageView
|
||||
//import androidx.activity.result.ActivityResultLauncher
|
||||
//import androidx.activity.result.contract.ActivityResultContracts
|
||||
//import androidx.annotation.RequiresApi
|
||||
//import androidx.appcompat.app.AppCompatActivity
|
||||
//import androidx.core.app.ActivityCompat
|
||||
//import androidx.core.content.ContextCompat
|
||||
//import bums.lunatic.launcher.utils.Blog
|
||||
//
|
||||
//
|
||||
//class PhotoFilter : CommonActivity() {
|
||||
//// private lateinit var originalImageView: ImageView
|
||||
//// private lateinit var filteredImageView: ImageView
|
||||
//// private lateinit var selectImageButton: Button
|
||||
//// private val PICK_IMAGE_REQUEST = 1
|
||||
//// private val PERMISSION_REQUEST_CODE = 200
|
||||
////
|
||||
//// init {
|
||||
////
|
||||
//// }
|
||||
////
|
||||
//// override fun onCreate(savedInstanceState: Bundle?) {
|
||||
//// super.onCreate(savedInstanceState)
|
||||
//// setContentView(R.layout.photo_filter)
|
||||
////
|
||||
//// originalImageView = findViewById(R.id.originalImageView)
|
||||
//// filteredImageView = findViewById(R.id.filteredImageView)
|
||||
//// selectImageButton = findViewById(R.id.selectImageButton)
|
||||
////
|
||||
//// selectImageButton.setOnClickListener {
|
||||
//// Blog.LOGE("imagePickerLauncher checkPermission() ${checkPermission()}")
|
||||
//// if (checkPermission()) {
|
||||
//// openGallery()
|
||||
//// } else {
|
||||
//// requestPermission()
|
||||
//// }
|
||||
//// }
|
||||
////
|
||||
//// imagePickerLauncher = registerForActivityResult(
|
||||
//// ActivityResultContracts.GetContent(),
|
||||
//// {result ->
|
||||
//// Blog.LOGE("imagePickerLauncher result ${result}")
|
||||
//// if (result != null) {
|
||||
//// // Handle the selected image
|
||||
//// FilePathUri = result;
|
||||
//// try {
|
||||
//// var bitmap = MediaStore.Images.Media.getBitmap(getContentResolver(), FilePathUri)
|
||||
//// Blog.LOGE("imagePickerLauncher result ${result} 2")
|
||||
//// originalImageView.setImageBitmap(bitmap)
|
||||
//// Blog.LOGE("imagePickerLauncher result ${result} 3")
|
||||
//// val filteredBitmap = applyCartoonFilter(bitmap)
|
||||
//// Blog.LOGE("imagePickerLauncher result ${result} 4")
|
||||
//// filteredImageView.setImageBitmap(filteredBitmap)
|
||||
//// } catch (e : Exception ) {
|
||||
//// e.printStackTrace();
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
//// );
|
||||
//// }
|
||||
////
|
||||
//// var FilePathUri : Uri? = null
|
||||
////
|
||||
//// private var imagePickerLauncher : ActivityResultLauncher<String>? = null
|
||||
////
|
||||
////
|
||||
//// private fun openGallery() {
|
||||
////// val intent = Intent(Intent.ACTION_PICK, MediaStore.Images.Media.EXTERNAL_CONTENT_URI)
|
||||
////// startActivityForResult(intent, PICK_IMAGE_REQUEST)
|
||||
////
|
||||
//// imagePickerLauncher?.launch("image/*");
|
||||
//// Blog.LOGE("imagePickerLauncher ")
|
||||
////
|
||||
//// }
|
||||
////
|
||||
////
|
||||
//// @RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
||||
//// private fun checkPermission(): Boolean {
|
||||
//// return ContextCompat.checkSelfPermission(this, Manifest.permission.READ_MEDIA_IMAGES) == PackageManager.PERMISSION_GRANTED
|
||||
//// }
|
||||
////
|
||||
//// @RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
||||
//// private fun requestPermission() {
|
||||
//// ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.READ_MEDIA_IMAGES), PERMISSION_REQUEST_CODE)
|
||||
//// }
|
||||
////
|
||||
//// override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
||||
//// super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
||||
//// if (requestCode == PERMISSION_REQUEST_CODE) {
|
||||
//// if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
||||
//// openGallery()
|
||||
//// }
|
||||
//// }
|
||||
//// }
|
||||
//}
|
||||
@ -55,7 +55,6 @@ import androidx.recyclerview.widget.ItemTouchHelper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import androidx.viewpager2.widget.ViewPager2
|
||||
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
|
||||
import bums.lunatic.launcher.PhotoFilter
|
||||
import bums.lunatic.launcher.R
|
||||
import bums.lunatic.launcher.apps.AppsAdapter
|
||||
import bums.lunatic.launcher.behavior.Behavior
|
||||
@ -259,7 +258,7 @@ internal class LauncherHome : Fragment() {
|
||||
}
|
||||
|
||||
binding.missedCalls.setOnLongClickListener {
|
||||
lActivity?.startActivity(Intent(lActivity, PhotoFilter::class.java))
|
||||
// lActivity?.startActivity(Intent(lActivity, PhotoFilter::class.java))
|
||||
// RssViewBuilder(lActivity!!)
|
||||
// .setRssId("https://booktoki468.com/")
|
||||
// .webViewMixedContentMode(MIXED_CONTENT_ALWAYS_ALLOW)
|
||||
|
||||
@ -2,12 +2,15 @@ package bums.lunatic.launcher.home
|
||||
|
||||
import android.content.ClipData
|
||||
import android.content.ClipboardManager
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.print.PDFPrint
|
||||
import android.provider.AlarmClock
|
||||
import android.util.Base64
|
||||
import android.view.HapticFeedbackConstants
|
||||
import android.view.KeyEvent
|
||||
import android.view.KeyEvent.ACTION_UP
|
||||
import android.view.KeyEvent.KEYCODE_BUTTON_A
|
||||
@ -31,9 +34,18 @@ import android.widget.Toast
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.core.net.toUri
|
||||
import androidx.core.view.postDelayed
|
||||
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
|
||||
import bums.lunatic.launcher.behavior.Behavior
|
||||
import bums.lunatic.launcher.helpers.Constants.Companion.BOTTOM_SHEET_TAG
|
||||
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_LOCK_METHOD
|
||||
import bums.lunatic.launcher.helpers.UniUtils.Companion.expandNotificationPanel
|
||||
import bums.lunatic.launcher.helpers.UniUtils.Companion.lockMethod
|
||||
import bums.lunatic.launcher.model.CiliMagnet
|
||||
import bums.lunatic.launcher.model.RssData
|
||||
import bums.lunatic.launcher.qaccess.QuickAccess
|
||||
import bums.lunatic.launcher.settings.SettingsActivity
|
||||
import bums.lunatic.launcher.utils.Blog
|
||||
import bums.lunatic.launcher.utils.SimpleFingerGestures
|
||||
import bums.lunatic.launcher.workers.WorkersDb
|
||||
import com.google.gson.Gson
|
||||
import io.realm.kotlin.UpdatePolicy
|
||||
@ -88,8 +100,9 @@ class RssViewBuilder(context: Context) : AwesomeWebView.Builder(context) {
|
||||
|
||||
ContextUtil.startActivity(intent)
|
||||
}
|
||||
|
||||
}
|
||||
class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListener {
|
||||
class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListener , View.OnTouchListener {
|
||||
var actionButtonPressX = 0f
|
||||
var actionButtonPressY = 0f
|
||||
var rssId : String = ""
|
||||
@ -108,8 +121,98 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
||||
} else {
|
||||
loadWithIntent = false
|
||||
}
|
||||
webView?.setOnTouchListener(this)
|
||||
|
||||
}
|
||||
private var startX = 0f
|
||||
private var startY = 0f
|
||||
private var startTime = 0L
|
||||
|
||||
// 임계값(앱에 맞게 조정)
|
||||
private val swipeThreshold = 150 // 스와이프 최소 거리(px)
|
||||
private val swipeTime = 300 // 스와이프 최대 시간(ms)
|
||||
private val clickThreshold = 30 // 클릭으로 인정할 최대 이동 거리(px)
|
||||
override fun onTouch(v: View?, event: MotionEvent): Boolean {
|
||||
if(event.device.name.equals("JX-12",true)) {
|
||||
when (event.action) {
|
||||
MotionEvent.ACTION_DOWN -> {
|
||||
startX = event.x
|
||||
startY = event.y
|
||||
startTime = System.currentTimeMillis()
|
||||
return true
|
||||
}
|
||||
|
||||
MotionEvent.ACTION_UP -> {
|
||||
val endX = event.x
|
||||
val endY = event.y
|
||||
val endTime = System.currentTimeMillis()
|
||||
val dx = endX - startX
|
||||
val dy = endY - startY
|
||||
val duration = endTime - startTime
|
||||
|
||||
// 클릭: 거의 움직이지 않고 짧은 시간
|
||||
if (Math.abs(dx) < clickThreshold && Math.abs(dy) < clickThreshold && duration < 250) {
|
||||
onClick() // View의 기본 클릭 호출
|
||||
return true
|
||||
}
|
||||
|
||||
// 좌우 스와이프: 수평 이동이 크고, 빠르게
|
||||
if (Math.abs(dx) > swipeThreshold && Math.abs(dx) > Math.abs(dy) && duration < swipeTime) {
|
||||
if (dx > 0) {
|
||||
onSwipeRight()
|
||||
} else {
|
||||
onSwipeLeft()
|
||||
}
|
||||
return true
|
||||
}
|
||||
Blog.LOGE("dy >>> $dy")
|
||||
// 상하 스크롤: 수직 이동이 더 크고, 일정 거리 이상
|
||||
// if (Math.abs(dy) > swipeThreshold && Math.abs(dy) > Math.abs(dx)) {
|
||||
// if (dy > 0) {
|
||||
// onScrollDown()
|
||||
// } else {
|
||||
// onScrollUp()
|
||||
// }
|
||||
// return true
|
||||
// }
|
||||
|
||||
}
|
||||
else -> return super.onTouchEvent(event)
|
||||
}
|
||||
}
|
||||
return super.onTouchEvent(event)
|
||||
}
|
||||
|
||||
private fun onClick() {
|
||||
Blog.LOGE("onClick")
|
||||
finish()
|
||||
}
|
||||
|
||||
// 아래 메서드에 원하는 동작 구현
|
||||
private fun onSwipeLeft() {
|
||||
Blog.LOGE("onSwipeLeft")
|
||||
vote()
|
||||
}
|
||||
|
||||
private fun onSwipeRight() {
|
||||
Blog.LOGE("onSwipeRight")
|
||||
doNextPage()
|
||||
}
|
||||
|
||||
private fun onScrollUp() {
|
||||
Blog.LOGE("onScrollUp")
|
||||
webView?.let {
|
||||
it.scrollBy(0, (it.contentHeight / 100).coerceAtLeast(200) * -1)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private fun onScrollDown() {
|
||||
Blog.LOGE("onScrollDown")
|
||||
webView?.let {
|
||||
it.scrollBy(0, (it.contentHeight / 100).coerceAtLeast(200) * 1)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
@ -151,6 +254,9 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
||||
}
|
||||
return false
|
||||
}
|
||||
private var lastX = 0f
|
||||
private var lastY = 0f
|
||||
private var onDown = false
|
||||
|
||||
override fun onGenericMotionEvent(ev: MotionEvent?): Boolean {
|
||||
|
||||
@ -217,13 +323,14 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
||||
}
|
||||
}
|
||||
}
|
||||
webView?.evaluateJavascript("document.documentElement.outerHTML",
|
||||
object : ValueCallback<String> {
|
||||
override fun onReceiveValue(value: String?) {
|
||||
val html = value?.replace("\\u003C", "<")
|
||||
onHtml(html, false)
|
||||
}
|
||||
})
|
||||
doNextPage()
|
||||
// webView?.evaluateJavascript("document.documentElement.outerHTML",
|
||||
// object : ValueCallback<String> {
|
||||
// override fun onReceiveValue(value: String?) {
|
||||
// val html = value?.replace("\\u003C", "<")
|
||||
// onHtml(html, false)
|
||||
// }
|
||||
// })
|
||||
} else {
|
||||
finish()
|
||||
}
|
||||
@ -534,8 +641,8 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
||||
guru.getElementsByClass("row")?.forEach { row ->
|
||||
row.getElementsByClass("grid1").first().getElementsByTag("a")?.first()
|
||||
?.attr("title")?.let { title ->
|
||||
Blog.LOGE("row >>> ${title.split("]")?.first()?.replace("[", "")}")
|
||||
}
|
||||
Blog.LOGE("row >>> ${title.split("]")?.first()?.replace("[", "")}")
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(rssId.contains("book")){
|
||||
@ -583,9 +690,9 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
||||
}
|
||||
}
|
||||
}.apply {
|
||||
temp.add(ciliMgn)
|
||||
temp.add(ciliMgn)
|
||||
|
||||
}
|
||||
}
|
||||
}catch (e:Exception) {}
|
||||
}
|
||||
}
|
||||
@ -609,48 +716,49 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
||||
}
|
||||
|
||||
override fun onHtml(value: String?, autoCheck : Boolean) {
|
||||
chechHandler.removeCallbacks(cancelSearch)
|
||||
if (loadWithIntent){
|
||||
return
|
||||
}
|
||||
showBlock()
|
||||
|
||||
var count = (webView!!.contentHeight / (webView!!.height * 0.3).toInt())
|
||||
LogUtil.e("count >>>> ${count} webView!!.contentHeight >>>> ${webView!!.contentHeight} , webView!!.height >>>> ${webView!!.height} :: ${(webView!!.height * 0.3).toInt()}")
|
||||
chechHandler.postDelayed(pageDown, defaultTime)
|
||||
webView!!.setOnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
|
||||
val measuredHeight: Int = v.measuredHeight
|
||||
LogUtil.e("OnScrollChange >>> ${scrollY} , ${oldScrollY}")
|
||||
if(measuredHeight + scrollY == webView!!.computeVerticalScrollRange()){
|
||||
chechHandler.removeCallbacks(scrollDown)
|
||||
chechHandler.removeCallbacks(pageDown)
|
||||
chechHandler.postDelayed({
|
||||
webView!!.evaluateJavascript("document.documentElement.outerHTML",object : ValueCallback<String> {
|
||||
override fun onReceiveValue(value: String?) {
|
||||
val html = value?.replace("\\u003C", "<")
|
||||
this@RssViewerActivity.run(html!!, autoCheck)
|
||||
}
|
||||
})
|
||||
},defaultTime.times(2))
|
||||
} else {
|
||||
chechHandler.removeCallbacks(cancelSearch)
|
||||
Blog.LOGE("onScrollChanged called PageDown")
|
||||
vote()
|
||||
// chechHandler.removeCallbacks(cancelSearch)
|
||||
// if (loadWithIntent){
|
||||
// return
|
||||
// }
|
||||
// showBlock()
|
||||
//
|
||||
// var count = (webView!!.contentHeight / (webView!!.height * 0.3).toInt())
|
||||
// LogUtil.e("count >>>> ${count} webView!!.contentHeight >>>> ${webView!!.contentHeight} , webView!!.height >>>> ${webView!!.height} :: ${(webView!!.height * 0.3).toInt()}")
|
||||
// chechHandler.postDelayed(pageDown, defaultTime)
|
||||
// webView!!.setOnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
|
||||
// val measuredHeight: Int = v.measuredHeight
|
||||
// LogUtil.e("OnScrollChange >>> ${scrollY} , ${oldScrollY}")
|
||||
// if(measuredHeight + scrollY == webView!!.computeVerticalScrollRange()){
|
||||
// chechHandler.removeCallbacks(scrollDown)
|
||||
if (switch) {
|
||||
chechHandler.removeCallbacks(pageDown)
|
||||
chechHandler.postDelayed(scrollDown, defaultTime)
|
||||
switch = false
|
||||
} else {
|
||||
switch = true
|
||||
chechHandler.removeCallbacks(scrollDown)
|
||||
chechHandler.postDelayed(pageDown, defaultTime)
|
||||
}
|
||||
}
|
||||
// else if (scrollY % 10 == 0 || oldScrollY % 10 == 0){
|
||||
//// chechHandler.removeCallbacks(pageDown)
|
||||
//// chechHandler.postDelayed(scrollDown, defaultTime)
|
||||
// chechHandler.removeCallbacks(pageDown)
|
||||
// chechHandler.postDelayed({
|
||||
// webView!!.evaluateJavascript("document.documentElement.outerHTML",object : ValueCallback<String> {
|
||||
// override fun onReceiveValue(value: String?) {
|
||||
// val html = value?.replace("\\u003C", "<")
|
||||
// this@RssViewerActivity.run(html!!, autoCheck)
|
||||
// }
|
||||
// })
|
||||
// },defaultTime.times(2))
|
||||
// } else {
|
||||
// chechHandler.removeCallbacks(cancelSearch)
|
||||
// Blog.LOGE("onScrollChanged called PageDown")
|
||||
//// chechHandler.removeCallbacks(scrollDown)
|
||||
// if (switch) {
|
||||
// chechHandler.removeCallbacks(pageDown)
|
||||
// chechHandler.postDelayed(scrollDown, defaultTime)
|
||||
// switch = false
|
||||
// } else {
|
||||
// switch = true
|
||||
// chechHandler.removeCallbacks(scrollDown)
|
||||
// chechHandler.postDelayed(pageDown, defaultTime)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
//// else if (scrollY % 10 == 0 || oldScrollY % 10 == 0){
|
||||
////// chechHandler.removeCallbacks(pageDown)
|
||||
////// chechHandler.postDelayed(scrollDown, defaultTime)
|
||||
//// }
|
||||
// }
|
||||
}
|
||||
var switch = false
|
||||
var scrollDown : Runnable = Runnable{
|
||||
@ -705,7 +813,58 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
||||
// }
|
||||
}
|
||||
}
|
||||
try {
|
||||
val muted =
|
||||
"try{" +
|
||||
"var videos = document.getElementsByTagName('video');" +
|
||||
"for (var i = 0; i < videos.length; i++) {" +
|
||||
"videos[i].muted = true;" +
|
||||
"}" +
|
||||
"}catch(e){}"
|
||||
webView?.evaluateJavascript(muted,{
|
||||
Blog.LOGE("RESULT >> $it")
|
||||
})
|
||||
}catch (e : Exception) {e.printStackTrace()}
|
||||
try {
|
||||
val muted =
|
||||
"try{" +
|
||||
"var videos = document.getElementsByTagName('video');" +
|
||||
"for (var i = 0; i < videos.length; i++) {" +
|
||||
"videos[i].controlsList.remove('nodownload');"
|
||||
"}" +
|
||||
"}catch(e){}"
|
||||
webView?.evaluateJavascript(muted,{
|
||||
Blog.LOGE("RESULT >> $it")
|
||||
})
|
||||
}catch (e : Exception) {e.printStackTrace()}
|
||||
webView?.postDelayed({
|
||||
|
||||
|
||||
try {
|
||||
val muted =
|
||||
"try{" +
|
||||
"var videos = document.getElementsByTagName('video');" +
|
||||
"for (var i = 0; i < videos.length; i++) {" +
|
||||
"videos[i].muted = true;" +
|
||||
"}" +
|
||||
"}catch(e){console.log(e);}"
|
||||
webView?.evaluateJavascript(muted,{
|
||||
Blog.LOGE("RESULT >> $it")
|
||||
})
|
||||
}catch (e : Exception) {e.printStackTrace()}
|
||||
try {
|
||||
val muted =
|
||||
"try{" +
|
||||
"var videos = document.getElementsByTagName('video');" +
|
||||
"for (var i = 0; i < videos.length; i++) {" +
|
||||
"videos[i].controlsList.remove('nodownload');"
|
||||
"}" +
|
||||
"}catch(e){console.log(e);}"
|
||||
webView?.evaluateJavascript(muted,{
|
||||
Blog.LOGE("RESULT >> $it")
|
||||
})
|
||||
}catch (e : Exception) {e.printStackTrace()}
|
||||
},1000)
|
||||
if (loadWithIntent) {
|
||||
webView?.evaluateJavascript(
|
||||
"try{document.querySelector('meta[name=viewport]').setAttribute('content','initial-scale=1.0')}catch(e){}",
|
||||
|
||||
@ -414,7 +414,6 @@ class GestureAnalyser @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
///https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/getUpdates
|
||||
|
||||
class SimpleFingerGestures : OnTouchListener {
|
||||
private var debug = BuildConfig.DEBUG
|
||||
@ -537,28 +536,28 @@ class SimpleFingerGestures : OnTouchListener {
|
||||
1,
|
||||
mGt.gestureDuration,
|
||||
mGt.gestureDistance
|
||||
)
|
||||
).apply { consumeTouchEvents = this }
|
||||
|
||||
GestureAnalyser.SWIPE_1_DOWN -> onFingerGestureListener!!.onSwipeDown(
|
||||
targetView,
|
||||
1,
|
||||
mGt.gestureDuration,
|
||||
mGt.gestureDistance
|
||||
)
|
||||
).apply { consumeTouchEvents = this }
|
||||
|
||||
GestureAnalyser.SWIPE_1_LEFT -> onFingerGestureListener!!.onSwipeLeft(
|
||||
targetView,
|
||||
1,
|
||||
mGt.gestureDuration,
|
||||
mGt.gestureDistance
|
||||
)
|
||||
).apply { consumeTouchEvents = this }
|
||||
|
||||
GestureAnalyser.SWIPE_1_RIGHT -> onFingerGestureListener!!.onSwipeRight(
|
||||
targetView,
|
||||
1,
|
||||
mGt.gestureDuration,
|
||||
mGt.gestureDistance
|
||||
)
|
||||
).apply { consumeTouchEvents = this }
|
||||
|
||||
GestureAnalyser.SWIPE_2_UP -> onFingerGestureListener!!.onSwipeUp(
|
||||
targetView,
|
||||
|
||||
@ -28,6 +28,7 @@ import bums.lunatic.launcher.model.UserActionModel
|
||||
import bums.lunatic.launcher.model.WeatherForcast
|
||||
import bums.lunatic.launcher.utils.Blog
|
||||
import bums.lunatic.launcher.utils.JamoUtils
|
||||
import bums.lunatic.launcher.utils.beforeDay
|
||||
import bums.lunatic.launcher.utils.beforeOneDay
|
||||
import io.realm.kotlin.Realm
|
||||
import io.realm.kotlin.RealmConfiguration
|
||||
@ -35,6 +36,7 @@ import io.realm.kotlin.UpdatePolicy
|
||||
import io.realm.kotlin.ext.query
|
||||
import io.realm.kotlin.migration.AutomaticSchemaMigration
|
||||
import io.realm.kotlin.query.RealmQuery
|
||||
import io.realm.kotlin.query.Sort
|
||||
import io.realm.kotlin.types.BaseRealmObject
|
||||
import io.realm.kotlin.types.TypedRealmObject
|
||||
import java.util.Calendar
|
||||
@ -218,10 +220,15 @@ object WorkersDb {
|
||||
|
||||
fun getVotedRss() = getRealm().query<RssData>().query("vote == $0", true).distinct("originPage", "title")
|
||||
|
||||
fun getDeleteQuery( ) : RealmQuery<RssData>{
|
||||
var rQ = getRealm().query<RssData>()
|
||||
rQ.query("pubDate > $0", beforeDay(14)).query("vote == $0", true)
|
||||
return rQ
|
||||
}
|
||||
fun getRssQuery(keyword: String?,
|
||||
category: Collection<String>? = arrayListOf(),
|
||||
noLimit: Boolean = false) : RealmQuery<RssData>{
|
||||
var rQ = getRealm().query<RssData>()
|
||||
var rQ = getRealm().query<RssData>().sort("pubDate", Sort.DESCENDING)
|
||||
if (!noLimit) rQ.query("pubDate > $0", beforeOneDay())
|
||||
keyword?.isNotEmpty()?.letTrue {
|
||||
if (JamoUtils.CHOSUNG.contains(keyword.split("")[0])) {
|
||||
|
||||
@ -20,5 +20,3 @@ dependencyResolutionManagement {
|
||||
|
||||
rootProject.name = "LunarLauncher"
|
||||
include ("app","library","utils")
|
||||
//annotations
|
||||
include(":sdk")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user