..
This commit is contained in:
parent
b17d4a0411
commit
3d65f30516
@ -118,7 +118,7 @@ dependencies {
|
|||||||
|
|
||||||
|
|
||||||
implementation ("androidx.media:media:1.7.0")
|
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-android:1.0.1")
|
||||||
// implementation ("me.everything:providers-core:1.0.1")
|
// implementation ("me.everything:providers-core:1.0.1")
|
||||||
// implementation ("androidx.window:window:1.0.0")
|
// implementation ("androidx.window:window:1.0.0")
|
||||||
|
|||||||
@ -109,11 +109,11 @@
|
|||||||
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
|
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
<activity
|
<!-- <activity-->
|
||||||
android:name=".PhotoFilter"
|
<!-- android:name=".PhotoFilter"-->
|
||||||
android:label="@string/lunar_settings"
|
<!-- android:label="@string/lunar_settings"-->
|
||||||
android:exported="true">
|
<!-- android:exported="true">-->
|
||||||
</activity>
|
<!-- </activity>-->
|
||||||
<activity
|
<activity
|
||||||
android:name=".feeds.Feeds"
|
android:name=".feeds.Feeds"
|
||||||
android:label="@string/lunar_settings"
|
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.color.DynamicColors
|
||||||
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
||||||
import io.realm.kotlin.ext.query
|
import io.realm.kotlin.ext.query
|
||||||
|
import io.realm.kotlin.query.Sort
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@ -311,17 +312,7 @@ internal class LauncherActivity : CommonActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
KEYCODE_BUTTON_X->{
|
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->{
|
KEYCODE_BUTTON_A->{
|
||||||
WorkersDb.getRealm().apply {
|
WorkersDb.getRealm().apply {
|
||||||
@ -337,11 +328,11 @@ internal class LauncherActivity : CommonActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
KEYCODE_BUTTON_B->{
|
KEYCODE_BUTTON_B->{
|
||||||
RssViewBuilder(lActivity!!)
|
// RssViewBuilder(lActivity!!)
|
||||||
.setRssId("https://jav.guru")
|
// .setRssId("https://jav.guru")
|
||||||
.webViewJavaScriptEnabled(true)
|
// .webViewJavaScriptEnabled(true)
|
||||||
.showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1)
|
// .showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1)
|
||||||
.show("https://jav.guru")
|
// .show("https://jav.guru")
|
||||||
}
|
}
|
||||||
KEYCODE_DPAD_DOWN->{
|
KEYCODE_DPAD_DOWN->{
|
||||||
|
|
||||||
@ -381,9 +372,21 @@ internal class LauncherActivity : CommonActivity() {
|
|||||||
|
|
||||||
|
|
||||||
fun onClickCenterButton() {
|
fun onClickCenterButton() {
|
||||||
|
|
||||||
WorkersDb.getRealm().apply {
|
WorkersDb.getRealm().apply {
|
||||||
writeBlocking {
|
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 origin = ddd.first()
|
||||||
var jjjj = hashSetOf<String>()
|
var jjjj = hashSetOf<String>()
|
||||||
jjjj.addAll(ddd)
|
jjjj.addAll(ddd)
|
||||||
|
|||||||
@ -1,139 +1,108 @@
|
|||||||
package bums.lunatic.launcher
|
//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)
|
|
||||||
//
|
//
|
||||||
// val filteredBitmap = applyCartoonFilter(bitmap)
|
//import bums.lunatic.launcher.common.CommonActivity
|
||||||
// filteredImageView.setImageBitmap(filteredBitmap)
|
//import android.Manifest
|
||||||
// }
|
//import android.app.Activity
|
||||||
// }
|
//import android.content.Intent
|
||||||
|
//import android.content.pm.PackageManager
|
||||||
private fun applyCartoonFilter(inputBitmap: Bitmap): Bitmap {
|
//import android.graphics.Bitmap
|
||||||
Blog.LOGE("applyCartoonFilter")
|
//import android.net.Uri
|
||||||
val src = Mat()
|
//import android.os.Build
|
||||||
Blog.LOGE("applyCartoonFilter 2")
|
//import android.os.Bundle
|
||||||
Utils.bitmapToMat(inputBitmap, src)
|
//import android.provider.MediaStore
|
||||||
Blog.LOGE("applyCartoonFilter 3")
|
//import android.widget.Button
|
||||||
val dst = Mat()
|
//import android.widget.ImageView
|
||||||
Blog.LOGE("applyCartoonFilter 4")
|
//import androidx.activity.result.ActivityResultLauncher
|
||||||
Photo.stylization(src, dst, 60f, 0.07f)
|
//import androidx.activity.result.contract.ActivityResultContracts
|
||||||
|
//import androidx.annotation.RequiresApi
|
||||||
val resultBitmap = Bitmap.createBitmap(inputBitmap.width, inputBitmap.height, Bitmap.Config.ARGB_8888)
|
//import androidx.appcompat.app.AppCompatActivity
|
||||||
Utils.matToBitmap(dst, resultBitmap)
|
//import androidx.core.app.ActivityCompat
|
||||||
|
//import androidx.core.content.ContextCompat
|
||||||
return resultBitmap
|
//import bums.lunatic.launcher.utils.Blog
|
||||||
}
|
//
|
||||||
|
//
|
||||||
|
//class PhotoFilter : CommonActivity() {
|
||||||
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
//// private lateinit var originalImageView: ImageView
|
||||||
private fun checkPermission(): Boolean {
|
//// private lateinit var filteredImageView: ImageView
|
||||||
return ContextCompat.checkSelfPermission(this, Manifest.permission.READ_MEDIA_IMAGES) == PackageManager.PERMISSION_GRANTED
|
//// private lateinit var selectImageButton: Button
|
||||||
}
|
//// private val PICK_IMAGE_REQUEST = 1
|
||||||
|
//// private val PERMISSION_REQUEST_CODE = 200
|
||||||
@RequiresApi(Build.VERSION_CODES.TIRAMISU)
|
////
|
||||||
private fun requestPermission() {
|
//// init {
|
||||||
ActivityCompat.requestPermissions(this, arrayOf(Manifest.permission.READ_MEDIA_IMAGES), PERMISSION_REQUEST_CODE)
|
////
|
||||||
}
|
//// }
|
||||||
|
////
|
||||||
override fun onRequestPermissionsResult(requestCode: Int, permissions: Array<out String>, grantResults: IntArray) {
|
//// override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults)
|
//// super.onCreate(savedInstanceState)
|
||||||
if (requestCode == PERMISSION_REQUEST_CODE) {
|
//// setContentView(R.layout.photo_filter)
|
||||||
if (grantResults.isNotEmpty() && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
|
////
|
||||||
openGallery()
|
//// 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.recyclerview.widget.RecyclerView
|
||||||
import androidx.viewpager2.widget.ViewPager2
|
import androidx.viewpager2.widget.ViewPager2
|
||||||
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
|
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
|
||||||
import bums.lunatic.launcher.PhotoFilter
|
|
||||||
import bums.lunatic.launcher.R
|
import bums.lunatic.launcher.R
|
||||||
import bums.lunatic.launcher.apps.AppsAdapter
|
import bums.lunatic.launcher.apps.AppsAdapter
|
||||||
import bums.lunatic.launcher.behavior.Behavior
|
import bums.lunatic.launcher.behavior.Behavior
|
||||||
@ -259,7 +258,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
binding.missedCalls.setOnLongClickListener {
|
binding.missedCalls.setOnLongClickListener {
|
||||||
lActivity?.startActivity(Intent(lActivity, PhotoFilter::class.java))
|
// lActivity?.startActivity(Intent(lActivity, PhotoFilter::class.java))
|
||||||
// RssViewBuilder(lActivity!!)
|
// RssViewBuilder(lActivity!!)
|
||||||
// .setRssId("https://booktoki468.com/")
|
// .setRssId("https://booktoki468.com/")
|
||||||
// .webViewMixedContentMode(MIXED_CONTENT_ALWAYS_ALLOW)
|
// .webViewMixedContentMode(MIXED_CONTENT_ALWAYS_ALLOW)
|
||||||
|
|||||||
@ -2,12 +2,15 @@ package bums.lunatic.launcher.home
|
|||||||
|
|
||||||
import android.content.ClipData
|
import android.content.ClipData
|
||||||
import android.content.ClipboardManager
|
import android.content.ClipboardManager
|
||||||
|
import android.content.ComponentName
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.print.PDFPrint
|
import android.print.PDFPrint
|
||||||
|
import android.provider.AlarmClock
|
||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
|
import android.view.HapticFeedbackConstants
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.KeyEvent.ACTION_UP
|
import android.view.KeyEvent.ACTION_UP
|
||||||
import android.view.KeyEvent.KEYCODE_BUTTON_A
|
import android.view.KeyEvent.KEYCODE_BUTTON_A
|
||||||
@ -31,9 +34,18 @@ import android.widget.Toast
|
|||||||
import androidx.appcompat.app.AlertDialog
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import androidx.core.view.postDelayed
|
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.CiliMagnet
|
||||||
import bums.lunatic.launcher.model.RssData
|
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.Blog
|
||||||
|
import bums.lunatic.launcher.utils.SimpleFingerGestures
|
||||||
import bums.lunatic.launcher.workers.WorkersDb
|
import bums.lunatic.launcher.workers.WorkersDb
|
||||||
import com.google.gson.Gson
|
import com.google.gson.Gson
|
||||||
import io.realm.kotlin.UpdatePolicy
|
import io.realm.kotlin.UpdatePolicy
|
||||||
@ -88,8 +100,9 @@ class RssViewBuilder(context: Context) : AwesomeWebView.Builder(context) {
|
|||||||
|
|
||||||
ContextUtil.startActivity(intent)
|
ContextUtil.startActivity(intent)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListener {
|
class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListener , View.OnTouchListener {
|
||||||
var actionButtonPressX = 0f
|
var actionButtonPressX = 0f
|
||||||
var actionButtonPressY = 0f
|
var actionButtonPressY = 0f
|
||||||
var rssId : String = ""
|
var rssId : String = ""
|
||||||
@ -108,8 +121,98 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
} else {
|
} else {
|
||||||
loadWithIntent = false
|
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() {
|
override fun onResume() {
|
||||||
super.onResume()
|
super.onResume()
|
||||||
@ -151,6 +254,9 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
}
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
private var lastX = 0f
|
||||||
|
private var lastY = 0f
|
||||||
|
private var onDown = false
|
||||||
|
|
||||||
override fun onGenericMotionEvent(ev: MotionEvent?): Boolean {
|
override fun onGenericMotionEvent(ev: MotionEvent?): Boolean {
|
||||||
|
|
||||||
@ -217,13 +323,14 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
webView?.evaluateJavascript("document.documentElement.outerHTML",
|
doNextPage()
|
||||||
object : ValueCallback<String> {
|
// webView?.evaluateJavascript("document.documentElement.outerHTML",
|
||||||
override fun onReceiveValue(value: String?) {
|
// object : ValueCallback<String> {
|
||||||
val html = value?.replace("\\u003C", "<")
|
// override fun onReceiveValue(value: String?) {
|
||||||
onHtml(html, false)
|
// val html = value?.replace("\\u003C", "<")
|
||||||
}
|
// onHtml(html, false)
|
||||||
})
|
// }
|
||||||
|
// })
|
||||||
} else {
|
} else {
|
||||||
finish()
|
finish()
|
||||||
}
|
}
|
||||||
@ -609,48 +716,49 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onHtml(value: String?, autoCheck : Boolean) {
|
override fun onHtml(value: String?, autoCheck : Boolean) {
|
||||||
chechHandler.removeCallbacks(cancelSearch)
|
vote()
|
||||||
if (loadWithIntent){
|
// chechHandler.removeCallbacks(cancelSearch)
|
||||||
return
|
// if (loadWithIntent){
|
||||||
}
|
// return
|
||||||
showBlock()
|
// }
|
||||||
|
// 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()}")
|
// var count = (webView!!.contentHeight / (webView!!.height * 0.3).toInt())
|
||||||
chechHandler.postDelayed(pageDown, defaultTime)
|
// LogUtil.e("count >>>> ${count} webView!!.contentHeight >>>> ${webView!!.contentHeight} , webView!!.height >>>> ${webView!!.height} :: ${(webView!!.height * 0.3).toInt()}")
|
||||||
webView!!.setOnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
|
// chechHandler.postDelayed(pageDown, defaultTime)
|
||||||
val measuredHeight: Int = v.measuredHeight
|
// webView!!.setOnScrollChangeListener { v, scrollX, scrollY, oldScrollX, oldScrollY ->
|
||||||
LogUtil.e("OnScrollChange >>> ${scrollY} , ${oldScrollY}")
|
// val measuredHeight: Int = v.measuredHeight
|
||||||
if(measuredHeight + scrollY == webView!!.computeVerticalScrollRange()){
|
// LogUtil.e("OnScrollChange >>> ${scrollY} , ${oldScrollY}")
|
||||||
chechHandler.removeCallbacks(scrollDown)
|
// if(measuredHeight + scrollY == webView!!.computeVerticalScrollRange()){
|
||||||
chechHandler.removeCallbacks(pageDown)
|
// chechHandler.removeCallbacks(scrollDown)
|
||||||
chechHandler.postDelayed({
|
// chechHandler.removeCallbacks(pageDown)
|
||||||
webView!!.evaluateJavascript("document.documentElement.outerHTML",object : ValueCallback<String> {
|
// chechHandler.postDelayed({
|
||||||
override fun onReceiveValue(value: String?) {
|
// webView!!.evaluateJavascript("document.documentElement.outerHTML",object : ValueCallback<String> {
|
||||||
val html = value?.replace("\\u003C", "<")
|
// override fun onReceiveValue(value: String?) {
|
||||||
this@RssViewerActivity.run(html!!, autoCheck)
|
// val html = value?.replace("\\u003C", "<")
|
||||||
}
|
// this@RssViewerActivity.run(html!!, autoCheck)
|
||||||
})
|
// }
|
||||||
},defaultTime.times(2))
|
// })
|
||||||
} else {
|
// },defaultTime.times(2))
|
||||||
chechHandler.removeCallbacks(cancelSearch)
|
// } else {
|
||||||
Blog.LOGE("onScrollChanged called PageDown")
|
// chechHandler.removeCallbacks(cancelSearch)
|
||||||
// chechHandler.removeCallbacks(scrollDown)
|
// Blog.LOGE("onScrollChanged called PageDown")
|
||||||
if (switch) {
|
//// chechHandler.removeCallbacks(scrollDown)
|
||||||
chechHandler.removeCallbacks(pageDown)
|
// if (switch) {
|
||||||
chechHandler.postDelayed(scrollDown, defaultTime)
|
// chechHandler.removeCallbacks(pageDown)
|
||||||
switch = false
|
// chechHandler.postDelayed(scrollDown, defaultTime)
|
||||||
} else {
|
// switch = false
|
||||||
switch = true
|
// } else {
|
||||||
chechHandler.removeCallbacks(scrollDown)
|
// switch = true
|
||||||
chechHandler.postDelayed(pageDown, defaultTime)
|
// chechHandler.removeCallbacks(scrollDown)
|
||||||
}
|
// chechHandler.postDelayed(pageDown, defaultTime)
|
||||||
}
|
// }
|
||||||
// else if (scrollY % 10 == 0 || oldScrollY % 10 == 0){
|
// }
|
||||||
//// chechHandler.removeCallbacks(pageDown)
|
//// else if (scrollY % 10 == 0 || oldScrollY % 10 == 0){
|
||||||
//// chechHandler.postDelayed(scrollDown, defaultTime)
|
////// chechHandler.removeCallbacks(pageDown)
|
||||||
|
////// chechHandler.postDelayed(scrollDown, defaultTime)
|
||||||
|
//// }
|
||||||
// }
|
// }
|
||||||
}
|
|
||||||
}
|
}
|
||||||
var switch = false
|
var switch = false
|
||||||
var scrollDown : Runnable = Runnable{
|
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) {
|
if (loadWithIntent) {
|
||||||
webView?.evaluateJavascript(
|
webView?.evaluateJavascript(
|
||||||
"try{document.querySelector('meta[name=viewport]').setAttribute('content','initial-scale=1.0')}catch(e){}",
|
"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 {
|
class SimpleFingerGestures : OnTouchListener {
|
||||||
private var debug = BuildConfig.DEBUG
|
private var debug = BuildConfig.DEBUG
|
||||||
@ -537,28 +536,28 @@ class SimpleFingerGestures : OnTouchListener {
|
|||||||
1,
|
1,
|
||||||
mGt.gestureDuration,
|
mGt.gestureDuration,
|
||||||
mGt.gestureDistance
|
mGt.gestureDistance
|
||||||
)
|
).apply { consumeTouchEvents = this }
|
||||||
|
|
||||||
GestureAnalyser.SWIPE_1_DOWN -> onFingerGestureListener!!.onSwipeDown(
|
GestureAnalyser.SWIPE_1_DOWN -> onFingerGestureListener!!.onSwipeDown(
|
||||||
targetView,
|
targetView,
|
||||||
1,
|
1,
|
||||||
mGt.gestureDuration,
|
mGt.gestureDuration,
|
||||||
mGt.gestureDistance
|
mGt.gestureDistance
|
||||||
)
|
).apply { consumeTouchEvents = this }
|
||||||
|
|
||||||
GestureAnalyser.SWIPE_1_LEFT -> onFingerGestureListener!!.onSwipeLeft(
|
GestureAnalyser.SWIPE_1_LEFT -> onFingerGestureListener!!.onSwipeLeft(
|
||||||
targetView,
|
targetView,
|
||||||
1,
|
1,
|
||||||
mGt.gestureDuration,
|
mGt.gestureDuration,
|
||||||
mGt.gestureDistance
|
mGt.gestureDistance
|
||||||
)
|
).apply { consumeTouchEvents = this }
|
||||||
|
|
||||||
GestureAnalyser.SWIPE_1_RIGHT -> onFingerGestureListener!!.onSwipeRight(
|
GestureAnalyser.SWIPE_1_RIGHT -> onFingerGestureListener!!.onSwipeRight(
|
||||||
targetView,
|
targetView,
|
||||||
1,
|
1,
|
||||||
mGt.gestureDuration,
|
mGt.gestureDuration,
|
||||||
mGt.gestureDistance
|
mGt.gestureDistance
|
||||||
)
|
).apply { consumeTouchEvents = this }
|
||||||
|
|
||||||
GestureAnalyser.SWIPE_2_UP -> onFingerGestureListener!!.onSwipeUp(
|
GestureAnalyser.SWIPE_2_UP -> onFingerGestureListener!!.onSwipeUp(
|
||||||
targetView,
|
targetView,
|
||||||
|
|||||||
@ -28,6 +28,7 @@ import bums.lunatic.launcher.model.UserActionModel
|
|||||||
import bums.lunatic.launcher.model.WeatherForcast
|
import bums.lunatic.launcher.model.WeatherForcast
|
||||||
import bums.lunatic.launcher.utils.Blog
|
import bums.lunatic.launcher.utils.Blog
|
||||||
import bums.lunatic.launcher.utils.JamoUtils
|
import bums.lunatic.launcher.utils.JamoUtils
|
||||||
|
import bums.lunatic.launcher.utils.beforeDay
|
||||||
import bums.lunatic.launcher.utils.beforeOneDay
|
import bums.lunatic.launcher.utils.beforeOneDay
|
||||||
import io.realm.kotlin.Realm
|
import io.realm.kotlin.Realm
|
||||||
import io.realm.kotlin.RealmConfiguration
|
import io.realm.kotlin.RealmConfiguration
|
||||||
@ -35,6 +36,7 @@ import io.realm.kotlin.UpdatePolicy
|
|||||||
import io.realm.kotlin.ext.query
|
import io.realm.kotlin.ext.query
|
||||||
import io.realm.kotlin.migration.AutomaticSchemaMigration
|
import io.realm.kotlin.migration.AutomaticSchemaMigration
|
||||||
import io.realm.kotlin.query.RealmQuery
|
import io.realm.kotlin.query.RealmQuery
|
||||||
|
import io.realm.kotlin.query.Sort
|
||||||
import io.realm.kotlin.types.BaseRealmObject
|
import io.realm.kotlin.types.BaseRealmObject
|
||||||
import io.realm.kotlin.types.TypedRealmObject
|
import io.realm.kotlin.types.TypedRealmObject
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
@ -218,10 +220,15 @@ object WorkersDb {
|
|||||||
|
|
||||||
fun getVotedRss() = getRealm().query<RssData>().query("vote == $0", true).distinct("originPage", "title")
|
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?,
|
fun getRssQuery(keyword: String?,
|
||||||
category: Collection<String>? = arrayListOf(),
|
category: Collection<String>? = arrayListOf(),
|
||||||
noLimit: Boolean = false) : RealmQuery<RssData>{
|
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())
|
if (!noLimit) rQ.query("pubDate > $0", beforeOneDay())
|
||||||
keyword?.isNotEmpty()?.letTrue {
|
keyword?.isNotEmpty()?.letTrue {
|
||||||
if (JamoUtils.CHOSUNG.contains(keyword.split("")[0])) {
|
if (JamoUtils.CHOSUNG.contains(keyword.split("")[0])) {
|
||||||
|
|||||||
@ -20,5 +20,3 @@ dependencyResolutionManagement {
|
|||||||
|
|
||||||
rootProject.name = "LunarLauncher"
|
rootProject.name = "LunarLauncher"
|
||||||
include ("app","library","utils")
|
include ("app","library","utils")
|
||||||
//annotations
|
|
||||||
include(":sdk")
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user