This commit is contained in:
lunaticbum 2024-11-20 15:51:13 +09:00
parent 53a267424a
commit 98a1fc959e
45 changed files with 1368 additions and 1310 deletions

View File

@ -24,8 +24,8 @@ android {
isMinifyEnabled = false isMinifyEnabled = false
isShrinkResources = false isShrinkResources = false
isDebuggable = true isDebuggable = true
applicationIdSuffix = ".debug" // applicationIdSuffix = ".debug"
versionNameSuffix = "-debug" // versionNameSuffix = "-debug"
buildConfigField("Long","BuildDateTime", getDateTime().toString().plus("L")) buildConfigField("Long","BuildDateTime", getDateTime().toString().plus("L"))
resValue ("string", "app_name", "Bums Launcher Debug") resValue ("string", "app_name", "Bums Launcher Debug")
} }

View File

@ -99,7 +99,26 @@
<category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LAUNCHER" />
</intent-filter> </intent-filter>
</activity> </activity>
<activity
android:name=".apps.AppDrawer"
android:label="@string/lunar_settings"
android:launchMode="singleTask"
android:excludeFromRecents="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
</intent-filter>
</activity>
<activity
android:name=".feeds.Feeds"
android:label="@string/lunar_settings"
android:launchMode="singleTask"
android:excludeFromRecents="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.APPLICATION_PREFERENCES" />
</intent-filter>
</activity>
<activity <activity
android:name=".settings.SettingsActivity" android:name=".settings.SettingsActivity"
android:label="@string/lunar_settings" android:label="@string/lunar_settings"
@ -170,10 +189,14 @@
</receiver> </receiver>
<activity <activity
android:name="kr.lunaticbum.awesomewebview.AwesomeWebViewActivity" android:name=".home.RssViewerActivity"
android:configChanges="keyboardHidden|orientation|screenSize" android:configChanges="keyboardHidden|orientation|screenSize"
android:hardwareAccelerated="true" android:hardwareAccelerated="true"
android:theme="@style/FinestWebViewTheme.Fullscreen" /> android:launchMode="singleTask"
android:excludeFromRecents="true"
android:theme="@style/FinestWebViewTheme.Fullscreen" >
</activity>
<provider <provider
android:name="androidx.core.content.FileProvider" android:name="androidx.core.content.FileProvider"

View File

@ -32,10 +32,8 @@ import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.content.res.Configuration import android.content.res.Configuration
import android.graphics.Bitmap
import android.graphics.Color import android.graphics.Color
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.isExternalStorageManager import android.os.Environment.isExternalStorageManager
@ -43,22 +41,12 @@ import android.os.Handler
import android.os.Looper import android.os.Looper
import android.provider.Settings import android.provider.Settings
import android.telephony.TelephonyManager import android.telephony.TelephonyManager
import android.view.KeyEvent
import android.view.MotionEvent import android.view.MotionEvent
import android.view.View import android.view.View
import android.view.WindowInsets import android.view.WindowInsets
import android.view.WindowManager import android.view.WindowManager
import android.webkit.JavascriptInterface
import android.webkit.SslErrorHandler
import android.webkit.WebResourceError
import android.webkit.WebResourceRequest
import android.webkit.WebSettings
import android.webkit.WebView
import android.webkit.WebViewClient
import android.widget.Toast
import androidx.activity.OnBackPressedCallback import androidx.activity.OnBackPressedCallback
import androidx.annotation.RequiresApi import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
import androidx.core.net.toUri import androidx.core.net.toUri
@ -67,17 +55,13 @@ import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat import androidx.core.view.WindowCompat
import androidx.core.view.WindowInsetsCompat import androidx.core.view.WindowInsetsCompat
import androidx.core.view.updatePadding import androidx.core.view.updatePadding
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
import androidx.work.ExistingPeriodicWorkPolicy import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.ListenableWorker
import androidx.work.OneTimeWorkRequest import androidx.work.OneTimeWorkRequest
import androidx.work.PeriodicWorkRequestBuilder import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager import androidx.work.WorkManager
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.apps.AppDrawer import bums.lunatic.launcher.apps.AppDrawer
import bums.lunatic.launcher.apps.DismissCalback import bums.lunatic.launcher.common.CommonActivity
import bums.lunatic.launcher.apps.SearchMenu
import bums.lunatic.launcher.databinding.LauncherActivityBinding import bums.lunatic.launcher.databinding.LauncherActivityBinding
import bums.lunatic.launcher.feeds.Feeds import bums.lunatic.launcher.feeds.Feeds
import bums.lunatic.launcher.feeds.WidgetHost import bums.lunatic.launcher.feeds.WidgetHost
@ -89,24 +73,13 @@ import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_FIRST_LAUNCH
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import bums.lunatic.launcher.helpers.Constants.Companion.widgetHostId import bums.lunatic.launcher.helpers.Constants.Companion.widgetHostId
import bums.lunatic.launcher.helpers.HeadsetActionButtonReceiver import bums.lunatic.launcher.helpers.HeadsetActionButtonReceiver
import bums.lunatic.launcher.helpers.PrefBoolean
import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.helpers.PrefLong import bums.lunatic.launcher.helpers.PrefLong
import bums.lunatic.launcher.helpers.letTrue
import bums.lunatic.launcher.home.LauncherHome import bums.lunatic.launcher.home.LauncherHome
import bums.lunatic.launcher.home.LauncherHome.Companion.lastedFinishedPageUrl import bums.lunatic.launcher.home.RssViewBuilder
import bums.lunatic.launcher.home.LauncherHome.Companion.listTags import bums.lunatic.launcher.home.adapters.RssItemAdapter.Companion.rssList
import bums.lunatic.launcher.model.JGuru
import bums.lunatic.launcher.model.MissD
import bums.lunatic.launcher.model.RssData import bums.lunatic.launcher.model.RssData
import bums.lunatic.launcher.model.getRssData
import bums.lunatic.launcher.model.getT
import bums.lunatic.launcher.model.jGuruTag
import bums.lunatic.launcher.receiver.NLService import bums.lunatic.launcher.receiver.NLService
import bums.lunatic.launcher.utils.BLog import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.utils.RssList.jGuruMain
import bums.lunatic.launcher.utils.beforeDay
import bums.lunatic.launcher.utils.make0H
import bums.lunatic.launcher.workers.AppInfoGetter import bums.lunatic.launcher.workers.AppInfoGetter
import bums.lunatic.launcher.workers.ArcaGetter import bums.lunatic.launcher.workers.ArcaGetter
import bums.lunatic.launcher.workers.CalendarGetter import bums.lunatic.launcher.workers.CalendarGetter
@ -118,7 +91,6 @@ import bums.lunatic.launcher.workers.DotaxGetter.Companion.COMIC2_WORK_TAG
import bums.lunatic.launcher.workers.FmKoreaGetter import bums.lunatic.launcher.workers.FmKoreaGetter
import bums.lunatic.launcher.workers.FmKoreaGetter.Companion.COMIC_WORK_TAG import bums.lunatic.launcher.workers.FmKoreaGetter.Companion.COMIC_WORK_TAG
import bums.lunatic.launcher.workers.LocationGetter import bums.lunatic.launcher.workers.LocationGetter
import bums.lunatic.launcher.workers.LocationUpdateService
import bums.lunatic.launcher.workers.NewsFeedsGetter import bums.lunatic.launcher.workers.NewsFeedsGetter
import bums.lunatic.launcher.workers.NewsFeedsGetter.Companion.FEDDS_WORK_TAG import bums.lunatic.launcher.workers.NewsFeedsGetter.Companion.FEDDS_WORK_TAG
import bums.lunatic.launcher.workers.OpenWeatherGetter import bums.lunatic.launcher.workers.OpenWeatherGetter
@ -134,8 +106,8 @@ import bums.lunatic.launcher.workers.YoutubeGetter
import bums.lunatic.launcher.workers.YoutubeGetter.Companion.YT_WORK_TAG 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 org.jsoup.Jsoup import io.realm.kotlin.ext.query
import org.jsoup.nodes.Document import kr.lunaticbum.utils.ui.DisplayUtil
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Calendar import java.util.Calendar
import java.util.Date import java.util.Date
@ -144,7 +116,7 @@ import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
internal class LauncherActivity : AppCompatActivity() { internal class LauncherActivity : CommonActivity() {
private lateinit var binding: LauncherActivityBinding private lateinit var binding: LauncherActivityBinding
private lateinit var settingsPrefs: SharedPreferences private lateinit var settingsPrefs: SharedPreferences
@ -329,52 +301,88 @@ internal class LauncherActivity : AppCompatActivity() {
override fun onConfigurationChanged(newConfig: Configuration) { override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig) super.onConfigurationChanged(newConfig)
BLog.LOGE("onConfigurationChanged Configuration >> ${newConfig}") Blog.LOGE("onConfigurationChanged Configuration >> ${newConfig}")
BLog.LOGE("onConfigurationChanged newConfig?.screenWidthDp >> ${newConfig?.screenWidthDp}") Blog.LOGE("onConfigurationChanged newConfig?.screenWidthDp >> ${newConfig?.screenWidthDp}")
BLog.LOGE("onConfigurationChanged newConfig?.screenHeightDp >> ${newConfig?.screenHeightDp}") Blog.LOGE("onConfigurationChanged newConfig?.screenHeightDp >> ${newConfig?.screenHeightDp}")
isOpendFold = (newConfig.screenWidthDp * 1.1f) > newConfig.screenHeightDp isOpendFold = (newConfig.screenWidthDp * 1.1f) > newConfig.screenHeightDp
} }
var actionButtonPressX = 0f var actionButtonPressX = 0f
var actionButtonPressY = 0f var actionButtonPressY = 0f
var onExit = false
var lastAction = MotionEvent.ACTION_HOVER_EXIT
override fun dispatchGenericMotionEvent(ev: MotionEvent?): Boolean { override fun dispatchGenericMotionEvent(ev: MotionEvent?): Boolean {
if (ev?.device?.name?.contains("BLE-M3") == true) { if (ev?.device?.name?.contains("BLE-M3") == true) {
BLog.LOGE("keyEvent >>>>> dispatchGenericMotionEvent ${ev}") Blog.LOGE("keyEvent >>>>> dispatchGenericMotionEvent ${ev}")
ev?.action?.let { action -> ev?.action?.let { action ->
when(action) { when(action) {
MotionEvent.ACTION_HOVER_ENTER -> { MotionEvent.ACTION_HOVER_ENTER -> {
// if (onExit) {
// onExit = false
// return true
// }
return false
}
MotionEvent.ACTION_HOVER_MOVE ->{
if(lastAction == MotionEvent.ACTION_HOVER_MOVE) {
Blog.LOGE("ACTION_HOVER_MOVE Click")
}
return false return false
} }
MotionEvent.ACTION_HOVER_MOVE ->{return false}
MotionEvent.ACTION_BUTTON_PRESS ->{ MotionEvent.ACTION_BUTTON_PRESS ->{
if (actionButtonPressX * actionButtonPressY == 0f) { if (actionButtonPressX * actionButtonPressY == 0f) {
actionButtonPressX = ev.x ?: 0f actionButtonPressX = ev.x ?: 0f
actionButtonPressY = ev.y ?: 0f actionButtonPressY = ev.y ?: 0f
} }
return true // if (onExit) return true
return false
} }
MotionEvent.ACTION_BUTTON_RELEASE ->{ MotionEvent.ACTION_BUTTON_RELEASE -> {
if (actionButtonPressY == ev.y) { if (actionButtonPressX == ev.x && actionButtonPressY == ev.y) {
Blog.LOGE("DisplayUtil.width >>> ${DisplayUtil.width} ${actionButtonPressX}")
Blog.LOGE("DisplayUtil.width >>> ${DisplayUtil.height} ${actionButtonPressY}")
if(actionButtonPressX.toInt() == 480 && actionButtonPressY < 2000) {
Blog.LOGE("Arrow Center Click")
WorkersDb.getRealm().apply {
writeBlocking {
var ddd = copyFromRealm(WorkersDb.getRssQuery("", arrayListOf(),false).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)
}
}
} else if(ev.y > 2000) {
}
} else if (actionButtonPressY == ev.y) {
if (actionButtonPressX.minus(ev.x ?: 0f) > 0f) { if (actionButtonPressX.minus(ev.x ?: 0f) > 0f) {
BLog.LOGE("Arrow Right Click") Blog.LOGE("Arrow Right Click")
} else { } else {
BLog.LOGE("Arrow Left Click") Blog.LOGE("Arrow Left Click")
} }
} else { } else {
if (actionButtonPressY.minus(ev.y ?: 0f) > 0f) { if (actionButtonPressY.minus(ev.y ?: 0f) > 0f) {
BLog.LOGE("Arrow Down Click") Blog.LOGE("Arrow Down Click")
} else { } else {
BLog.LOGE("Arrow Up Click") Blog.LOGE("Arrow Up Click")
} }
} }
// if (onExit) return true
return false return false
} }
MotionEvent.ACTION_HOVER_EXIT ->{ MotionEvent.ACTION_HOVER_EXIT -> {
actionButtonPressX = 0f actionButtonPressX = 0f
actionButtonPressY = 0f actionButtonPressY = 0f
onExit = true
return false return false
} }
else -> {return false} else -> {return false}
}.apply {
lastAction = action
} }
} }
} }
@ -382,10 +390,7 @@ internal class LauncherActivity : AppCompatActivity() {
} }
override fun onNewIntent(intent: Intent?) { override fun onNewIntent(intent: Intent?) {
Blog.LOGE("onNewIntent intent >> ${intent}")
BLog.LOGE("onNewIntent intent >> ${intent}")
if(intent?.action?.equals(Intent.ACTION_SEND) == true && if(intent?.action?.equals(Intent.ACTION_SEND) == true &&
intent?.hasExtra(Intent.EXTRA_TEXT) == true) { intent?.hasExtra(Intent.EXTRA_TEXT) == true) {
intent?.getStringExtra(Intent.EXTRA_TEXT)?.let { intent?.getStringExtra(Intent.EXTRA_TEXT)?.let {
@ -394,8 +399,8 @@ internal class LauncherActivity : AppCompatActivity() {
if(string.startsWith("http")) { if(string.startsWith("http")) {
try { try {
string.toUri()?.let { uri -> string.toUri()?.let { uri ->
BLog.LOGE("onNewIntent string uri.lastPathSegment >>>>> ${uri.host}") Blog.LOGE("onNewIntent string uri.lastPathSegment >>>>> ${uri.host}")
BLog.LOGE("onNewIntent string uri.lastPathSegment >>>>> ${uri.lastPathSegment}") Blog.LOGE("onNewIntent string uri.lastPathSegment >>>>> ${uri.lastPathSegment}")
} }
} catch (e: Exception) { } catch (e: Exception) {
@ -405,8 +410,8 @@ internal class LauncherActivity : AppCompatActivity() {
} else { } else {
try { try {
it.toUri()?.let { uri -> it.toUri()?.let { uri ->
BLog.LOGE("onNewIntent it uri.lastPathSegment >>>>> ${uri.host}") Blog.LOGE("onNewIntent it uri.lastPathSegment >>>>> ${uri.host}")
BLog.LOGE("onNewIntent it uri.lastPathSegment >>>>> ${uri.lastPathSegment}") Blog.LOGE("onNewIntent it uri.lastPathSegment >>>>> ${uri.lastPathSegment}")
} }
} catch (e: Exception) { } catch (e: Exception) {
@ -416,7 +421,7 @@ internal class LauncherActivity : AppCompatActivity() {
// BLog.LOGE("onNewIntent intent?.dataString >> ${intent?.dataString}") // BLog.LOGE("onNewIntent intent?.dataString >> ${intent?.dataString}")
// BLog.LOGE("onNewIntent intent?.data >> ${intent?.data}") // BLog.LOGE("onNewIntent intent?.data >> ${intent?.data}")
} else { } else {
BLog.LOGE("onNewIntent intent?.hasExtra >> ${intent?.hasExtra(Intent.EXTRA_STREAM)}") Blog.LOGE("onNewIntent intent?.hasExtra >> ${intent?.hasExtra(Intent.EXTRA_STREAM)}")
if (intent?.action?.equals(Intent.ACTION_MAIN) == true && intent.categories.contains( if (intent?.action?.equals(Intent.ACTION_MAIN) == true && intent.categories.contains(
@ -433,7 +438,7 @@ internal class LauncherActivity : AppCompatActivity() {
} else { } else {
intent?.extras?.keySet()?.forEach { intent?.extras?.keySet()?.forEach {
try { try {
BLog.LOGE( Blog.LOGE(
"onNewIntent :: key >> ${it} :: value >> ${ "onNewIntent :: key >> ${it} :: value >> ${
intent?.extras?.getString( intent?.extras?.getString(
it it
@ -478,13 +483,13 @@ internal class LauncherActivity : AppCompatActivity() {
/* if this is the first launch, /* if this is the first launch,
then remember the event and show the welcome dialog */ then remember the event and show the welcome dialog */
welcomeDialog()
home = binding.home.getFragment<LauncherHome>() home = binding.home.getFragment<LauncherHome>()
/* handle navigation back events */ /* handle navigation back events */
handleBackPress() handleBackPress()
val cn: ComponentName = ComponentName(this, NLService::class.java) val cn = ComponentName(this, NLService::class.java)
val n = applicationContext.getSystemService(NOTIFICATION_SERVICE) as NotificationManager val n = applicationContext.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
if (n.isNotificationListenerAccessGranted(cn)) { if (n.isNotificationListenerAccessGranted(cn)) {
} else { } else {
@ -508,14 +513,7 @@ internal class LauncherActivity : AppCompatActivity() {
updateLocationService() updateLocationService()
} }
fun updateLocationService() {
PrefBoolean.location.get().letTrue {
startService(Intent(this, LocationUpdateService::class.java))
}
if (PrefBoolean.location.get() == false) {
stopService(Intent(this, LocationUpdateService::class.java))
}
}
override fun onDestroy() { override fun onDestroy() {
super.onDestroy() super.onDestroy()
@ -529,16 +527,18 @@ internal class LauncherActivity : AppCompatActivity() {
blutoothManager?.initBluetoothAdapter() blutoothManager?.initBluetoothAdapter()
blutoothManager?.blueToothState() blutoothManager?.blueToothState()
blutoothManager?.getPairedDevices() blutoothManager?.getPairedDevices()
BLog.LOGE("LauncherActivity onStart()") Blog.LOGE("LauncherActivity onStart()")
statusBarView() statusBarView()
setBgColor() setBgColor()
welcomeDialog()
} }
@RequiresApi(Build.VERSION_CODES.O_MR1) @RequiresApi(Build.VERSION_CODES.O_MR1)
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
blutoothManager?.getPairedDevices() blutoothManager?.getPairedDevices()
BLog.LOGE("LauncherActivity onResume") Blog.LOGE("LauncherActivity onResume")
} }
private fun welcomeDialog() { private fun welcomeDialog() {
@ -560,8 +560,17 @@ internal class LauncherActivity : AppCompatActivity() {
) { ) {
true true
} else false } else false
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if (!isExternalStorageManager()) {
needAsk = true
}
}
val cn = ComponentName(this, NLService::class.java)
val n = applicationContext.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
if (n.isNotificationListenerAccessGranted(cn)) {
} else {
needAsk = true
}
getSharedPreferences(PREFS_FIRST_LAUNCH, 0).let { getSharedPreferences(PREFS_FIRST_LAUNCH, 0).let {
if (it.getBoolean(KEY_FIRST_LAUNCH, true) || needAsk) { if (it.getBoolean(KEY_FIRST_LAUNCH, true) || needAsk) {
it.edit().putBoolean(KEY_FIRST_LAUNCH, false).apply() it.edit().putBoolean(KEY_FIRST_LAUNCH, false).apply()
@ -584,6 +593,8 @@ internal class LauncherActivity : AppCompatActivity() {
/* ask for the permissions */ /* ask for the permissions */
private fun askPermissions() { private fun askPermissions() {
/* phone permission */ /* phone permission */
val cn = ComponentName(this, NLService::class.java)
val n = applicationContext.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
if ( if (
this.checkSelfPermission(Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED || this.checkSelfPermission(Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED ||
@ -625,6 +636,21 @@ internal class LauncherActivity : AppCompatActivity() {
.setData(Uri.parse("package:" + this.packageName)) .setData(Uri.parse("package:" + this.packageName))
.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
) )
} else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
if (!isExternalStorageManager()) {
try {
startActivityForResult(Intent(Settings.ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION).apply {
data = Uri.parse(String.format("package:%s", applicationContext.packageName))
}, 300)
} catch (e: Exception) {
startActivityForResult(Intent().apply {
action = Settings.ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION
}, 300)
}
}else if (!n.isNotificationListenerAccessGranted(cn)) {
val intent = Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS)
startActivity(intent)
}
} }
} }
@ -633,21 +659,7 @@ internal class LauncherActivity : AppCompatActivity() {
fun switchAppDrawer() { fun switchAppDrawer() {
if(supportFragmentManager.findFragmentByTag("AppDrawer") == null){ startActivity(Intent(this,AppDrawer::class.java))
val transaction = supportFragmentManager.beginTransaction()
transaction.add(R.id.app_drawer, appDrawer,"AppDrawer")
transaction.commit()
}
if(binding.appDrawer.visibility == View.GONE) {
supportFragmentManager.beginTransaction().show(appDrawer).commit()
binding.home.visibility = View.GONE
binding.appDrawer.visibility = View.VISIBLE
appDrawer.openSearch()
} else {
supportFragmentManager.beginTransaction().hide(appDrawer).commit()
binding.home.visibility = View.VISIBLE
binding.appDrawer.visibility = View.GONE
}
} }
@ -710,13 +722,11 @@ internal class LauncherActivity : AppCompatActivity() {
} }
} }
fun openSearchMenus(keyword : String, dismissCalback: DismissCalback) {
SearchMenu().show(supportFragmentManager,keyword) {dismissCalback?.invoke()}
}
class EndCallReceiver : BroadcastReceiver() { class EndCallReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) { override fun onReceive(context: Context, intent: Intent) {
BLog.LOGE("EndCallReceiver >>> ${intent}") Blog.LOGE("EndCallReceiver >>> ${intent}")
val phoneState = intent.getStringExtra(TelephonyManager.EXTRA_STATE) ?: return val phoneState = intent.getStringExtra(TelephonyManager.EXTRA_STATE) ?: return
if (phoneState == TelephonyManager.EXTRA_STATE_IDLE) { if (phoneState == TelephonyManager.EXTRA_STATE_IDLE) {
refreshDeviceData() refreshDeviceData()
@ -725,7 +735,7 @@ internal class LauncherActivity : AppCompatActivity() {
} }
class SMSReceiver : BroadcastReceiver() { class SMSReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) { override fun onReceive(context: Context, intent: Intent) {
BLog.LOGE("SMSReceiver >>> ${intent}") Blog.LOGE("SMSReceiver >>> ${intent}")
refreshDeviceData() refreshDeviceData()
} }
} }
@ -740,282 +750,282 @@ internal class LauncherActivity : AppCompatActivity() {
var callBack : CommadCallabck? = null var callBack : CommadCallabck? = null
var isF = false var isF = false
fun doWebParseStart(url : String, callBack :CommadCallabck?) { // fun doWebParseStart(url : String, callBack :CommadCallabck?) {
isF = false // isF = false
this.callBack = callBack // this.callBack = callBack
binding.searcher01.post { binding.searcher01.visibility = View.VISIBLE } // binding.searcher01.post { binding.searcher01.visibility = View.VISIBLE }
BLog.LOGE("binding.otherCheck before ThreadRun") // BLog.LOGE("binding.otherCheck before ThreadRun")
binding.searcher01.webViewClient = object : WebViewClient() { // binding.searcher01.webViewClient = object : WebViewClient() {
override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean { // override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
BLog.LOGE("binding.otherCheck before ${url}") // BLog.LOGE("binding.otherCheck before ${url}")
if ((url?.contains("guru") == true || url?.contains("missav") == true) && !isF) { // if ((url?.contains("guru") == true || url?.contains("missav") == true) && !isF) {
BLog.LOGE("binding.otherCheck before reload") // BLog.LOGE("binding.otherCheck before reload")
view?.loadUrl(url!!) // view?.loadUrl(url!!)
isF = true // isF = true
return false // return false
}
return false
}
override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
BLog.LOGE("binding.otherCheck searcher01 in onPageStarted ${url}")
super.onPageStarted(view, url, favicon)
}
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()
}
override fun onPageFinished(view: WebView?, url: String?) {
super.onPageFinished(view, url)
lastedFinishedPageUrl = url ?: ""
BLog.LOGE("binding.otherCheck searcher01 in onPageFinished ${url}")
//lastedFinishedPageUrl?.length ?: 0 > 10 &&
// if(url?.startsWith("https://") == true) {
// if (url?.contains("guru", true) == true) {
// isF = true
// view?.loadUrl(url)
// } // }
if (url?.contains("youtube", false) == true) { // return false
view?.evaluateJavascript( // }
"function getAll() {\n" + //
" MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" + // override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
" };getAll()" // BLog.LOGE("binding.otherCheck searcher01 in onPageStarted ${url}")
) { result -> // super.onPageStarted(view, url, favicon)
(result as? String)?.let {} // }
} // override fun onReceivedError(
} else if(url?.contains("translate.google.com") == true) { // view: WebView?,
binding.searcher01.postDelayed({ // request: WebResourceRequest?,
binding.searcher01.evaluateJavascript( // error: WebResourceError?
"function getAll() {\n" + // ) {
" MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" + //// super.onReceivedError(view, request, error)
" };getAll()" // }
) { result -> // override fun onReceivedSslError(
(result as? String)?.let {} // view: WebView?,
} // handler: SslErrorHandler?,
}, 6000L) // error: SslError?
} else if (url?.contains("guru", true) == true) { // ) {
if (!isF) { // handler?.proceed()
binding.searcher01.postDelayed({ // }
view?.loadUrl(url) //
isF = true // override fun onPageFinished(view: WebView?, url: String?) {
},5000) // super.onPageFinished(view, url)
} else { // lastedFinishedPageUrl = url ?: ""
binding.searcher01.postDelayed({ // BLog.LOGE("binding.otherCheck searcher01 in onPageFinished ${url}")
binding.searcher01.evaluateJavascript( // //lastedFinishedPageUrl?.length ?: 0 > 10 &&
"function getAll() {\n" + //// if(url?.startsWith("https://") == true) {
" MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" + //// if (url?.contains("guru", true) == true) {
" };getAll()" //// isF = true
) { result -> //// view?.loadUrl(url)
(result as? String)?.let {} //// }
} // if (url?.contains("youtube", false) == true) {
}, 10000L) // view?.evaluateJavascript(
} // "function getAll() {\n" +
}else { // " MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" +
// // " };getAll()"
view?.evaluateJavascript( // ) { result ->
"function getAll() {\n" + // (result as? String)?.let {}
" MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" + // }
" };getAll()" // } else if(url?.contains("translate.google.com") == true) {
) { result -> // binding.searcher01.postDelayed({
(result as? String)?.let {} // binding.searcher01.evaluateJavascript(
} // "function getAll() {\n" +
} // " MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" +
if (isF) this@LauncherActivity.callBack?.collectComplete() // " };getAll()"
} // ) { result ->
} // (result as? String)?.let {}
WebView.setWebContentsDebuggingEnabled(false) // }
binding.searcher01.apply { // }, 6000L)
// Jsoup.connect("https://missav.com/dm11/ko").userAgent() // } else if (url?.contains("guru", true) == true) {
// .timeout(30000).get()?.apply { // if (!isF) {
// BLog.LOGE("Jsoup.connect(missAv).get() ${this}") // binding.searcher01.postDelayed({
// view?.loadUrl(url)
// isF = true
// },5000)
// } else {
// binding.searcher01.postDelayed({
// binding.searcher01.evaluateJavascript(
// "function getAll() {\n" +
// " MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" +
// " };getAll()"
// ) { result ->
// (result as? String)?.let {}
// }
// }, 10000L)
// }
// }else {
// //
// view?.evaluateJavascript(
// "function getAll() {\n" +
// " MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" +
// " };getAll()"
// ) { result ->
// (result as? String)?.let {}
// }
// } // }
try { // if (isF) this@LauncherActivity.callBack?.collectComplete()
this.removeJavascriptInterface("MyJavaScriptInterface") // }
}catch (e :Exception) {} // }
this.addJavascriptInterface(MyJavaScriptInterface(this),"MyJavaScriptInterface") // WebView.setWebContentsDebuggingEnabled(false)
setBackgroundColor(Color.WHITE) // 백그라운드 색상 설정 // binding.searcher01.apply {
setLayerType(View.LAYER_TYPE_SOFTWARE, null) // 랜더링 이슈 해결 //// Jsoup.connect("https://missav.com/dm11/ko").userAgent()
try { //// .timeout(30000).get()?.apply {
settings.apply { //// BLog.LOGE("Jsoup.connect(missAv).get() ${this}")
userAgentString = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36" //// }
javaScriptEnabled = true // 자바스크립트 사용 가능하도록 설정 // try {
loadWithOverviewMode = true // 전체 웹페이지를 화면에 맞게 로드 // this.removeJavascriptInterface("MyJavaScriptInterface")
useWideViewPort = true // 화면에 맞게 페이지 확대/축소 // }catch (e :Exception) {}
domStorageEnabled = true // DOM 저장소 사용 가능하도록 설정 // this.addJavascriptInterface(MyJavaScriptInterface(this),"MyJavaScriptInterface")
setSupportMultipleWindows(true) // setBackgroundColor(Color.WHITE) // 백그라운드 색상 설정
javaScriptCanOpenWindowsAutomatically = true // 팝업창 차단 해제 // setLayerType(View.LAYER_TYPE_SOFTWARE, null) // 랜더링 이슈 해결
cacheMode = WebSettings.LOAD_CACHE_ELSE_NETWORK // try {
textZoom = 100 // system 에 의한 글꼴 변형 방지 // settings.apply {
defaultTextEncodingName = "UTF-8" // 인코딩 설정 // userAgentString = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36"
allowContentAccess = true // 웹뷰를 통해 content url에 접근할지 여부 // javaScriptEnabled = true // 자바스크립트 사용 가능하도록 설정
layoutAlgorithm = WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING // 웹페이지의 레이아웃을 화면에 맞게 자동으로 조정 // loadWithOverviewMode = true // 전체 웹페이지를 화면에 맞게 로드
} // useWideViewPort = true // 화면에 맞게 페이지 확대/축소
} catch (ignore: NoSuchMethodError) { // domStorageEnabled = true // DOM 저장소 사용 가능하도록 설정
// setSupportMultipleWindows(true)
}.apply { // javaScriptCanOpenWindowsAutomatically = true // 팝업창 차단 해제
loadUrl(url) // 웹페이지 연결 // cacheMode = WebSettings.LOAD_CACHE_ELSE_NETWORK
} // textZoom = 100 // system 에 의한 글꼴 변형 방지
} // defaultTextEncodingName = "UTF-8" // 인코딩 설정
} // allowContentAccess = true // 웹뷰를 통해 content url에 접근할지 여부
// layoutAlgorithm = WebSettings.LayoutAlgorithm.TEXT_AUTOSIZING // 웹페이지의 레이아웃을 화면에 맞게 자동으로 조정
// }
// } catch (ignore: NoSuchMethodError) {
//
// }.apply {
// loadUrl(url) // 웹페이지 연결
// }
// }
// }
var maxDate : Long = Long.MIN_VALUE var maxDate : Long = Long.MIN_VALUE
var minDate : Long = Long.MAX_VALUE var minDate : Long = Long.MAX_VALUE
val triple = 1000L * 60L * 60L * 24L * 2L val triple = 1000L * 60L * 60L * 24L * 2L
val simpldateFormat = SimpleDateFormat("d MMM, yy", Locale.US) val simpldateFormat = SimpleDateFormat("d MMM, yy", Locale.US)
fun jGuruToday(doc: Document) { // fun jGuruToday(doc: Document) {
var temp = arrayListOf<RssData>() // var temp = arrayListOf<RssData>()
doc.getElementsByTag("li").forEach { // doc.getElementsByTag("li").forEach {
if (it.getElementsByTag("img").size > 0) { // if (it.getElementsByTag("img").size > 0) {
var title = it.getElementsByTag("a").get(0).attr("title") // var title = it.getElementsByTag("a").get(0).attr("title")
var model = title.replace("[", "").split("]")[0] // var model = title.replace("[", "").split("]")[0]
var pageLink = it.getElementsByTag("a").get(0).attr("href") // var pageLink = it.getElementsByTag("a").get(0).attr("href")
var imgg = it.getElementsByTag("img").get(0).attr("src") // var imgg = it.getElementsByTag("img").get(0).attr("src")
var actor = if (it.getElementsByClass("wpptax").size > 0 )it.getElementsByClass("wpptax").get(0).text() else "" // var actor = if (it.getElementsByClass("wpptax").size > 0 )it.getElementsByClass("wpptax").get(0).text() else ""
if (pageLink.length > 0 && imgg.length > 0 && title.length > 0 && model.length > 0) { // if (pageLink.length > 0 && imgg.length > 0 && title.length > 0 && model.length > 0) {
temp.add( // temp.add(
JGuru( // JGuru(
model = model, // model = model,
title = title, // title = title,
pageLink = pageLink, // pageLink = pageLink,
image = imgg, // image = imgg,
tags = actor, // tags = actor,
date = beforeDay(Date(),3) + 360000 // date = beforeDay(Date(),3) + 360000
).getRssData() // ).getRssData()
) // )
} // }
} // }
}.apply { // }.apply {
this@LauncherActivity.callBack?.collectComplete() // this@LauncherActivity.callBack?.collectComplete()
WorkersDb.insertBulkInteface(temp) // WorkersDb.insertBulkInteface(temp)
Toast.makeText(this@LauncherActivity, // Toast.makeText(this@LauncherActivity,
"Stored rank data", Toast.LENGTH_LONG).show() // "Stored rank data", Toast.LENGTH_LONG).show()
binding.searcher01?.post { binding.searcher01.loadUrl(jGuruMain) } // binding.searcher01?.post { binding.searcher01.loadUrl(jGuruMain) }
} // }
} // }
fun jGuruMain(doc: Document) { // fun jGuruMain(doc: Document) {
var temp = arrayListOf<RssData>() // var temp = arrayListOf<RssData>()
val prevUrl = doc.getElementsByClass("prev").get(0).getElementsByAttribute("href").get(0).attr("href") // val prevUrl = doc.getElementsByClass("prev").get(0).getElementsByAttribute("href").get(0).attr("href")
doc.getElementsByClass("column").forEach { // doc.getElementsByClass("column").forEach {
var title = it.getElementsByAttribute("title").get(0).text() // var title = it.getElementsByAttribute("title").get(0).text()
var model = title.replace("[","").split("]")[0] // var model = title.replace("[","").split("]")[0]
var pageLink = it.getElementsByClass("imgg").get(0).getElementsByAttribute("href").get(0).attr("href") // var pageLink = it.getElementsByClass("imgg").get(0).getElementsByAttribute("href").get(0).attr("href")
var imgg = it.getElementsByClass("imgg").get(0).getElementsByAttribute("src").get(0).attr("src") // var imgg = it.getElementsByClass("imgg").get(0).getElementsByAttribute("src").get(0).attr("src")
var tags = it.getElementsByClass("tags").get(0).text() // var tags = it.getElementsByClass("tags").get(0).text()
var date = it.getElementsByClass("date").get(0).text() // var date = it.getElementsByClass("date").get(0).text()
var regDate = simpldateFormat.parse(date).time // var regDate = simpldateFormat.parse(date).time
//
minDate = Math.min(minDate,regDate) // minDate = Math.min(minDate,regDate)
maxDate = Math.max(maxDate,regDate) // maxDate = Math.max(maxDate,regDate)
temp.add(JGuru(model = model, title = title, pageLink = pageLink, image = imgg, tags = tags, date = make0H(simpldateFormat.parse(date))).getRssData()) // temp.add(JGuru(model = model, title = title, pageLink = pageLink, image = imgg, tags = tags, date = make0H(simpldateFormat.parse(date))).getRssData())
}.apply { // }.apply {
var itemC = 0 // var itemC = 0
WorkersDb.insertBulkInteface(temp) // WorkersDb.insertBulkInteface(temp)
callBack?.onConsoleLog("Stored data :: ${simpldateFormat.format(Date(minDate))} ~ ${simpldateFormat.format(Date(maxDate))} set in ${itemC}") // callBack?.onConsoleLog("Stored data :: ${simpldateFormat.format(Date(minDate))} ~ ${simpldateFormat.format(Date(maxDate))} set in ${itemC}")
binding.searcher01?.post { binding.searcher01.loadData("<html></html>",null,null) } // binding.searcher01?.post { binding.searcher01.loadData("<html></html>",null,null) }
this@LauncherActivity.callBack?.collectComplete() // this@LauncherActivity.callBack?.collectComplete()
} // }
} // }
//
fun jGuruTag(doc: Document) { // fun jGuruTag(doc: Document) {
doc.getElementsByTag("ul").forEach { // doc.getElementsByTag("ul").forEach {
it.children().forEach { // it.children().forEach {
if (it.tag().name.contains("li")) { // if (it.tag().name.contains("li")) {
listTags.add( // listTags.add(
jGuruTag( // jGuruTag(
tagTitle = it.getElementsByTag("a").get(0).text(), // tagTitle = it.getElementsByTag("a").get(0).text(),
link = it.getElementsByTag("a").get(0).attr("href") // link = it.getElementsByTag("a").get(0).attr("href")
) // )
) // )
//
} // }
} // }
}.apply { // }.apply {
binding.searcher01?.post { binding.searcher01.loadData("<html></html>",null,null) } // binding.searcher01?.post { binding.searcher01.loadData("<html></html>",null,null) }
this@LauncherActivity.callBack?.collectComplete() // this@LauncherActivity.callBack?.collectComplete()
} // }
} // }
fun switchFeeds() { fun switchFeeds() {
Feeds().show(supportFragmentManager, "Feeds") startActivity(Intent(this,Feeds::class.java))
} }
inner class MyJavaScriptInterface(val webView: WebView) { // inner class MyJavaScriptInterface(val webView: WebView) {
@JavascriptInterface // @JavascriptInterface
fun sendValueFromHtml(result: String) { // fun sendValueFromHtml(result: String) {
if (lastedFinishedPageUrl.contains(jGuruMain)) { // if (lastedFinishedPageUrl.contains(jGuruMain)) {
var htmlString = result.replace("\\u003","<") // var htmlString = result.replace("\\u003","<")
val doc: Document = Jsoup.parse(htmlString) // val doc: Document = Jsoup.parse(htmlString)
if (lastedFinishedPageUrl?.contains("page") == true || lastedFinishedPageUrl?.equals(jGuruMain) == true) { // if (lastedFinishedPageUrl?.contains("page") == true || lastedFinishedPageUrl?.equals(jGuruMain) == true) {
jGuruMain(doc) // jGuruMain(doc)
} else if (lastedFinishedPageUrl?.contains("/most-watched-rank") == true) { // } else if (lastedFinishedPageUrl?.contains("/most-watched-rank") == true) {
jGuruToday(doc) // jGuruToday(doc)
} else if (lastedFinishedPageUrl?.contains("/tags/") == true) { // } else if (lastedFinishedPageUrl?.contains("/tags/") == true) {
jGuruTag(doc) // jGuruTag(doc)
} // }
} else if (lastedFinishedPageUrl?.contains("missav")==true) { // } else if (lastedFinishedPageUrl?.contains("missav")==true) {
val doc: Document = Jsoup.parse(result) // val doc: Document = Jsoup.parse(result)
var temp = arrayListOf<RssData>() // var temp = arrayListOf<RssData>()
doc.getElementsByClass("thumbnail group").forEach { miss_li -> // doc.getElementsByClass("thumbnail group").forEach { miss_li ->
if (miss_li.getElementsByTag("img").size > 0 && miss_li.getElementsByTag("img").get(0).attr("data-src").length > 10 && // if (miss_li.getElementsByTag("img").size > 0 && miss_li.getElementsByTag("img").get(0).attr("data-src").length > 10 &&
miss_li.getElementsByTag("img").get(0).attr("data-src").startsWith("https") && // miss_li.getElementsByTag("img").get(0).attr("data-src").startsWith("https") &&
miss_li.getElementsByTag("img").get(0).attr("data-src").endsWith("jpg")) { // miss_li.getElementsByTag("img").get(0).attr("data-src").endsWith("jpg")) {
var link = if(miss_li.getElementsByTag("a").size > 0) miss_li.getElementsByTag("a").get(0).attr("href") else "" // var link = if(miss_li.getElementsByTag("a").size > 0) miss_li.getElementsByTag("a").get(0).attr("href") else ""
var title = miss_li.getElementsByClass("text-secondary group-hover:text-primary").getT() // var title = miss_li.getElementsByClass("text-secondary group-hover:text-primary").getT()
var thumb = miss_li.getElementsByTag("img").get(0).attr("data-src") // var thumb = miss_li.getElementsByTag("img").get(0).attr("data-src")
var desc = miss_li.getElementsByTag("img").get(0).text() // var desc = miss_li.getElementsByTag("img").get(0).text()
MissD().apply { // MissD().apply {
this.link = link // this.link = link
this.title = title // this.title = title
this.thumb = thumb // this.thumb = thumb
this.desc = desc // this.desc = desc
temp.add(this.getRssData()) // temp.add(this.getRssData())
} // }
} // }
}.apply { // }.apply {
WorkersDb.insertBulkData(temp) // WorkersDb.insertBulkData(temp)
} // }
} else if(lastedFinishedPageUrl?.contains("https://translate.google.com") == true){ // } else if(lastedFinishedPageUrl?.contains("https://translate.google.com") == true){
callBackHandler.removeCallbacks(postNext) // callBackHandler.removeCallbacks(postNext)
val doc: Document = Jsoup.parse(result) // val doc: Document = Jsoup.parse(result)
doc.getElementsByTag("span").forEach { span -> // doc.getElementsByTag("span").forEach { span ->
// BLog.LOGE("on getHangule ${span.text()}") //// BLog.LOGE("on getHangule ${span.text()}")
if(span.hasAttr("jsaction") && // if(span.hasAttr("jsaction") &&
span.attr("jsaction").contains("mouseout") && // span.attr("jsaction").contains("mouseout") &&
span.attr("jsaction").contains("contextmenu") && // span.attr("jsaction").contains("contextmenu") &&
span.attr("jsaction").contains("click") && // span.attr("jsaction").contains("click") &&
span.attr("jsaction").contains("mouseover") // span.attr("jsaction").contains("mouseover")
) { // ) {
BLog.LOGE("on getHangule $span") // BLog.LOGE("on getHangule $span")
val resultString = span.text() // val resultString = span.text()
if (resultString != null && resultString.length > 0) { // if (resultString != null && resultString.length > 0) {
callBackHandler.removeCallbacks(postNext) // callBackHandler.removeCallbacks(postNext)
callBack?.onConsoleLog("result::${span.text()}") // callBack?.onConsoleLog("result::${span.text()}")
callBack = null // callBack = null
} // }
} // }
}.apply { // }.apply {
callBackHandler.removeCallbacks(postNext) // callBackHandler.removeCallbacks(postNext)
callBackHandler.postDelayed(postNext,25000L) // callBackHandler.postDelayed(postNext,25000L)
} // }
} else { // } else {
val doc: Document = Jsoup.parse(result) // val doc: Document = Jsoup.parse(result)
callBack?.onConsoleLog("lastedFinishedPageUrl >>> ${doc}") // callBack?.onConsoleLog("lastedFinishedPageUrl >>> ${doc}")
} // }
BLog.LOGE("binding.otherCheck after ThreadRun") // BLog.LOGE("binding.otherCheck after ThreadRun")
} // }
//
} // }
var postNext : Runnable = Runnable{ var postNext : Runnable = Runnable{
callBack?.collectComplete() callBack?.collectComplete()
} }
@ -1068,7 +1078,7 @@ fun openYouTube(schemeString : String) {
} }
fun openReddit(schemeString : String) { fun openReddit(schemeString : String) {
BLog.LOGE("schemeString >>>> ${schemeString}") Blog.LOGE("schemeString >>>> ${schemeString}")
var uri = schemeString.toUri() var uri = schemeString.toUri()
val gmmIntentUri = Uri.parse(schemeString) val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri) val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
@ -1083,9 +1093,9 @@ fun openReddit(schemeString : String) {
fun openDotax(schemeString : String) { fun openDotax(schemeString : String) {
val gmmIntentUri = Uri.parse(schemeString) val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW) val mapIntent = Intent(Intent.ACTION_VIEW)
mapIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP) // mapIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
mapIntent.addCategory(Intent.CATEGORY_BROWSABLE) // mapIntent.addCategory(Intent.CATEGORY_BROWSABLE)
mapIntent.setPackage("net.daum.android.cafe") // mapIntent.setPackage("net.daum.android.cafe")
mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
// mapIntent.setPackage("com.android.chrome") // mapIntent.setPackage("com.android.chrome")
mapIntent.setData(gmmIntentUri) mapIntent.setData(gmmIntentUri)
@ -1094,7 +1104,7 @@ fun openDotax(schemeString : String) {
fun openOpera(schemeString : String) { fun openOpera(schemeString : String) {
BLog.LOGE("openOpera ${schemeString}") Blog.LOGE("openOpera ${schemeString}")
val gmmIntentUri = Uri.parse(schemeString) val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri) val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)

View File

@ -23,6 +23,7 @@ import android.content.ComponentCallbacks2
import android.content.Context import android.content.Context
import android.database.sqlite.SQLiteDatabase import android.database.sqlite.SQLiteDatabase
import bums.lunatic.launcher.helpers.PrefHelper import bums.lunatic.launcher.helpers.PrefHelper
import kr.lunaticbum.Base
internal class LunaticLauncher : Application() { internal class LunaticLauncher : Application() {
@ -33,6 +34,7 @@ internal class LunaticLauncher : Application() {
override fun onCreate() { override fun onCreate() {
super.onCreate() super.onCreate()
appContext = this appContext = this
Base.initialize(this)
PrefHelper.initialize(this) PrefHelper.initialize(this)
} }
override fun onTrimMemory(level: Int) { override fun onTrimMemory(level: Int) {

View File

@ -18,7 +18,6 @@
package bums.lunatic.launcher.apps package bums.lunatic.launcher.apps
import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
@ -30,19 +29,14 @@ import android.os.Bundle
import android.os.Handler import android.os.Handler
import android.os.Looper import android.os.Looper
import android.view.KeyEvent import android.view.KeyEvent
import android.view.LayoutInflater
import android.view.View
import android.view.View.GONE import android.view.View.GONE
import android.view.View.VISIBLE import android.view.View.VISIBLE
import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager import android.view.inputmethod.InputMethodManager
import androidx.core.widget.doOnTextChanged import androidx.core.widget.doOnTextChanged
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import bums.lunatic.launcher.BuildConfig import bums.lunatic.launcher.BuildConfig
import bums.lunatic.launcher.CommadCallabck import bums.lunatic.launcher.common.CommonActivity
import bums.lunatic.launcher.LauncherActivity import bums.lunatic.launcher.common.letTrue
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.databinding.AppDrawerBinding import bums.lunatic.launcher.databinding.AppDrawerBinding
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_APPS_COUNT import bums.lunatic.launcher.helpers.Constants.Companion.KEY_APPS_COUNT
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_APPS_LAYOUT import bums.lunatic.launcher.helpers.Constants.Companion.KEY_APPS_LAYOUT
@ -50,9 +44,8 @@ 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.letTrue
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
import bums.lunatic.launcher.workers.WorkersDb import bums.lunatic.launcher.workers.WorkersDb
import io.realm.kotlin.ext.query import io.realm.kotlin.ext.query
@ -65,7 +58,7 @@ import java.util.concurrent.TimeUnit
import java.util.regex.Pattern import java.util.regex.Pattern
internal class AppDrawer : Fragment() { internal class AppDrawer : CommonActivity() {
private lateinit var binding: AppDrawerBinding private lateinit var binding: AppDrawerBinding
private var layoutType: Int = 0 private var layoutType: Int = 0
@ -104,28 +97,29 @@ internal class AppDrawer : Fragment() {
} }
} }
fun getInputText() = binding.searchInput.text.toString()
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
packageManager = lActivity?.packageManager!! // setStyle(STYLE_NO_TITLE, R.style.FilterFullScreenDialog)
} // packageManager = lActivity?.packageManager!!
// }
override fun onAttach(context: Context) { // override fun onAttach(context: Context) {
super.onAttach(context) // super.onAttach(context)
} //// }
//
//
//
// override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
fun getInputText() = binding.searchInput.text.toString() binding = AppDrawerBinding.inflate(layoutInflater)
setContentView(binding.root)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { settingsPrefs = this.getSharedPreferences(PREFS_SETTINGS, 0)
appNamesPrefs = this.getSharedPreferences(PREFS_APP_NAMES, 0)
binding = AppDrawerBinding.inflate(inflater, container, false)
settingsPrefs = requireContext().getSharedPreferences(PREFS_SETTINGS, 0)
appNamesPrefs = requireContext().getSharedPreferences(PREFS_APP_NAMES, 0)
layoutType = settingsPrefs!!.getInt(KEY_APPS_LAYOUT, 0) layoutType = settingsPrefs!!.getInt(KEY_APPS_LAYOUT, 0)
appsAdapter = AppsAdapter(layoutType, packageManager!!, childFragmentManager, binding.appsCount) appsAdapter = AppsAdapter(layoutType, packageManager!!, supportFragmentManager, binding.appsCount)
contactAdapter = ContactAdapter(packageManager!!, childFragmentManager) contactAdapter = ContactAdapter(packageManager!!, supportFragmentManager)
binding.appsCount.visibility = if (settingsPrefs!!.getBoolean(KEY_APPS_COUNT, true)) VISIBLE else GONE binding.appsCount.visibility = if (settingsPrefs!!.getBoolean(KEY_APPS_COUNT, true)) VISIBLE else GONE
binding.searchNmap.setOnClickListener { binding.searchNmap.setOnClickListener {
@ -176,44 +170,6 @@ internal class AppDrawer : Fragment() {
// openSearchApps("kakaot://taxi?dest_addr=${URLEncoder.encode("세곡동 557")}","com.kakao.taxi") // openSearchApps("kakaot://taxi?dest_addr=${URLEncoder.encode("세곡동 557")}","com.kakao.taxi")
} }
setLayout() setLayout()
return binding.root
}
fun sendMsg(scheme : String? = null , pkg : String? = null) {
var postIntent : Intent? = null
if (scheme != null && scheme.length > 1) {
postIntent = Intent(Intent.ACTION_VIEW,Uri.parse(scheme))
} else {
postIntent = Intent(Intent.ACTION_SEND)
postIntent.type = "text/plain"
postIntent.putExtra(Intent.EXTRA_TEXT, "${getInputText()}")
}
if (pkg != null && pkg.length > 1) {
postIntent?.setPackage(pkg)
startActivity(postIntent)
} else {
val chooserTitle = "바로 보냄"
startActivity(Intent.createChooser(postIntent, chooserTitle))
}
}
val appNames = hashSetOf<AppInfo>()
val contactList = arrayListOf<SimpleContact>()
fun openSearchApps(schemeString : String, pakage : String? = null) {
val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
pakage?.let {
mapIntent.setPackage(pakage)
WorkersDb.updateAppUse(pakage)
}
startActivity(mapIntent)
}
@SuppressLint("ClickableViewAccessibility")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
binding.searchInput.setOnKeyListener { v, keyCode, event -> binding.searchInput.setOnKeyListener { v, keyCode, event ->
//contactList.size < 1 && packageList.size < 1 && //contactList.size < 1 && packageList.size < 1 &&
if(PrefBoolean.useQuickLaunch.get(false) && keyCode == 66 && event.action == KeyEvent.ACTION_UP) { if(PrefBoolean.useQuickLaunch.get(false) && keyCode == 66 && event.action == KeyEvent.ACTION_UP) {
@ -261,10 +217,43 @@ internal class AppDrawer : Fragment() {
binding.searchInput.text?.let { binding.searchInput.setSelection(it.length) } binding.searchInput.text?.let { binding.searchInput.setSelection(it.length) }
filterAppsList(inputText.toString()) filterAppsList(inputText.toString())
} }
// return binding.root
} }
fun sendMsg(scheme : String? = null , pkg : String? = null) {
var postIntent : Intent? = null
if (scheme != null && scheme.length > 1) {
postIntent = Intent(Intent.ACTION_VIEW,Uri.parse(scheme))
} else {
postIntent = Intent(Intent.ACTION_SEND)
postIntent.type = "text/plain"
postIntent.putExtra(Intent.EXTRA_TEXT, "${getInputText()}")
}
if (pkg != null && pkg.length > 1) {
postIntent?.setPackage(pkg)
startActivity(postIntent)
} else {
val chooserTitle = "바로 보냄"
startActivity(Intent.createChooser(postIntent, chooserTitle))
}
}
val appNames = hashSetOf<AppInfo>()
val contactList = arrayListOf<SimpleContact>()
fun openSearchApps(schemeString : String, pakage : String? = null) {
val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
pakage?.let {
mapIntent.setPackage(pakage)
WorkersDb.updateAppUse(pakage)
}
startActivity(mapIntent)
}
fun checkResult(keyword: String) { fun checkResult(keyword: String) {
lActivity?.openSearchMenus(keyword) { openSearchMenus(keyword) {
registCancelSearch() registCancelSearch()
} }
} }
@ -284,21 +273,19 @@ internal class AppDrawer : Fragment() {
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
BLog.LOGE("onResume") Blog.LOGE("onResume")
fetchApps() fetchApps()
binding.appsCount.visibility = if (PrefBoolean.showAppResultCount.get(false)) VISIBLE else GONE binding.appsCount.visibility = if (PrefBoolean.showAppResultCount.get(false)) VISIBLE else GONE
if (isAdded && isVisible) {
PrefBoolean.openWithKayboard.get().letTrue { openSearch() } PrefBoolean.openWithKayboard.get().letTrue { openSearch() }
registCancelSearch() registCancelSearch()
}
// BLog.LOGE("onResume after chechHandler.postDelayed(cancelSearch, 3000L)")
} }
val chechHandler = Handler(Looper.getMainLooper()) val chechHandler = Handler(Looper.getMainLooper())
val cancelSearch = Runnable { val cancelSearch = Runnable {
// lActivity?.viewPager?.currentItem = 1 finish()
} }
fun registCancelSearch() { fun registCancelSearch() {
@ -316,8 +303,8 @@ internal class AppDrawer : Fragment() {
} }
private fun setLayout() { private fun setLayout() {
binding.appsList.layoutManager = GridLayoutManager(requireContext(), 2, GridLayoutManager.HORIZONTAL,false) binding.appsList.layoutManager = GridLayoutManager(this, 2, GridLayoutManager.HORIZONTAL,false)
binding.contactList.layoutManager = GridLayoutManager(requireContext(), 2, GridLayoutManager.HORIZONTAL,false) binding.contactList.layoutManager = GridLayoutManager(this, 2, GridLayoutManager.HORIZONTAL,false)
/* initialize apps list adapter */ /* initialize apps list adapter */
binding.appsList.adapter = appsAdapter binding.appsList.adapter = appsAdapter
binding.contactList.adapter = contactAdapter binding.contactList.adapter = contactAdapter
@ -388,7 +375,7 @@ internal class AppDrawer : Fragment() {
} }
fun getHangule() { fun getHangule() {
BLog.LOGE("on getHangule") Blog.LOGE("on getHangule")
Executors.newSingleThreadScheduledExecutor().schedule({ Executors.newSingleThreadScheduledExecutor().schedule({
if (appNames.size > 0) { if (appNames.size > 0) {
val info = appNames.first() val info = appNames.first()
@ -396,7 +383,7 @@ internal class AppDrawer : Fragment() {
if (info.koreanName?.length ?: 0 > 0 || info.appNameChosung?.length ?: 0 > 0) { if (info.koreanName?.length ?: 0 > 0 || info.appNameChosung?.length ?: 0 > 0) {
getHangule() getHangule()
} else { } else {
BLog.LOGE("on getHangule ${info.appName}") Blog.LOGE("on getHangule ${info.appName}")
if (Pattern.matches("^[a-zA-Z]*$", info.appName)) { if (Pattern.matches("^[a-zA-Z]*$", info.appName)) {
// Jsoup.connect("https://translate.google.com/?hl=ko&sl=en&tl=ko&text=${info.appName}&op=translate").get().let { trans -> // Jsoup.connect("https://translate.google.com/?hl=ko&sl=en&tl=ko&text=${info.appName}&op=translate").get().let { trans ->
// BLog.LOGE("on getHangule ${trans.title()}") // BLog.LOGE("on getHangule ${trans.title()}")
@ -414,35 +401,35 @@ internal class AppDrawer : Fragment() {
// }.apply { // }.apply {
// getHangule() // getHangule()
// } // }
Handler(Looper.getMainLooper()).post { // Handler(Looper.getMainLooper()).post {
LauncherActivity.Companion.lActivity?.doWebParseStart( // LauncherActivity.Companion.lActivity?.doWebParseStart(
"https://translate.google.com/?hl=ko&sl=en&tl=ko&text=${info.appName}&op=translate", // "https://translate.google.com/?hl=ko&sl=en&tl=ko&text=${info.appName}&op=translate",
object : CommadCallabck { // object : CommadCallabck {
override fun onConsoleLog(log: String) { // override fun onConsoleLog(log: String) {
if (log.contains("result::")) { // if (log.contains("result::")) {
val appHangulName = log.split("result::")[1] // val appHangulName = log.split("result::")[1]
if(appHangulName?.length ?: 0 > 0) { // if(appHangulName?.length ?: 0 > 0) {
info.appNameChosung = JamoUtils.split(appHangulName).joinToString("") // info.appNameChosung = JamoUtils.split(appHangulName).joinToString("")
info.koreanName = appHangulName // info.koreanName = appHangulName
// BLog.LOGE("appHangulName >>> $appHangulName") //// BLog.LOGE("appHangulName >>> $appHangulName")
// BLog.LOGE("appHangulName >>> ${info.appNameChosung}") //// BLog.LOGE("appHangulName >>> ${info.appNameChosung}")
WorkersDb.update(info) // WorkersDb.update(info)
getHangule() // getHangule()
} // }
} // }
} // }
//
override fun collectComplete() { // override fun collectComplete() {
getHangule() // getHangule()
} // }
}) // })
} // }
} else { } else {
info.appNameChosung = JamoUtils.split(info.appName).joinToString("") info.appNameChosung = JamoUtils.split(info.appName).joinToString("")
info.koreanName = info.appName info.koreanName = info.appName
WorkersDb.update(info) WorkersDb.update(info)
getHangule() getHangule()
BLog.LOGE("on getHangule to next") Blog.LOGE("on getHangule to next")
} }
} }
} }
@ -482,16 +469,14 @@ internal class AppDrawer : Fragment() {
fun openSearch() { fun openSearch() {
try { try {
if(isAdded && isVisible) { binding.searchInput.apply {
binding.searchInput.apply { visibility = VISIBLE
visibility = VISIBLE requestFocus()
requestFocus() let {
let { (getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager)?.showSoftInput(
(lActivity?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager)?.showSoftInput( it,
it, InputMethodManager.SHOW_IMPLICIT
InputMethodManager.SHOW_IMPLICIT )
)
}
} }
} }
} catch (e : UninitializedPropertyAccessException) { } catch (e : UninitializedPropertyAccessException) {
@ -504,7 +489,7 @@ internal class AppDrawer : Fragment() {
binding.searchInput.apply { binding.searchInput.apply {
let { let {
text?.clear() text?.clear()
(lActivity?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager)?.hideSoftInputFromWindow(it.windowToken, 0) (getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager)?.hideSoftInputFromWindow(it.windowToken, 0)
} }
} }
} }

View File

@ -104,7 +104,7 @@ internal class AppMenu : BottomSheetDialogFragment() {
var result = query<AppInfo>("pkgName == $0", packageName).find() var result = query<AppInfo>("pkgName == $0", packageName).find()
if (result.size > 0) { if (result.size > 0) {
val app = result.first() val app = result.first()
delete(app) app.currentInstalled = false
} }
} }
dismiss() dismiss()
@ -124,6 +124,7 @@ internal class AppMenu : BottomSheetDialogFragment() {
binding.totalTouch.text = "총 실행 횟수 : ".plus(app.clickCount.toString()) binding.totalTouch.text = "총 실행 횟수 : ".plus(app.clickCount.toString())
binding.lastTouchDate.text = binding.lastTouchDate.text =
"최종 실행 일시 : ".plus(SimpleDateFormat("yyyy-MM-dd HH:mm").format(Date(app.lastUseDate))) "최종 실행 일시 : ".plus(SimpleDateFormat("yyyy-MM-dd HH:mm").format(Date(app.lastUseDate)))
app.currentInstalled = true
binding.alterName.setText(app.koreanName) binding.alterName.setText(app.koreanName)
// app.clickCount = app.clickCount + 15 // app.clickCount = app.clickCount + 15

View File

@ -33,7 +33,7 @@ import bums.lunatic.launcher.R
import bums.lunatic.launcher.apps.IconPackManager.Companion.getDrawableIconForPackage import bums.lunatic.launcher.apps.IconPackManager.Companion.getDrawableIconForPackage
import bums.lunatic.launcher.databinding.AppsChildBinding import bums.lunatic.launcher.databinding.AppsChildBinding
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.workers.WorkersDb import bums.lunatic.launcher.workers.WorkersDb
import io.realm.kotlin.ext.query import io.realm.kotlin.ext.query
import kotlinx.coroutines.MainScope import kotlinx.coroutines.MainScope
@ -81,7 +81,7 @@ internal class AppsAdapter(
setOnClickListener { setOnClickListener {
WorkersDb.getRealm().apply { WorkersDb.getRealm().apply {
writeBlocking { writeBlocking {
BLog.LOGE("item.pkgName >>>> ${item.pkgName Blog.LOGE("item.pkgName >>>> ${item.pkgName
}") }")
var result = query<AppInfo>("pkgName == $0",item.pkgName).find() var result = query<AppInfo>("pkgName == $0",item.pkgName).find()
if(result.size > 0) { if(result.size > 0) {

View File

@ -27,7 +27,7 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.databinding.ContactMenuBinding import bums.lunatic.launcher.databinding.ContactMenuBinding
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.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
@ -82,7 +82,7 @@ internal class ContactMenu : BottomSheetDialogFragment() {
ContactsContract.CommonDataKinds.Phone.NUMBER, ContactsContract.CommonDataKinds.Phone.NUMBER,
) )
BLog.LOGE("GetContact", "packageName ${contactId}") Blog.LOGE("GetContact", "packageName ${contactId}")
try { try {
val cursor = resolver.query(phoneUri, projection, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId, null , null) val cursor = resolver.query(phoneUri, projection, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId, null , null)
if (cursor != null) { if (cursor != null) {
@ -92,7 +92,7 @@ internal class ContactMenu : BottomSheetDialogFragment() {
contactName = cursor.getString(nameIndex) contactName = cursor.getString(nameIndex)
var number = cursor.getString(numberIndex) var number = cursor.getString(numberIndex)
contactPhoneNumber = number.replace("-", "") contactPhoneNumber = number.replace("-", "")
BLog.LOGE("GetContact", "이름 : $contactName 번호 : $contactPhoneNumber ") Blog.LOGE("GetContact", "이름 : $contactName 번호 : $contactPhoneNumber ")
} }
} }
// 데이터 계열은 반드시 닫아줘야 한다. // 데이터 계열은 반드시 닫아줘야 한다.

View File

@ -31,7 +31,7 @@ import bums.lunatic.launcher.helpers.Constants.Companion.DEFAULT_ICON_PACK
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_ICON_PACK import bums.lunatic.launcher.helpers.Constants.Companion.KEY_ICON_PACK
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_PKGICS import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_PKGICS
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import bums.lunatic.launcher.utils.BLog import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.utils.ImageUtils import bums.lunatic.launcher.utils.ImageUtils
import kotlinx.coroutines.GlobalScope import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async import kotlinx.coroutines.async
@ -79,7 +79,7 @@ internal class IconPackManager {
} }
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
BLog.w("", "Couldn't find the appfilter.xml file") Blog.w("", "Couldn't find the appfilter.xml file")
} }
} }
if (xpp != null) { if (xpp != null) {
@ -118,9 +118,9 @@ internal class IconPackManager {
} }
loaded = true loaded = true
} catch (e: PackageManager.NameNotFoundException) { } catch (e: PackageManager.NameNotFoundException) {
BLog.w("", "Failed to load the icon pack") Blog.w("", "Failed to load the icon pack")
} catch (e: XmlPullParserException) { } catch (e: XmlPullParserException) {
BLog.w("", "Failed to parse the appfilter.xml file") Blog.w("", "Failed to parse the appfilter.xml file")
} catch (e: IOException) { } catch (e: IOException) {
e.printStackTrace() e.printStackTrace()
} }
@ -193,7 +193,7 @@ internal class IconPackManager {
var componentName: String? = null var componentName: String? = null
componentName = packagesConponentNames.get(appPackageName!!) componentName = packagesConponentNames.get(appPackageName!!)
if (componentName == null || componentName.length ?: 0 <= 0 ) { if (componentName == null || componentName.length ?: 0 <= 0 ) {
BLog.LOGE("it's compo ${appPackageName}") Blog.LOGE("it's compo ${appPackageName}")
var pkgIntent = var pkgIntent =
lActivity!!.packageManager.getLaunchIntentForPackage( lActivity!!.packageManager.getLaunchIntentForPackage(
appPackageName!! appPackageName!!

View File

@ -29,8 +29,9 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import bums.lunatic.launcher.BuildConfig import bums.lunatic.launcher.BuildConfig
import bums.lunatic.launcher.common.DismissCalback
import bums.lunatic.launcher.databinding.SearchMenuBinding import bums.lunatic.launcher.databinding.SearchMenuBinding
import bums.lunatic.launcher.utils.BLog import bums.lunatic.launcher.utils.Blog
import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
@ -131,16 +132,16 @@ internal class SearchMenu : BottomSheetDialogFragment() {
} }
override fun dismiss() { override fun dismiss() {
BLog.LOGE("dismiss()") Blog.LOGE("dismiss()")
mDismissCalback?.invoke() mDismissCalback?.invoke()
super.dismiss() super.dismiss()
} }
override fun onDismiss(dialog: DialogInterface) { override fun onDismiss(dialog: DialogInterface) {
BLog.LOGE("onDismiss(dialog: DialogInterface)") Blog.LOGE("onDismiss(dialog: DialogInterface)")
mDismissCalback?.invoke() mDismissCalback?.invoke()
super.onDismiss(dialog) super.onDismiss(dialog)
} }
} }
typealias DismissCalback = ()->Unit

View File

@ -0,0 +1,113 @@
package bums.lunatic.launcher.common
import android.content.Intent
import android.os.Environment
import androidx.appcompat.app.AppCompatActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.apps.SearchMenu
import bums.lunatic.launcher.helpers.PrefBoolean
import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.workers.LocationUpdateService
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.gson.Gson
import com.google.gson.JsonArray
import com.google.gson.reflect.TypeToken
import org.json.JSONArray
import org.json.JSONObject
import java.io.BufferedReader
import java.io.File
import java.io.FileInputStream
import java.io.FileNotFoundException
import java.io.FileOutputStream
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
import java.io.OutputStreamWriter
import java.util.Base64
import kotlin.system.exitProcess
abstract class CommonActivity : AppCompatActivity() {
fun openSearchMenus(keyword : String, dismissCalback: DismissCalback) {
SearchMenu().show(supportFragmentManager,keyword) {dismissCalback.invoke()}
}
fun updateLocationService() {
PrefBoolean.location.get().letTrue {
startService(Intent(this, LocationUpdateService::class.java))
}
if (PrefBoolean.location.get() == false) {
stopService(Intent(this, LocationUpdateService::class.java))
}
}
protected fun saveObjToJson(path : File, targetFileName : String, targetObj : Any) {
val fileName = "prefSettings.stng"
val path = File(Environment.getExternalStorageDirectory(),"bums")
if (path.exists() == false) {
path.mkdirs()
}
val file = File(path, targetFileName)
Blog.LOGE("saveObjToJson [${path.absolutePath}]targetFileName[${targetFileName}] data >>>> ${Gson().toJson(targetObj)}")
writeToFile(String(Base64.getEncoder().encode(Gson().toJson(targetObj).toByteArray())),file)
Blog.LOGE("saveObjToJson [${path.absolutePath}]targetFileName[${targetFileName}].length >>>> ${file.length()}")
}
protected fun writeToFile(data: String, file : File) {
try {
val outputStreamWriter =
OutputStreamWriter(FileOutputStream(file))
outputStreamWriter.write(data)
outputStreamWriter.close()
} catch (e: IOException) {
Blog.LOGE("Exception", "File write failed: $e")
}
}
protected fun readMap(file : File) : HashMap<String, Any> {
var result = HashMap<String, Any>()
readFromFile(file).let { base64String ->
String(Base64.getMimeDecoder().decode(base64String.toByteArray()))?.let { jsonString ->
Blog.LOGE("jsonString >>>> ${jsonString }")
result = Gson().fromJson(
jsonString, object : TypeToken<HashMap<String?, Any?>?>() {}.type
)
}
}
return result
}
protected fun decodeString(file : File) : String {
var result = ""
readFromFile(file).let { base64String ->
String(Base64.getMimeDecoder().decode(base64String.toByteArray()))?.let { jsonString ->
result = jsonString
}
}
return result
}
protected fun readFromFile(file : File): String {
var ret = ""
try {
val inputStream: InputStream? = FileInputStream(file)
if (inputStream != null) {
val inputStreamReader = InputStreamReader(inputStream)
val bufferedReader = BufferedReader(inputStreamReader)
var receiveString: String? = ""
val stringBuilder = StringBuilder()
while ((bufferedReader.readLine().also { receiveString = it }) != null) { stringBuilder.append("\n").append(receiveString) }
inputStream.close()
ret = stringBuilder.toString()
}
} catch (e: FileNotFoundException) {
Blog.LOGE("login activity", "File not found: $e")
} catch (e: IOException) {
Blog.LOGE("login activity", "Can not read file: $e")
}
return ret
}
}

View File

@ -0,0 +1,13 @@
package bums.lunatic.launcher.common
typealias DismissCalback = ()->Unit
typealias BLOCK = ()->Unit
inline fun Boolean.letTrue(block: BLOCK) {
if (this) {
block.invoke()
} else {
// elseblock.invoke()
}
}

View File

@ -19,9 +19,6 @@
package bums.lunatic.launcher.feeds package bums.lunatic.launcher.feeds
import android.Manifest import android.Manifest
import android.app.Activity.RESULT_CANCELED
import android.app.Activity.RESULT_OK
import android.appwidget.AppWidgetManager
import android.content.DialogInterface import android.content.DialogInterface
import android.content.Intent import android.content.Intent
import android.content.SharedPreferences import android.content.SharedPreferences
@ -35,52 +32,35 @@ import android.speech.RecognizerIntent
import android.speech.SpeechRecognizer import android.speech.SpeechRecognizer
import android.text.method.ScrollingMovementMethod import android.text.method.ScrollingMovementMethod
import android.view.ContextMenu import android.view.ContextMenu
import android.view.Gravity
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.MenuItem
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.EditText import android.widget.EditText
import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.PopupMenu
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.Fragment
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import bums.lunatic.launcher.CommadCallabck import bums.lunatic.launcher.CommadCallabck
import bums.lunatic.launcher.LauncherActivity.Companion.appWidgetHost
import bums.lunatic.launcher.LauncherActivity.Companion.appWidgetManager
import bums.lunatic.launcher.LauncherActivity.Companion.getCal import bums.lunatic.launcher.LauncherActivity.Companion.getCal
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.LauncherActivity.Companion.refreshDeviceData import bums.lunatic.launcher.LauncherActivity.Companion.refreshDeviceData
import bums.lunatic.launcher.LauncherActivity.Companion.refreshFeeds import bums.lunatic.launcher.LauncherActivity.Companion.refreshFeeds
import bums.lunatic.launcher.R import bums.lunatic.launcher.R
import bums.lunatic.launcher.common.CommonActivity
import bums.lunatic.launcher.databinding.FeedsBinding import bums.lunatic.launcher.databinding.FeedsBinding
import bums.lunatic.launcher.feeds.rss.RssAdapter import bums.lunatic.launcher.feeds.rss.RssAdapter
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_WIDGET_HEIGHTS import bums.lunatic.launcher.helpers.Constants.Companion.KEY_WIDGET_HEIGHTS
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_WIDGET_IDS import bums.lunatic.launcher.helpers.Constants.Companion.KEY_WIDGET_IDS
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_WIDGETS import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_WIDGETS
import bums.lunatic.launcher.helpers.Constants.Companion.SEPARATOR import bums.lunatic.launcher.helpers.Constants.Companion.SEPARATOR
import bums.lunatic.launcher.helpers.Constants.Companion.requestCreateWidget
import bums.lunatic.launcher.helpers.Constants.Companion.requestPickWidget
import bums.lunatic.launcher.helpers.PrefBoolean import bums.lunatic.launcher.helpers.PrefBoolean
import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.helpers.PrefString import bums.lunatic.launcher.helpers.PrefString
import bums.lunatic.launcher.home.LauncherHome.Companion.home import bums.lunatic.launcher.home.LauncherHome.Companion.home
import bums.lunatic.launcher.home.LauncherHome.Companion.listTags
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.model.RssDataInterface import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.jGuruTag import bums.lunatic.launcher.model.jGuruTag
import bums.lunatic.launcher.utils.BLog import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.utils.FeedParseManager import bums.lunatic.launcher.utils.FeedParseManager
import bums.lunatic.launcher.utils.RssList.jGuruMain
import bums.lunatic.launcher.utils.RssList.plist
import bums.lunatic.launcher.utils.getJ import bums.lunatic.launcher.utils.getJ
import bums.lunatic.launcher.workers.RecentCallGetter import bums.lunatic.launcher.workers.RecentCallGetter
import bums.lunatic.launcher.workers.RecentSmsGetter import bums.lunatic.launcher.workers.RecentSmsGetter
@ -91,8 +71,6 @@ import io.realm.kotlin.ext.query
import io.realm.kotlin.query.Sort 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.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.jsoup.Jsoup import org.jsoup.Jsoup
import java.net.URLEncoder import java.net.URLEncoder
@ -100,7 +78,7 @@ import java.nio.charset.Charset
import java.util.Base64 import java.util.Base64
internal class Feeds : DialogFragment() , CommadCallabck { internal class Feeds : CommonActivity() , CommadCallabck {
private lateinit var binding: FeedsBinding private lateinit var binding: FeedsBinding
private val requestCodeString = "requestCode" private val requestCodeString = "requestCode"
@ -109,24 +87,14 @@ internal class Feeds : DialogFragment() , CommadCallabck {
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
setStyle(STYLE_NO_TITLE, R.style.FilterFullScreenDialog) binding = FeedsBinding.inflate(layoutInflater)
} setContentView(binding.root)
mRssAdapter = RssAdapter(this)
mRssAdapter2 = RssAdapter(this)
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = FeedsBinding.inflate(inflater, container, false)
mRssAdapter = RssAdapter(requireContext())
mRssAdapter2 = RssAdapter(requireContext())
binding.feedsRss.rss.adapter = mRssAdapter binding.feedsRss.rss.adapter = mRssAdapter
binding.feedsRss.rss2.adapter = mRssAdapter2 binding.feedsRss.rss2.adapter = mRssAdapter2
binding.consoleLog.movementMethod = ScrollingMovementMethod(); binding.consoleLog.movementMethod = ScrollingMovementMethod();
updateWidgets() // updateWidgets()
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
expandCollapse() expandCollapse()
systemInfo() systemInfo()
} }
@ -146,13 +114,13 @@ internal class Feeds : DialogFragment() , CommadCallabck {
override fun onCreateContextMenu(menu: ContextMenu, v: View, menuInfo: ContextMenu.ContextMenuInfo?) { override fun onCreateContextMenu(menu: ContextMenu, v: View, menuInfo: ContextMenu.ContextMenuInfo?) {
super.onCreateContextMenu(menu, v, menuInfo) super.onCreateContextMenu(menu, v, menuInfo)
menu.clearHeader() menu.clearHeader()
lActivity!!.menuInflater.inflate(R.menu.add_widget, menu) menuInflater.inflate(R.menu.add_widget, menu)
} }
override fun onContextItemSelected(item: MenuItem): Boolean { // override fun onContextItemSelected(item: MenuItem): Boolean {
if (item.itemId == R.id.add_widget) selectWidget() // if (item.itemId == R.id.add_widget) selectWidget()
return super.onContextItemSelected(item) // return super.onContextItemSelected(item)
} // }
/* control view's expand-collapse actions */ /* control view's expand-collapse actions */
private fun expandCollapse() { private fun expandCollapse() {
@ -187,16 +155,16 @@ internal class Feeds : DialogFragment() , CommadCallabck {
binding.consoleLog.text = binding.consoleLog.text.toString() + "\n" + str binding.consoleLog.text = binding.consoleLog.text.toString() + "\n" + str
} }
mMainHandler.postDelayed(hideConsole,10000L) mMainHandler.postDelayed(hideConsole,10000L)
BLog.LOGE("consoleLog >>>> ${str}") Blog.LOGE("consoleLog >>>> ${str}")
} }
fun openOpera(schemeString : String) { fun openOpera(schemeString : String) {
BLog.LOGE("openOpera ${schemeString}") Blog.LOGE("openOpera ${schemeString}")
val gmmIntentUri = Uri.parse(schemeString) val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri) val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS) mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
mapIntent.setPackage("com.opera.browser") mapIntent.setPackage("com.opera.browser")
lActivity?.startActivity(mapIntent) startActivity(mapIntent)
} }
override fun onConsoleLog(log: String) { override fun onConsoleLog(log: String) {
@ -223,10 +191,10 @@ internal class Feeds : DialogFragment() , CommadCallabck {
binding.feedsRss.rss2.visibility = View.GONE binding.feedsRss.rss2.visibility = View.GONE
binding.feedsRss.loading.visibility = View.VISIBLE binding.feedsRss.loading.visibility = View.VISIBLE
binding.feedsRss.refresh.visibility = View.VISIBLE binding.feedsRss.refresh.visibility = View.VISIBLE
val builder: AlertDialog.Builder = AlertDialog.Builder(requireContext()) val builder: AlertDialog.Builder = AlertDialog.Builder(this)
builder.setTitle("Command Line") builder.setTitle("Command Line")
val viewInflated: View = LayoutInflater.from(context) val viewInflated: View = LayoutInflater.from(this)
.inflate(R.layout.text_inpu_password, view as ViewGroup?, false) .inflate(R.layout.text_inpu_password, binding.root as ViewGroup?, false)
val input = viewInflated.findViewById<View>(R.id.input) as EditText val input = viewInflated.findViewById<View>(R.id.input) as EditText
builder.setView(viewInflated) builder.setView(viewInflated)
builder.setPositiveButton(android.R.string.ok, builder.setPositiveButton(android.R.string.ok,
@ -338,7 +306,7 @@ internal class Feeds : DialogFragment() , CommadCallabck {
speechRecognizer = null speechRecognizer = null
} }
"sps"->{ "sps"->{
lActivity?.let { lActivity -> let { lActivity ->
if (lActivity.checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) { if (lActivity.checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
lActivity.requestPermissions(arrayOf(Manifest.permission.RECORD_AUDIO), 1) lActivity.requestPermissions(arrayOf(Manifest.permission.RECORD_AUDIO), 1)
} else { } else {
@ -396,13 +364,13 @@ internal class Feeds : DialogFragment() , CommadCallabck {
var nations = arrayListOf<String>() var nations = arrayListOf<String>()
CoroutineScope(Dispatchers.IO).launch { CoroutineScope(Dispatchers.IO).launch {
"https://www.worldcitydb.com/search-by-country?lang=ko".getJ().let { doc -> "https://www.worldcitydb.com/search-by-country?lang=ko".getJ().let { doc ->
BLog.LOGE("it.title() >> ${doc.title()}") Blog.LOGE("it.title() >> ${doc.title()}")
doc.getElementsByTag("tr").forEach { table -> doc.getElementsByTag("tr").forEach { table ->
table.children().forEach { table.children().forEach {
it.getElementsByTag("td").forEach { td -> it.getElementsByTag("td").forEach { td ->
td.children().forEach { td.children().forEach {
if (it.tag().name.equals("a")) { if (it.tag().name.equals("a")) {
BLog.LOGE("TD>>A ${it}") Blog.LOGE("TD>>A ${it}")
it.text() it.text()
} }
} }
@ -413,12 +381,12 @@ internal class Feeds : DialogFragment() , CommadCallabck {
} }
} }
"loc_ck" -> { "loc_ck" -> {
FeedsResult().show(parentFragmentManager, "") FeedsResult().show(supportFragmentManager, "")
} }
"loc_on" -> { "loc_on" -> {
PrefBoolean.location.set(!PrefBoolean.location.get()) PrefBoolean.location.set(!PrefBoolean.location.get())
consoleLog("PrefHelper.isLocationOn() >>> ${PrefBoolean.location.get()}") consoleLog("PrefHelper.isLocationOn() >>> ${PrefBoolean.location.get()}")
lActivity?.updateLocationService() updateLocationService()
} }
"cal" ->{ "cal" ->{
getCal() getCal()
@ -477,93 +445,93 @@ internal class Feeds : DialogFragment() , CommadCallabck {
} }
} }
"jjp" -> { "jjp" -> {
// lActivity?.doWebParseStart("https://projectjav.com") {} // doWebParseStart("https://projectjav.com") {}
} }
"jmnew" -> { "jmnew" -> {
// lActivity?.doWebParseStart("https://missav.com/dm507/en/release") {} // doWebParseStart("https://missav.com/dm507/en/release") {}
} }
"jmiss" -> { "jmiss" -> {
// lActivity?.doWebParseStart("https://missav.com/dm16/en") {} // doWebParseStart("https://missav.com/dm16/en") {}
} }
"jreq" -> { // "jreq" -> {
consoleLog("current j req() ${WorkersDb.getRealm() // consoleLog("current j req() ${WorkersDb.getRealm()
.query<RssData>("category == $0", RssDataType.GURU.name).find().size}") // .query<RssData>("category == $0", RssDataType.GURU.name).find().size}")
CoroutineScope(Dispatchers.IO).launch { // CoroutineScope(Dispatchers.IO).launch {
var isOk = false // var isOk = false
// plist.forEach { //// plist.forEach {
if (!isOk) { // if (!isOk) {
try { // try {
Jsoup.connect(jGuruMain) // Jsoup.connect(jGuruMain)
.userAgent("Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.5414.117 Mobile Safari/537.36") // .userAgent("Mozilla/5.0 (Linux; Android 13) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.5414.117 Mobile Safari/537.36")
.referrer("http://www.google.com") // .referrer("http://www.google.com")
.header("Accept-Language", "it-IT,en;q=0.8,en-US;q=0.6,de;q=0.4,it;q=0.2,es;q=0.2") // .header("Accept-Language", "it-IT,en;q=0.8,en-US;q=0.6,de;q=0.4,it;q=0.2,es;q=0.2")
.header("Connection", "keep-alive") // .header("Connection", "keep-alive")
.header("scheme", "https") // .header("scheme", "https")
.header("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8") // .header("accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8")
.header("accept-encoding", "gzip, deflate, br") // .header("accept-encoding", "gzip, deflate, br")
.header("cache-control", "no-cache") // .header("cache-control", "no-cache")
.header("pragma", "no-cache") // .header("pragma", "no-cache")
.header("upgrade-insecure-requests", "1") // .header("upgrade-insecure-requests", "1")
.ignoreContentType(true) // .ignoreContentType(true)
.timeout(30000).execute().let { // .timeout(30000).execute().let {
BLog.LOGE("DOC -> ${it}") // BLog.LOGE("DOC -> ${it}")
isOk = true // isOk = true
} // }
} catch (e: Exception) { // } catch (e: Exception) {
e.printStackTrace() // e.printStackTrace()
} // }
}
// } // }
BLog.LOGE("last state ${isOk}") //// }
} // BLog.LOGE("last state ${isOk}")
// lActivity?.doWebParseStart(jGuruMain,callBack = object : CommadCallabck { // }
// override fun onConsoleLog(log: String) { //// doWebParseStart(jGuruMain,callBack = object : CommadCallabck {
// this@Feeds.consoleLog(log) //// override fun onConsoleLog(log: String) {
// } //// this@Feeds.consoleLog(log)
// //// }
// override fun collectComplete() { ////
// consoleLog("excuted j req() ${WorkersDb.getRealm() //// override fun collectComplete() {
// .query<RssData>("category == $0", RssDataType.GURU.name).find().size}") //// consoleLog("excuted j req() ${WorkersDb.getRealm()
// } //// .query<RssData>("category == $0", RssDataType.GURU.name).find().size}")
// }) //// }
} //// })
// }
"jtag" -> { //
// lActivity?.doWebPare(TEST_PAG.plus("tags")) { // "jtag" -> {
binding.feedsRss.apply { //// doWebPare(TEST_PAG.plus("tags")) {
rss2.adapter = mRssAdapter2 // binding.feedsRss.apply {
// rss2.adapter = mRssAdapter2
loading.visibility = View.VISIBLE //
if (listTags.size > 0) { // loading.visibility = View.VISIBLE
mRssAdapter2?.updateData(listTags) // if (listTags.size > 0) {
rss2.visibility = View.VISIBLE // mRssAdapter2?.updateData(listTags)
loading.visibility = View.GONE // rss2.visibility = View.VISIBLE
refresh.visibility = View.GONE // loading.visibility = View.GONE
} else { // refresh.visibility = View.GONE
refresh.visibility = View.VISIBLE // } else {
rss2.visibility = View.GONE // refresh.visibility = View.VISIBLE
refresh.setOnClickListener { // rss2.visibility = View.GONE
lActivity?.doWebParseStart(jGuruMain.plus("tags"), callBack = object : CommadCallabck { // refresh.setOnClickListener {
override fun onConsoleLog(log: String) { // doWebParseStart(jGuruMain.plus("tags"), callBack = object : CommadCallabck {
this@Feeds.consoleLog(log) // override fun onConsoleLog(log: String) {
} // this@Feeds.consoleLog(log)
// }
override fun collectComplete() { //
if (listTags.size > 0) { // override fun collectComplete() {
rss2?.postDelayed({ // if (listTags.size > 0) {
mRssAdapter2?.updateData(listTags) // rss2?.postDelayed({
loading.visibility = View.GONE // mRssAdapter2?.updateData(listTags)
refresh.visibility = View.GONE // loading.visibility = View.GONE
rss2.visibility = View.VISIBLE // refresh.visibility = View.GONE
}, 500L) // rss2.visibility = View.VISIBLE
} // }, 500L)
} // }
}) // }
} // })
} // }
} // }
// }
//// }
// } // }
}
else -> { else -> {
binding.expandRss.isChecked = false binding.expandRss.isChecked = false
@ -619,171 +587,171 @@ internal class Feeds : DialogFragment() , CommadCallabck {
private fun systemInfo() { private fun systemInfo() {
viewLifecycleOwner.lifecycleScope.launch { // viewLifecycleOwner.lifecycleScope.launch {
repeatOnLifecycle(Lifecycle.State.RESUMED) { // repeatOnLifecycle(Lifecycle.State.RESUMED) {
SystemStats().apply { SystemStats().apply {
intStorage(binding.feedsSysInfos.intParent) intStorage(binding.feedsSysInfos.intParent)
extStorage(binding.feedsSysInfos.extParent) extStorage(binding.feedsSysInfos.extParent)
while (isActive) { // while (isActive) {
ram(binding.feedsSysInfos.ramParent) ram(binding.feedsSysInfos.ramParent)
cpu(binding.feedsSysInfos.cpuParent) cpu(binding.feedsSysInfos.cpuParent)
misc(binding.feedsSysInfos.misc) misc(binding.feedsSysInfos.misc)
delay(1000) // delay(1000)
} // }
}
}
} }
} }
// }
// }
private fun selectWidget() { // private fun selectWidget() {
Intent(AppWidgetManager.ACTION_APPWIDGET_PICK).apply { // Intent(AppWidgetManager.ACTION_APPWIDGET_PICK).apply {
putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetHost?.allocateAppWidgetId()) // putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetHost?.allocateAppWidgetId())
putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_INFO, ArrayList()) // putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_INFO, ArrayList())
putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_EXTRAS, ArrayList()) // putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_EXTRAS, ArrayList())
putExtra(requestCodeString, requestPickWidget) // putExtra(requestCodeString, requestPickWidget)
}.let { widgetPicker.launch(it) } // }.let { widgetPicker.launch(it) }
} // }
private val widgetPicker = // private val widgetPicker =
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result -> // registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
val data = result.data // val data = result.data
val appWidgetId = data?.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1) // val appWidgetId = data?.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1)
if (result.resultCode == RESULT_OK) { // if (result.resultCode == RESULT_OK) {
when (data?.getIntExtra(requestCodeString, requestPickWidget)) { // when (data?.getIntExtra(requestCodeString, requestPickWidget)) {
requestPickWidget -> configureWidget(appWidgetId!!) // requestPickWidget -> configureWidget(appWidgetId!!)
requestCreateWidget -> createWidget(appWidgetId!!, null) // requestCreateWidget -> createWidget(appWidgetId!!, null)
} // }
} else if (result.resultCode == RESULT_CANCELED && data != null) { // } else if (result.resultCode == RESULT_CANCELED && data != null) {
if (appWidgetId != -1) appWidgetHost?.deleteAppWidgetId(appWidgetId!!) // if (appWidgetId != -1) appWidgetHost?.deleteAppWidgetId(appWidgetId!!)
} // }
} // }
//
private fun configureWidget(appWidgetId: Int) { // private fun configureWidget(appWidgetId: Int) {
when (val appWidgetConfig = appWidgetManager!!.getAppWidgetInfo(appWidgetId).configure) { // when (val appWidgetConfig = appWidgetManager!!.getAppWidgetInfo(appWidgetId).configure) {
null -> createWidget(appWidgetId, null) // null -> createWidget(appWidgetId, null)
else -> { // else -> {
Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE).apply { // Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE).apply {
component = appWidgetConfig // component = appWidgetConfig
putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId) // putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
putExtra(requestCodeString, requestCreateWidget) // putExtra(requestCodeString, requestCreateWidget)
}.let { // }.let {
try { widgetPicker.launch(it) } // try { widgetPicker.launch(it) }
catch (e: Exception) { e.printStackTrace() } // catch (e: Exception) { e.printStackTrace() }
} // }
} // }
} // }
} // }
//
private fun createWidget(appWidgetId: Int, height: Int?) { // private fun createWidget(appWidgetId: Int, height: Int?) {
if (appWidgetId == -1) return // if (appWidgetId == -1) return
//
val appWidgetInfo = appWidgetManager!!.getAppWidgetInfo(appWidgetId) // val appWidgetInfo = appWidgetManager!!.getAppWidgetInfo(appWidgetId)
val params: ConstraintLayout.LayoutParams? // val params: ConstraintLayout.LayoutParams?
//
when (height) { // when (height) {
null -> { // null -> {
params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, appWidgetInfo.minHeight) // params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, appWidgetInfo.minHeight)
val updatedIds = splitWidgetIds.plus("$appWidgetId") // val updatedIds = splitWidgetIds.plus("$appWidgetId")
val updatedHeights = splitWidgetHeights.plus("${appWidgetInfo.minHeight}") // val updatedHeights = splitWidgetHeights.plus("${appWidgetInfo.minHeight}")
saveWidgetData(updatedIds, updatedHeights) // saveWidgetData(updatedIds, updatedHeights)
} // }
else -> params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, height) // else -> params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, height)
} // }
//
(appWidgetHost?.createView(lActivity!!.applicationContext, appWidgetId, appWidgetInfo) as WidgetHostView) // (appWidgetHost?.createView(lActivity!!.applicationContext, appWidgetId, appWidgetInfo) as WidgetHostView)
.apply { // .apply {
setAppWidget(appWidgetId, appWidgetInfo) // setAppWidget(appWidgetId, appWidgetInfo)
}.let { // }.let {
binding.widgetContainer.addView(it, params) // binding.widgetContainer.addView(it, params)
widgetMenu(it) // widgetMenu(it)
} // }
} // }
//
private fun updateWidgets() { // private fun updateWidgets() {
if (splitWidgetIds.size > 0) { // if (splitWidgetIds.size > 0) {
viewLifecycleOwner.lifecycleScope.launch { // viewLifecycleOwner.lifecycleScope.launch {
binding.widgetContainer.removeAllViews() // binding.widgetContainer.removeAllViews()
splitWidgetIds.indices.forEach { i: Int -> // splitWidgetIds.indices.forEach { i: Int ->
createWidget(splitWidgetIds[i]!!.int(), splitWidgetHeights[i]!!.int()) // createWidget(splitWidgetIds[i]!!.int(), splitWidgetHeights[i]!!.int())
} // }
} // }
} // }
} // }
//
private fun widgetMenu(hostView: WidgetHostView) { // private fun widgetMenu(hostView: WidgetHostView) {
val appWidgetId = hostView.appWidgetId // val appWidgetId = hostView.appWidgetId
hostView.setOnLongClickListener { // hostView.setOnLongClickListener {
PopupMenu(requireContext(), it, Gravity.END).apply { // PopupMenu(requireContext(), it, Gravity.END).apply {
menuInflater.inflate(R.menu.widget_menu, this.menu) // menuInflater.inflate(R.menu.widget_menu, this.menu)
show() // show()
setOnMenuItemClickListener { menuItem -> // setOnMenuItemClickListener { menuItem ->
when (menuItem.itemId) { // when (menuItem.itemId) {
R.id.move_up -> moveWidget(appWidgetId, true) // R.id.move_up -> moveWidget(appWidgetId, true)
R.id.move_down -> moveWidget(appWidgetId, false) // R.id.move_down -> moveWidget(appWidgetId, false)
R.id.increase_height -> resizeWidget(appWidgetId, true) // R.id.increase_height -> resizeWidget(appWidgetId, true)
R.id.decrease_height -> resizeWidget(appWidgetId, false) // R.id.decrease_height -> resizeWidget(appWidgetId, false)
R.id.delete_widget -> removeWidget(it as WidgetHostView) // R.id.delete_widget -> removeWidget(it as WidgetHostView)
} // }
false // false
} // }
} // }
true // true
} // }
} // }
//
private fun moveWidget(widgetId: Int, moveUp: Boolean) { // private fun moveWidget(widgetId: Int, moveUp: Boolean) {
val tempIds = splitWidgetIds // val tempIds = splitWidgetIds
val tempHeights = splitWidgetHeights // val tempHeights = splitWidgetHeights
//
splitWidgetIds.indexOf(widgetId.toString()).let { i -> // splitWidgetIds.indexOf(widgetId.toString()).let { i ->
when { // when {
moveUp && i > 0 -> { // moveUp && i > 0 -> {
tempIds.swap(i-1, i) // tempIds.swap(i-1, i)
tempHeights.swap(i-1, i) // tempHeights.swap(i-1, i)
} // }
!moveUp && i < splitWidgetIds.size - 1 -> { // !moveUp && i < splitWidgetIds.size - 1 -> {
tempIds.swap(i, i+1) // tempIds.swap(i, i+1)
tempHeights.swap(i, i+1) // tempHeights.swap(i, i+1)
} // }
else -> return // else -> return
} // }
} // }
//
saveWidgetData(tempIds, tempHeights) // saveWidgetData(tempIds, tempHeights)
updateWidgets() // updateWidgets()
} // }
//
private fun resizeWidget(widgetId: Int, shouldAdd: Boolean) { // private fun resizeWidget(widgetId: Int, shouldAdd: Boolean) {
val tempList = splitWidgetHeights // val tempList = splitWidgetHeights
//
splitWidgetIds.indexOf(widgetId.toString()).let { i -> // splitWidgetIds.indexOf(widgetId.toString()).let { i ->
tempList[i] = when (shouldAdd) { // tempList[i] = when (shouldAdd) {
true -> (splitWidgetHeights[i]!!.int().plus(50)).toString() // true -> (splitWidgetHeights[i]!!.int().plus(50)).toString()
false -> (splitWidgetHeights[i]!!.int().minus(50)).toString() // false -> (splitWidgetHeights[i]!!.int().minus(50)).toString()
} // }
} // }
//
widgetPref.edit().putString(KEY_WIDGET_HEIGHTS, tempList.joinToString(separator = SEPARATOR)).apply() // widgetPref.edit().putString(KEY_WIDGET_HEIGHTS, tempList.joinToString(separator = SEPARATOR)).apply()
updateWidgets() // updateWidgets()
} // }
//
private fun removeWidget(hostView: WidgetHostView) { // private fun removeWidget(hostView: WidgetHostView) {
hostView.let { v -> // hostView.let { v ->
appWidgetHost?.deleteAppWidgetId(v.appWidgetId) // appWidgetHost?.deleteAppWidgetId(v.appWidgetId)
binding.widgetContainer.removeView(v) // binding.widgetContainer.removeView(v)
//
splitWidgetIds.indexOf(v.appWidgetId.toString()).let { i -> // splitWidgetIds.indexOf(v.appWidgetId.toString()).let { i ->
saveWidgetData(splitWidgetIds.minus(splitWidgetIds[i]), splitWidgetHeights.minus(splitWidgetHeights[i])) // saveWidgetData(splitWidgetIds.minus(splitWidgetIds[i]), splitWidgetHeights.minus(splitWidgetHeights[i]))
} // }
} // }
} // }
//
private fun saveWidgetData(idList: List<String?>, heightList: List<String?>) { // private fun saveWidgetData(idList: List<String?>, heightList: List<String?>) {
widgetPref.edit() // widgetPref.edit()
.putString(KEY_WIDGET_IDS, idList.joinToString(separator = SEPARATOR)) // .putString(KEY_WIDGET_IDS, idList.joinToString(separator = SEPARATOR))
.putString(KEY_WIDGET_HEIGHTS, heightList.joinToString(separator = SEPARATOR)) // .putString(KEY_WIDGET_HEIGHTS, heightList.joinToString(separator = SEPARATOR))
.apply() // .apply()
} // }
private val widgetPref: SharedPreferences get() = lActivity!!.getSharedPreferences(PREFS_WIDGETS, 0) private val widgetPref: SharedPreferences get() = lActivity!!.getSharedPreferences(PREFS_WIDGETS, 0)
private val widgetIds: String? get() = widgetPref.getString(KEY_WIDGET_IDS, "") private val widgetIds: String? get() = widgetPref.getString(KEY_WIDGET_IDS, "")

View File

@ -8,10 +8,10 @@ import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import bums.lunatic.launcher.apps.DismissCalback import bums.lunatic.launcher.common.DismissCalback
import bums.lunatic.launcher.databinding.FeedsResultMenuBinding import bums.lunatic.launcher.databinding.FeedsResultMenuBinding
import bums.lunatic.launcher.model.LocationLog import bums.lunatic.launcher.model.LocationLog
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.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
@ -35,7 +35,7 @@ internal class FeedsResult : BottomSheetDialogFragment() {
WorkersDb.getRealm().query<LocationLog>().sort("time", Sort.DESCENDING).find()?.let { WorkersDb.getRealm().query<LocationLog>().sort("time", Sort.DESCENDING).find()?.let {
if (it.size > 0) { if (it.size > 0) {
binding.logs.text = it.map { binding.logs.text = it.map {
BLog.LOGE("LocLog >> ${it.toString()}") Blog.LOGE("LocLog >> ${it.toString()}")
SimpleDateFormat("yyyy/MM/dd-HH:mm:ss").format(Date(it.time)).plus("\n").plus(it.mAddressLines.joinToString(" ,\n")) SimpleDateFormat("yyyy/MM/dd-HH:mm:ss").format(Date(it.time)).plus("\n").plus(it.mAddressLines.joinToString(" ,\n"))
}.joinToString( ",\n") }.joinToString( ",\n")
} }
@ -63,13 +63,13 @@ internal class FeedsResult : BottomSheetDialogFragment() {
} }
override fun dismiss() { override fun dismiss() {
BLog.LOGE("dismiss()") Blog.LOGE("dismiss()")
mDismissCalback?.invoke() mDismissCalback?.invoke()
super.dismiss() super.dismiss()
} }
override fun onDismiss(dialog: DialogInterface) { override fun onDismiss(dialog: DialogInterface) {
BLog.LOGE("onDismiss(dialog: DialogInterface)") Blog.LOGE("onDismiss(dialog: DialogInterface)")
mDismissCalback?.invoke() mDismissCalback?.invoke()
super.onDismiss(dialog) super.onDismiss(dialog)
} }

View File

@ -10,7 +10,7 @@ import android.content.Intent
import android.content.IntentFilter import android.content.IntentFilter
import android.content.pm.PackageManager import android.content.pm.PackageManager
import androidx.core.app.ActivityCompat import androidx.core.app.ActivityCompat
import bums.lunatic.launcher.utils.BLog import bums.lunatic.launcher.utils.Blog
import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
@ -115,7 +115,7 @@ class BluetoothManager {
} }
// BLog.LOGE("sendToI telegram response isSuccessful ${body}") // BLog.LOGE("sendToI telegram response isSuccessful ${body}")
} else BLog.LOGE("sendToI telegram Error Occurred") } else Blog.LOGE("sendToI telegram Error Occurred")
} }
} }
} }

View File

@ -6,7 +6,7 @@ import android.content.Context
import android.content.Intent import android.content.Intent
import android.media.AudioManager import android.media.AudioManager
import android.view.KeyEvent import android.view.KeyEvent
import bums.lunatic.launcher.utils.BLog import bums.lunatic.launcher.utils.Blog
import java.util.Timer import java.util.Timer
import java.util.TimerTask import java.util.TimerTask
@ -18,12 +18,12 @@ class HeadsetActionButtonReceiver : BroadcastReceiver() {
} }
override fun onReceive(context: Context?, intent: Intent?) { override fun onReceive(context: Context?, intent: Intent?) {
BLog.LOGE("HeadsetActionButtonReceiver keyEvent >>>>> ${intent}") Blog.LOGE("HeadsetActionButtonReceiver keyEvent >>>>> ${intent}")
if (intent == null || delegate == null || Intent.ACTION_MEDIA_BUTTON != intent.action) return if (intent == null || delegate == null || Intent.ACTION_MEDIA_BUTTON != intent.action) return
val keyEvent = intent.extras!![Intent.EXTRA_KEY_EVENT] as KeyEvent? val keyEvent = intent.extras!![Intent.EXTRA_KEY_EVENT] as KeyEvent?
if (keyEvent == null || keyEvent.action != KeyEvent.ACTION_DOWN) return if (keyEvent == null || keyEvent.action != KeyEvent.ACTION_DOWN) return
BLog.LOGE("HeadsetActionButtonReceiver keyEvent >>>>> ${keyEvent}") Blog.LOGE("HeadsetActionButtonReceiver keyEvent >>>>> ${keyEvent}")
counter++ counter++
if (doublePressTimer != null) { if (doublePressTimer != null) {
doublePressTimer!!.cancel() doublePressTimer!!.cancel()

View File

@ -1,9 +1,11 @@
package bums.lunatic.launcher.helpers package bums.lunatic.launcher.helpers
import android.content.SharedPreferences import android.content.SharedPreferences
import bums.lunatic.launcher.model.RssDataType
import kr.lunaticbum.utils.preferences.PrefJsonConvert import kr.lunaticbum.utils.preferences.PrefJsonConvert
import kr.lunaticbum.utils.preferences.PrefKey import kr.lunaticbum.utils.preferences.PrefKey
import kr.lunaticbum.utils.preferences.PreferencesHelper import kr.lunaticbum.utils.preferences.PreferencesHelper
import java.math.BigDecimal
enum class PrefString : PrefKey<String> { enum class PrefString : PrefKey<String> {
@ -64,34 +66,45 @@ object PrefHelper : PreferencesHelper() {
PrefString.values().forEach { jsonObj.put(it.name,it.get("")) } PrefString.values().forEach { jsonObj.put(it.name,it.get("")) }
PrefBoolean.values().forEach { jsonObj.put(it.name,it.get(false)) } PrefBoolean.values().forEach { jsonObj.put(it.name,it.get(false)) }
PrefLong.values().forEach { jsonObj.put(it.name,it.get(0L)) } PrefLong.values().forEach { jsonObj.put(it.name,it.get(0L)) }
RssDataType.values().forEach { jsonObj.put(it.name,getBoolean(it.name, false)) }
return jsonObj return jsonObj
} }
override fun putSetting(json : Map<String,Any>) { override fun putSetting(json : Map<String,Any>) {
PrefString.values().forEach { if(json.containsKey(it.getKey())) { it.set(json.get(it.getKey()) as String) } } PrefString.values().forEach {
PrefBoolean.values().forEach { if(json.containsKey(it.getKey())) { it.set(json.get(it.getKey()) as Boolean) } } if (json.containsKey(it.getKey())) {
PrefLong.values().forEach { if(json.containsKey(it.getKey())) { it.set(json.get(it.getKey()) as Long) } } it.set(json.get(it.getKey()) as String)
}
}
PrefBoolean.values().forEach {
if (json.containsKey(it.getKey())) {
it.set(json.get(it.getKey()) as Boolean)
}
}
PrefLong.values().forEach {
if (json.containsKey(it.getKey())) {
it.set(BigDecimal(json.get(it.getKey()).toString()).toLong())
}
}
RssDataType.values().forEach { type ->
if (json.containsKey(type.name)) {
putBoolean(type.name,json.get(type.name) as Boolean)
}
}
} }
fun getBoolean(key: String, def: Boolean) = get(getBooleanPrefix().plus(key), def)
fun getBoolean(key : String, def :Boolean) = get(getBooleanPrefix().plus(key),def) fun putBoolean(key: String, value: Boolean) = put(getBooleanPrefix().plus(key), value)
fun putBoolean(key : String, value :Boolean) = put(getBooleanPrefix().plus(key),value) fun getLong(key: String, def: Long) = get(getLongPrefix().plus(key), def)
fun getLong(key : String, def :Long) = get(getLongPrefix().plus(key),def) fun putLong(key: String, value: Long) = put(getBooleanPrefix().plus(key), value)
fun putLong(key : String, value :Long) = put(getBooleanPrefix().plus(key),value) fun getString(key: String, def: String) = get(getStringPrefix().plus(key), def)
fun getString(key : String, def :String) = get(getStringPrefix().plus(key),def) fun putString(key: String, value: String) = put(getStringPrefix().plus(key), value)
fun putString(key : String, value :String) = put(getStringPrefix().plus(key),value)
// fun location(boolean: Boolean) = PrefBoolean.location.set(boolean) // fun location(boolean: Boolean) = PrefBoolean.location.set(boolean)
// fun isLocationOn() = (PrefBoolean.location.get() as? Boolean) ?: false // fun isLocationOn() = (PrefBoolean.location.get() as? Boolean) ?: false
}
typealias BLOCK = ()->Unit
inline fun Boolean.letTrue(block: BLOCK) {
if (this) {
block.invoke()
} else {
// elseblock.invoke()
}
} }

View File

@ -25,8 +25,6 @@ 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.graphics.Bitmap
import android.graphics.Color
import android.media.AudioManager import android.media.AudioManager
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
@ -34,7 +32,6 @@ import android.os.Handler
import android.os.Looper import android.os.Looper
import android.os.SystemClock import android.os.SystemClock
import android.provider.AlarmClock import android.provider.AlarmClock
import android.view.Gravity
import android.view.HapticFeedbackConstants import android.view.HapticFeedbackConstants
import android.view.KeyEvent import android.view.KeyEvent
import android.view.LayoutInflater import android.view.LayoutInflater
@ -42,7 +39,6 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.CheckBox import android.widget.CheckBox
import android.widget.EditText import android.widget.EditText
import android.widget.PopupWindow
import android.widget.TableRow import android.widget.TableRow
import android.widget.Toast import android.widget.Toast
import androidx.annotation.NonNull import androidx.annotation.NonNull
@ -52,26 +48,20 @@ import androidx.core.view.children
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.DividerItemDecoration import androidx.recyclerview.widget.DividerItemDecoration
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.LinearLayoutManager
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.R import bums.lunatic.launcher.R
import bums.lunatic.launcher.behavior.Behavior import bums.lunatic.launcher.behavior.Behavior
import bums.lunatic.launcher.common.letTrue
import bums.lunatic.launcher.databinding.LauncherHomeBinding import bums.lunatic.launcher.databinding.LauncherHomeBinding
import bums.lunatic.launcher.feeds.Feeds
import bums.lunatic.launcher.helpers.Constants.Companion.BOTTOM_SHEET_TAG 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.Constants.Companion.KEY_LOCK_METHOD
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_TODO_LOCK
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.UniUtils.Companion.biometricPromptInfo
import bums.lunatic.launcher.helpers.UniUtils.Companion.canAuthenticate
import bums.lunatic.launcher.helpers.UniUtils.Companion.expandNotificationPanel import bums.lunatic.launcher.helpers.UniUtils.Companion.expandNotificationPanel
import bums.lunatic.launcher.helpers.UniUtils.Companion.lockMethod import bums.lunatic.launcher.helpers.UniUtils.Companion.lockMethod
import bums.lunatic.launcher.helpers.letTrue
import bums.lunatic.launcher.home.adapters.NotificationItemAdapter import bums.lunatic.launcher.home.adapters.NotificationItemAdapter
import bums.lunatic.launcher.home.adapters.RecentCallsAdapter import bums.lunatic.launcher.home.adapters.RecentCallsAdapter
import bums.lunatic.launcher.home.adapters.RssItemAdapter import bums.lunatic.launcher.home.adapters.RssItemAdapter
@ -90,9 +80,8 @@ import bums.lunatic.launcher.model.WeatherForcast
import bums.lunatic.launcher.model.WeatherInfoManager import bums.lunatic.launcher.model.WeatherInfoManager
import bums.lunatic.launcher.qaccess.QuickAccess import bums.lunatic.launcher.qaccess.QuickAccess
import bums.lunatic.launcher.settings.SettingsActivity 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.JamoUtils
import bums.lunatic.launcher.utils.SimpleFingerGestures import bums.lunatic.launcher.utils.SimpleFingerGestures
import bums.lunatic.launcher.utils.beforeDay import bums.lunatic.launcher.utils.beforeDay
import bums.lunatic.launcher.view.TableRadioGroup import bums.lunatic.launcher.view.TableRadioGroup
@ -102,7 +91,6 @@ import bums.lunatic.launcher.workers.RecentSms
import bums.lunatic.launcher.workers.WorkersDb import bums.lunatic.launcher.workers.WorkersDb
import bums.lunatic.launcher.workers.latitudeRange import bums.lunatic.launcher.workers.latitudeRange
import bums.lunatic.launcher.workers.longitudeRange import bums.lunatic.launcher.workers.longitudeRange
import com.google.android.material.snackbar.Snackbar
import io.realm.kotlin.UpdatePolicy import io.realm.kotlin.UpdatePolicy
import io.realm.kotlin.ext.query import io.realm.kotlin.ext.query
import io.realm.kotlin.notifications.InitialResults import io.realm.kotlin.notifications.InitialResults
@ -114,8 +102,6 @@ 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.Job import kotlinx.coroutines.Job
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.cancellable
import kotlinx.coroutines.launch import kotlinx.coroutines.launch
import org.json.JSONArray import org.json.JSONArray
import org.json.JSONObject import org.json.JSONObject
@ -124,8 +110,6 @@ import java.math.RoundingMode
import java.net.URLEncoder import java.net.URLEncoder
import java.util.Calendar import java.util.Calendar
import java.util.Date import java.util.Date
import java.util.Locale
import java.util.regex.Pattern
internal class LauncherHome : Fragment() { internal class LauncherHome : Fragment() {
@ -376,7 +360,7 @@ internal class LauncherHome : Fragment() {
lonR.first(), lonR.last(), lonR.first(), lonR.last(),
(System.currentTimeMillis() / 1000L).toLong() (System.currentTimeMillis() / 1000L).toLong()
).also { ).also {
BLog.LOGE("re >>> ${it.description()}") Blog.LOGE("re >>> ${it.description()}")
}.find().let { hours -> }.find().let { hours ->
Handler(Looper.getMainLooper()).post { Handler(Looper.getMainLooper()).post {
weatherDressAdapter?.let { weatherDressAdapter?.let {
@ -399,7 +383,7 @@ internal class LauncherHome : Fragment() {
) )
} }
) )
BLog.LOGE("hour ${hours}") Blog.LOGE("hour ${hours}")
it.notifyDataSetChanged() it.notifyDataSetChanged()
} }
mWeatherAdapter?.let { mWeatherAdapter?.let {
@ -417,14 +401,14 @@ internal class LauncherHome : Fragment() {
// @SuppressLint("NotifyDataSetChanged") // @SuppressLint("NotifyDataSetChanged")
private fun queryWeather() { private fun queryWeather() {
result = WorkersDb.getRealm().query<WeatherForcast>().also { result = WorkersDb.getRealm().query<WeatherForcast>().also {
BLog.LOGE("re >>> ${it.description()}") // 쿼리 로그 Blog.LOGE("re >>> ${it.description()}") // 쿼리 로그
}.find() }.find()
weatherJob?.cancel() weatherJob?.cancel()
weatherJob = CoroutineScope(Dispatchers.Default).launch { weatherJob = CoroutineScope(Dispatchers.Default).launch {
result?.asFlow()?.collect { li -> result?.asFlow()?.collect { li ->
BLog.LOGE("queryWeather done. >>> ${li}") //Blog.LOGE("queryWeather done. >>> ${li}")
if (li.list.size > 0) { if (li.list.size > 0) {
BLog.LOGE("queryWeather done. >>> ${li.list.size}") //Blog.LOGE("queryWeather done. >>> ${li.list.size}")
queryWeatherWithLoc() queryWeatherWithLoc()
} }
} }
@ -561,7 +545,7 @@ internal class LauncherHome : Fragment() {
binding.functionLayer.setOnTouchListener(SimpleFingerGestures(context = requireContext(), binding.functionLayer, mFingerGestureListener)) binding.functionLayer.setOnTouchListener(SimpleFingerGestures(context = requireContext(), binding.functionLayer, mFingerGestureListener))
binding.time.setOnTouchListener(SimpleFingerGestures(context = requireContext(), binding.time, mFingerGestureListener)) binding.time.setOnTouchListener(SimpleFingerGestures(context = requireContext(), binding.time, mFingerGestureListener))
BLog.LOGE("onViewCreated()") Blog.LOGE("onViewCreated()")
binding.summaryChoose.visibility = View.GONE binding.summaryChoose.visibility = View.GONE
(PrefBoolean.showCallHistory.get(false) || PrefBoolean.showSMSHistory.get(false) || PrefBoolean.showNotificationHistory.get(false) || PrefBoolean.showNewsHistory.get(false)).letTrue { (PrefBoolean.showCallHistory.get(false) || PrefBoolean.showSMSHistory.get(false) || PrefBoolean.showNotificationHistory.get(false) || PrefBoolean.showNewsHistory.get(false)).letTrue {
@ -573,7 +557,7 @@ internal class LauncherHome : Fragment() {
} }
fragManager.addOnBackStackChangedListener { fragManager.addOnBackStackChangedListener {
BLog.LOGE("addOnBackStackChangedListener()") Blog.LOGE("addOnBackStackChangedListener()")
shouldResume = if (fragManager.backStackEntryCount == 0) { shouldResume = if (fragManager.backStackEntryCount == 0) {
binding.root.visibility = View.VISIBLE binding.root.visibility = View.VISIBLE
true true
@ -795,7 +779,7 @@ internal class LauncherHome : Fragment() {
val swipeToDeleteCallback: SwipeToDeleteCallback = val swipeToDeleteCallback: SwipeToDeleteCallback =
object : SwipeToDeleteCallback(requireContext()) { object : SwipeToDeleteCallback(requireContext()) {
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 ->
WorkersDb.getRealm().apply { WorkersDb.getRealm().apply {
writeBlocking { writeBlocking {
@ -960,7 +944,7 @@ internal class LauncherHome : Fragment() {
// startActivity(mClockIntent) // startActivity(mClockIntent)
// } // }
BLog.LOGE("onSwipeLeft targetView. >>>> ${targetView} && ${targetView.equals(binding.functionLayer)}") Blog.LOGE("onSwipeLeft targetView. >>>> ${targetView} && ${targetView.equals(binding.functionLayer)}")
if(targetView.equals(binding.functionLayer)){ if(targetView.equals(binding.functionLayer)){
targetView?.performHapticFeedback(HapticFeedbackConstants.CONFIRM) targetView?.performHapticFeedback(HapticFeedbackConstants.CONFIRM)
when(fingers) { when(fingers) {
@ -991,7 +975,7 @@ internal class LauncherHome : Fragment() {
lActivity?.switchFeeds() lActivity?.switchFeeds()
return true return true
} }
// //
else ->{} else ->{}
} }
} else if (targetView.equals(binding.time) && fingers == 2) { } else if (targetView.equals(binding.time) && fingers == 2) {
@ -1008,7 +992,7 @@ internal class LauncherHome : Fragment() {
gestureDuration: Long, gestureDuration: Long,
gestureDistance: Double gestureDistance: Double
): Boolean { ): Boolean {
BLog.LOGE("Maybe GA PINCH is Like Zoom out") Blog.LOGE("Maybe GA PINCH is Like Zoom out")
return false return false
} }
@ -1018,7 +1002,7 @@ internal class LauncherHome : Fragment() {
gestureDuration: Long, gestureDuration: Long,
gestureDistance: Double gestureDistance: Double
): Boolean { ): Boolean {
BLog.LOGE("Maybe GA UN PINCH is Like Zoom In") Blog.LOGE("Maybe GA UN PINCH is Like Zoom In")
return false return false
} }
@ -1121,15 +1105,15 @@ internal class LauncherHome : Fragment() {
fun jsonObjLog(pkey: String, key: String, jsonObject: JSONObject) { fun jsonObjLog(pkey: String, key: String, jsonObject: JSONObject) {
if (jsonObject.has(key) == true && jsonObject.get(key) is String) { if (jsonObject.has(key) == true && jsonObject.get(key) is String) {
BLog.LOGE("jsonObjLog $pkey String in $key >> ${jsonObject.getString(key)}") Blog.LOGE("jsonObjLog $pkey String in $key >> ${jsonObject.getString(key)}")
} else if (jsonObject.has(key) == true && jsonObject.get(key) is JSONObject) { } else if (jsonObject.has(key) == true && jsonObject.get(key) is JSONObject) {
var obj = jsonObject.getJSONObject(key) var obj = jsonObject.getJSONObject(key)
BLog.LOGE("jsonObjLog $pkey JSONObject in $key >> ${obj}") Blog.LOGE("jsonObjLog $pkey JSONObject in $key >> ${obj}")
obj?.keys()?.forEach { obj?.keys()?.forEach {
// jsonObjLog(key,it, obj) // jsonObjLog(key,it, obj)
} }
} else if (jsonObject.has(key) == true && jsonObject.get(key) is JSONArray) { } else if (jsonObject.has(key) == true && jsonObject.get(key) is JSONArray) {
BLog.LOGE("jsonObjLog $pkey JSONArray in $key >> ${jsonObject.getJSONArray(key)}") Blog.LOGE("jsonObjLog $pkey JSONArray in $key >> ${jsonObject.getJSONArray(key)}")
var array = jsonObject.getJSONArray(key) var array = jsonObject.getJSONArray(key)
for (i in 0..<(array?.length() ?: 0)) { for (i in 0..<(array?.length() ?: 0)) {
if (array?.get(i) is String) { if (array?.get(i) is String) {
@ -1140,11 +1124,11 @@ internal class LauncherHome : Fragment() {
// jsonObjLog(key, it, child) // jsonObjLog(key, it, child)
} }
} else if (array?.get(i) is JSONArray) { } else if (array?.get(i) is JSONArray) {
BLog.LOGE("jsonObjLog $pkey JSONArray in $key >> ${array.getJSONArray(i)}") Blog.LOGE("jsonObjLog $pkey JSONArray in $key >> ${array.getJSONArray(i)}")
} }
} }
} else { } else {
BLog.LOGE( Blog.LOGE(
"jsonObjLog $pkey else in $key >> ${ "jsonObjLog $pkey else in $key >> ${
if (jsonObject.has(key) == true) (jsonObject.get( if (jsonObject.has(key) == true) (jsonObject.get(
key key

View File

@ -18,26 +18,14 @@
package bums.lunatic.launcher.home package bums.lunatic.launcher.home
import android.content.Intent
import android.content.pm.PackageManager import android.content.pm.PackageManager
import android.os.Bundle import android.os.Bundle
import android.os.Environment
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.widget.Toast
import androidx.core.content.FileProvider
import androidx.core.net.toUri
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.RssViewerBinding import bums.lunatic.launcher.databinding.RssViewerBinding
import bums.lunatic.launcher.utils.BLog
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import java.io.File
import java.io.IOException
internal class RssViewer : DialogFragment() { internal class RssViewer : DialogFragment() {

View File

@ -0,0 +1,212 @@
package bums.lunatic.launcher.home
import android.app.Activity
import android.content.Context
import android.content.Intent
import android.view.MotionEvent
import android.widget.Toast
import androidx.core.net.toUri
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.model.RssData
import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.workers.WorkersDb
import io.realm.kotlin.UpdatePolicy
import io.realm.kotlin.ext.query
import kr.lunaticbum.awesomewebview.AwesomeWebView
import kr.lunaticbum.awesomewebview.AwesomeWebView.Builder
import kr.lunaticbum.awesomewebview.AwesomeWebViewActivity
import kr.lunaticbum.awesomewebview.listeners.BroadCastManager
import kr.lunaticbum.awesomewebview.objects.CustomMenu
import kr.lunaticbum.utils.content.ContextUtil
import kr.lunaticbum.utils.log.LogUtil
class RssViewBuilder(context: Context) : AwesomeWebView.Builder(context) {
var rssId : String = ""
var rssList: MutableList<String> = ArrayList()
fun setRssId(rssId: String): RssViewBuilder {
this.rssId = rssId
return this
}
fun setRssList(rssList: ArrayList<String>): RssViewBuilder {
this.rssList.clear()
this.rssList.addAll(rssList)
return this
}
override fun show(url: String?, data: String?) {
this.url = url
this.data = data
this.key = System.identityHashCode(this)
if (!listeners.isEmpty()) BroadCastManager(context, key!!, listeners)
val intent = Intent(
context,
RssViewerActivity::class.java
)
intent.putExtra("builder", this)
ContextUtil.startActivity(intent)
}
}
class RssViewerActivity : AwesomeWebViewActivity() {
var actionButtonPressX = 0f
var actionButtonPressY = 0f
var rssId : String = ""
var currentIdx = 0
var double = false
var rssList: MutableList<String> = ArrayList()
override fun dispatchGenericMotionEvent(ev: MotionEvent?): Boolean {
if (ev?.device?.name?.contains("BLE-M3") == true) {
Blog.LOGE("keyEvent >>>>> dispatchGenericMotionEvent ${ev}")
ev?.action?.let { action ->
when(action) {
MotionEvent.ACTION_HOVER_ENTER -> {
return false
}
MotionEvent.ACTION_HOVER_MOVE ->{
Blog.LOGE("ACTION_HOVER_MOVE Click")
return false
}
MotionEvent.ACTION_BUTTON_PRESS -> {
if (actionButtonPressX * actionButtonPressY == 0f) {
actionButtonPressX = ev.x ?: 0f
actionButtonPressY = ev.y ?: 0f
}
return false
}
MotionEvent.ACTION_BUTTON_RELEASE -> {
if (actionButtonPressX == ev.x && actionButtonPressY == ev.y) {
Blog.LOGE("Arrow Center Click")
if(actionButtonPressX.toInt() == 480 && actionButtonPressY < 2000) {
Blog.LOGE("Arrow Center Click")
WorkersDb.getRealm().apply {
writeBlocking {
val result = query<RssData>().query("originPage == $0", rssId).find()
if(result.size == 1) {
result.first().vote = true
}
}
}
} else if(ev.y > 2000) {
WorkersDb.getRealm().apply {
writeBlocking {
val result = query<RssData>().query("originPage == $0", rssId).find()
if(result.size == 1) {
result.first().read = 5
}
}
}
}
registCancelSearch()
double = false
} else if (actionButtonPressY == ev.y) {
if (actionButtonPressX.minus(ev.x ?: 0f) > 0f) {
Blog.LOGE("Arrow Right Click")
if (currentIdx < rssList.size - 1) {
currentIdx += 1
rssId = rssList.get(currentIdx)
Blog.LOGE("Arrow Right Click ${currentIdx} ${rssId}")
load(rssId)
registCancelSearch()
} else {
Toast.makeText(this, "없어 끄자", Toast.LENGTH_LONG).show()
fast()
}
} else {
if (currentIdx > 0) {
currentIdx -= 1
rssId = rssList.get(currentIdx)
Blog.LOGE("Arrow Left Click ${currentIdx} ${rssId}")
load(rssId)
registCancelSearch()
} else {
Toast.makeText(this, "없어 끄자", Toast.LENGTH_LONG).show()
fast()
}
Blog.LOGE("Arrow Left Click")
}
double = false
} else {
if (webView?.scrollY ?: 0 < 10 && actionButtonPressY.minus(ev.y ?: 0f) > 0f == false) {
if(double){
Blog.LOGE("make no show")
WorkersDb.getRealm().apply {
writeBlocking {
val result =
query<RssData>().query("originPage == $0", rssId)
.find()
if (result.size == 1) {
result.first().read = 5
}
}
}
if (currentIdx < rssList.size - 1) {
currentIdx += 1
rssId = rssList.get(currentIdx)
Blog.LOGE("Arrow Right Click ${currentIdx} ${rssId}")
load(rssId)
registCancelSearch()
} else if (currentIdx > 0) {
currentIdx -= 1
rssId = rssList.get(currentIdx)
Blog.LOGE("Arrow Left Click ${currentIdx} ${rssId}")
load(rssId)
registCancelSearch()
} else {
finish()
}
}
double = true
} else {
double = false
val unit = ((webView?.height ?: 0) * 0.4).toInt()
if (actionButtonPressY.minus(ev.y ?: 0f) > 0f) {
Blog.LOGE("Arrow Down Click")
registCancelSearch()
webView?.scrollTo(webView?.scrollX?: 0,(webView?.scrollY?: 0) + unit)
} else {
webView?.scrollTo(webView?.scrollX?: 0,(webView?.scrollY?: 0) - unit)
Blog.LOGE("Arrow Up Click")
registCancelSearch()
}
}
}
return false
}
MotionEvent.ACTION_HOVER_EXIT ->{
actionButtonPressX = 0f
actionButtonPressY = 0f
return false
}
else -> {return false}
}
}
}
return super.dispatchGenericMotionEvent(ev)
}
protected fun load(newUrl: String) {
if (extraHeaders == null) {
webView!!.loadUrl(newUrl!!)
} else {
webView!!.loadUrl(newUrl!!, extraHeaders!!)
}
double = false
}
override fun initializeOptions() {
super.initializeOptions()
val intent = intent ?: return
val builder = intent.getSerializableExtra("builder") as RssViewBuilder?
this.rssId = builder?.rssId ?: ""
this.rssList.clear()
builder?.rssList?.let { this.rssList.addAll(it) }
Blog.LOGE("this.rssList >>>> ${this.rssList}")
this.rssList.forEachIndexed { index, s ->
if (s.equals(rssId)) {
currentIdx = index
return@forEachIndexed}
}
}
}

View File

@ -4,7 +4,6 @@ import android.util.Xml
import bums.lunatic.launcher.model.NewsData import bums.lunatic.launcher.model.NewsData
import bums.lunatic.launcher.model.RssDataInterface import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.others.Reddit import bums.lunatic.launcher.model.others.Reddit
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.utils.beforeDay import bums.lunatic.launcher.utils.beforeDay
import com.google.gson.Gson import com.google.gson.Gson
import org.xmlpull.v1.XmlPullParser import org.xmlpull.v1.XmlPullParser

View File

@ -31,7 +31,7 @@ import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.ListItemWithBinding import bums.lunatic.launcher.databinding.ListItemWithBinding
import bums.lunatic.launcher.home.RssViewer import bums.lunatic.launcher.home.RssViewBuilder
import bums.lunatic.launcher.model.RssData import bums.lunatic.launcher.model.RssData
import bums.lunatic.launcher.model.RssDataInterface import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.RssDataType
@ -39,15 +39,16 @@ import bums.lunatic.launcher.openClient
import bums.lunatic.launcher.openDotax import bums.lunatic.launcher.openDotax
import bums.lunatic.launcher.openReddit import bums.lunatic.launcher.openReddit
import bums.lunatic.launcher.openYouTube import bums.lunatic.launcher.openYouTube
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.workers.WorkersDb import bums.lunatic.launcher.workers.WorkersDb
import com.google.android.material.imageview.ShapeableImageView import com.google.android.material.imageview.ShapeableImageView
import com.google.gson.Gson
import com.squareup.picasso.Picasso import com.squareup.picasso.Picasso
import kr.lunaticbum.awesomewebview.AwesomeWebView import kr.lunaticbum.awesomewebview.AwesomeWebView
import io.realm.kotlin.UpdatePolicy import io.realm.kotlin.UpdatePolicy
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.launch
import kr.lunaticbum.awesomewebview.listeners.WebViewListener import kr.lunaticbum.awesomewebview.listeners.WebViewListener
import kr.lunaticbum.awesomewebview.objects.CustomMenu
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
import java.util.Date import java.util.Date
@ -58,6 +59,7 @@ internal class RssItemAdapter (
@SuppressLint("SimpleDateFormat") @SuppressLint("SimpleDateFormat")
val dateFormat = SimpleDateFormat("a HH:mm / yy - MM - dd") val dateFormat = SimpleDateFormat("a HH:mm / yy - MM - dd")
val emptyDate = " - " val emptyDate = " - "
var rssList: ArrayList<String> = ArrayList()
val webViewListener = object : WebViewListener() { val webViewListener = object : WebViewListener() {
override fun onCustomMenuClick(menuCode: String?) { override fun onCustomMenuClick(menuCode: String?) {
super.onCustomMenuClick(menuCode) super.onCustomMenuClick(menuCode)
@ -89,16 +91,11 @@ internal class RssItemAdapter (
if (RssDataType.REDDIT_NSFW.equals(rss.category())) { if (RssDataType.REDDIT_NSFW.equals(rss.category())) {
openReddit(rss.originPage()) openReddit(rss.originPage())
} else { } else {
// RssViewer().apply { RssViewBuilder(lActivity!!)
// show(lActivity!!.supportFragmentManager,rss.originPage) .setRssList(rssList)
// } .setRssId(rss.originPage())
AwesomeWebView.Builder(lActivity!!)
// .setWebViewListener(webViewListener).addCustomMenu(
// CustomMenu("PDF 저장","PDF")
// ).
.showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1) .showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1)
.show(rss.originPage!!) .show(rss.originPage!!)
// openOpera(rss.originPage())
} }
} }
} }
@ -107,7 +104,11 @@ internal class RssItemAdapter (
openReddit(rss.originPage()) openReddit(rss.originPage())
} }
RssDataType.DOTAX -> { RssDataType.DOTAX -> {
openDotax(rss.originPage()) RssViewBuilder(lActivity!!)
.setRssList(rssList)
.setRssId(rss.originPage())
.showIconClose(true).showIconBack(false).showProgressBar(true).webViewMixedContentMode(0)
.show(rss.originPage!!)
} }
RssDataType.YOUTUBE -> { openYouTube(rss.originPage()) RssDataType.YOUTUBE -> { openYouTube(rss.originPage())
} }
@ -115,7 +116,9 @@ internal class RssItemAdapter (
openClient(rss.originPage()) openClient(rss.originPage())
} }
else -> { else -> {
AwesomeWebView.Builder(lActivity!!) RssViewBuilder(lActivity!!)
.setRssList(rssList)
.setRssId(rss.originPage())
.showIconClose(true).showIconBack(false).showProgressBar(true).webViewMixedContentMode(0) .showIconClose(true).showIconBack(false).showProgressBar(true).webViewMixedContentMode(0)
.show(rss.originPage!!) .show(rss.originPage!!)
} }
@ -208,7 +211,10 @@ internal class RssItemAdapter (
} }
rssDataItemLis.clear() rssDataItemLis.clear()
rssDataItemLis.addAll(newList) rssDataItemLis.addAll(newList)
// BLog.LOGE("rssDataItemLis >> ${rssDataItemLis}") CoroutineScope(Dispatchers.IO).launch {
rssList.clear()
rssList.addAll(newList.map { it.originPage() })
}
} catch (e: Exception) { } catch (e: Exception) {
e.printStackTrace() e.printStackTrace()
} }

View File

@ -13,7 +13,6 @@ import androidx.annotation.NonNull
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.utils.BLog
abstract class SwipeToDeleteCallback internal constructor(context: Context) : abstract class SwipeToDeleteCallback internal constructor(context: Context) :

View File

@ -8,7 +8,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearSnapHelper import androidx.recyclerview.widget.LinearSnapHelper
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.databinding.WeatherBookBinding import bums.lunatic.launcher.databinding.WeatherBookBinding
import bums.lunatic.launcher.utils.BLog import bums.lunatic.launcher.utils.Blog
class WeatherAdapter( class WeatherAdapter(
private val pages: List<Int>, private val pages: List<Int>,
@ -36,10 +36,10 @@ class WeatherAdapter(
fun syncScroll(newPosition: Int) { fun syncScroll(newPosition: Int) {
childs[newPosition].let {recyclerView -> childs[newPosition].let {recyclerView ->
BLog.LOGE("recyclerView >>> ${recyclerView} 1 ") Blog.LOGE("recyclerView >>> ${recyclerView} 1 ")
if (!isSyncingScroll) { if (!isSyncingScroll) {
isSyncingScroll = true isSyncingScroll = true
BLog.LOGE("recyclerView >>> ${recyclerView} 2 ") Blog.LOGE("recyclerView >>> ${recyclerView} 2 ")
childs.forEach { c -> childs.forEach { c ->
// val visibleItemCount = (layoutManager?.findLastVisibleItemPosition() ?: 0) - (layoutManager?.findFirstVisibleItemPosition() ?: 0) // val visibleItemCount = (layoutManager?.findLastVisibleItemPosition() ?: 0) - (layoutManager?.findFirstVisibleItemPosition() ?: 0)
if (c != recyclerView) { if (c != recyclerView) {
@ -51,11 +51,11 @@ class WeatherAdapter(
// .scrollToPosition(it) // .scrollToPosition(it)
} }
} }
BLog.LOGE("recyclerView >>> ${recyclerView} 3 ") Blog.LOGE("recyclerView >>> ${recyclerView} 3 ")
} }
} }
isSyncingScroll = false isSyncingScroll = false
BLog.LOGE("recyclerView >>> ${recyclerView} 4 ") Blog.LOGE("recyclerView >>> ${recyclerView} 4 ")
} }
} }

View File

@ -9,7 +9,6 @@ import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.databinding.ItemRecHourlyDressBinding import bums.lunatic.launcher.databinding.ItemRecHourlyDressBinding
import bums.lunatic.launcher.model.Hour import bums.lunatic.launcher.model.Hour
import bums.lunatic.launcher.model.WeatherInfoManager import bums.lunatic.launcher.model.WeatherInfoManager
import bums.lunatic.launcher.utils.BLog
import java.util.Calendar import java.util.Calendar
class WeatherDressAdatper (private val dataSet: ArrayList<Hour>) : RecyclerView.Adapter<WeatherDressAdatper.ViewHolder>(){ class WeatherDressAdatper (private val dataSet: ArrayList<Hour>) : RecyclerView.Adapter<WeatherDressAdatper.ViewHolder>(){

View File

@ -2,13 +2,12 @@ package bums.lunatic.launcher.home.adapters
import android.graphics.Color import android.graphics.Color
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.databinding.ItemHourlyWeatherBinding import bums.lunatic.launcher.databinding.ItemHourlyWeatherBinding
import bums.lunatic.launcher.model.Hour import bums.lunatic.launcher.model.Hour
import bums.lunatic.launcher.model.WeatherInfoManager import bums.lunatic.launcher.model.WeatherInfoManager
import bums.lunatic.launcher.utils.BLog import bums.lunatic.launcher.utils.Blog
import com.squareup.picasso.Picasso import com.squareup.picasso.Picasso
class WeatherHourlyAdapter(private val dataSet: ArrayList<Hour>): RecyclerView.Adapter<WeatherHourlyAdapter.ViewHolder>() { class WeatherHourlyAdapter(private val dataSet: ArrayList<Hour>): RecyclerView.Adapter<WeatherHourlyAdapter.ViewHolder>() {
@ -49,7 +48,7 @@ class WeatherHourlyAdapter(private val dataSet: ArrayList<Hour>): RecyclerView.A
override fun getItemCount(): Int = dataSet.size override fun getItemCount(): Int = dataSet.size
fun update(li: Collection<Hour>) { fun update(li: Collection<Hour>) {
BLog.LOGE("${this.javaClass.simpleName} update") Blog.LOGE("${this.javaClass.simpleName} update")
li.toList() li.toList()
this.dataSet.clear() this.dataSet.clear()
this.dataSet.addAll(li) this.dataSet.addAll(li)

View File

@ -16,4 +16,5 @@ class AppInfo : RealmObject {
var clickCount : Int = 0 var clickCount : Int = 0
var lastUseDate : Long = 0L var lastUseDate : Long = 0L
var category : String? = null var category : String? = null
var currentInstalled : Boolean = false
} }

View File

@ -1,7 +1,7 @@
package bums.lunatic.launcher.model package bums.lunatic.launcher.model
import bums.lunatic.launcher.R import bums.lunatic.launcher.R
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 io.realm.kotlin.ext.query import io.realm.kotlin.ext.query
import io.realm.kotlin.types.RealmList import io.realm.kotlin.types.RealmList
@ -124,7 +124,7 @@ object WeatherInfoManager {
private fun getLocation(): Location? { private fun getLocation(): Location? {
return if (info?.location == null) { return if (info?.location == null) {
WorkersDb.getRealm().query<Location>().also { WorkersDb.getRealm().query<Location>().also {
BLog.LOGE("re >>> ${it.description()}") // 쿼리 로그 Blog.LOGE("re >>> ${it.description()}") // 쿼리 로그
}.find().first() }.find().first()
} else { } else {
info?.location info?.location

View File

@ -60,8 +60,7 @@ import bums.lunatic.launcher.helpers.Constants.Companion.SEPARATOR
import bums.lunatic.launcher.helpers.Constants.Companion.SHORTCUT_TYPE_PHONE import bums.lunatic.launcher.helpers.Constants.Companion.SHORTCUT_TYPE_PHONE
import bums.lunatic.launcher.helpers.Constants.Companion.SHORTCUT_TYPE_URL import bums.lunatic.launcher.helpers.Constants.Companion.SHORTCUT_TYPE_URL
import bums.lunatic.launcher.model.AppInfo import bums.lunatic.launcher.model.AppInfo
import bums.lunatic.launcher.settings.childs.Apps 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.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
@ -71,8 +70,6 @@ import com.google.android.material.slider.Slider
import com.google.android.material.textview.MaterialTextView import com.google.android.material.textview.MaterialTextView
import io.realm.kotlin.ext.query import io.realm.kotlin.ext.query
import io.realm.kotlin.query.RealmResults import io.realm.kotlin.query.RealmResults
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Objects import java.util.Objects
import kotlin.properties.Delegates import kotlin.properties.Delegates
@ -249,7 +246,7 @@ internal class QuickAccess : BottomSheetDialogFragment() {
/* type is url */ /* type is url */
if (shortcutType == SHORTCUT_TYPE_URL) { if (shortcutType == SHORTCUT_TYPE_URL) {
var url = intentString var url = intentString
BLog.LOGE("intentString >>>> ${intentString}") Blog.LOGE("intentString >>>> ${intentString}")
/* add http before the url if it doesn't have http/https prefix */ /* add http before the url if it doesn't have http/https prefix */
if (!url.startsWith("http")) { if (!url.startsWith("http")) {
// url = "http://$intentString" // url = "http://$intentString"
@ -284,14 +281,14 @@ internal class QuickAccess : BottomSheetDialogFragment() {
/* make phone call */ /* make phone call */
WorkersDb.getRealm().writeBlocking { WorkersDb.getRealm().writeBlocking {
BLog.LOGE(">>>> ${query<SimpleContact>().query("phoneNumber CONTAINS $0", intentString).description()}") Blog.LOGE(">>>> ${query<SimpleContact>().query("phoneNumber CONTAINS $0", intentString).description()}")
var result : RealmResults<SimpleContact>? = null var result : RealmResults<SimpleContact>? = null
if (intentString.startsWith("0")) { if (intentString.startsWith("0")) {
result = query<SimpleContact>().query("phoneNumber CONTAINS $0 or phoneNumber CONTAINS $1", intentString, intentString.removeRange(0,1)).find() result = query<SimpleContact>().query("phoneNumber CONTAINS $0 or phoneNumber CONTAINS $1", intentString, intentString.removeRange(0,1)).find()
} else { } else {
result = query<SimpleContact>().query("phoneNumber CONTAINS $0", intentString).find() result = query<SimpleContact>().query("phoneNumber CONTAINS $0", intentString).find()
} }
BLog.LOGE(">>>> ${result.size}") Blog.LOGE(">>>> ${result.size}")
if(result.size > 0){ if(result.size > 0){
result.forEach { result.forEach {
it.touchCount = 1 + it.touchCount it.touchCount = 1 + it.touchCount

View File

@ -1,12 +1,10 @@
package bums.lunatic.launcher.receiver package bums.lunatic.launcher.receiver
import android.annotation.SuppressLint
import android.content.BroadcastReceiver import android.content.BroadcastReceiver
import android.content.ComponentName import android.content.ComponentName
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.IntentFilter import android.content.IntentFilter
import android.location.Location
import android.media.MediaMetadata import android.media.MediaMetadata
import android.media.session.MediaSessionManager import android.media.session.MediaSessionManager
import android.os.Build import android.os.Build
@ -16,12 +14,9 @@ import androidx.annotation.RequiresApi
import androidx.core.content.getSystemService import androidx.core.content.getSystemService
import bums.lunatic.launcher.model.CurrentPlayItem import bums.lunatic.launcher.model.CurrentPlayItem
import bums.lunatic.launcher.model.NotificationItem import bums.lunatic.launcher.model.NotificationItem
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.workers.WorkersDb import bums.lunatic.launcher.workers.WorkersDb
import com.google.android.gms.location.FusedLocationProviderClient
import com.google.android.gms.location.LocationServices
import com.google.android.gms.tasks.OnSuccessListener
import io.realm.kotlin.UpdatePolicy import io.realm.kotlin.UpdatePolicy
import io.realm.kotlin.ext.query import io.realm.kotlin.ext.query
@ -115,7 +110,7 @@ class NLService : NotificationListenerService() {
} else { } else {
current.albumArt = "" current.albumArt = ""
} }
BLog.LOGE( Blog.LOGE(
"Sessions", "Sessions",
"$session -- " + (session?.metadata?.getString(MediaMetadata.METADATA_KEY_TITLE)) "$session -- " + (session?.metadata?.getString(MediaMetadata.METADATA_KEY_TITLE))
) )

View File

@ -6,7 +6,7 @@ import android.content.Intent
import androidx.work.OneTimeWorkRequest import androidx.work.OneTimeWorkRequest
import androidx.work.WorkManager import androidx.work.WorkManager
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.workers.AppInfoGetter import bums.lunatic.launcher.workers.AppInfoGetter
import bums.lunatic.launcher.workers.WorkersDb import bums.lunatic.launcher.workers.WorkersDb
import io.realm.kotlin.ext.query import io.realm.kotlin.ext.query
@ -19,7 +19,7 @@ class PackageEventReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) { override fun onReceive(context: Context, intent: Intent) {
val action = intent.action val action = intent.action
BLog.LOGE("action >>>> ${action}") Blog.LOGE("action >>>> ${action}")
when(action) { when(action) {
Intent.ACTION_PACKAGE_ADDED,Intent.ACTION_PACKAGE_INSTALL -> { Intent.ACTION_PACKAGE_ADDED,Intent.ACTION_PACKAGE_INSTALL -> {
startAppInfoGetter(context) startAppInfoGetter(context)
@ -30,7 +30,7 @@ class PackageEventReceiver : BroadcastReceiver() {
WorkersDb.getRealm().writeBlocking { WorkersDb.getRealm().writeBlocking {
val result = query<AppInfo>("pkgName == $0", packageName).find() val result = query<AppInfo>("pkgName == $0", packageName).find()
if (result.size == 1) { if (result.size == 1) {
delete(result) result.first().currentInstalled = false
} }
} }
} }

View File

@ -22,15 +22,18 @@ import android.annotation.SuppressLint
import android.content.SharedPreferences import android.content.SharedPreferences
import android.content.res.Resources import android.content.res.Resources
import android.os.Bundle import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity import android.os.Environment
import bums.lunatic.launcher.BuildConfig import bums.lunatic.launcher.BuildConfig
import bums.lunatic.launcher.R import bums.lunatic.launcher.R
import bums.lunatic.launcher.apps.SimpleContact
import bums.lunatic.launcher.common.CommonActivity
import bums.lunatic.launcher.databinding.AboutBinding import bums.lunatic.launcher.databinding.AboutBinding
import bums.lunatic.launcher.databinding.SettingsActivityBinding import bums.lunatic.launcher.databinding.SettingsActivityBinding
import bums.lunatic.launcher.helpers.Constants.Companion.BOTTOM_SHEET_TAG import bums.lunatic.launcher.helpers.Constants.Companion.BOTTOM_SHEET_TAG
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.PrefHelper import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.model.AppInfo
import bums.lunatic.launcher.settings.childs.Advance import bums.lunatic.launcher.settings.childs.Advance
import bums.lunatic.launcher.settings.childs.Appearances import bums.lunatic.launcher.settings.childs.Appearances
import bums.lunatic.launcher.settings.childs.Apps import bums.lunatic.launcher.settings.childs.Apps
@ -38,12 +41,20 @@ import bums.lunatic.launcher.settings.childs.HomeSettings
import bums.lunatic.launcher.settings.childs.Misc import bums.lunatic.launcher.settings.childs.Misc
import bums.lunatic.launcher.settings.childs.TopInfos import bums.lunatic.launcher.settings.childs.TopInfos
import bums.lunatic.launcher.settings.childs.WeatherSettings import bums.lunatic.launcher.settings.childs.WeatherSettings
import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.workers.WorkersDb
import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
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 com.google.gson.Gson
import com.google.gson.reflect.TypeToken
import io.realm.kotlin.UpdatePolicy
import io.realm.kotlin.ext.query
import java.io.File
import kotlin.system.exitProcess
internal class SettingsActivity : AppCompatActivity() { internal class SettingsActivity : CommonActivity() {
private lateinit var binding: SettingsActivityBinding private lateinit var binding: SettingsActivityBinding
private val sourceCode = "https://github.com/iamrasel/lunar-launcher" private val sourceCode = "https://github.com/iamrasel/lunar-launcher"
@ -150,18 +161,34 @@ internal class SettingsActivity : AppCompatActivity() {
} }
} }
/* support dialog */
private fun supportDialog() { private fun supportDialog() {
MaterialAlertDialogBuilder(this) MaterialAlertDialogBuilder(this)
.setTitle(R.string.support) .setTitle(R.string.support)
.setMessage(R.string.support_message) .setMessage(R.string.support_message)
/* star button */ /* star button */
.setNeutralButton(R.string.star) { _, _ -> .setNeutralButton("backup") { _, _ ->
// startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(sourceCode))) val path = File(Environment.getExternalStorageDirectory(),"bums")
if (path.exists() == false) {
path.mkdirs()
}
saveObjToJson(path,"prefSettings.txt",PrefHelper.getSettings())
WorkersDb.getRealm().apply {
val foundAppInfo = query<AppInfo>().find()
Blog.LOGE("foundAppInfo >>> ${foundAppInfo}")
val apps = arrayListOf<AppInfo>().apply { addAll((copyFromRealm(foundAppInfo))) }
Blog.LOGE("foundAppInfo >>> ${apps.size}")
saveObjToJson(path,"appInfos.txt",apps)
val foundSimpleContact = query<SimpleContact>().find()
Blog.LOGE("foundSimpleContact >>> ${foundSimpleContact.size}")
val contacts = arrayListOf<SimpleContact>().apply { addAll(copyFromRealm(foundSimpleContact)) }
saveObjToJson(path,"contactInfos.txt",contacts)
}
} }
/* affiliate button */ /* affiliate button */
.setNegativeButton(R.string.amazon) { _, _ -> .setNegativeButton("restore") { d, c ->
// startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://amzn.to/44krAw9"))) d.dismiss()
restoreSetting()
} }
/* donate button */ /* donate button */
.setPositiveButton(R.string.donate) { _, _ -> .setPositiveButton(R.string.donate) { _, _ ->
@ -170,4 +197,34 @@ internal class SettingsActivity : AppCompatActivity() {
.show() .show()
} }
fun restoreSetting() {
val fileName = "prefSettings.txt"
val path = File(Environment.getExternalStorageDirectory(),"bums")
val file = File(path, fileName)
if (path.exists() && file.exists()) {
val retMap = readMap(file)
decodeString(File(path, "appInfos.txt"))?.let {
val appInfos = Gson().fromJson(it, object : TypeToken<ArrayList<AppInfo?>?>() {}.type) as ArrayList<AppInfo>
Blog.LOGE("appInfos >>>> ${appInfos.size}")
WorkersDb.getRealm().writeBlocking { appInfos.forEach { copyToRealm(it,UpdatePolicy.ALL) } }
}
decodeString(File(path,"contactInfos.txt"))?.let {
val contacts = Gson().fromJson(it, object : TypeToken<ArrayList<SimpleContact?>?>() {}.type) as ArrayList<SimpleContact>
Blog.LOGE("contacts >>>> ${contacts.size}")
WorkersDb.getRealm().writeBlocking { contacts.forEach { copyToRealm(it,UpdatePolicy.ALL) } }
}
Blog.LOGE("retMap >>>> ${Gson().toJson(retMap)}")
PrefHelper.putSetting(retMap)
MaterialAlertDialogBuilder(this)
.setTitle(R.string.restart_now)
.setMessage(R.string.restart_message)
.setPositiveButton(R.string.restart) { _, _ ->
exitProcess(0)
}.setCancelable(false)
.show()
} else {
Blog.LOGE("파일 없는뎅?!")
}
}
} }

View File

@ -28,7 +28,7 @@ import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.SettingsTodoBinding import bums.lunatic.launcher.databinding.SettingsTodoBinding
import bums.lunatic.launcher.helpers.PrefBoolean import bums.lunatic.launcher.helpers.PrefBoolean
import bums.lunatic.launcher.helpers.PrefHelper import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.utils.BLog import bums.lunatic.launcher.utils.Blog
import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -82,9 +82,9 @@ internal class HomeSettings : BottomSheetDialogFragment() {
} else { } else {
} }
BLog.LOGE("field > 0 >>> ${field}") Blog.LOGE("field > 0 >>> ${field}")
PrefBoolean.showNewsHistory.set(field > 0) PrefBoolean.showNewsHistory.set(field > 0)
BLog.LOGE("field > 0 >>> ${PrefBoolean.showNewsHistory.get(false)}") Blog.LOGE("field > 0 >>> ${PrefBoolean.showNewsHistory.get(false)}")
} }
@ -104,8 +104,6 @@ internal class HomeSettings : BottomSheetDialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
(requireDialog() as BottomSheetDialog).dismissWithAnimation = true (requireDialog() as BottomSheetDialog).dismissWithAnimation = true
} }
override fun onDestroyView() { override fun onDestroyView() {

View File

@ -29,7 +29,7 @@ import bums.lunatic.launcher.databinding.SettingsTimeDateBinding
import bums.lunatic.launcher.helpers.PrefBoolean import bums.lunatic.launcher.helpers.PrefBoolean
import bums.lunatic.launcher.helpers.PrefHelper import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.helpers.PrefString import bums.lunatic.launcher.helpers.PrefString
import bums.lunatic.launcher.utils.BLog import bums.lunatic.launcher.utils.Blog
import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder import com.google.android.material.dialog.MaterialAlertDialogBuilder
@ -48,7 +48,7 @@ internal class TopInfos : BottomSheetDialogFragment() {
binding.useBattery.isChecked = PrefBoolean.displayBattery.get(true) binding.useBattery.isChecked = PrefBoolean.displayBattery.get(true)
binding.useDateTime.isChecked = PrefBoolean.displayDateTime.get(true) binding.useDateTime.isChecked = PrefBoolean.displayDateTime.get(true)
BLog.LOGE("PrefHelper.getSettings() >>> ${Gson().toJson(PrefHelper.getSettings())}") Blog.LOGE("PrefHelper.getSettings() >>> ${Gson().toJson(PrefHelper.getSettings())}")
binding.useBattery.setOnCheckedChangeListener { button, b -> binding.useBattery.setOnCheckedChangeListener { button, b ->
PrefBoolean.displayBattery.set(b) PrefBoolean.displayBattery.set(b)
settingsChanged = true settingsChanged = true

View File

@ -3,7 +3,7 @@ package bums.lunatic.launcher.utils
import android.util.Log import android.util.Log
import bums.lunatic.launcher.BuildConfig import bums.lunatic.launcher.BuildConfig
object BLog { object Blog {
val DEFAULT_TAG = "Lunatic" val DEFAULT_TAG = "Lunatic"
enum class BLogType { enum class BLogType {
D,I,E D,I,E

View File

@ -2,14 +2,10 @@ package bums.lunatic.launcher.utils
import org.jsoup.nodes.Document import org.jsoup.nodes.Document
import java.net.URLEncoder import java.net.URLEncoder
import java.util.Base64
object RssList { object RssList {
val TEST_PAG2 = "https://torrentsee246.com/topic/index?category1=129&category2=132"
val jGuruMain = "https://jav.guru"
val jGuruRanks ="https://jav.guru/most-watched-rank/"
val youtubeUrls = arrayListOf( val youtubeUrls = arrayListOf(
"https://www.youtube.com/@zzanbro", "https://www.youtube.com/@zzanbro",
"https://www.youtube.com/@sungsikyung", "https://www.youtube.com/@sungsikyung",
@ -19,33 +15,13 @@ object RssList {
) )
val newsFeeds = arrayListOf( val newsFeeds = arrayListOf(
"https://news.google.com/rss?hl=ko&gl=KR&ceid=KR:ko", "https://news.google.com/rss?hl=ko&gl=KR&ceid=KR:ko",
// "https://imnews.imbc.com/rss/google_news/narrativeNews.rss",
"http://www.hani.co.kr/rss",
"http://biz.heraldcorp.com/common_prog/rssdisp.php?ct=010000000000.xml",
// "https://rss.inews24.com/rss/news_inews.xml",
// "https://rss.nocutnews.co.kr/category/it.xml",
// "https://rss.nocutnews.co.kr/news/news.xml",
"https://rss.nocutnews.co.kr/news/top.xml", "https://rss.nocutnews.co.kr/news/top.xml",
) )
val feedJsons = arrayListOf( val feedJsons = arrayListOf(
// "https://www.reddit.com/r/nsfw/.json",
"https://www.reddit.com/r/Mogong/.json", "https://www.reddit.com/r/Mogong/.json",
// "https://www.reddit.com/r/Mogong/comments/e6tu50/19_%ED%9B%84%EB%B0%A9%EA%B0%80%EB%93%9D%ED%95%9C_%EC%84%9C%EB%B8%8C%EB%A0%88%EB%94%A7/.json"
// "https://www.reddit.com/r/${URLEncoder.encode("모공")}/.json",
)
val feedJsons_nsfw = arrayListOf(
"https://www.reddit.com/r/nsfw/.json",
"https://www.reddit.com/r/nsfw411/.json",
"https://www.reddit.com/r/nsfw2/.json",
"https://www.reddit.com/r/nudes/.json",
"https://www.reddit.com/r/cuckold/.json",
// "https://www.reddit.com/r/Mogong/.json",
// "https://www.reddit.com/r/Mogong/comments/e6tu50/19_%ED%9B%84%EB%B0%A9%EA%B0%80%EB%93%9D%ED%95%9C_%EC%84%9C%EB%B8%8C%EB%A0%88%EB%94%A7/.json"
// "https://www.reddit.com/r/${URLEncoder.encode("모공")}/.json",
) )
val feedJsons_nsfw = String(Base64.getMimeDecoder().decode("aHR0cHM6Ly93d3cucmVkZGl0LmNvbS9yL25zZncvLmpzb258aHR0cHM6Ly93d3cucmVkZGl0LmNvbS9yL25zZnc0MTEvLmpzb258aHR0cHM6Ly93d3cucmVkZGl0LmNvbS9yL25zZncyLy5qc29ufGh0dHBzOi8vd3d3LnJlZGRpdC5jb20vci9udWRlcy8uanNvbnxodHRwczovL3d3dy5yZWRkaXQuY29tL3IvY3Vja29sZC8uanNvbg==".toByteArray())).split("|")
fun getFeedUrls() = keyWords.map { "https://news.google.com/rss/search?q=${URLEncoder.encode(it)}=ko&gl=KR&ceid=KR%3Ako/" } fun getFeedUrls() = keyWords.map { "https://news.google.com/rss/search?q=${URLEncoder.encode(it)}=ko&gl=KR&ceid=KR%3Ako/" }
@ -60,310 +36,6 @@ object RssList {
"여행", "여행",
) )
val plist = arrayListOf<Pair<String,Int>>(
Pair("72.10.160.94", 8355),
Pair("148.72.165.7", 30127),
Pair("67.43.227.226", 30373),
Pair("143.110.226.180", 8888),
Pair("44.195.247.145", 80),
Pair("3.21.101.158", 80),
Pair("5.9.238.29", 80),
Pair("54.233.119.172", 3128),
Pair("3.122.84.99", 3128),
Pair("35.72.118.126", 80),
Pair("52.196.1.182", 80),
Pair("52.67.10.183", 80),
Pair("13.36.104.85", 80),
Pair("44.219.175.186", 80),
Pair("43.201.121.81", 80),
Pair("35.79.120.242", 3128),
Pair("18.228.198.164", 80),
Pair("3.212.148.199", 80),
Pair("3.12.144.146", 80),
Pair("43.200.77.128", 3128),
Pair("18.223.25.15", 80),
Pair("13.36.113.81", 3128),
Pair("43.202.154.212", 80),
Pair("13.59.156.167", 80),
Pair("35.76.62.196", 80),
Pair("54.152.3.36", 80),
Pair("44.218.183.55", 80),
Pair("3.37.125.76", 3128),
Pair("46.51.249.135", 3128),
Pair("3.141.217.225", 80),
Pair("13.37.89.201", 80),
Pair("158.160.14.101", 8090),
Pair("204.236.137.68", 80),
Pair("149.28.181.52", 80),
Pair("5.252.22.45", 80),
Pair("160.86.242.23", 8080),
Pair("195.114.209.50", 80),
Pair("64.147.212.78", 8080),
Pair("47.247.78.131", 80),
Pair("109.176.198.142", 80),
Pair("43.134.229.98", 3128),
Pair("78.28.152.111", 80),
Pair("51.255.20.138", 80),
Pair("158.255.77.169", 80),
Pair("159.65.244.233", 80),
Pair("158.255.77.168", 80),
Pair("154.205.128.153", 8888),
Pair("101.101.217.36", 80),
Pair("190.119.80.140", 80),
Pair("77.221.136.168", 8000),
Pair("77.221.139.76", 8000),
Pair("148.72.169.225", 30127),
Pair("185.244.173.33", 8118),
Pair("188.253.112.218", 80),
Pair("194.182.187.78", 3128),
Pair("143.42.66.91", 80),
Pair("154.90.55.37", 80),
Pair("82.102.10.253", 80),
Pair("158.255.77.166", 80),
Pair("67.43.227.229", 16401),
Pair("176.9.239.181", 80),
Pair("189.43.42.97", 80),
Pair("189.43.42.96", 80),
Pair("189.43.42.103", 80),
Pair("189.43.42.101", 80),
Pair("3.71.80.214", 8090),
Pair("87.98.148.98", 80),
Pair("72.10.160.170", 2657),
Pair("15.204.161.192", 18080),
Pair("209.97.150.167", 3128),
Pair("50.217.226.41", 80),
Pair("43.134.74.143", 3128),
Pair("3.70.198.14", 8090),
Pair("178.128.113.118", 23128),
Pair("198.44.255.3", 80),
Pair("170.106.183.248", 8080),
Pair("4.175.200.138", 8080),
Pair("172.191.74.198", 8080),
Pair("23.247.136.245", 80),
Pair("198.199.86.11", 8080),
Pair("139.59.1.14", 8080),
Pair("50.207.199.86", 80),
Pair("67.43.236.19", 17293),
Pair("144.126.216.57", 80),
Pair("50.217.226.44", 80),
Pair("139.162.78.109", 8080),
Pair("50.172.75.122", 80),
Pair("211.128.96.206", 80),
Pair("51.255.57.241", 8080),
Pair("68.185.57.66", 80),
Pair("50.231.104.58", 80),
Pair("50.174.7.156", 80),
Pair("43.134.33.254", 3128),
Pair("123.30.154.171", 7777),
Pair("190.103.177.131", 80),
Pair("127.0.0.7", 80),
Pair("148.72.168.80", 30127),
Pair("189.43.42.111", 80),
Pair("212.107.28.120", 80),
Pair("20.206.106.192", 8123),
Pair("202.93.244.194", 8080),
Pair("172.178.22.57", 9080),
Pair("38.156.75.27", 8080),
Pair("149.34.210.56", 9090),
Pair("27.131.248.172", 8080),
Pair("34.122.187.196", 80),
Pair("43.134.68.153", 3128),
Pair("222.252.194.29", 8080),
Pair("43.153.207.93", 3128),
Pair("103.237.144.232", 1311),
Pair("47.241.43.44", 7777),
Pair("45.122.240.154", 3128),
Pair("89.116.191.51", 80),
Pair("212.110.188.222", 34411),
Pair("152.230.215.123", 80),
Pair("93.127.215.97", 80),
Pair("212.110.188.216", 34405),
Pair("117.1.109.130", 10006),
Pair("51.222.102.172", 8080),
Pair("47.242.47.64", 8888),
Pair("154.113.18.189", 8090),
Pair("61.118.38.234", 60808),
Pair("39.61.54.80", 8080),
Pair("129.213.89.36", 80),
Pair("159.65.245.255", 80),
Pair("65.108.159.129", 1080),
Pair("85.214.195.118", 80),
Pair("174.138.54.65", 80),
Pair("39.109.113.97", 4090),
Pair("138.68.235.51", 80),
Pair("34.87.84.105", 80),
Pair("113.160.133.32", 8080),
Pair("94.131.9.215", 4002),
Pair("41.204.53.29", 80),
Pair("35.215.216.90", 80),
Pair("146.190.178.108", 80),
Pair("198.74.51.79", 8888),
Pair("188.166.197.129", 3128),
Pair("3.71.80.164", 8090),
Pair("72.10.160.174", 13093),
Pair("38.54.71.67", 80),
Pair("198.49.68.80", 80),
Pair("67.43.228.251", 3343),
Pair("47.56.110.204", 8989),
Pair("85.215.64.49", 80),
Pair("5.135.188.78", 3127),
Pair("144.24.122.46", 80),
Pair("179.41.8.151", 80),
Pair("165.232.129.150", 80),
Pair("190.110.226.122", 80),
Pair("41.204.53.21", 80),
Pair("154.65.39.8", 80),
Pair("185.164.73.117", 80),
Pair("133.18.234.13", 80),
Pair("68.183.143.134", 80),
Pair("87.248.129.26", 80),
Pair("8.219.97.248", 80),
Pair("23.82.137.156", 80),
Pair("13.37.59.99", 3128),
Pair("43.134.32.184", 3128),
Pair("43.133.59.220", 3128),
Pair("63.35.64.177", 3128),
Pair("15.235.46.52", 8888),
Pair("193.124.181.93", 8888),
Pair("96.10.203.8", 80),
Pair("185.44.65.171", 3128),
Pair("185.76.10.135", 8082),
Pair("13.37.73.214", 80),
Pair("3.123.150.192", 80),
Pair("13.36.87.105", 3128),
Pair("185.217.5.3", 80),
Pair("116.125.141.115", 80),
Pair("50.168.72.115", 80),
Pair("50.168.72.116", 80),
Pair("172.94.32.48", 80),
Pair("89.179.71.21", 3128),
Pair("102.134.98.222", 8081),
Pair("78.135.87.235", 80),
Pair("60.242.169.3", 80),
Pair("51.210.54.186", 80),
Pair("41.204.53.28", 80),
Pair("20.24.43.214", 80),
Pair("20.210.113.32", 8123),
Pair("103.49.202.250", 80),
Pair("103.78.36.116", 8080),
Pair("103.107.84.177", 8080),
Pair("186.148.184.196", 999),
Pair("103.179.182.185", 8181),
Pair("103.179.182.31", 8090),
Pair("103.155.190.242", 8080),
Pair("223.205.103.1", 8080),
Pair("118.172.239.231", 8180),
Pair("118.67.134.17", 80),
Pair("194.250.197.206", 80),
Pair("171.238.236.203", 5000),
Pair("129.10.76.179", 80),
Pair("68.178.168.41", 80),
Pair("128.199.202.122", 8080),
Pair("200.174.198.86", 8888),
Pair("23.82.137.161", 80),
Pair("222.122.110.26", 80),
Pair("54.38.181.125", 80),
Pair("46.47.197.210", 3128),
Pair("51.75.206.209", 80),
Pair("8.213.134.213", 8008),
Pair("183.100.14.134", 8000),
Pair("35.209.198.222", 80),
Pair("47.243.114.192", 8180),
Pair("41.59.90.174", 80),
Pair("41.204.53.22", 80),
Pair("113.160.132.33", 8080),
Pair("47.88.59.79", 82),
Pair("103.151.20.131", 80),
Pair("176.9.238.176", 16379),
Pair("41.204.53.17", 80),
Pair("41.59.90.171", 80),
Pair("66.29.154.105", 3128),
Pair("213.233.177.134", 80),
Pair("72.10.160.90", 1365),
Pair("87.248.129.32", 80),
Pair("83.68.136.241", 80),
Pair("189.43.42.105", 80),
Pair("222.252.194.204", 8080),
Pair("67.43.228.253", 12915),
Pair("67.43.236.20", 10145),
Pair("72.10.164.178", 1417),
Pair("47.251.43.115", 33333),
Pair("162.223.90.130", 80),
Pair("67.43.227.230", 4961),
Pair("67.43.228.254", 2679),
Pair("103.127.1.130", 80),
Pair("31.40.248.2", 8080),
Pair("161.35.70.249", 8080),
Pair("97.74.87.226", 80),
Pair("154.65.39.7", 80),
Pair("51.89.255.67", 80),
Pair("47.74.152.29", 8888),
Pair("146.59.202.70", 80),
Pair("91.228.186.200", 80),
Pair("62.169.26.156", 8081),
Pair("38.156.73.61", 8080),
Pair("38.58.56.18", 3128),
Pair("103.179.246.30", 8080),
Pair("94.247.129.244", 3128),
Pair("181.78.99.31", 8080),
Pair("38.45.46.2", 6332),
Pair("202.74.245.83", 5020),
Pair("103.153.39.25", 8080),
Pair("161.49.176.173", 1337),
Pair("103.27.118.138", 8080),
Pair("191.101.80.162", 80),
Pair("157.254.53.50", 80),
Pair("43.134.121.40", 3128),
Pair("23.82.137.158", 80),
Pair("198.44.255.5", 80),
Pair("129.226.193.16", 3128),
Pair("63.143.57.120", 80),
Pair("65.108.207.6", 80),
Pair("23.94.86.138", 80),
Pair("101.36.102.78", 8168),
Pair("123.58.199.232", 8168),
Pair("123.58.199.17", 8168),
Pair("101.36.102.238", 8168),
Pair("38.6.182.13", 8080),
Pair("47.90.205.231", 33333),
Pair("93.127.163.52", 80),
Pair("154.90.48.76", 80),
Pair("193.190.253.97", 80),
Pair("178.16.129.11", 80),
Pair("18.228.149.161", 80),
Pair("3.126.147.182", 3128),
Pair("147.135.128.218", 80),
Pair("47.251.73.54", 8080),
Pair("18.159.135.44", 8090),
Pair("77.232.128.191", 80),
Pair("197.243.20.178", 80),
Pair("82.146.37.145", 80),
Pair("34.143.183.96", 80),
Pair("192.73.244.36", 80),
Pair("35.209.22.27", 80),
Pair("107.175.179.52", 80),
Pair("78.80.228.150", 80),
Pair("1.20.207.75", 8080),
Pair("103.247.14.103", 1111),
Pair("103.156.15.252", 8080),
Pair("131.100.48.105", 999),
Pair("13.59.114.202", 80),
Pair("45.76.123.210", 80),
Pair("72.10.160.92", 5635),
Pair("203.77.215.45", 10000),
Pair("3.124.133.93", 80),
Pair("3.130.65.162", 3128),
Pair("114.156.77.107", 8080),
Pair("140.227.228.202", 10101),
Pair("3.139.242.184", 80),
Pair("122.152.4.133", 6000),
Pair("20.111.54.16", 8123),
Pair("122.160.30.99", 80),
Pair("50.169.222.243", 80),
Pair("50.237.207.186", 80),
)
} }
object DocParserManager { object DocParserManager {
@ -374,5 +46,4 @@ interface DocParser { fun <T>parse(doc : Document) : T }
class JGuruMain { class JGuruMain {
var maxDate : Long = Long.MIN_VALUE var maxDate : Long = Long.MIN_VALUE
var minDate : Long = Long.MAX_VALUE var minDate : Long = Long.MAX_VALUE
} }

View File

@ -4,7 +4,7 @@ import android.content.Context
import android.net.Uri import android.net.Uri
import androidx.work.WorkerParameters import androidx.work.WorkerParameters
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.utils.BLog import bums.lunatic.launcher.utils.Blog
class CalendarGetter : BaseGetter { class CalendarGetter : BaseGetter {
@ -97,11 +97,11 @@ class CalendarGetter : BaseGetter {
for (i in title.indices) { for (i in title.indices) {
calendar_id[i] = managedCursor.getInt(0) calendar_id[i] = managedCursor.getInt(0)
BLog.LOGE("Calendar ID : " + calendar_id[i]) Blog.LOGE("Calendar ID : " + calendar_id[i])
// htmlUri[i] = managedCursor.getString(1) // htmlUri[i] = managedCursor.getString(1)
// Log.i("Calendar", "htmlUri : " + htmlUri[i]) // Log.i("Calendar", "htmlUri : " + htmlUri[i])
title[i] = managedCursor.getString(1) title[i] = managedCursor.getString(1)
BLog.LOGE("Calendar title : " + title[i]) Blog.LOGE("Calendar title : " + title[i])
// eventLocation[i] = managedCursor.getString(3) // eventLocation[i] = managedCursor.getString(3)
// Log.i("Calendar", "eventLocation : " + eventLocation[i]) // Log.i("Calendar", "eventLocation : " + eventLocation[i])
description[i] = managedCursor.getString(2) description[i] = managedCursor.getString(2)
@ -109,9 +109,9 @@ class CalendarGetter : BaseGetter {
// selfAttendeeStatus[i] = managedCursor.getInt(6) // selfAttendeeStatus[i] = managedCursor.getInt(6)
// commentsUri[i] = managedCursor.getString(7) // commentsUri[i] = managedCursor.getString(7)
dtstart[i] = managedCursor.getString(3) dtstart[i] = managedCursor.getString(3)
BLog.LOGE("Calendar dtstart : " + rdate[i]) Blog.LOGE("Calendar dtstart : " + rdate[i])
dtend[i] = managedCursor.getString(4) dtend[i] = managedCursor.getString(4)
BLog.LOGE("Calendar dtend : " + rdate[i]) Blog.LOGE("Calendar dtend : " + rdate[i])
// eventTimezone[i] = managedCursor.getString(10) // eventTimezone[i] = managedCursor.getString(10)
// duration[i] = managedCursor.getString(11) // duration[i] = managedCursor.getString(11)
// allDay[i] = managedCursor.getInt(12) // allDay[i] = managedCursor.getInt(12)
@ -121,7 +121,7 @@ class CalendarGetter : BaseGetter {
// hasExtendedProperties[i] = managedCursor.getInt(16) // hasExtendedProperties[i] = managedCursor.getInt(16)
// rrule[i] = managedCursor.getString(17) // rrule[i] = managedCursor.getString(17)
rdate[i] = managedCursor.getString(5) rdate[i] = managedCursor.getString(5)
BLog.LOGE("Calendar rdate : " + rdate[i]) Blog.LOGE("Calendar rdate : " + rdate[i])
// exrule[i] = managedCursor.getString(19) // exrule[i] = managedCursor.getString(19)
// exdate[i] = managedCursor.getString(20) // exdate[i] = managedCursor.getString(20)
// originalEvent[i] = managedCursor.getString(21) // originalEvent[i] = managedCursor.getString(21)
@ -136,7 +136,7 @@ class CalendarGetter : BaseGetter {
// deleted[i] = managedCursor.getInt(30) // deleted[i] = managedCursor.getInt(30)
if (title[i] != null) { if (title[i] != null) {
BLog.LOGE("title[i] ${title[i]}") Blog.LOGE("title[i] ${title[i]}")
} }
managedCursor.moveToNext() managedCursor.moveToNext()

View File

@ -5,10 +5,9 @@ import android.content.Context
import android.location.Location import android.location.Location
import androidx.work.WorkerParameters import androidx.work.WorkerParameters
import bums.lunatic.launcher.LauncherActivity.Companion.runWeatherGetter import bums.lunatic.launcher.LauncherActivity.Companion.runWeatherGetter
import bums.lunatic.launcher.common.letTrue
import bums.lunatic.launcher.helpers.PrefBoolean import bums.lunatic.launcher.helpers.PrefBoolean
import bums.lunatic.launcher.helpers.PrefHelper import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.helpers.letTrue
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.workers.LocationUpdateService.Companion.pushLocation import bums.lunatic.launcher.workers.LocationUpdateService.Companion.pushLocation
import com.google.android.gms.location.LocationServices import com.google.android.gms.location.LocationServices
import com.google.android.gms.location.Priority import com.google.android.gms.location.Priority
@ -24,14 +23,14 @@ class LocationGetter(context: Context, workerParams: WorkerParameters) : BaseGet
@SuppressLint("MissingPermission") @SuppressLint("MissingPermission")
override fun realWork(): Result { override fun realWork(): Result {
BLog.LOGE("${OpenWeatherGetter.TAG} realWork()") Blog.LOGE("${OpenWeatherGetter.TAG} realWork()")
LocationServices.getFusedLocationProviderClient(this.applicationContext) LocationServices.getFusedLocationProviderClient(this.applicationContext)
.getCurrentLocation(Priority.PRIORITY_HIGH_ACCURACY, CancellationTokenSource().token) .getCurrentLocation(Priority.PRIORITY_HIGH_ACCURACY, CancellationTokenSource().token)
.addOnSuccessListener{ success: Location? -> .addOnSuccessListener{ success: Location? ->
success?.let { success?.let {
BLog.LOGE("Location >>> $it") Blog.LOGE("Location >>> $it")
BLog.LOGE("Location >>> (latitude)${it.longitude}/(longitude)${it.latitude}") Blog.LOGE("Location >>> (latitude)${it.longitude}/(longitude)${it.latitude}")
longitude = it.longitude longitude = it.longitude
latitude = it.latitude latitude = it.latitude
runWeatherGetter() runWeatherGetter()
@ -40,7 +39,7 @@ class LocationGetter(context: Context, workerParams: WorkerParameters) : BaseGet
} }
} }
}.addOnFailureListener{ }.addOnFailureListener{
BLog.LOGE("Location error >>> $it") Blog.LOGE("Location error >>> $it")
} }
return Result.success() return Result.success()

View File

@ -1,11 +1,9 @@
package bums.lunatic.launcher.workers package bums.lunatic.launcher.workers
import android.Manifest
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.app.Service import android.app.Service
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.content.pm.PackageManager
import android.location.Geocoder import android.location.Geocoder
import android.location.Location import android.location.Location
import android.location.LocationListener import android.location.LocationListener
@ -13,15 +11,13 @@ import android.location.LocationManager
import android.os.Build import android.os.Build
import android.os.IBinder import android.os.IBinder
import android.widget.Toast import android.widget.Toast
import androidx.core.app.ActivityCompat
import bums.lunatic.launcher.LauncherActivity.Companion.runWeatherGetter import bums.lunatic.launcher.LauncherActivity.Companion.runWeatherGetter
import bums.lunatic.launcher.common.letTrue
import bums.lunatic.launcher.helpers.PrefBoolean import bums.lunatic.launcher.helpers.PrefBoolean
import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.helpers.PrefLong import bums.lunatic.launcher.helpers.PrefLong
import bums.lunatic.launcher.helpers.PrefString import bums.lunatic.launcher.helpers.PrefString
import bums.lunatic.launcher.helpers.letTrue
import bums.lunatic.launcher.model.LocationLog import bums.lunatic.launcher.model.LocationLog
import bums.lunatic.launcher.utils.BLog import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.utils.inRange import bums.lunatic.launcher.utils.inRange
import bums.lunatic.launcher.workers.LocationGetter.Companion.latitude import bums.lunatic.launcher.workers.LocationGetter.Companion.latitude
import bums.lunatic.launcher.workers.LocationGetter.Companion.longitude import bums.lunatic.launcher.workers.LocationGetter.Companion.longitude
@ -69,7 +65,7 @@ class LocationUpdateService : Service(), LocationListener {
try { try {
//////-1002450229641 //////-1002450229641
val url = PrefString.locationApi.get() val url = PrefString.locationApi.get()
BLog.LOGE("LocationLog ${url}") Blog.LOGE("LocationLog ${url}")
if (url.length > 10) { if (url.length > 10) {
val client = OkHttpClient.Builder() val client = OkHttpClient.Builder()
.connectionPool(ConnectionPool(5, 60, TimeUnit.SECONDS)) .connectionPool(ConnectionPool(5, 60, TimeUnit.SECONDS))
@ -88,7 +84,7 @@ class LocationUpdateService : Service(), LocationListener {
) )
val request: Request = builder.build() val request: Request = builder.build()
BLog.LOGE("telegram before request ") Blog.LOGE("telegram before request ")
// OkHttp 클라이언트로 GET 요청 객체 전송 // OkHttp 클라이언트로 GET 요청 객체 전송
val response: Response = client.newCall(request).execute() val response: Response = client.newCall(request).execute()
if (response.isSuccessful()) { if (response.isSuccessful()) {
@ -97,7 +93,7 @@ class LocationUpdateService : Service(), LocationListener {
if (body != null) { if (body != null) {
} }
} else BLog.LOGE("telegram Error Occurred") } else Blog.LOGE("telegram Error Occurred")
} }
} catch (e: java.lang.Exception) { } catch (e: java.lang.Exception) {
e.printStackTrace() e.printStackTrace()
@ -141,7 +137,7 @@ class LocationUpdateService : Service(), LocationListener {
} }
override fun onLocationChanged(p0: Location) { override fun onLocationChanged(p0: Location) {
BLog.LOGE("p0") Blog.LOGE("p0")
PrefBoolean.location.get().letTrue { PrefBoolean.location.get().letTrue {
longitude = p0.longitude longitude = p0.longitude
latitude = p0.latitude latitude = p0.latitude

View File

@ -6,7 +6,6 @@ import androidx.work.WorkerParameters
import bums.lunatic.launcher.home.adapters.RssFeedsParser import bums.lunatic.launcher.home.adapters.RssFeedsParser
import bums.lunatic.launcher.model.RssDataType import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.getRssData import bums.lunatic.launcher.model.getRssData
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.utils.RssList import bums.lunatic.launcher.utils.RssList
class NewsFeedsGetter : BaseGetter { class NewsFeedsGetter : BaseGetter {

View File

@ -5,7 +5,7 @@ import androidx.work.WorkerParameters
import bums.lunatic.launcher.helpers.PrefString import bums.lunatic.launcher.helpers.PrefString
import bums.lunatic.launcher.model.WeatherForcast import bums.lunatic.launcher.model.WeatherForcast
import bums.lunatic.launcher.model.WeatherInfoManager import bums.lunatic.launcher.model.WeatherInfoManager
import bums.lunatic.launcher.utils.BLog import bums.lunatic.launcher.utils.Blog
import io.realm.kotlin.UpdatePolicy import io.realm.kotlin.UpdatePolicy
import retrofit2.Call import retrofit2.Call
import retrofit2.Retrofit import retrofit2.Retrofit
@ -32,20 +32,20 @@ class OpenWeatherGetter(context: Context, workerParams: WorkerParameters) : Base
////////////////////////////////////////// //////////////////////////////////////////
override fun realWork(): Result { override fun realWork(): Result {
BLog.LOGE("${TAG} realWork()") Blog.LOGE("${TAG} realWork()")
// 위치 값 가져오기 // 위치 값 가져오기
lat = LocationGetter.latitude lat = LocationGetter.latitude
lon = LocationGetter.longitude lon = LocationGetter.longitude
if (lat != null && lon != null) { if (lat != null && lon != null) {
getWeather(lat!!, lon!!) getWeather(lat!!, lon!!)
} else { } else {
BLog.LOGE("lat or lon is null") Blog.LOGE("lat or lon is null")
} }
return Result.success() return Result.success()
} }
fun getWeather(latitude: Double, longitude: Double) { fun getWeather(latitude: Double, longitude: Double) {
BLog.LOGE("into getWeather") Blog.LOGE("into getWeather")
///saved weatherForcast ///saved weatherForcast
Retrofit.Builder() Retrofit.Builder()
.baseUrl(URI_WEATHERAPI) .baseUrl(URI_WEATHERAPI)

View File

@ -2,7 +2,7 @@ package bums.lunatic.launcher.workers
import bums.lunatic.launcher.BuildConfig import bums.lunatic.launcher.BuildConfig
import bums.lunatic.launcher.apps.SimpleContact import bums.lunatic.launcher.apps.SimpleContact
import bums.lunatic.launcher.helpers.letTrue import bums.lunatic.launcher.common.letTrue
import bums.lunatic.launcher.model.AppInfo import bums.lunatic.launcher.model.AppInfo
import bums.lunatic.launcher.model.Astro import bums.lunatic.launcher.model.Astro
import bums.lunatic.launcher.model.BotCommandEentitie import bums.lunatic.launcher.model.BotCommandEentitie
@ -25,13 +25,12 @@ import bums.lunatic.launcher.model.TelegramData
import bums.lunatic.launcher.model.TelegramFrom import bums.lunatic.launcher.model.TelegramFrom
import bums.lunatic.launcher.model.TelegramMessage import bums.lunatic.launcher.model.TelegramMessage
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.beforeDay
import io.realm.kotlin.Realm import io.realm.kotlin.Realm
import io.realm.kotlin.RealmConfiguration import io.realm.kotlin.RealmConfiguration
import io.realm.kotlin.UpdatePolicy import io.realm.kotlin.UpdatePolicy
import io.realm.kotlin.dynamic.getValue
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
@ -44,8 +43,8 @@ import kotlin.reflect.KClass
class CustMigration : AutomaticSchemaMigration { class CustMigration : AutomaticSchemaMigration {
override fun migrate(migrationContext: AutomaticSchemaMigration.MigrationContext) { override fun migrate(migrationContext: AutomaticSchemaMigration.MigrationContext) {
BLog.LOGE(migrationContext.oldRealm.configuration.schemaVersion.toString()) Blog.LOGE(migrationContext.oldRealm.configuration.schemaVersion.toString())
BLog.LOGE(migrationContext.newRealm.configuration.schemaVersion.toString()) Blog.LOGE(migrationContext.newRealm.configuration.schemaVersion.toString())
} }
} }
object WorkersDb { object WorkersDb {
@ -67,7 +66,6 @@ object WorkersDb {
pRealm = Realm.open(RealmConfiguration.Builder(clazz as Set<KClass<out TypedRealmObject>>) pRealm = Realm.open(RealmConfiguration.Builder(clazz as Set<KClass<out TypedRealmObject>>)
.migration(CustMigration(),true) .migration(CustMigration(),true)
.schemaVersion(schemaVersion) .schemaVersion(schemaVersion)
// .deleteRealmIfMigrationNeeded()
.build()) .build())
} catch (e : IllegalStateException) { } catch (e : IllegalStateException) {
getRealm() getRealm()
@ -98,13 +96,14 @@ object WorkersDb {
if(catfillters.contains(it.category()) && query<RssData>("chosung == $0",it.chosung).find().size == 0) { if(catfillters.contains(it.category()) && query<RssData>("chosung == $0",it.chosung).find().size == 0) {
this.copyToRealm(it, UpdatePolicy.ERROR) this.copyToRealm(it, UpdatePolicy.ERROR)
} else { } else {
this.copyToRealm(it, UpdatePolicy.ALL) this.copyToRealm(it, UpdatePolicy.ERROR)
} }
} catch (e : Exception) { } catch (e : Exception) {
} }
} }
} catch (e : Exception) { } catch (e : Exception) {
e.printStackTrace()
} }
} }
} }
@ -123,6 +122,7 @@ object WorkersDb {
} }
} }
} catch (e : Exception) { } catch (e : Exception) {
e.printStackTrace()
} }
} }
} }
@ -133,7 +133,7 @@ object WorkersDb {
try { try {
this.copyToRealm(data, UpdatePolicy.ALL) this.copyToRealm(data, UpdatePolicy.ALL)
} catch (e : Exception) { } catch (e : Exception) {
e.printStackTrace()
} }
} }
} }
@ -145,7 +145,7 @@ object WorkersDb {
try { try {
this.copyToRealm(info, UpdatePolicy.ALL) this.copyToRealm(info, UpdatePolicy.ALL)
} catch (e : Exception) { } catch (e : Exception) {
e.printStackTrace()
} }
} }
} }
@ -157,7 +157,7 @@ object WorkersDb {
try { try {
this.copyToRealm(contact, UpdatePolicy.ALL) this.copyToRealm(contact, UpdatePolicy.ALL)
} catch (e : Exception) { } catch (e : Exception) {
e.printStackTrace()
} }
} }
} }

View File

@ -4,7 +4,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/black"
android:orientation="vertical"> android:orientation="vertical">
<com.google.android.material.button.MaterialButtonToggleGroup <com.google.android.material.button.MaterialButtonToggleGroup

View File

@ -26,7 +26,7 @@ import java.io.Serializable
* Created by Leonardo on 11/21/15. * Created by Leonardo on 11/21/15.
*/ */
class AwesomeWebView { class AwesomeWebView {
class Builder : Serializable { open class Builder : Serializable {
@Transient @Transient
val context: Context val context: Context
@ -1000,7 +1000,7 @@ class AwesomeWebView {
show(url, null) show(url, null)
} }
fun show(url: String?, data: String?) { open fun show(url: String?, data: String?) {
this.url = url this.url = url
this.data = data this.data = data
this.key = System.identityHashCode(this) this.key = System.identityHashCode(this)

View File

@ -15,6 +15,7 @@ import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.os.Environment import android.os.Environment
import android.os.Handler import android.os.Handler
import android.os.Looper
import android.os.Message import android.os.Message
import android.print.PDFPrint import android.print.PDFPrint
import android.provider.MediaStore import android.provider.MediaStore
@ -93,7 +94,7 @@ import java.util.Date
import kotlin.math.abs import kotlin.math.abs
class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener, open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
Handler.Callback { Handler.Callback {
protected var key: Int = 0 protected var key: Int = 0
@ -281,13 +282,18 @@ class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
) )
} }
protected var handler: Handler = Handler(this) protected var handler: Handler = Handler(this)
protected val MSG_CLICK_ON_WEBVIEW: Int = 1 protected val MSG_CLICK_ON_WEBVIEW: Int = 1
protected val MSG_CLICK_ON_URL: Int = 2 protected val MSG_CLICK_ON_URL: Int = 2
@SuppressLint("ResourceType") @SuppressLint("ResourceType")
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
protected fun initializeOptions() { open protected fun initializeOptions() {
val intent = intent ?: return val intent = intent ?: return
val builder = intent.getSerializableExtra("builder") as AwesomeWebView.Builder? val builder = intent.getSerializableExtra("builder") as AwesomeWebView.Builder?
@ -538,6 +544,9 @@ class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
extraHeaders = builder?.extraHeaders extraHeaders = builder?.extraHeaders
} }
protected fun bindViews() { protected fun bindViews() {
binding.toolbarContent.close.setOnClickListener(this) binding.toolbarContent.close.setOnClickListener(this)
binding.toolbarContent.back.setOnClickListener(this) binding.toolbarContent.back.setOnClickListener(this)
@ -545,6 +554,27 @@ class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
binding.toolbarContent.more.setOnClickListener(this) binding.toolbarContent.more.setOnClickListener(this)
webView = buildWebView() webView = buildWebView()
binding.webLayout.addView(webView) binding.webLayout.addView(webView)
webView?.setOnScrollChangeListener { view, i, i2, i3, i4 ->
// LogUtil.e("$view, $i, $i2, $i3, $i4")
registCancelSearch()
}
}
val chechHandler = Handler(Looper.getMainLooper())
val cancelSearch = Runnable {
finish()
}
fun fast() {
chechHandler.removeCallbacks(cancelSearch)
chechHandler.postDelayed(cancelSearch, 6000L)
}
fun registCancelSearch() {
chechHandler.removeCallbacks(cancelSearch)
chechHandler.postDelayed(cancelSearch, 60000L)
} }
protected fun layoutViews() { protected fun layoutViews() {
@ -1284,6 +1314,7 @@ LogUtil.e("url!!.toUri(). >> ${url!!.toUri().authority}")
webView!!.loadUrl(url!!, extraHeaders!!) webView!!.loadUrl(url!!, extraHeaders!!)
} }
} }
} }
protected val maxWidth: Int protected val maxWidth: Int
@ -1432,7 +1463,6 @@ LogUtil.e("onBackPressed ${webChromeClient} && ${binding.menus.menuLayout.visibi
snackbarView.setBackgroundColor(toolbarColor) snackbarView.setBackgroundColor(toolbarColor)
if (snackbarView is ViewGroup) updateChildTextView(snackbarView) if (snackbarView is ViewGroup) updateChildTextView(snackbarView)
snackbar.show() snackbar.show()
hideMenu() hideMenu()
} else if (viewId == R.id.menuOpenWith) { } else if (viewId == R.id.menuOpenWith) {
val browserIntent = Intent( val browserIntent = Intent(
@ -1441,8 +1471,8 @@ LogUtil.e("onBackPressed ${webChromeClient} && ${binding.menus.menuLayout.visibi
) )
) )
startActivity(browserIntent) startActivity(browserIntent)
hideMenu() hideMenu()
finish()
} }
} }
@ -1809,8 +1839,8 @@ LogUtil.e("onBackPressed ${webChromeClient} && ${binding.menus.menuLayout.visibi
view: WebView, view: WebView,
request: WebResourceRequest request: WebResourceRequest
): WebResourceResponse? { ): WebResourceResponse? {
LogUtil.e("shouldInterceptRequest request >>> ${request.url.toString()}") // LogUtil.e("shouldInterceptRequest request >>> ${request.url.toString()}")
if (request.url.toString().contains("gif")) { if (request.url.toString().contains("gif") && request.url.toString().contains("sogirl")) {
return WebResourceResponse( return WebResourceResponse(
"text/plain", "utf-8", "text/plain", "utf-8",
ByteArrayInputStream("".toByteArray()) ByteArrayInputStream("".toByteArray())
@ -1863,12 +1893,13 @@ LogUtil.e("onBackPressed ${webChromeClient} && ${binding.menus.menuLayout.visibi
webView!!.loadUrl(injectJavaScript!!) webView!!.loadUrl(injectJavaScript!!)
} }
} }
registCancelSearch()
} }
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)
LogUtil.e("host >>> ${host} , url >>> ${url}") // LogUtil.e("host >>> ${host} , url >>> ${url}")
// if (host?.length ?: 0 > 2 && url.contains(host!!)) { if (url.contains("coupang") == false && url.contains("aliex") == false) {
if (url.endsWith(".mp4")) { if (url.endsWith(".mp4")) {
val intent = Intent(Intent.ACTION_VIEW) val intent = Intent(Intent.ACTION_VIEW)
intent.setDataAndType(Uri.parse(url), "video/*") intent.setDataAndType(Uri.parse(url), "video/*")
@ -1919,9 +1950,9 @@ LogUtil.e("onBackPressed ${webChromeClient} && ${binding.menus.menuLayout.visibi
return super.shouldOverrideUrlLoading(view, url) return super.shouldOverrideUrlLoading(view, url)
} }
} }
// } else { } else {
// return true return true
// } }
} }
override fun onLoadResource(view: WebView, url: String) { override fun onLoadResource(view: WebView, url: String) {