...
This commit is contained in:
parent
a297e76da0
commit
b17d4a0411
@ -65,6 +65,8 @@ android {
|
|||||||
buildFeatures {
|
buildFeatures {
|
||||||
viewBinding = true
|
viewBinding = true
|
||||||
dataBinding = true
|
dataBinding = true
|
||||||
|
buildConfig = true
|
||||||
|
resValues = true
|
||||||
}
|
}
|
||||||
|
|
||||||
compileOptions {
|
compileOptions {
|
||||||
@ -111,7 +113,12 @@ dependencies {
|
|||||||
implementation(project(":utils"))
|
implementation(project(":utils"))
|
||||||
// implementation ("org.apache.tika:tika-parsers:1.12")
|
// implementation ("org.apache.tika:tika-parsers:1.12")
|
||||||
|
|
||||||
|
|
||||||
|
// implementation("org.opencv:opencv-android:4.11.0")
|
||||||
|
|
||||||
|
|
||||||
implementation ("androidx.media:media:1.7.0")
|
implementation ("androidx.media:media:1.7.0")
|
||||||
|
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,6 +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
|
||||||
|
android:name=".PhotoFilter"
|
||||||
|
android:label="@string/lunar_settings"
|
||||||
|
android:exported="true">
|
||||||
|
</activity>
|
||||||
<activity
|
<activity
|
||||||
android:name=".feeds.Feeds"
|
android:name=".feeds.Feeds"
|
||||||
android:label="@string/lunar_settings"
|
android:label="@string/lunar_settings"
|
||||||
|
|||||||
@ -290,6 +290,7 @@ internal class LauncherActivity : CommonActivity() {
|
|||||||
var onExit = false
|
var onExit = false
|
||||||
var lastAction = MotionEvent.ACTION_HOVER_EXIT
|
var lastAction = MotionEvent.ACTION_HOVER_EXIT
|
||||||
override fun dispatchKeyEvent(ev: KeyEvent): Boolean {
|
override fun dispatchKeyEvent(ev: KeyEvent): Boolean {
|
||||||
|
|
||||||
Blog.LOGE("dispatch ev?.device?.name >>> ${ev?.device?.name}")
|
Blog.LOGE("dispatch ev?.device?.name >>> ${ev?.device?.name}")
|
||||||
if (ev?.device?.name?.contains("SM-031N Mouse") == true) {
|
if (ev?.device?.name?.contains("SM-031N Mouse") == true) {
|
||||||
|
|
||||||
@ -298,6 +299,7 @@ internal class LauncherActivity : CommonActivity() {
|
|||||||
Blog.LOGE("dispatch dispatchKeyEvent>>> ${ev}")
|
Blog.LOGE("dispatch dispatchKeyEvent>>> ${ev}")
|
||||||
when(ev.keyCode) {
|
when(ev.keyCode) {
|
||||||
KEYCODE_BUTTON_Y->{
|
KEYCODE_BUTTON_Y->{
|
||||||
|
|
||||||
CoroutineScope(Dispatchers.IO).launch {
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
String(Base64.getMimeDecoder().decode("aHR0cHM6Ly9qYXZtb3N0LnRvL2xhdGVzdC11cGRhdGVzCg==".toByteArray())).getJ().let { doc -> FeedParseManager.parse(doc){Blog.LOGE(it)} }
|
String(Base64.getMimeDecoder().decode("aHR0cHM6Ly9qYXZtb3N0LnRvL2xhdGVzdC11cGRhdGVzCg==".toByteArray())).getJ().let { doc -> FeedParseManager.parse(doc){Blog.LOGE(it)} }
|
||||||
}
|
}
|
||||||
|
|||||||
139
app/src/main/kotlin/bums/lunatic/launcher/PhotoFilter.kt
Normal file
139
app/src/main/kotlin/bums/lunatic/launcher/PhotoFilter.kt
Normal file
@ -0,0 +1,139 @@
|
|||||||
|
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)
|
||||||
|
// 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()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -36,6 +36,7 @@ import androidx.core.widget.doOnTextChanged
|
|||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import bums.lunatic.launcher.BuildConfig
|
import bums.lunatic.launcher.BuildConfig
|
||||||
import bums.lunatic.launcher.LauncherActivity
|
import bums.lunatic.launcher.LauncherActivity
|
||||||
|
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
|
||||||
import bums.lunatic.launcher.common.CommonActivity
|
import bums.lunatic.launcher.common.CommonActivity
|
||||||
import bums.lunatic.launcher.common.letTrue
|
import bums.lunatic.launcher.common.letTrue
|
||||||
import bums.lunatic.launcher.databinding.AppDrawerBinding
|
import bums.lunatic.launcher.databinding.AppDrawerBinding
|
||||||
@ -45,6 +46,7 @@ import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_APP_NAMES
|
|||||||
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
|
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
|
||||||
import bums.lunatic.launcher.helpers.PrefBoolean
|
import bums.lunatic.launcher.helpers.PrefBoolean
|
||||||
import bums.lunatic.launcher.helpers.PrefLong
|
import bums.lunatic.launcher.helpers.PrefLong
|
||||||
|
import bums.lunatic.launcher.helpers.PrefString
|
||||||
import bums.lunatic.launcher.model.AppInfo
|
import bums.lunatic.launcher.model.AppInfo
|
||||||
import bums.lunatic.launcher.utils.Blog
|
import bums.lunatic.launcher.utils.Blog
|
||||||
import bums.lunatic.launcher.utils.JamoUtils
|
import bums.lunatic.launcher.utils.JamoUtils
|
||||||
@ -139,7 +141,7 @@ internal class AppDrawer : CommonActivity() {
|
|||||||
sendMsg()
|
sendMsg()
|
||||||
}
|
}
|
||||||
binding.runTelegram.setOnClickListener {
|
binding.runTelegram.setOnClickListener {
|
||||||
sendMsg("tg://msg?text=${getInputText()}&to=","org.telegram.messenger")
|
sendMsg("tg://msg?text=${getInputText()}&to=${PrefString.telegramSendTarget.get()}","org.telegram.messenger")
|
||||||
}
|
}
|
||||||
binding.runKatalk.setOnClickListener {
|
binding.runKatalk.setOnClickListener {
|
||||||
sendMsg(pkg = "com.kakao.talk")
|
sendMsg(pkg = "com.kakao.talk")
|
||||||
@ -160,6 +162,8 @@ internal class AppDrawer : CommonActivity() {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var packageManager = lActivity?.packageManager
|
||||||
|
|
||||||
binding.searchInput.setOnLongClickListener {
|
binding.searchInput.setOnLongClickListener {
|
||||||
WorkersDb.getRealm().apply {
|
WorkersDb.getRealm().apply {
|
||||||
var newQ = query<AppInfo>()
|
var newQ = query<AppInfo>()
|
||||||
@ -168,10 +172,18 @@ internal class AppDrawer : CommonActivity() {
|
|||||||
if(it.size > 0) {
|
if(it.size > 0) {
|
||||||
WorkersDb.getRealm().apply {
|
WorkersDb.getRealm().apply {
|
||||||
packageList.clear()
|
packageList.clear()
|
||||||
packageList.addAll(copyFromRealm(it))
|
writeBlocking {
|
||||||
binding.appsList.post { if (packageList.size > 0) {
|
it.filter {
|
||||||
|
var installed = isPackageInstalled(it.pkgName ?: "fffffffail", packageManager!!)
|
||||||
|
// it.isInstalled = installed
|
||||||
|
installed
|
||||||
|
}.let { result ->
|
||||||
|
packageList.addAll(copyFromRealm(result))
|
||||||
|
binding.appsList.post { if (result.size > 0) {
|
||||||
appsAdapter?.updateData(packageList)
|
appsAdapter?.updateData(packageList)
|
||||||
} }
|
}}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -200,6 +212,14 @@ internal class AppDrawer : CommonActivity() {
|
|||||||
}
|
}
|
||||||
// return binding.root
|
// return binding.root
|
||||||
}
|
}
|
||||||
|
fun isPackageInstalled( packageName : String, packageManager : PackageManager?) : Boolean{
|
||||||
|
try {
|
||||||
|
packageManager!!.getPackageInfo(packageName, 0)
|
||||||
|
return true;
|
||||||
|
} catch ( e : Exception) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun sendMsg(scheme : String? = null , pkg : String? = null) {
|
fun sendMsg(scheme : String? = null , pkg : String? = null) {
|
||||||
var postIntent : Intent? = null
|
var postIntent : Intent? = null
|
||||||
@ -317,10 +337,18 @@ internal class AppDrawer : CommonActivity() {
|
|||||||
if(it.size > 0) {
|
if(it.size > 0) {
|
||||||
WorkersDb.getRealm().apply {
|
WorkersDb.getRealm().apply {
|
||||||
packageList.clear()
|
packageList.clear()
|
||||||
packageList.addAll(copyFromRealm(it))
|
writeBlocking {
|
||||||
binding.appsList.post { if (packageList.size > 0) {
|
it.filter {
|
||||||
|
var installed = isPackageInstalled(it.pkgName ?: "fffffffail", packageManager!!)
|
||||||
|
// it.isInstalled = installed
|
||||||
|
installed
|
||||||
|
}.let { result ->
|
||||||
|
packageList.addAll(copyFromRealm(result))
|
||||||
|
binding.appsList.post { if (result.size > 0) {
|
||||||
appsAdapter?.updateData(packageList)
|
appsAdapter?.updateData(packageList)
|
||||||
} }
|
}}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -25,6 +25,7 @@ import android.content.DialogInterface
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.content.IntentFilter
|
import android.content.IntentFilter
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
|
import android.content.pm.PackageManager
|
||||||
import android.media.AudioManager
|
import android.media.AudioManager
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
@ -37,6 +38,8 @@ import android.view.KeyEvent
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.webkit.WebSettings.LOAD_NO_CACHE
|
||||||
|
import android.webkit.WebSettings.MIXED_CONTENT_ALWAYS_ALLOW
|
||||||
import android.widget.CheckBox
|
import android.widget.CheckBox
|
||||||
import android.widget.EditText
|
import android.widget.EditText
|
||||||
import android.widget.TableRow
|
import android.widget.TableRow
|
||||||
@ -52,6 +55,7 @@ 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
|
||||||
@ -85,6 +89,7 @@ import bums.lunatic.launcher.settings.SettingsActivity
|
|||||||
import bums.lunatic.launcher.utils.Blog
|
import bums.lunatic.launcher.utils.Blog
|
||||||
import bums.lunatic.launcher.utils.BitmapConverter
|
import bums.lunatic.launcher.utils.BitmapConverter
|
||||||
import bums.lunatic.launcher.utils.SimpleFingerGestures
|
import bums.lunatic.launcher.utils.SimpleFingerGestures
|
||||||
|
import bums.lunatic.launcher.utils.USAGT
|
||||||
import bums.lunatic.launcher.utils.beforeDay
|
import bums.lunatic.launcher.utils.beforeDay
|
||||||
import bums.lunatic.launcher.utils.beforeOneDay
|
import bums.lunatic.launcher.utils.beforeOneDay
|
||||||
import bums.lunatic.launcher.view.TableRadioGroup
|
import bums.lunatic.launcher.view.TableRadioGroup
|
||||||
@ -108,12 +113,14 @@ import kotlinx.coroutines.Job
|
|||||||
import kotlinx.coroutines.flow.cancellable
|
import kotlinx.coroutines.flow.cancellable
|
||||||
import kotlinx.coroutines.flow.collect
|
import kotlinx.coroutines.flow.collect
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import okhttp3.Dns
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import java.math.BigDecimal
|
import java.math.BigDecimal
|
||||||
import java.math.RoundingMode
|
import java.math.RoundingMode
|
||||||
import java.net.URLEncoder
|
import java.net.URLEncoder
|
||||||
import java.util.Calendar
|
import java.util.Calendar
|
||||||
|
import kotlin.jvm.java
|
||||||
|
|
||||||
|
|
||||||
internal class LauncherHome : Fragment() {
|
internal class LauncherHome : Fragment() {
|
||||||
@ -231,15 +238,43 @@ internal class LauncherHome : Fragment() {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
binding.notice.setOnLongClickListener {
|
binding.favApps.setOnLongClickListener {
|
||||||
RssViewBuilder(lActivity!!)
|
RssViewBuilder(lActivity!!)
|
||||||
.setRssId("https://jav.guru")
|
.setRssId("https://jav.guru")
|
||||||
|
.webViewDomStorageEnabled(true)
|
||||||
.webViewJavaScriptEnabled(true)
|
.webViewJavaScriptEnabled(true)
|
||||||
.showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1)
|
.webViewUserAgentAppend(false)
|
||||||
|
.webViewAllowContentAccess(true)
|
||||||
|
.webViewCookieEnabled(true)
|
||||||
|
.webViewCacheMode(LOAD_NO_CACHE)
|
||||||
|
.webViewUserAgentString(USAGT)
|
||||||
|
.webViewMixedContentMode(MIXED_CONTENT_ALWAYS_ALLOW)
|
||||||
|
.showIconClose(true)
|
||||||
|
.showIconBack(false)
|
||||||
|
.showProgressBar(true)
|
||||||
|
.backPressToClose(false)
|
||||||
|
.webViewCookieEnabled(true)
|
||||||
.show("https://jav.guru")
|
.show("https://jav.guru")
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.missedCalls.setOnLongClickListener {
|
||||||
|
lActivity?.startActivity(Intent(lActivity, PhotoFilter::class.java))
|
||||||
|
// RssViewBuilder(lActivity!!)
|
||||||
|
// .setRssId("https://booktoki468.com/")
|
||||||
|
// .webViewMixedContentMode(MIXED_CONTENT_ALWAYS_ALLOW)
|
||||||
|
// .webViewCacheMode(LOAD_NO_CACHE)
|
||||||
|
// .webViewJavaScriptEnabled(true)
|
||||||
|
// .webViewUserAgentAppend(false)
|
||||||
|
// .webViewAllowContentAccess(true)
|
||||||
|
// .webViewCookieEnabled(true)
|
||||||
|
// .webViewDomStorageEnabled(true)
|
||||||
|
// .webViewUserAgentString(USAGT)
|
||||||
|
// .showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false)
|
||||||
|
// .show("https://booktoki468.com/")
|
||||||
|
true
|
||||||
|
}
|
||||||
|
|
||||||
arrayListOf(binding.mainList,binding.smsList,binding.infoList,binding.notiList).forEach {
|
arrayListOf(binding.mainList,binding.smsList,binding.infoList,binding.notiList).forEach {
|
||||||
try {
|
try {
|
||||||
it.removeOnScrollListener(onScrChanged)
|
it.removeOnScrollListener(onScrChanged)
|
||||||
@ -259,6 +294,15 @@ internal class LauncherHome : Fragment() {
|
|||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isPackageInstalled( packageName : String, packageManager : PackageManager?) : Boolean{
|
||||||
|
try {
|
||||||
|
packageManager!!.getPackageInfo(packageName, 0);
|
||||||
|
return true;
|
||||||
|
} catch ( e : Exception) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun queryApps() {
|
private fun queryApps() {
|
||||||
WorkersDb.getRealm().apply {
|
WorkersDb.getRealm().apply {
|
||||||
var newQ = query<AppInfo>()
|
var newQ = query<AppInfo>()
|
||||||
@ -266,8 +310,18 @@ internal class LauncherHome : Fragment() {
|
|||||||
if(it.size > 0) {
|
if(it.size > 0) {
|
||||||
WorkersDb.getRealm().apply {
|
WorkersDb.getRealm().apply {
|
||||||
var packageList = arrayListOf<AppInfo>()
|
var packageList = arrayListOf<AppInfo>()
|
||||||
packageList.addAll(copyFromRealm(it))
|
writeBlocking {
|
||||||
|
it.filter {
|
||||||
|
var installed = isPackageInstalled(it.pkgName ?: "fffffffail", lActivity?.packageManager)
|
||||||
|
// it.isInstalled = installed
|
||||||
|
installed
|
||||||
|
}.let { result ->
|
||||||
|
packageList.addAll(copyFromRealm(result))
|
||||||
|
binding.appsList.post { if (result.size > 0) {
|
||||||
mAppsAdapter?.updateData(packageList)
|
mAppsAdapter?.updateData(packageList)
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -495,7 +549,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
WorkersDb.getRealm().writeBlocking {
|
WorkersDb.getRealm().writeBlocking {
|
||||||
delete(
|
delete(
|
||||||
query<RssData>()
|
query<RssData>()
|
||||||
.query("pubDate < $0", beforeOneDay())
|
.query("pubDate < $0", beforeDay(30))
|
||||||
.query("category != $0 AND category != $1 ", RssDataType.GURU.name, RssDataType.MOST.name)
|
.query("category != $0 AND category != $1 ", RssDataType.GURU.name, RssDataType.MOST.name)
|
||||||
.query("vote != $0", true).find()
|
.query("vote != $0", true).find()
|
||||||
)
|
)
|
||||||
@ -503,24 +557,18 @@ internal class LauncherHome : Fragment() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun updateQuery(q: RealmQuery<RssData>) {
|
fun updateQuery(q: RealmQuery<RssData>) {
|
||||||
mRssDataResult = q.sort("pubDate ", Sort.DESCENDING).limit(300).distinct("title").find()
|
mRssDataResult = q.sort("pubDate ", Sort.DESCENDING).limit(300).distinct("originPage", "title").find()
|
||||||
mRssDataResult?.asFlow()?.let { flow ->
|
mRssDataResult?.asFlow()?.let { flow ->
|
||||||
|
|
||||||
infosJob = CoroutineScope(Dispatchers.IO).launch {
|
infosJob = CoroutineScope(Dispatchers.IO).launch {
|
||||||
flow.collect { changes: ResultsChange<RssData> ->
|
flow.collect { changes: ResultsChange<RssData> ->
|
||||||
commandHandler.removeCallbacks(hideListView)
|
commandHandler.removeCallbacks(hideListView)
|
||||||
commandHandler.removeCallbacks(infoUpdate)
|
commandHandler.removeCallbacks(infoUpdate)
|
||||||
// when (changes) {
|
|
||||||
// is InitialResults, is UpdatedResults -> {
|
|
||||||
WorkersDb.getRealm().apply {
|
WorkersDb.getRealm().apply {
|
||||||
lasted = copyFromRealm(changes.list)
|
lasted = copyFromRealm(changes.list)
|
||||||
}
|
}
|
||||||
commandHandler.postDelayed(infoUpdate, UPDATE_DELAY)
|
commandHandler.postDelayed(infoUpdate, UPDATE_DELAY)
|
||||||
// }
|
|
||||||
|
|
||||||
// else -> {
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
infosJob?.start()
|
infosJob?.start()
|
||||||
@ -539,7 +587,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
filter: Collection<RssDataType>? = arrayListOf(RssDataType.GURU, RssDataType.MOST,RssDataType.REDDIT_NSFW), noLimit: Boolean = false
|
filter: Collection<RssDataType>? = arrayListOf(RssDataType.GURU, RssDataType.MOST,RssDataType.REDDIT_NSFW), noLimit: Boolean = false
|
||||||
) {
|
) {
|
||||||
beforeQuery()
|
beforeQuery()
|
||||||
var rQ = WorkersDb.getRealm().query<RssData>().query("read < $0", nomoreShowCount).distinct("originPage").distinct("title")
|
var rQ = WorkersDb.getRealm().query<RssData>().query("read < $0", nomoreShowCount).distinct("originPage", "title")
|
||||||
if (!noLimit) rQ.query("pubDate > $0", beforeOneDay())
|
if (!noLimit) rQ.query("pubDate > $0", beforeOneDay())
|
||||||
((filter?.size ?: 0) > 0).letTrue {filter!!.forEach {rQ = rQ.query("category != $0", it.name)}}
|
((filter?.size ?: 0) > 0).letTrue {filter!!.forEach {rQ = rQ.query("category != $0", it.name)}}
|
||||||
updateQuery(rQ)
|
updateQuery(rQ)
|
||||||
@ -820,27 +868,26 @@ internal class LauncherHome : Fragment() {
|
|||||||
override fun onSwiped(@NonNull viewHolder: RecyclerView.ViewHolder, direction: Int) {
|
override fun onSwiped(@NonNull viewHolder: RecyclerView.ViewHolder, direction: Int) {
|
||||||
Blog.LOGE("onSwiped direction >>>> $direction")
|
Blog.LOGE("onSwiped direction >>>> $direction")
|
||||||
(viewHolder.itemView.tag as? RssData)?.let { rss ->
|
(viewHolder.itemView.tag as? RssData)?.let { rss ->
|
||||||
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
WorkersDb.getRealm().apply {
|
WorkersDb.getRealm().apply {
|
||||||
writeBlocking {
|
writeBlocking {
|
||||||
when(direction) {
|
when (direction) {
|
||||||
ItemTouchHelper.LEFT->{
|
ItemTouchHelper.LEFT -> {
|
||||||
if (rssStateVote() && rss.vote) {
|
if (rssStateVote() && rss.vote) {
|
||||||
rss.vote = false
|
rss.vote = false
|
||||||
rss.read = 0
|
rss.read = 0
|
||||||
} else {
|
} else {
|
||||||
rss.read += nomoreShowCount
|
rss.read += nomoreShowCount
|
||||||
}
|
}
|
||||||
// copyToRealm(rss, UpdatePolicy.ALL)
|
query<RssData>(
|
||||||
query<RssData>("originPage == $0",rss.originPage).find().forEach { it ->
|
"originPage == $0",
|
||||||
it.read += nomoreShowCount
|
rss.originPage
|
||||||
}
|
).find().forEach { it ->
|
||||||
query<RssData>("chosung == $0",rss.chosung).find().forEach { it ->
|
|
||||||
if (!rss.originPage().equals(it.originPage())) {
|
|
||||||
it.read += nomoreShowCount
|
it.read += nomoreShowCount
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ItemTouchHelper.RIGHT->{
|
ItemTouchHelper.RIGHT -> {
|
||||||
if (rssStateVote() && rss.vote) {
|
if (rssStateVote() && rss.vote) {
|
||||||
rss.vote = false
|
rss.vote = false
|
||||||
rss.read = 0
|
rss.read = 0
|
||||||
@ -848,11 +895,12 @@ internal class LauncherHome : Fragment() {
|
|||||||
rss.vote = true
|
rss.vote = true
|
||||||
|
|
||||||
}
|
}
|
||||||
// copyToRealm(rss,UpdatePolicy.ALL)
|
|
||||||
}
|
}
|
||||||
else ->{}
|
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
binding.infoList.post { mRssAdapter.refresh() }
|
||||||
}
|
}
|
||||||
// binding.infoList.post { mRssAdapter.refresh() }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import android.content.ClipData
|
|||||||
import android.content.ClipboardManager
|
import android.content.ClipboardManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.print.PDFPrint
|
import android.print.PDFPrint
|
||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
@ -34,7 +35,10 @@ import bums.lunatic.launcher.model.CiliMagnet
|
|||||||
import bums.lunatic.launcher.model.RssData
|
import bums.lunatic.launcher.model.RssData
|
||||||
import bums.lunatic.launcher.utils.Blog
|
import bums.lunatic.launcher.utils.Blog
|
||||||
import bums.lunatic.launcher.workers.WorkersDb
|
import bums.lunatic.launcher.workers.WorkersDb
|
||||||
|
import com.google.gson.Gson
|
||||||
|
import io.realm.kotlin.UpdatePolicy
|
||||||
import io.realm.kotlin.ext.query
|
import io.realm.kotlin.ext.query
|
||||||
|
import io.realm.kotlin.ext.realmListOf
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@ -411,11 +415,15 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
|
|
||||||
override fun bindViews() {
|
override fun bindViews() {
|
||||||
super.bindViews()
|
super.bindViews()
|
||||||
if (this.rssId.contains(".guru")) {
|
if (this.rssId.contains(".guru")|| this.rssId.contains("bookto")) {
|
||||||
|
webView?.clearCache(true)
|
||||||
Blog.LOGE("this.webView >>>> ${this.rssId}")
|
Blog.LOGE("this.webView >>>> ${this.rssId}")
|
||||||
Blog.LOGE("this.webView >>>> ${this.webView}")
|
Blog.LOGE("this.webView >>>> ${this.webView}")
|
||||||
webView?.alpha = 0.2f
|
if (this.rssId.contains(".guru")) webView?.alpha = 0.2f
|
||||||
|
|
||||||
webView?.addJavascriptInterface(gji, "GJI")
|
webView?.addJavascriptInterface(gji, "GJI")
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -520,14 +528,22 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
fun onResult(result : String?) {
|
fun onResult(result : String?) {
|
||||||
registCancelSearch()
|
registCancelSearch()
|
||||||
result.toString()?.replace("\\u003C","<")?.replace("\\"","")?.let {
|
result.toString()?.replace("\\u003C","<")?.replace("\\"","")?.let {
|
||||||
|
if (rssId.contains("guru")) {
|
||||||
Jsoup.parse(it)?.let { guru ->
|
Jsoup.parse(it)?.let { guru ->
|
||||||
Blog.LOGE("guru >>> ${guru.title()} ")
|
Blog.LOGE("guru >>> ${guru.title()} ")
|
||||||
guru.getElementsByClass("row")?.forEach { row ->
|
guru.getElementsByClass("row")?.forEach { row ->
|
||||||
row.getElementsByClass("grid1").first().getElementsByTag("a")?.first()?.attr("title")?.let { title ->
|
row.getElementsByClass("grid1").first().getElementsByTag("a")?.first()
|
||||||
Blog.LOGE("row >>> ${title.split("]")?.first()?.replace("[","")}")
|
?.attr("title")?.let { title ->
|
||||||
|
Blog.LOGE("row >>> ${title.split("]")?.first()?.replace("[", "")}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if(rssId.contains("book")){
|
||||||
|
Jsoup.parse(it)?.let { book ->
|
||||||
|
Blog.LOGE("book.title() >>> ${book.title()}")
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -655,18 +671,23 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
var isFirst = true
|
||||||
override fun webviewOnPageFinished() {
|
override fun webviewOnPageFinished() {
|
||||||
if (rssId.contains(".guru")) {
|
if (rssId.contains(".guru")) {
|
||||||
registCancelSearch()
|
registCancelSearch()
|
||||||
// webView?.scaleX = 0.2f
|
|
||||||
// webView?.scaleY = 0.2f
|
|
||||||
// webView?.post { webView?.addJavascriptInterface(gji,"GJI") }
|
|
||||||
webView?.postDelayed(2000L,{
|
webView?.postDelayed(2000L,{
|
||||||
webView?.evaluateJavascript("try{GJI.log();}catch(e){console.log(e);}", {})
|
webView?.evaluateJavascript("try{GJI.log();}catch(e){console.log(e);}", {})
|
||||||
webView?.evaluateJavascript("try{GJI.onResult(document.documentElement.outerHTML);}catch(e){console.log(e);}", {})
|
webView?.evaluateJavascript("try{GJI.onResult(document.documentElement.outerHTML);}catch(e){console.log(e);}", {})
|
||||||
webView?.evaluateJavascript("document.getElementsByClassName('banner-ad-wrapper')[0].remove()",{})
|
webView?.evaluateJavascript("document.getElementsByClassName('banner-ad-wrapper')[0].remove()",{})
|
||||||
})
|
})
|
||||||
} else {
|
}
|
||||||
|
else if(rssId.contains("booktoki")) {
|
||||||
|
registCancelSearch()
|
||||||
|
webView?.postDelayed(2000L,{
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
else {
|
||||||
double = false
|
double = false
|
||||||
registCancelSearch()
|
registCancelSearch()
|
||||||
if (hasYoutubePlayer) {
|
if (hasYoutubePlayer) {
|
||||||
@ -685,7 +706,6 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//<meta name="viewport" content="initial-scale=1.0">
|
|
||||||
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){}",
|
||||||
@ -720,4 +740,24 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inner class BookHelper {
|
||||||
|
@JavascriptInterface
|
||||||
|
fun sendValueFromHtml(string: String) {
|
||||||
|
|
||||||
|
Jsoup.parse(string)?.let { html ->
|
||||||
|
|
||||||
|
val toon_intro = html.getElementsByClass("toon_index")?.first()
|
||||||
|
val view_padding = html.select("#bo_v_con")
|
||||||
|
if (toon_intro != null) {
|
||||||
|
|
||||||
|
}else if (view_padding.size > 0){
|
||||||
|
//
|
||||||
|
} else {
|
||||||
|
Blog.LOGE("finishedUrl >>> ${rssId} :::: ${html.title()}")
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -17,4 +17,5 @@ class AppInfo : RealmObject {
|
|||||||
var lastUseDate : Long = 0L
|
var lastUseDate : Long = 0L
|
||||||
var category : String? = null
|
var category : String? = null
|
||||||
var currentInstalled : Boolean = false
|
var currentInstalled : Boolean = false
|
||||||
|
var isInstalled : Boolean = false
|
||||||
}
|
}
|
||||||
@ -8,7 +8,7 @@ import java.util.Date
|
|||||||
class UserActionModel: RealmObject {
|
class UserActionModel: RealmObject {
|
||||||
|
|
||||||
var actionType: String = ""
|
var actionType: String = ""
|
||||||
var timestamp: Date = Date()
|
// var timestamp: Date = Realm()
|
||||||
|
|
||||||
var weekOfYear : Int = 0
|
var weekOfYear : Int = 0
|
||||||
var weekOfMonth : Int = 0
|
var weekOfMonth : Int = 0
|
||||||
@ -22,19 +22,19 @@ class UserActionModel: RealmObject {
|
|||||||
var lunDayOfYear : Int = 0
|
var lunDayOfYear : Int = 0
|
||||||
|
|
||||||
init {
|
init {
|
||||||
val cal = Calendar.getInstance()
|
// val cal = Calendar.getInstance()
|
||||||
cal.time = timestamp
|
// cal.time = timestamp
|
||||||
weekOfYear = cal.get(Calendar.WEEK_OF_YEAR)
|
// weekOfYear = cal.get(Calendar.WEEK_OF_YEAR)
|
||||||
weekOfMonth = cal.get(Calendar.WEEK_OF_MONTH)
|
// weekOfMonth = cal.get(Calendar.WEEK_OF_MONTH)
|
||||||
dayOfWeek = cal.get(Calendar.DAY_OF_WEEK)
|
// dayOfWeek = cal.get(Calendar.DAY_OF_WEEK)
|
||||||
hourOfDay = cal.get(Calendar.HOUR_OF_DAY)
|
// hourOfDay = cal.get(Calendar.HOUR_OF_DAY)
|
||||||
month = cal.get(Calendar.MONTH)
|
// month = cal.get(Calendar.MONTH)
|
||||||
dayOfYear = cal.get(Calendar.DAY_OF_YEAR)
|
// dayOfYear = cal.get(Calendar.DAY_OF_YEAR)
|
||||||
dayOfMonth = cal.get(Calendar.DAY_OF_MONTH)
|
// dayOfMonth = cal.get(Calendar.DAY_OF_MONTH)
|
||||||
var cinCal = ChineseCalendar()
|
// var cinCal = ChineseCalendar()
|
||||||
cinCal.time = timestamp
|
// cinCal.time = timestamp
|
||||||
lunMonth = cinCal.get(ChineseCalendar.MONTH)
|
// lunMonth = cinCal.get(ChineseCalendar.MONTH)
|
||||||
lunDayOFMonth = cinCal.get(ChineseCalendar.DAY_OF_MONTH)
|
// lunDayOFMonth = cinCal.get(ChineseCalendar.DAY_OF_MONTH)
|
||||||
lunDayOfYear = cinCal.get(ChineseCalendar.DAY_OF_YEAR)
|
// lunDayOfYear = cinCal.get(ChineseCalendar.DAY_OF_YEAR)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -33,6 +33,9 @@ class ClienGetter : BaseGetter {
|
|||||||
Clien().let { c ->
|
Clien().let { c ->
|
||||||
c.title = title
|
c.title = title
|
||||||
c.link = "https://www.clien.net".plus(link)
|
c.link = "https://www.clien.net".plus(link)
|
||||||
|
if (c.link?.contains("?") == true) {
|
||||||
|
try { c.link = c.link?.split("?")?.first() }catch (e : Exception) {}
|
||||||
|
}
|
||||||
c.desc = desc
|
c.desc = desc
|
||||||
c.dateTiem = timeStamp
|
c.dateTiem = timeStamp
|
||||||
if (c.pubDate() > limitDateTime) {
|
if (c.pubDate() > limitDateTime) {
|
||||||
|
|||||||
@ -84,7 +84,6 @@ class DCGetter : BaseGetter {
|
|||||||
"https://m.dcinside.com/board/programming",
|
"https://m.dcinside.com/board/programming",
|
||||||
"https://m.dcinside.com/board/cartoon",
|
"https://m.dcinside.com/board/cartoon",
|
||||||
"https://m.dcinside.com/board/reading",
|
"https://m.dcinside.com/board/reading",
|
||||||
"https://m.dcinside.com/board/chiangmai",
|
|
||||||
"https://m.dcinside.com/board/hit",
|
"https://m.dcinside.com/board/hit",
|
||||||
"https://m.dcinside.com/board/dcbest"
|
"https://m.dcinside.com/board/dcbest"
|
||||||
)
|
)
|
||||||
|
|||||||
@ -18,6 +18,20 @@ class FmKoreaGetter : BaseGetter {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun extractDocumentSrl(url: String): String? {
|
||||||
|
val uri = java.net.URI(url)
|
||||||
|
val query = uri.query ?: return null // 쿼리 문자열이 없으면 null 반환
|
||||||
|
|
||||||
|
val params = query.split("&")
|
||||||
|
for (param in params) {
|
||||||
|
val parts = param.split("=")
|
||||||
|
if (parts.size == 2 && parts[0] == "document_srl") {
|
||||||
|
return "${uri.scheme}://${uri.host}${uri.path}?document_srl=${parts[1]}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null // document_srl 파라미터를 찾지 못하면 null 반환
|
||||||
|
}
|
||||||
|
|
||||||
@SuppressLint("RestrictedApi")
|
@SuppressLint("RestrictedApi")
|
||||||
override fun realWork(): Result {
|
override fun realWork(): Result {
|
||||||
RssDataType.FMKORAE.isOn {
|
RssDataType.FMKORAE.isOn {
|
||||||
@ -41,9 +55,19 @@ class FmKoreaGetter : BaseGetter {
|
|||||||
fmkorea_li.getElementsByClass("thumb")
|
fmkorea_li.getElementsByClass("thumb")
|
||||||
.attr("data-original")
|
.attr("data-original")
|
||||||
)
|
)
|
||||||
val pageUrl = "https://www.fmkorea.com".plus(
|
var pageUrl = "https://www.fmkorea.com".plus(
|
||||||
fmkorea_li.getElementsByTag("a").get(0).attr("href")
|
fmkorea_li.getElementsByTag("a").get(0).attr("href")
|
||||||
)
|
)
|
||||||
|
try {
|
||||||
|
val originalUrl = pageUrl
|
||||||
|
val extractedUrl = extractDocumentSrl(originalUrl)
|
||||||
|
if (extractedUrl != null) {
|
||||||
|
pageUrl = extractedUrl
|
||||||
|
} else {
|
||||||
|
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {}
|
||||||
|
|
||||||
val desc = fmkorea_li.getElementsByClass("category").text()
|
val desc = fmkorea_li.getElementsByClass("category").text()
|
||||||
val date = fmkorea_li.getElementsByClass("regdate").text()
|
val date = fmkorea_li.getElementsByClass("regdate").text()
|
||||||
FmKorea(pageUrl, desc, date, title, tumb).apply {
|
FmKorea(pageUrl, desc, date, title, tumb).apply {
|
||||||
|
|||||||
@ -33,6 +33,11 @@ class TheQooGetter : BaseGetter {
|
|||||||
TheQoo().let { tq ->
|
TheQoo().let { tq ->
|
||||||
tq.title = title
|
tq.title = title
|
||||||
tq.link = "https://theqoo.net".plus(pageLink)
|
tq.link = "https://theqoo.net".plus(pageLink)
|
||||||
|
if (tq.link?.contains("?") == true) {
|
||||||
|
try {
|
||||||
|
tq.link = tq.link?.split("?")?.first()
|
||||||
|
}catch (e:Exception){}
|
||||||
|
}
|
||||||
tq.dateTiem = dateTime
|
tq.dateTiem = dateTime
|
||||||
tq.desc = desc
|
tq.desc = desc
|
||||||
if (tq.pubDate() > limitDateTime) {
|
if (tq.pubDate() > limitDateTime) {
|
||||||
|
|||||||
@ -58,15 +58,16 @@ object WorkersDb {
|
|||||||
val weekOfMonth = cal.get(Calendar.WEEK_OF_MONTH)
|
val weekOfMonth = cal.get(Calendar.WEEK_OF_MONTH)
|
||||||
val dayOfWeek = cal.get(Calendar.DAY_OF_WEEK)
|
val dayOfWeek = cal.get(Calendar.DAY_OF_WEEK)
|
||||||
getRealm().apply {
|
getRealm().apply {
|
||||||
this.query<UserActionModel>().query("weekOfYear == $0 OR weekOfMonth == $1 OR dayOfWeek == $2").limit()
|
// this.query<UserActionModel>().query("weekOfYear == $0 OR weekOfMonth == $1 OR dayOfWeek == $2").limit()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val clazz : Set<KClass<out BaseRealmObject>> = setOf(RssData::class, NotificationItem::class, AppInfo::class,SimpleContact::class, RecentCall::class, RecentSms::class, CurrentPlayItem::class,
|
val clazz : Set<KClass<out BaseRealmObject>> = setOf(RssData::class, NotificationItem::class, AppInfo::class,SimpleContact::class, RecentCall::class, RecentSms::class, CurrentPlayItem::class,
|
||||||
TelegramBotUpdate::class, TelegramData::class, TelegramMessage::class, TelegramChat::class, BotCommandEentitie::class, TelegramFrom::class,
|
TelegramBotUpdate::class, TelegramData::class, TelegramMessage::class, TelegramChat::class, BotCommandEentitie::class, TelegramFrom::class,
|
||||||
WeatherForcast::class, Location::class, Current::class, Forecast::class, Condition::class, Forecastday::class, Day::class, Astro::class, Hour::class,
|
WeatherForcast::class, Location::class, Current::class, Forecast::class, Condition::class, Forecastday::class, Day::class, Astro::class, Hour::class,
|
||||||
LocationLog::class,UserActionModel::class
|
LocationLog::class
|
||||||
)
|
)
|
||||||
|
//,UserActionModel::class
|
||||||
|
|
||||||
val schemaVersion : Long = BuildConfig.BuildDateTime
|
val schemaVersion : Long = BuildConfig.BuildDateTime
|
||||||
|
|
||||||
@ -89,7 +90,9 @@ object WorkersDb {
|
|||||||
getRealm().apply {
|
getRealm().apply {
|
||||||
this.writeBlocking {
|
this.writeBlocking {
|
||||||
try {
|
try {
|
||||||
|
if (query<RssData>("originPage == $0", rssData.originPage).find().isEmpty()) {
|
||||||
this.copyToRealm(rssData, UpdatePolicy.ERROR)
|
this.copyToRealm(rssData, UpdatePolicy.ERROR)
|
||||||
|
}
|
||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -103,12 +106,19 @@ object WorkersDb {
|
|||||||
try {
|
try {
|
||||||
getRealm().writeBlocking {
|
getRealm().writeBlocking {
|
||||||
try {
|
try {
|
||||||
val catfillters = arrayListOf<RssDataType>(RssDataType.THEQOO,RssDataType.RULIWEB,RssDataType.ARCA,RssDataType.CLIEN,RssDataType.FMKORAE,RssDataType.DOTAX,RssDataType.DCINSIDE)
|
rssDatas.forEach { t ->
|
||||||
if(catfillters.contains(it.category()) && query<RssData>("chosung == $0",it.chosung).find().size == 0) {
|
if (query<RssData>("originPage == $0", t.originPage).find().isEmpty()) {
|
||||||
this.copyToRealm(it, UpdatePolicy.ERROR)
|
// val catfillters = arrayListOf<RssDataType>(RssDataType.THEQOO,RssDataType.RULIWEB,RssDataType.ARCA,RssDataType.CLIEN,RssDataType.FMKORAE,RssDataType.DOTAX,RssDataType.DCINSIDE)
|
||||||
} else if(!catfillters.contains(it.category())){
|
// if(catfillters.contains(it.category()) && query<RssData>("chosung == $0",it.chosung).find().size == 0) {
|
||||||
this.copyToRealm(it, UpdatePolicy.ERROR)
|
this.copyToRealm(t, UpdatePolicy.ERROR)
|
||||||
|
// } else if(!catfillters.contains(it.category())){
|
||||||
|
// this.copyToRealm(it, UpdatePolicy.ERROR)
|
||||||
|
// } else {
|
||||||
|
//
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -206,7 +216,7 @@ object WorkersDb {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getVotedRss() = getRealm().query<RssData>().query("vote == $0", true).distinct("originPage").distinct("title")
|
fun getVotedRss() = getRealm().query<RssData>().query("vote == $0", true).distinct("originPage", "title")
|
||||||
|
|
||||||
fun getRssQuery(keyword: String?,
|
fun getRssQuery(keyword: String?,
|
||||||
category: Collection<String>? = arrayListOf(),
|
category: Collection<String>? = arrayListOf(),
|
||||||
@ -241,7 +251,7 @@ object WorkersDb {
|
|||||||
if (keyword?.length ?: 0 == 0 && category?.size ?: 0 == 0) {
|
if (keyword?.length ?: 0 == 0 && category?.size ?: 0 == 0) {
|
||||||
rQ = rQ.query("read < $0", 3).query("vote != $0", true)
|
rQ = rQ.query("read < $0", 3).query("vote != $0", true)
|
||||||
}
|
}
|
||||||
return rQ.distinct("originPage").distinct("title")
|
return rQ.distinct("originPage", "title")
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
36
app/src/main/res/layout/photo_filter.xml
Normal file
36
app/src/main/res/layout/photo_filter.xml
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:padding="16dp">
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/selectImageButton"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="이미지 선택" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:orientation="horizontal">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/originalImageView"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:scaleType="fitCenter" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/filteredImageView"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:scaleType="fitCenter" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
@ -9,9 +9,11 @@ buildscript {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
id ("com.android.application") version "8.2.2" apply false
|
id ("com.android.application") version "8.8.0" apply false
|
||||||
id ("com.android.library") version "8.2.2" apply false
|
id ("com.android.library") version "8.8.0" apply false
|
||||||
id ("io.realm.kotlin") version "2.0.0" apply false
|
id ("io.realm.kotlin") version "2.0.0" apply false
|
||||||
|
id("org.jetbrains.kotlin.android") version "2.0.0" apply false
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.register<Delete>("clean") {
|
tasks.register<Delete>("clean") {
|
||||||
|
|||||||
@ -22,6 +22,5 @@ android.useAndroidX=true
|
|||||||
# resources declared in the library itself and none from the library's dependencies,
|
# resources declared in the library itself and none from the library's dependencies,
|
||||||
# thereby reducing the size of the R class for that library
|
# thereby reducing the size of the R class for that library
|
||||||
android.nonTransitiveRClass=true
|
android.nonTransitiveRClass=true
|
||||||
android.defaults.buildfeatures.buildconfig=true
|
|
||||||
android.nonFinalResIds=true
|
android.nonFinalResIds=true
|
||||||
android.enableJetifier=true
|
android.enableJetifier=true
|
||||||
@ -11,6 +11,7 @@ import android.graphics.drawable.GradientDrawable
|
|||||||
import android.graphics.drawable.StateListDrawable
|
import android.graphics.drawable.StateListDrawable
|
||||||
import android.net.MailTo
|
import android.net.MailTo
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
|
import android.net.http.SslError
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
@ -36,8 +37,10 @@ import android.webkit.CookieSyncManager
|
|||||||
import android.webkit.DownloadListener
|
import android.webkit.DownloadListener
|
||||||
import android.webkit.GeolocationPermissions
|
import android.webkit.GeolocationPermissions
|
||||||
import android.webkit.PermissionRequest
|
import android.webkit.PermissionRequest
|
||||||
|
import android.webkit.SslErrorHandler
|
||||||
import android.webkit.ValueCallback
|
import android.webkit.ValueCallback
|
||||||
import android.webkit.WebChromeClient
|
import android.webkit.WebChromeClient
|
||||||
|
import android.webkit.WebResourceError
|
||||||
import android.webkit.WebResourceRequest
|
import android.webkit.WebResourceRequest
|
||||||
import android.webkit.WebResourceResponse
|
import android.webkit.WebResourceResponse
|
||||||
import android.webkit.WebSettings
|
import android.webkit.WebSettings
|
||||||
@ -1915,7 +1918,9 @@ open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
|
|||||||
view: WebView,
|
view: WebView,
|
||||||
request: WebResourceRequest
|
request: WebResourceRequest
|
||||||
): WebResourceResponse? {
|
): WebResourceResponse? {
|
||||||
|
if (host?.contains("booktoki") == true) {
|
||||||
|
return super.shouldInterceptRequest(view, request)
|
||||||
|
}
|
||||||
var skipResource =
|
var skipResource =
|
||||||
(host != null) && ((request.url?.host?.contains(host!!) ?: true) == false)
|
(host != null) && ((request.url?.host?.contains(host!!) ?: true) == false)
|
||||||
if (skipResource && request.url.toString().contains("gif")) {
|
if (skipResource && request.url.toString().contains("gif")) {
|
||||||
@ -2065,8 +2070,12 @@ open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
|
|||||||
registCancelSearch()
|
registCancelSearch()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Deprecated("Deprecated in Java")
|
||||||
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
|
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
|
||||||
handler.sendEmptyMessage(MSG_CLICK_ON_URL)
|
handler.sendEmptyMessage(MSG_CLICK_ON_URL)
|
||||||
|
if (url.contains("booktoki")) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
if (url.contains("http:")) {
|
if (url.contains("http:")) {
|
||||||
var newUrl = url.replace("http:","https:")
|
var newUrl = url.replace("http:","https:")
|
||||||
LogUtil.e("is StartWith ${url} , ${newUrl}")
|
LogUtil.e("is StartWith ${url} , ${newUrl}")
|
||||||
@ -2164,6 +2173,22 @@ open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
|
|||||||
override fun onPageCommitVisible(view: WebView, url: String) {
|
override fun onPageCommitVisible(view: WebView, url: String) {
|
||||||
BroadCastManager.onPageCommitVisible(this@AwesomeWebViewActivity, key, url)
|
BroadCastManager.onPageCommitVisible(this@AwesomeWebViewActivity, key, url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onReceivedError(
|
||||||
|
view: WebView?,
|
||||||
|
request: WebResourceRequest?,
|
||||||
|
error: WebResourceError?
|
||||||
|
) {
|
||||||
|
super.onReceivedError(view, request, error)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onReceivedSslError(
|
||||||
|
view: WebView?,
|
||||||
|
handler: SslErrorHandler?,
|
||||||
|
error: SslError?
|
||||||
|
) {
|
||||||
|
handler?.proceed()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun parsePermission(resource: Array<String>): Array<String?> {
|
protected fun parsePermission(resource: Array<String>): Array<String?> {
|
||||||
|
|||||||
@ -3,6 +3,7 @@ pluginManagement {
|
|||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
jcenter()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10,6 +11,7 @@ pluginManagement {
|
|||||||
dependencyResolutionManagement {
|
dependencyResolutionManagement {
|
||||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||||
repositories {
|
repositories {
|
||||||
|
jcenter()
|
||||||
google()
|
google()
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
maven(url = "https://jitpack.io")
|
maven(url = "https://jitpack.io")
|
||||||
@ -19,3 +21,4 @@ dependencyResolutionManagement {
|
|||||||
rootProject.name = "LunarLauncher"
|
rootProject.name = "LunarLauncher"
|
||||||
include ("app","library","utils")
|
include ("app","library","utils")
|
||||||
//annotations
|
//annotations
|
||||||
|
include(":sdk")
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user