...
This commit is contained in:
parent
a297e76da0
commit
b17d4a0411
@ -65,6 +65,8 @@ android {
|
||||
buildFeatures {
|
||||
viewBinding = true
|
||||
dataBinding = true
|
||||
buildConfig = true
|
||||
resValues = true
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
@ -111,7 +113,12 @@ dependencies {
|
||||
implementation(project(":utils"))
|
||||
// implementation ("org.apache.tika:tika-parsers:1.12")
|
||||
|
||||
|
||||
// implementation("org.opencv:opencv-android:4.11.0")
|
||||
|
||||
|
||||
implementation ("androidx.media:media:1.7.0")
|
||||
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,6 +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=".feeds.Feeds"
|
||||
android:label="@string/lunar_settings"
|
||||
|
||||
@ -290,6 +290,7 @@ internal class LauncherActivity : CommonActivity() {
|
||||
var onExit = false
|
||||
var lastAction = MotionEvent.ACTION_HOVER_EXIT
|
||||
override fun dispatchKeyEvent(ev: KeyEvent): Boolean {
|
||||
|
||||
Blog.LOGE("dispatch ev?.device?.name >>> ${ev?.device?.name}")
|
||||
if (ev?.device?.name?.contains("SM-031N Mouse") == true) {
|
||||
|
||||
@ -298,6 +299,7 @@ internal class LauncherActivity : CommonActivity() {
|
||||
Blog.LOGE("dispatch dispatchKeyEvent>>> ${ev}")
|
||||
when(ev.keyCode) {
|
||||
KEYCODE_BUTTON_Y->{
|
||||
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
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 bums.lunatic.launcher.BuildConfig
|
||||
import bums.lunatic.launcher.LauncherActivity
|
||||
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
|
||||
import bums.lunatic.launcher.common.CommonActivity
|
||||
import bums.lunatic.launcher.common.letTrue
|
||||
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.PrefBoolean
|
||||
import bums.lunatic.launcher.helpers.PrefLong
|
||||
import bums.lunatic.launcher.helpers.PrefString
|
||||
import bums.lunatic.launcher.model.AppInfo
|
||||
import bums.lunatic.launcher.utils.Blog
|
||||
import bums.lunatic.launcher.utils.JamoUtils
|
||||
@ -139,7 +141,7 @@ internal class AppDrawer : CommonActivity() {
|
||||
sendMsg()
|
||||
}
|
||||
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 {
|
||||
sendMsg(pkg = "com.kakao.talk")
|
||||
@ -160,6 +162,8 @@ internal class AppDrawer : CommonActivity() {
|
||||
false
|
||||
}
|
||||
}
|
||||
var packageManager = lActivity?.packageManager
|
||||
|
||||
binding.searchInput.setOnLongClickListener {
|
||||
WorkersDb.getRealm().apply {
|
||||
var newQ = query<AppInfo>()
|
||||
@ -168,10 +172,18 @@ internal class AppDrawer : CommonActivity() {
|
||||
if(it.size > 0) {
|
||||
WorkersDb.getRealm().apply {
|
||||
packageList.clear()
|
||||
packageList.addAll(copyFromRealm(it))
|
||||
binding.appsList.post { if (packageList.size > 0) {
|
||||
appsAdapter?.updateData(packageList)
|
||||
} }
|
||||
writeBlocking {
|
||||
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)
|
||||
}}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -200,6 +212,14 @@ internal class AppDrawer : CommonActivity() {
|
||||
}
|
||||
// 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) {
|
||||
var postIntent : Intent? = null
|
||||
@ -317,10 +337,18 @@ internal class AppDrawer : CommonActivity() {
|
||||
if(it.size > 0) {
|
||||
WorkersDb.getRealm().apply {
|
||||
packageList.clear()
|
||||
packageList.addAll(copyFromRealm(it))
|
||||
binding.appsList.post { if (packageList.size > 0) {
|
||||
appsAdapter?.updateData(packageList)
|
||||
} }
|
||||
writeBlocking {
|
||||
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)
|
||||
}}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -25,6 +25,7 @@ import android.content.DialogInterface
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.content.SharedPreferences
|
||||
import android.content.pm.PackageManager
|
||||
import android.media.AudioManager
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
@ -37,6 +38,8 @@ import android.view.KeyEvent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
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.EditText
|
||||
import android.widget.TableRow
|
||||
@ -52,6 +55,7 @@ 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
|
||||
@ -85,6 +89,7 @@ import bums.lunatic.launcher.settings.SettingsActivity
|
||||
import bums.lunatic.launcher.utils.Blog
|
||||
import bums.lunatic.launcher.utils.BitmapConverter
|
||||
import bums.lunatic.launcher.utils.SimpleFingerGestures
|
||||
import bums.lunatic.launcher.utils.USAGT
|
||||
import bums.lunatic.launcher.utils.beforeDay
|
||||
import bums.lunatic.launcher.utils.beforeOneDay
|
||||
import bums.lunatic.launcher.view.TableRadioGroup
|
||||
@ -108,12 +113,14 @@ import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.flow.cancellable
|
||||
import kotlinx.coroutines.flow.collect
|
||||
import kotlinx.coroutines.launch
|
||||
import okhttp3.Dns
|
||||
import org.json.JSONArray
|
||||
import org.json.JSONObject
|
||||
import java.math.BigDecimal
|
||||
import java.math.RoundingMode
|
||||
import java.net.URLEncoder
|
||||
import java.util.Calendar
|
||||
import kotlin.jvm.java
|
||||
|
||||
|
||||
internal class LauncherHome : Fragment() {
|
||||
@ -231,15 +238,43 @@ internal class LauncherHome : Fragment() {
|
||||
|
||||
})
|
||||
|
||||
binding.notice.setOnLongClickListener {
|
||||
binding.favApps.setOnLongClickListener {
|
||||
RssViewBuilder(lActivity!!)
|
||||
.setRssId("https://jav.guru")
|
||||
.webViewDomStorageEnabled(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")
|
||||
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 {
|
||||
try {
|
||||
it.removeOnScrollListener(onScrChanged)
|
||||
@ -259,6 +294,15 @@ internal class LauncherHome : Fragment() {
|
||||
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() {
|
||||
WorkersDb.getRealm().apply {
|
||||
var newQ = query<AppInfo>()
|
||||
@ -266,8 +310,18 @@ internal class LauncherHome : Fragment() {
|
||||
if(it.size > 0) {
|
||||
WorkersDb.getRealm().apply {
|
||||
var packageList = arrayListOf<AppInfo>()
|
||||
packageList.addAll(copyFromRealm(it))
|
||||
mAppsAdapter?.updateData(packageList)
|
||||
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)
|
||||
}}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -495,7 +549,7 @@ internal class LauncherHome : Fragment() {
|
||||
WorkersDb.getRealm().writeBlocking {
|
||||
delete(
|
||||
query<RssData>()
|
||||
.query("pubDate < $0", beforeOneDay())
|
||||
.query("pubDate < $0", beforeDay(30))
|
||||
.query("category != $0 AND category != $1 ", RssDataType.GURU.name, RssDataType.MOST.name)
|
||||
.query("vote != $0", true).find()
|
||||
)
|
||||
@ -503,24 +557,18 @@ internal class LauncherHome : Fragment() {
|
||||
}
|
||||
|
||||
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 ->
|
||||
|
||||
infosJob = CoroutineScope(Dispatchers.IO).launch {
|
||||
flow.collect { changes: ResultsChange<RssData> ->
|
||||
commandHandler.removeCallbacks(hideListView)
|
||||
commandHandler.removeCallbacks(infoUpdate)
|
||||
// when (changes) {
|
||||
// is InitialResults, is UpdatedResults -> {
|
||||
WorkersDb.getRealm().apply {
|
||||
lasted = copyFromRealm(changes.list)
|
||||
}
|
||||
commandHandler.postDelayed(infoUpdate, UPDATE_DELAY)
|
||||
// }
|
||||
|
||||
// else -> {
|
||||
|
||||
// }
|
||||
// }
|
||||
}
|
||||
}
|
||||
infosJob?.start()
|
||||
@ -539,7 +587,7 @@ internal class LauncherHome : Fragment() {
|
||||
filter: Collection<RssDataType>? = arrayListOf(RssDataType.GURU, RssDataType.MOST,RssDataType.REDDIT_NSFW), noLimit: Boolean = false
|
||||
) {
|
||||
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())
|
||||
((filter?.size ?: 0) > 0).letTrue {filter!!.forEach {rQ = rQ.query("category != $0", it.name)}}
|
||||
updateQuery(rQ)
|
||||
@ -820,39 +868,39 @@ internal class LauncherHome : Fragment() {
|
||||
override fun onSwiped(@NonNull viewHolder: RecyclerView.ViewHolder, direction: Int) {
|
||||
Blog.LOGE("onSwiped direction >>>> $direction")
|
||||
(viewHolder.itemView.tag as? RssData)?.let { rss ->
|
||||
WorkersDb.getRealm().apply {
|
||||
writeBlocking {
|
||||
when(direction) {
|
||||
ItemTouchHelper.LEFT->{
|
||||
if (rssStateVote() && rss.vote) {
|
||||
rss.vote = false
|
||||
rss.read = 0
|
||||
} else {
|
||||
rss.read += nomoreShowCount
|
||||
}
|
||||
// copyToRealm(rss, UpdatePolicy.ALL)
|
||||
query<RssData>("originPage == $0",rss.originPage).find().forEach { it ->
|
||||
it.read += nomoreShowCount
|
||||
}
|
||||
query<RssData>("chosung == $0",rss.chosung).find().forEach { it ->
|
||||
if (!rss.originPage().equals(it.originPage())) {
|
||||
CoroutineScope(Dispatchers.IO).launch {
|
||||
WorkersDb.getRealm().apply {
|
||||
writeBlocking {
|
||||
when (direction) {
|
||||
ItemTouchHelper.LEFT -> {
|
||||
if (rssStateVote() && rss.vote) {
|
||||
rss.vote = false
|
||||
rss.read = 0
|
||||
} else {
|
||||
rss.read += nomoreShowCount
|
||||
}
|
||||
query<RssData>(
|
||||
"originPage == $0",
|
||||
rss.originPage
|
||||
).find().forEach { it ->
|
||||
it.read += nomoreShowCount
|
||||
}
|
||||
}
|
||||
}
|
||||
ItemTouchHelper.RIGHT->{
|
||||
if (rssStateVote() && rss.vote) {
|
||||
rss.vote = false
|
||||
rss.read = 0
|
||||
} else {
|
||||
rss.vote = true
|
||||
|
||||
ItemTouchHelper.RIGHT -> {
|
||||
if (rssStateVote() && rss.vote) {
|
||||
rss.vote = false
|
||||
rss.read = 0
|
||||
} else {
|
||||
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.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.print.PDFPrint
|
||||
import android.util.Base64
|
||||
@ -34,7 +35,10 @@ import bums.lunatic.launcher.model.CiliMagnet
|
||||
import bums.lunatic.launcher.model.RssData
|
||||
import bums.lunatic.launcher.utils.Blog
|
||||
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.realmListOf
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
@ -411,11 +415,15 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
||||
|
||||
override fun 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.webView}")
|
||||
webView?.alpha = 0.2f
|
||||
if (this.rssId.contains(".guru")) webView?.alpha = 0.2f
|
||||
|
||||
webView?.addJavascriptInterface(gji, "GJI")
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -520,13 +528,21 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
||||
fun onResult(result : String?) {
|
||||
registCancelSearch()
|
||||
result.toString()?.replace("\\u003C","<")?.replace("\\"","")?.let {
|
||||
Jsoup.parse(it)?.let { guru ->
|
||||
Blog.LOGE("guru >>> ${guru.title()} ")
|
||||
guru.getElementsByClass("row")?.forEach { row ->
|
||||
row.getElementsByClass("grid1").first().getElementsByTag("a")?.first()?.attr("title")?.let { title ->
|
||||
Blog.LOGE("row >>> ${title.split("]")?.first()?.replace("[","")}")
|
||||
if (rssId.contains("guru")) {
|
||||
Jsoup.parse(it)?.let { guru ->
|
||||
Blog.LOGE("guru >>> ${guru.title()} ")
|
||||
guru.getElementsByClass("row")?.forEach { row ->
|
||||
row.getElementsByClass("grid1").first().getElementsByTag("a")?.first()
|
||||
?.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() {
|
||||
if (rssId.contains(".guru")) {
|
||||
registCancelSearch()
|
||||
// webView?.scaleX = 0.2f
|
||||
// webView?.scaleY = 0.2f
|
||||
// webView?.post { webView?.addJavascriptInterface(gji,"GJI") }
|
||||
webView?.postDelayed(2000L,{
|
||||
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("document.getElementsByClassName('banner-ad-wrapper')[0].remove()",{})
|
||||
})
|
||||
} else {
|
||||
}
|
||||
else if(rssId.contains("booktoki")) {
|
||||
registCancelSearch()
|
||||
webView?.postDelayed(2000L,{
|
||||
|
||||
})
|
||||
}
|
||||
else {
|
||||
double = false
|
||||
registCancelSearch()
|
||||
if (hasYoutubePlayer) {
|
||||
@ -685,7 +706,6 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
||||
}
|
||||
}
|
||||
|
||||
//<meta name="viewport" content="initial-scale=1.0">
|
||||
if (loadWithIntent) {
|
||||
webView?.evaluateJavascript(
|
||||
"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 category : String? = null
|
||||
var currentInstalled : Boolean = false
|
||||
var isInstalled : Boolean = false
|
||||
}
|
||||
@ -8,7 +8,7 @@ import java.util.Date
|
||||
class UserActionModel: RealmObject {
|
||||
|
||||
var actionType: String = ""
|
||||
var timestamp: Date = Date()
|
||||
// var timestamp: Date = Realm()
|
||||
|
||||
var weekOfYear : Int = 0
|
||||
var weekOfMonth : Int = 0
|
||||
@ -22,19 +22,19 @@ class UserActionModel: RealmObject {
|
||||
var lunDayOfYear : Int = 0
|
||||
|
||||
init {
|
||||
val cal = Calendar.getInstance()
|
||||
cal.time = timestamp
|
||||
weekOfYear = cal.get(Calendar.WEEK_OF_YEAR)
|
||||
weekOfMonth = cal.get(Calendar.WEEK_OF_MONTH)
|
||||
dayOfWeek = cal.get(Calendar.DAY_OF_WEEK)
|
||||
hourOfDay = cal.get(Calendar.HOUR_OF_DAY)
|
||||
month = cal.get(Calendar.MONTH)
|
||||
dayOfYear = cal.get(Calendar.DAY_OF_YEAR)
|
||||
dayOfMonth = cal.get(Calendar.DAY_OF_MONTH)
|
||||
var cinCal = ChineseCalendar()
|
||||
cinCal.time = timestamp
|
||||
lunMonth = cinCal.get(ChineseCalendar.MONTH)
|
||||
lunDayOFMonth = cinCal.get(ChineseCalendar.DAY_OF_MONTH)
|
||||
lunDayOfYear = cinCal.get(ChineseCalendar.DAY_OF_YEAR)
|
||||
// val cal = Calendar.getInstance()
|
||||
// cal.time = timestamp
|
||||
// weekOfYear = cal.get(Calendar.WEEK_OF_YEAR)
|
||||
// weekOfMonth = cal.get(Calendar.WEEK_OF_MONTH)
|
||||
// dayOfWeek = cal.get(Calendar.DAY_OF_WEEK)
|
||||
// hourOfDay = cal.get(Calendar.HOUR_OF_DAY)
|
||||
// month = cal.get(Calendar.MONTH)
|
||||
// dayOfYear = cal.get(Calendar.DAY_OF_YEAR)
|
||||
// dayOfMonth = cal.get(Calendar.DAY_OF_MONTH)
|
||||
// var cinCal = ChineseCalendar()
|
||||
// cinCal.time = timestamp
|
||||
// lunMonth = cinCal.get(ChineseCalendar.MONTH)
|
||||
// lunDayOFMonth = cinCal.get(ChineseCalendar.DAY_OF_MONTH)
|
||||
// lunDayOfYear = cinCal.get(ChineseCalendar.DAY_OF_YEAR)
|
||||
}
|
||||
}
|
||||
@ -33,6 +33,9 @@ class ClienGetter : BaseGetter {
|
||||
Clien().let { c ->
|
||||
c.title = title
|
||||
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.dateTiem = timeStamp
|
||||
if (c.pubDate() > limitDateTime) {
|
||||
|
||||
@ -84,7 +84,6 @@ class DCGetter : BaseGetter {
|
||||
"https://m.dcinside.com/board/programming",
|
||||
"https://m.dcinside.com/board/cartoon",
|
||||
"https://m.dcinside.com/board/reading",
|
||||
"https://m.dcinside.com/board/chiangmai",
|
||||
"https://m.dcinside.com/board/hit",
|
||||
"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")
|
||||
override fun realWork(): Result {
|
||||
RssDataType.FMKORAE.isOn {
|
||||
@ -41,9 +55,19 @@ class FmKoreaGetter : BaseGetter {
|
||||
fmkorea_li.getElementsByClass("thumb")
|
||||
.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")
|
||||
)
|
||||
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 date = fmkorea_li.getElementsByClass("regdate").text()
|
||||
FmKorea(pageUrl, desc, date, title, tumb).apply {
|
||||
|
||||
@ -33,6 +33,11 @@ class TheQooGetter : BaseGetter {
|
||||
TheQoo().let { tq ->
|
||||
tq.title = title
|
||||
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.desc = desc
|
||||
if (tq.pubDate() > limitDateTime) {
|
||||
|
||||
@ -58,15 +58,16 @@ object WorkersDb {
|
||||
val weekOfMonth = cal.get(Calendar.WEEK_OF_MONTH)
|
||||
val dayOfWeek = cal.get(Calendar.DAY_OF_WEEK)
|
||||
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,
|
||||
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,
|
||||
LocationLog::class,UserActionModel::class
|
||||
LocationLog::class
|
||||
)
|
||||
//,UserActionModel::class
|
||||
|
||||
val schemaVersion : Long = BuildConfig.BuildDateTime
|
||||
|
||||
@ -89,7 +90,9 @@ object WorkersDb {
|
||||
getRealm().apply {
|
||||
this.writeBlocking {
|
||||
try {
|
||||
this.copyToRealm(rssData, UpdatePolicy.ERROR)
|
||||
if (query<RssData>("originPage == $0", rssData.originPage).find().isEmpty()) {
|
||||
this.copyToRealm(rssData, UpdatePolicy.ERROR)
|
||||
}
|
||||
} catch (e : Exception) {
|
||||
|
||||
}
|
||||
@ -103,12 +106,19 @@ object WorkersDb {
|
||||
try {
|
||||
getRealm().writeBlocking {
|
||||
try {
|
||||
val catfillters = arrayListOf<RssDataType>(RssDataType.THEQOO,RssDataType.RULIWEB,RssDataType.ARCA,RssDataType.CLIEN,RssDataType.FMKORAE,RssDataType.DOTAX,RssDataType.DCINSIDE)
|
||||
if(catfillters.contains(it.category()) && query<RssData>("chosung == $0",it.chosung).find().size == 0) {
|
||||
this.copyToRealm(it, UpdatePolicy.ERROR)
|
||||
} else if(!catfillters.contains(it.category())){
|
||||
this.copyToRealm(it, UpdatePolicy.ERROR)
|
||||
rssDatas.forEach { t ->
|
||||
if (query<RssData>("originPage == $0", t.originPage).find().isEmpty()) {
|
||||
// val catfillters = arrayListOf<RssDataType>(RssDataType.THEQOO,RssDataType.RULIWEB,RssDataType.ARCA,RssDataType.CLIEN,RssDataType.FMKORAE,RssDataType.DOTAX,RssDataType.DCINSIDE)
|
||||
// if(catfillters.contains(it.category()) && query<RssData>("chosung == $0",it.chosung).find().size == 0) {
|
||||
this.copyToRealm(t, UpdatePolicy.ERROR)
|
||||
// } else if(!catfillters.contains(it.category())){
|
||||
// this.copyToRealm(it, UpdatePolicy.ERROR)
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
} 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?,
|
||||
category: Collection<String>? = arrayListOf(),
|
||||
@ -241,7 +251,7 @@ object WorkersDb {
|
||||
if (keyword?.length ?: 0 == 0 && category?.size ?: 0 == 0) {
|
||||
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 {
|
||||
id ("com.android.application") version "8.2.2" apply false
|
||||
id ("com.android.library") version "8.2.2" apply false
|
||||
id ("com.android.application") version "8.8.0" apply false
|
||||
id ("com.android.library") version "8.8.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") {
|
||||
|
||||
@ -22,6 +22,5 @@ android.useAndroidX=true
|
||||
# resources declared in the library itself and none from the library's dependencies,
|
||||
# thereby reducing the size of the R class for that library
|
||||
android.nonTransitiveRClass=true
|
||||
android.defaults.buildfeatures.buildconfig=true
|
||||
android.nonFinalResIds=true
|
||||
android.enableJetifier=true
|
||||
@ -11,6 +11,7 @@ import android.graphics.drawable.GradientDrawable
|
||||
import android.graphics.drawable.StateListDrawable
|
||||
import android.net.MailTo
|
||||
import android.net.Uri
|
||||
import android.net.http.SslError
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
@ -36,8 +37,10 @@ import android.webkit.CookieSyncManager
|
||||
import android.webkit.DownloadListener
|
||||
import android.webkit.GeolocationPermissions
|
||||
import android.webkit.PermissionRequest
|
||||
import android.webkit.SslErrorHandler
|
||||
import android.webkit.ValueCallback
|
||||
import android.webkit.WebChromeClient
|
||||
import android.webkit.WebResourceError
|
||||
import android.webkit.WebResourceRequest
|
||||
import android.webkit.WebResourceResponse
|
||||
import android.webkit.WebSettings
|
||||
@ -1915,7 +1918,9 @@ open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
|
||||
view: WebView,
|
||||
request: WebResourceRequest
|
||||
): WebResourceResponse? {
|
||||
|
||||
if (host?.contains("booktoki") == true) {
|
||||
return super.shouldInterceptRequest(view, request)
|
||||
}
|
||||
var skipResource =
|
||||
(host != null) && ((request.url?.host?.contains(host!!) ?: true) == false)
|
||||
if (skipResource && request.url.toString().contains("gif")) {
|
||||
@ -2065,8 +2070,12 @@ open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
|
||||
registCancelSearch()
|
||||
}
|
||||
|
||||
@Deprecated("Deprecated in Java")
|
||||
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
|
||||
handler.sendEmptyMessage(MSG_CLICK_ON_URL)
|
||||
if (url.contains("booktoki")) {
|
||||
return false
|
||||
}
|
||||
if (url.contains("http:")) {
|
||||
var newUrl = url.replace("http:","https:")
|
||||
LogUtil.e("is StartWith ${url} , ${newUrl}")
|
||||
@ -2164,6 +2173,22 @@ open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
|
||||
override fun onPageCommitVisible(view: WebView, url: String) {
|
||||
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?> {
|
||||
|
||||
@ -3,6 +3,7 @@ pluginManagement {
|
||||
gradlePluginPortal()
|
||||
google()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +11,7 @@ pluginManagement {
|
||||
dependencyResolutionManagement {
|
||||
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
mavenCentral()
|
||||
maven(url = "https://jitpack.io")
|
||||
@ -19,3 +21,4 @@ dependencyResolutionManagement {
|
||||
rootProject.name = "LunarLauncher"
|
||||
include ("app","library","utils")
|
||||
//annotations
|
||||
include(":sdk")
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user