From 98a1fc959ed849205644fb5f8c8ec50638394772 Mon Sep 17 00:00:00 2001
From: lunaticbum <>
Date: Wed, 20 Nov 2024 15:51:13 +0900
Subject: [PATCH] ...
---
app/build.gradle.kts | 4 +-
app/src/main/AndroidManifest.xml | 29 +-
.../bums/lunatic/launcher/LauncherActivity.kt | 734 +++++++++---------
.../bums/lunatic/launcher/LunaticLauncher.kt | 2 +
.../bums/lunatic/launcher/apps/AppDrawer.kt | 209 +++--
.../bums/lunatic/launcher/apps/AppMenu.kt | 3 +-
.../bums/lunatic/launcher/apps/AppsAdapter.kt | 4 +-
.../bums/lunatic/launcher/apps/ContactMenu.kt | 6 +-
.../lunatic/launcher/apps/IconPackManager.kt | 10 +-
.../bums/lunatic/launcher/apps/SearchMenu.kt | 9 +-
.../lunatic/launcher/common/CommonActivity.kt | 113 +++
.../bums/lunatic/launcher/common/typeAlias.kt | 13 +
.../bums/lunatic/launcher/feeds/Feeds.kt | 562 +++++++-------
.../lunatic/launcher/feeds/FeedsResult.kt | 10 +-
.../launcher/helpers/BluetoothManager.kt | 4 +-
.../helpers/HeadsetActionButtonReceiver.kt | 6 +-
.../lunatic/launcher/helpers/PrefHelper.kt | 49 +-
.../lunatic/launcher/home/LauncherHome.kt | 54 +-
.../bums/lunatic/launcher/home/RssViewer.kt | 12 -
.../launcher/home/RssViewerActivity.kt | 212 +++++
.../launcher/home/adapters/RssFeedsParser.kt | 1 -
.../launcher/home/adapters/RssItemAdapter.kt | 36 +-
.../home/adapters/SwipeToDeleteCallback.kt | 1 -
.../launcher/home/adapters/WeatherAdapter.kt | 10 +-
.../home/adapters/WeatherDressAdatper.kt | 1 -
.../home/adapters/WeatherHourlyAdater.kt | 5 +-
.../bums/lunatic/launcher/model/AppInfo.kt | 1 +
.../launcher/model/WeatherInfoManager.kt | 4 +-
.../lunatic/launcher/qaccess/QuickAccess.kt | 11 +-
.../lunatic/launcher/receiver/NLService.kt | 9 +-
.../launcher/receiver/PackageEventReceiver.kt | 6 +-
.../launcher/settings/SettingsActivity.kt | 71 +-
.../launcher/settings/childs/HomeSettings.kt | 8 +-
.../launcher/settings/childs/TopInfos.kt | 4 +-
.../launcher/utils/{BLog.kt => Blog.kt} | 2 +-
.../bums/lunatic/launcher/utils/RssList.kt | 333 +-------
.../launcher/workers/CalendarGetter.kt | 14 +-
.../launcher/workers/LocationGetter.kt | 13 +-
.../launcher/workers/LocationUpdateService.kt | 16 +-
.../launcher/workers/NewsFeedsGetter.kt | 1 -
.../launcher/workers/OpenWeatherGetter.kt | 8 +-
.../lunatic/launcher/workers/WorkersDb.kt | 20 +-
app/src/main/res/layout/feeds.xml | 1 -
.../awesomewebview/AwesomeWebView.kt | 4 +-
.../awesomewebview/AwesomeWebViewActivity.kt | 53 +-
45 files changed, 1368 insertions(+), 1310 deletions(-)
create mode 100644 app/src/main/kotlin/bums/lunatic/launcher/common/CommonActivity.kt
create mode 100644 app/src/main/kotlin/bums/lunatic/launcher/common/typeAlias.kt
create mode 100644 app/src/main/kotlin/bums/lunatic/launcher/home/RssViewerActivity.kt
rename app/src/main/kotlin/bums/lunatic/launcher/utils/{BLog.kt => Blog.kt} (98%)
diff --git a/app/build.gradle.kts b/app/build.gradle.kts
index 17ae02e3..6090c84a 100644
--- a/app/build.gradle.kts
+++ b/app/build.gradle.kts
@@ -24,8 +24,8 @@ android {
isMinifyEnabled = false
isShrinkResources = false
isDebuggable = true
- applicationIdSuffix = ".debug"
- versionNameSuffix = "-debug"
+// applicationIdSuffix = ".debug"
+// versionNameSuffix = "-debug"
buildConfigField("Long","BuildDateTime", getDateTime().toString().plus("L"))
resValue ("string", "app_name", "Bums Launcher Debug")
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0ab8b876..cfa62b25 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -99,7 +99,26 @@
-
+
+
+
+
+
+
+
+
+
+
+ android:launchMode="singleTask"
+ android:excludeFromRecents="true"
+ android:theme="@style/FinestWebViewTheme.Fullscreen" >
+
+
> ${newConfig}")
+ Blog.LOGE("onConfigurationChanged Configuration >> ${newConfig}")
- BLog.LOGE("onConfigurationChanged newConfig?.screenWidthDp >> ${newConfig?.screenWidthDp}")
- BLog.LOGE("onConfigurationChanged newConfig?.screenHeightDp >> ${newConfig?.screenHeightDp}")
+ Blog.LOGE("onConfigurationChanged newConfig?.screenWidthDp >> ${newConfig?.screenWidthDp}")
+ Blog.LOGE("onConfigurationChanged newConfig?.screenHeightDp >> ${newConfig?.screenHeightDp}")
isOpendFold = (newConfig.screenWidthDp * 1.1f) > newConfig.screenHeightDp
}
var actionButtonPressX = 0f
var actionButtonPressY = 0f
+ var onExit = false
+ var lastAction = MotionEvent.ACTION_HOVER_EXIT
override fun dispatchGenericMotionEvent(ev: MotionEvent?): Boolean {
if (ev?.device?.name?.contains("BLE-M3") == true) {
- BLog.LOGE("keyEvent >>>>> dispatchGenericMotionEvent ${ev}")
+ Blog.LOGE("keyEvent >>>>> dispatchGenericMotionEvent ${ev}")
ev?.action?.let { action ->
when(action) {
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
}
- MotionEvent.ACTION_HOVER_MOVE ->{return false}
MotionEvent.ACTION_BUTTON_PRESS ->{
if (actionButtonPressX * actionButtonPressY == 0f) {
actionButtonPressX = ev.x ?: 0f
actionButtonPressY = ev.y ?: 0f
}
- return true
+// if (onExit) return true
+ return false
}
- MotionEvent.ACTION_BUTTON_RELEASE ->{
- if (actionButtonPressY == ev.y) {
+ MotionEvent.ACTION_BUTTON_RELEASE -> {
+ 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().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) {
- BLog.LOGE("Arrow Right Click")
+ Blog.LOGE("Arrow Right Click")
} else {
- BLog.LOGE("Arrow Left Click")
+ Blog.LOGE("Arrow Left Click")
}
} else {
if (actionButtonPressY.minus(ev.y ?: 0f) > 0f) {
- BLog.LOGE("Arrow Down Click")
+ Blog.LOGE("Arrow Down Click")
} else {
- BLog.LOGE("Arrow Up Click")
+ Blog.LOGE("Arrow Up Click")
}
}
+// if (onExit) return true
return false
}
- MotionEvent.ACTION_HOVER_EXIT ->{
+ MotionEvent.ACTION_HOVER_EXIT -> {
actionButtonPressX = 0f
actionButtonPressY = 0f
+ onExit = true
return false
}
else -> {return false}
+ }.apply {
+ lastAction = action
}
}
}
@@ -382,10 +390,7 @@ internal class LauncherActivity : AppCompatActivity() {
}
override fun onNewIntent(intent: Intent?) {
-
-
- BLog.LOGE("onNewIntent intent >> ${intent}")
-
+ Blog.LOGE("onNewIntent intent >> ${intent}")
if(intent?.action?.equals(Intent.ACTION_SEND) == true &&
intent?.hasExtra(Intent.EXTRA_TEXT) == true) {
intent?.getStringExtra(Intent.EXTRA_TEXT)?.let {
@@ -394,8 +399,8 @@ internal class LauncherActivity : AppCompatActivity() {
if(string.startsWith("http")) {
try {
string.toUri()?.let { uri ->
- BLog.LOGE("onNewIntent string uri.lastPathSegment >>>>> ${uri.host}")
- BLog.LOGE("onNewIntent string uri.lastPathSegment >>>>> ${uri.lastPathSegment}")
+ Blog.LOGE("onNewIntent string uri.lastPathSegment >>>>> ${uri.host}")
+ Blog.LOGE("onNewIntent string uri.lastPathSegment >>>>> ${uri.lastPathSegment}")
}
} catch (e: Exception) {
@@ -405,8 +410,8 @@ internal class LauncherActivity : AppCompatActivity() {
} else {
try {
it.toUri()?.let { uri ->
- BLog.LOGE("onNewIntent it uri.lastPathSegment >>>>> ${uri.host}")
- BLog.LOGE("onNewIntent it uri.lastPathSegment >>>>> ${uri.lastPathSegment}")
+ Blog.LOGE("onNewIntent it uri.lastPathSegment >>>>> ${uri.host}")
+ Blog.LOGE("onNewIntent it uri.lastPathSegment >>>>> ${uri.lastPathSegment}")
}
} catch (e: Exception) {
@@ -416,7 +421,7 @@ internal class LauncherActivity : AppCompatActivity() {
// BLog.LOGE("onNewIntent intent?.dataString >> ${intent?.dataString}")
// BLog.LOGE("onNewIntent intent?.data >> ${intent?.data}")
} 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(
@@ -433,7 +438,7 @@ internal class LauncherActivity : AppCompatActivity() {
} else {
intent?.extras?.keySet()?.forEach {
try {
- BLog.LOGE(
+ Blog.LOGE(
"onNewIntent :: key >> ${it} :: value >> ${
intent?.extras?.getString(
it
@@ -478,13 +483,13 @@ internal class LauncherActivity : AppCompatActivity() {
/* if this is the first launch,
then remember the event and show the welcome dialog */
- welcomeDialog()
+
home = binding.home.getFragment()
/* handle navigation back events */
handleBackPress()
- val cn: ComponentName = ComponentName(this, NLService::class.java)
+ val cn = ComponentName(this, NLService::class.java)
val n = applicationContext.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
if (n.isNotificationListenerAccessGranted(cn)) {
} else {
@@ -508,14 +513,7 @@ internal class LauncherActivity : AppCompatActivity() {
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() {
super.onDestroy()
@@ -529,16 +527,18 @@ internal class LauncherActivity : AppCompatActivity() {
blutoothManager?.initBluetoothAdapter()
blutoothManager?.blueToothState()
blutoothManager?.getPairedDevices()
- BLog.LOGE("LauncherActivity onStart()")
+ Blog.LOGE("LauncherActivity onStart()")
statusBarView()
setBgColor()
+ welcomeDialog()
}
@RequiresApi(Build.VERSION_CODES.O_MR1)
override fun onResume() {
super.onResume()
+
blutoothManager?.getPairedDevices()
- BLog.LOGE("LauncherActivity onResume")
+ Blog.LOGE("LauncherActivity onResume")
}
private fun welcomeDialog() {
@@ -560,8 +560,17 @@ internal class LauncherActivity : AppCompatActivity() {
) {
true
} 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 {
if (it.getBoolean(KEY_FIRST_LAUNCH, true) || needAsk) {
it.edit().putBoolean(KEY_FIRST_LAUNCH, false).apply()
@@ -584,6 +593,8 @@ internal class LauncherActivity : AppCompatActivity() {
/* ask for the permissions */
private fun askPermissions() {
/* phone permission */
+ val cn = ComponentName(this, NLService::class.java)
+ val n = applicationContext.getSystemService(NOTIFICATION_SERVICE) as NotificationManager
if (
this.checkSelfPermission(Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED ||
@@ -625,6 +636,21 @@ internal class LauncherActivity : AppCompatActivity() {
.setData(Uri.parse("package:" + this.packageName))
.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() {
- if(supportFragmentManager.findFragmentByTag("AppDrawer") == null){
- 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
- }
+ startActivity(Intent(this,AppDrawer::class.java))
}
@@ -710,13 +722,11 @@ internal class LauncherActivity : AppCompatActivity() {
}
}
- fun openSearchMenus(keyword : String, dismissCalback: DismissCalback) {
- SearchMenu().show(supportFragmentManager,keyword) {dismissCalback?.invoke()}
- }
+
class EndCallReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
- BLog.LOGE("EndCallReceiver >>> ${intent}")
+ Blog.LOGE("EndCallReceiver >>> ${intent}")
val phoneState = intent.getStringExtra(TelephonyManager.EXTRA_STATE) ?: return
if (phoneState == TelephonyManager.EXTRA_STATE_IDLE) {
refreshDeviceData()
@@ -725,7 +735,7 @@ internal class LauncherActivity : AppCompatActivity() {
}
class SMSReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
- BLog.LOGE("SMSReceiver >>> ${intent}")
+ Blog.LOGE("SMSReceiver >>> ${intent}")
refreshDeviceData()
}
}
@@ -740,282 +750,282 @@ internal class LauncherActivity : AppCompatActivity() {
var callBack : CommadCallabck? = null
var isF = false
- fun doWebParseStart(url : String, callBack :CommadCallabck?) {
- isF = false
- this.callBack = callBack
- binding.searcher01.post { binding.searcher01.visibility = View.VISIBLE }
- BLog.LOGE("binding.otherCheck before ThreadRun")
- binding.searcher01.webViewClient = object : WebViewClient() {
- override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
- BLog.LOGE("binding.otherCheck before ${url}")
- if ((url?.contains("guru") == true || url?.contains("missav") == true) && !isF) {
- BLog.LOGE("binding.otherCheck before reload")
- view?.loadUrl(url!!)
- isF = true
- 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)
+// fun doWebParseStart(url : String, callBack :CommadCallabck?) {
+// isF = false
+// this.callBack = callBack
+// binding.searcher01.post { binding.searcher01.visibility = View.VISIBLE }
+// BLog.LOGE("binding.otherCheck before ThreadRun")
+// binding.searcher01.webViewClient = object : WebViewClient() {
+// override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
+// BLog.LOGE("binding.otherCheck before ${url}")
+// if ((url?.contains("guru") == true || url?.contains("missav") == true) && !isF) {
+// BLog.LOGE("binding.otherCheck before reload")
+// view?.loadUrl(url!!)
+// isF = true
+// return false
// }
- if (url?.contains("youtube", false) == true) {
- view?.evaluateJavascript(
- "function getAll() {\n" +
- " MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" +
- " };getAll()"
- ) { result ->
- (result as? String)?.let {}
- }
- } else if(url?.contains("translate.google.com") == true) {
- binding.searcher01.postDelayed({
- binding.searcher01.evaluateJavascript(
- "function getAll() {\n" +
- " MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" +
- " };getAll()"
- ) { result ->
- (result as? String)?.let {}
- }
- }, 6000L)
- } else if (url?.contains("guru", true) == true) {
- if (!isF) {
- 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 {}
- }
- }
- if (isF) this@LauncherActivity.callBack?.collectComplete()
- }
- }
- WebView.setWebContentsDebuggingEnabled(false)
- binding.searcher01.apply {
-// Jsoup.connect("https://missav.com/dm11/ko").userAgent()
-// .timeout(30000).get()?.apply {
-// BLog.LOGE("Jsoup.connect(missAv).get() ${this}")
+// 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) {
+// view?.evaluateJavascript(
+// "function getAll() {\n" +
+// " MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" +
+// " };getAll()"
+// ) { result ->
+// (result as? String)?.let {}
+// }
+// } else if(url?.contains("translate.google.com") == true) {
+// binding.searcher01.postDelayed({
+// binding.searcher01.evaluateJavascript(
+// "function getAll() {\n" +
+// " MyJavaScriptInterface.sendValueFromHtml(document.getElementsByTagName('html')[0].innerHTML)" +
+// " };getAll()"
+// ) { result ->
+// (result as? String)?.let {}
+// }
+// }, 6000L)
+// } else if (url?.contains("guru", true) == true) {
+// if (!isF) {
+// 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 {
- this.removeJavascriptInterface("MyJavaScriptInterface")
- }catch (e :Exception) {}
- this.addJavascriptInterface(MyJavaScriptInterface(this),"MyJavaScriptInterface")
- setBackgroundColor(Color.WHITE) // 백그라운드 색상 설정
- setLayerType(View.LAYER_TYPE_SOFTWARE, null) // 랜더링 이슈 해결
- try {
- settings.apply {
- 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 // 자바스크립트 사용 가능하도록 설정
- loadWithOverviewMode = true // 전체 웹페이지를 화면에 맞게 로드
- useWideViewPort = true // 화면에 맞게 페이지 확대/축소
- domStorageEnabled = true // DOM 저장소 사용 가능하도록 설정
- setSupportMultipleWindows(true)
- javaScriptCanOpenWindowsAutomatically = true // 팝업창 차단 해제
- 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) // 웹페이지 연결
- }
- }
- }
+// if (isF) this@LauncherActivity.callBack?.collectComplete()
+// }
+// }
+// WebView.setWebContentsDebuggingEnabled(false)
+// binding.searcher01.apply {
+//// Jsoup.connect("https://missav.com/dm11/ko").userAgent()
+//// .timeout(30000).get()?.apply {
+//// BLog.LOGE("Jsoup.connect(missAv).get() ${this}")
+//// }
+// try {
+// this.removeJavascriptInterface("MyJavaScriptInterface")
+// }catch (e :Exception) {}
+// this.addJavascriptInterface(MyJavaScriptInterface(this),"MyJavaScriptInterface")
+// setBackgroundColor(Color.WHITE) // 백그라운드 색상 설정
+// setLayerType(View.LAYER_TYPE_SOFTWARE, null) // 랜더링 이슈 해결
+// try {
+// settings.apply {
+// 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 // 자바스크립트 사용 가능하도록 설정
+// loadWithOverviewMode = true // 전체 웹페이지를 화면에 맞게 로드
+// useWideViewPort = true // 화면에 맞게 페이지 확대/축소
+// domStorageEnabled = true // DOM 저장소 사용 가능하도록 설정
+// setSupportMultipleWindows(true)
+// javaScriptCanOpenWindowsAutomatically = true // 팝업창 차단 해제
+// 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 minDate : Long = Long.MAX_VALUE
val triple = 1000L * 60L * 60L * 24L * 2L
val simpldateFormat = SimpleDateFormat("d MMM, yy", Locale.US)
- fun jGuruToday(doc: Document) {
- var temp = arrayListOf()
- doc.getElementsByTag("li").forEach {
- if (it.getElementsByTag("img").size > 0) {
- var title = it.getElementsByTag("a").get(0).attr("title")
- var model = title.replace("[", "").split("]")[0]
- var pageLink = it.getElementsByTag("a").get(0).attr("href")
- var imgg = it.getElementsByTag("img").get(0).attr("src")
- 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) {
- temp.add(
- JGuru(
- model = model,
- title = title,
- pageLink = pageLink,
- image = imgg,
- tags = actor,
- date = beforeDay(Date(),3) + 360000
- ).getRssData()
- )
- }
- }
- }.apply {
- this@LauncherActivity.callBack?.collectComplete()
- WorkersDb.insertBulkInteface(temp)
- Toast.makeText(this@LauncherActivity,
- "Stored rank data", Toast.LENGTH_LONG).show()
- binding.searcher01?.post { binding.searcher01.loadUrl(jGuruMain) }
- }
- }
- fun jGuruMain(doc: Document) {
- var temp = arrayListOf()
- val prevUrl = doc.getElementsByClass("prev").get(0).getElementsByAttribute("href").get(0).attr("href")
- doc.getElementsByClass("column").forEach {
- var title = it.getElementsByAttribute("title").get(0).text()
- var model = title.replace("[","").split("]")[0]
- 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 tags = it.getElementsByClass("tags").get(0).text()
- var date = it.getElementsByClass("date").get(0).text()
- var regDate = simpldateFormat.parse(date).time
-
- minDate = Math.min(minDate,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())
- }.apply {
- var itemC = 0
- WorkersDb.insertBulkInteface(temp)
- callBack?.onConsoleLog("Stored data :: ${simpldateFormat.format(Date(minDate))} ~ ${simpldateFormat.format(Date(maxDate))} set in ${itemC}")
- binding.searcher01?.post { binding.searcher01.loadData("",null,null) }
- this@LauncherActivity.callBack?.collectComplete()
- }
- }
-
- fun jGuruTag(doc: Document) {
- doc.getElementsByTag("ul").forEach {
- it.children().forEach {
- if (it.tag().name.contains("li")) {
- listTags.add(
- jGuruTag(
- tagTitle = it.getElementsByTag("a").get(0).text(),
- link = it.getElementsByTag("a").get(0).attr("href")
- )
- )
-
- }
- }
- }.apply {
- binding.searcher01?.post { binding.searcher01.loadData("",null,null) }
- this@LauncherActivity.callBack?.collectComplete()
- }
- }
+// fun jGuruToday(doc: Document) {
+// var temp = arrayListOf()
+// doc.getElementsByTag("li").forEach {
+// if (it.getElementsByTag("img").size > 0) {
+// var title = it.getElementsByTag("a").get(0).attr("title")
+// var model = title.replace("[", "").split("]")[0]
+// var pageLink = it.getElementsByTag("a").get(0).attr("href")
+// var imgg = it.getElementsByTag("img").get(0).attr("src")
+// 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) {
+// temp.add(
+// JGuru(
+// model = model,
+// title = title,
+// pageLink = pageLink,
+// image = imgg,
+// tags = actor,
+// date = beforeDay(Date(),3) + 360000
+// ).getRssData()
+// )
+// }
+// }
+// }.apply {
+// this@LauncherActivity.callBack?.collectComplete()
+// WorkersDb.insertBulkInteface(temp)
+// Toast.makeText(this@LauncherActivity,
+// "Stored rank data", Toast.LENGTH_LONG).show()
+// binding.searcher01?.post { binding.searcher01.loadUrl(jGuruMain) }
+// }
+// }
+// fun jGuruMain(doc: Document) {
+// var temp = arrayListOf()
+// val prevUrl = doc.getElementsByClass("prev").get(0).getElementsByAttribute("href").get(0).attr("href")
+// doc.getElementsByClass("column").forEach {
+// var title = it.getElementsByAttribute("title").get(0).text()
+// var model = title.replace("[","").split("]")[0]
+// 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 tags = it.getElementsByClass("tags").get(0).text()
+// var date = it.getElementsByClass("date").get(0).text()
+// var regDate = simpldateFormat.parse(date).time
+//
+// minDate = Math.min(minDate,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())
+// }.apply {
+// var itemC = 0
+// WorkersDb.insertBulkInteface(temp)
+// callBack?.onConsoleLog("Stored data :: ${simpldateFormat.format(Date(minDate))} ~ ${simpldateFormat.format(Date(maxDate))} set in ${itemC}")
+// binding.searcher01?.post { binding.searcher01.loadData("",null,null) }
+// this@LauncherActivity.callBack?.collectComplete()
+// }
+// }
+//
+// fun jGuruTag(doc: Document) {
+// doc.getElementsByTag("ul").forEach {
+// it.children().forEach {
+// if (it.tag().name.contains("li")) {
+// listTags.add(
+// jGuruTag(
+// tagTitle = it.getElementsByTag("a").get(0).text(),
+// link = it.getElementsByTag("a").get(0).attr("href")
+// )
+// )
+//
+// }
+// }
+// }.apply {
+// binding.searcher01?.post { binding.searcher01.loadData("",null,null) }
+// this@LauncherActivity.callBack?.collectComplete()
+// }
+// }
fun switchFeeds() {
- Feeds().show(supportFragmentManager, "Feeds")
+ startActivity(Intent(this,Feeds::class.java))
}
- inner class MyJavaScriptInterface(val webView: WebView) {
- @JavascriptInterface
- fun sendValueFromHtml(result: String) {
- if (lastedFinishedPageUrl.contains(jGuruMain)) {
- var htmlString = result.replace("\\u003","<")
- val doc: Document = Jsoup.parse(htmlString)
- if (lastedFinishedPageUrl?.contains("page") == true || lastedFinishedPageUrl?.equals(jGuruMain) == true) {
- jGuruMain(doc)
- } else if (lastedFinishedPageUrl?.contains("/most-watched-rank") == true) {
- jGuruToday(doc)
- } else if (lastedFinishedPageUrl?.contains("/tags/") == true) {
- jGuruTag(doc)
- }
- } else if (lastedFinishedPageUrl?.contains("missav")==true) {
- val doc: Document = Jsoup.parse(result)
- var temp = arrayListOf()
- 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 &&
- miss_li.getElementsByTag("img").get(0).attr("data-src").startsWith("https") &&
- 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 title = miss_li.getElementsByClass("text-secondary group-hover:text-primary").getT()
- var thumb = miss_li.getElementsByTag("img").get(0).attr("data-src")
- var desc = miss_li.getElementsByTag("img").get(0).text()
- MissD().apply {
- this.link = link
- this.title = title
- this.thumb = thumb
- this.desc = desc
- temp.add(this.getRssData())
- }
- }
- }.apply {
- WorkersDb.insertBulkData(temp)
- }
- } else if(lastedFinishedPageUrl?.contains("https://translate.google.com") == true){
- callBackHandler.removeCallbacks(postNext)
- val doc: Document = Jsoup.parse(result)
- doc.getElementsByTag("span").forEach { span ->
-// BLog.LOGE("on getHangule ${span.text()}")
- if(span.hasAttr("jsaction") &&
- span.attr("jsaction").contains("mouseout") &&
- span.attr("jsaction").contains("contextmenu") &&
- span.attr("jsaction").contains("click") &&
- span.attr("jsaction").contains("mouseover")
- ) {
- BLog.LOGE("on getHangule $span")
- val resultString = span.text()
- if (resultString != null && resultString.length > 0) {
- callBackHandler.removeCallbacks(postNext)
- callBack?.onConsoleLog("result::${span.text()}")
- callBack = null
- }
- }
- }.apply {
- callBackHandler.removeCallbacks(postNext)
- callBackHandler.postDelayed(postNext,25000L)
- }
- } else {
- val doc: Document = Jsoup.parse(result)
- callBack?.onConsoleLog("lastedFinishedPageUrl >>> ${doc}")
- }
- BLog.LOGE("binding.otherCheck after ThreadRun")
- }
-
- }
+ // inner class MyJavaScriptInterface(val webView: WebView) {
+// @JavascriptInterface
+// fun sendValueFromHtml(result: String) {
+// if (lastedFinishedPageUrl.contains(jGuruMain)) {
+// var htmlString = result.replace("\\u003","<")
+// val doc: Document = Jsoup.parse(htmlString)
+// if (lastedFinishedPageUrl?.contains("page") == true || lastedFinishedPageUrl?.equals(jGuruMain) == true) {
+// jGuruMain(doc)
+// } else if (lastedFinishedPageUrl?.contains("/most-watched-rank") == true) {
+// jGuruToday(doc)
+// } else if (lastedFinishedPageUrl?.contains("/tags/") == true) {
+// jGuruTag(doc)
+// }
+// } else if (lastedFinishedPageUrl?.contains("missav")==true) {
+// val doc: Document = Jsoup.parse(result)
+// var temp = arrayListOf()
+// 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 &&
+// miss_li.getElementsByTag("img").get(0).attr("data-src").startsWith("https") &&
+// 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 title = miss_li.getElementsByClass("text-secondary group-hover:text-primary").getT()
+// var thumb = miss_li.getElementsByTag("img").get(0).attr("data-src")
+// var desc = miss_li.getElementsByTag("img").get(0).text()
+// MissD().apply {
+// this.link = link
+// this.title = title
+// this.thumb = thumb
+// this.desc = desc
+// temp.add(this.getRssData())
+// }
+// }
+// }.apply {
+// WorkersDb.insertBulkData(temp)
+// }
+// } else if(lastedFinishedPageUrl?.contains("https://translate.google.com") == true){
+// callBackHandler.removeCallbacks(postNext)
+// val doc: Document = Jsoup.parse(result)
+// doc.getElementsByTag("span").forEach { span ->
+//// BLog.LOGE("on getHangule ${span.text()}")
+// if(span.hasAttr("jsaction") &&
+// span.attr("jsaction").contains("mouseout") &&
+// span.attr("jsaction").contains("contextmenu") &&
+// span.attr("jsaction").contains("click") &&
+// span.attr("jsaction").contains("mouseover")
+// ) {
+// BLog.LOGE("on getHangule $span")
+// val resultString = span.text()
+// if (resultString != null && resultString.length > 0) {
+// callBackHandler.removeCallbacks(postNext)
+// callBack?.onConsoleLog("result::${span.text()}")
+// callBack = null
+// }
+// }
+// }.apply {
+// callBackHandler.removeCallbacks(postNext)
+// callBackHandler.postDelayed(postNext,25000L)
+// }
+// } else {
+// val doc: Document = Jsoup.parse(result)
+// callBack?.onConsoleLog("lastedFinishedPageUrl >>> ${doc}")
+// }
+// BLog.LOGE("binding.otherCheck after ThreadRun")
+// }
+//
+// }
var postNext : Runnable = Runnable{
callBack?.collectComplete()
}
@@ -1068,7 +1078,7 @@ fun openYouTube(schemeString : String) {
}
fun openReddit(schemeString : String) {
- BLog.LOGE("schemeString >>>> ${schemeString}")
+ Blog.LOGE("schemeString >>>> ${schemeString}")
var uri = schemeString.toUri()
val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
@@ -1083,9 +1093,9 @@ fun openReddit(schemeString : String) {
fun openDotax(schemeString : String) {
val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW)
- mapIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
- mapIntent.addCategory(Intent.CATEGORY_BROWSABLE)
- mapIntent.setPackage("net.daum.android.cafe")
+// mapIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP)
+// mapIntent.addCategory(Intent.CATEGORY_BROWSABLE)
+// mapIntent.setPackage("net.daum.android.cafe")
mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
// mapIntent.setPackage("com.android.chrome")
mapIntent.setData(gmmIntentUri)
@@ -1094,7 +1104,7 @@ fun openDotax(schemeString : String) {
fun openOpera(schemeString : String) {
- BLog.LOGE("openOpera ${schemeString}")
+ Blog.LOGE("openOpera ${schemeString}")
val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/LunaticLauncher.kt b/app/src/main/kotlin/bums/lunatic/launcher/LunaticLauncher.kt
index daec1da6..41ea9472 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/LunaticLauncher.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/LunaticLauncher.kt
@@ -23,6 +23,7 @@ import android.content.ComponentCallbacks2
import android.content.Context
import android.database.sqlite.SQLiteDatabase
import bums.lunatic.launcher.helpers.PrefHelper
+import kr.lunaticbum.Base
internal class LunaticLauncher : Application() {
@@ -33,6 +34,7 @@ internal class LunaticLauncher : Application() {
override fun onCreate() {
super.onCreate()
appContext = this
+ Base.initialize(this)
PrefHelper.initialize(this)
}
override fun onTrimMemory(level: Int) {
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/apps/AppDrawer.kt b/app/src/main/kotlin/bums/lunatic/launcher/apps/AppDrawer.kt
index 67c87a00..ca54da32 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/apps/AppDrawer.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/apps/AppDrawer.kt
@@ -18,7 +18,6 @@
package bums.lunatic.launcher.apps
-import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
@@ -30,19 +29,14 @@ import android.os.Bundle
import android.os.Handler
import android.os.Looper
import android.view.KeyEvent
-import android.view.LayoutInflater
-import android.view.View
import android.view.View.GONE
import android.view.View.VISIBLE
-import android.view.ViewGroup
import android.view.inputmethod.InputMethodManager
import androidx.core.widget.doOnTextChanged
-import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.GridLayoutManager
import bums.lunatic.launcher.BuildConfig
-import bums.lunatic.launcher.CommadCallabck
-import bums.lunatic.launcher.LauncherActivity
-import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
+import bums.lunatic.launcher.common.CommonActivity
+import bums.lunatic.launcher.common.letTrue
import bums.lunatic.launcher.databinding.AppDrawerBinding
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_APPS_COUNT
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.PrefBoolean
import bums.lunatic.launcher.helpers.PrefLong
-import bums.lunatic.launcher.helpers.letTrue
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.workers.WorkersDb
import io.realm.kotlin.ext.query
@@ -65,7 +58,7 @@ import java.util.concurrent.TimeUnit
import java.util.regex.Pattern
-internal class AppDrawer : Fragment() {
+internal class AppDrawer : CommonActivity() {
private lateinit var binding: AppDrawerBinding
private var layoutType: Int = 0
@@ -104,28 +97,29 @@ internal class AppDrawer : Fragment() {
}
}
-
+ fun getInputText() = binding.searchInput.text.toString()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- packageManager = lActivity?.packageManager!!
- }
+// setStyle(STYLE_NO_TITLE, R.style.FilterFullScreenDialog)
+// packageManager = lActivity?.packageManager!!
+// }
- override fun onAttach(context: Context) {
- super.onAttach(context)
- }
+// override fun onAttach(context: Context) {
+// super.onAttach(context)
+//// }
+//
+//
+//
+// override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
- fun getInputText() = binding.searchInput.text.toString()
-
- override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
-
- binding = AppDrawerBinding.inflate(inflater, container, false)
-
- settingsPrefs = requireContext().getSharedPreferences(PREFS_SETTINGS, 0)
- appNamesPrefs = requireContext().getSharedPreferences(PREFS_APP_NAMES, 0)
+ binding = AppDrawerBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+ settingsPrefs = this.getSharedPreferences(PREFS_SETTINGS, 0)
+ appNamesPrefs = this.getSharedPreferences(PREFS_APP_NAMES, 0)
layoutType = settingsPrefs!!.getInt(KEY_APPS_LAYOUT, 0)
- appsAdapter = AppsAdapter(layoutType, packageManager!!, childFragmentManager, binding.appsCount)
- contactAdapter = ContactAdapter(packageManager!!, childFragmentManager)
+ appsAdapter = AppsAdapter(layoutType, packageManager!!, supportFragmentManager, binding.appsCount)
+ contactAdapter = ContactAdapter(packageManager!!, supportFragmentManager)
binding.appsCount.visibility = if (settingsPrefs!!.getBoolean(KEY_APPS_COUNT, true)) VISIBLE else GONE
binding.searchNmap.setOnClickListener {
@@ -176,44 +170,6 @@ internal class AppDrawer : Fragment() {
// openSearchApps("kakaot://taxi?dest_addr=${URLEncoder.encode("세곡동 557")}","com.kakao.taxi")
}
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()
- val contactList = arrayListOf()
-
- 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 ->
//contactList.size < 1 && packageList.size < 1 &&
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) }
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()
+ val contactList = arrayListOf()
+
+ 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) {
- lActivity?.openSearchMenus(keyword) {
+ openSearchMenus(keyword) {
registCancelSearch()
}
}
@@ -284,21 +273,19 @@ internal class AppDrawer : Fragment() {
override fun onResume() {
super.onResume()
- BLog.LOGE("onResume")
+ Blog.LOGE("onResume")
fetchApps()
binding.appsCount.visibility = if (PrefBoolean.showAppResultCount.get(false)) VISIBLE else GONE
- if (isAdded && isVisible) {
- PrefBoolean.openWithKayboard.get().letTrue { openSearch() }
- registCancelSearch()
- }
-// BLog.LOGE("onResume after chechHandler.postDelayed(cancelSearch, 3000L)")
+
+ PrefBoolean.openWithKayboard.get().letTrue { openSearch() }
+ registCancelSearch()
}
val chechHandler = Handler(Looper.getMainLooper())
val cancelSearch = Runnable {
-// lActivity?.viewPager?.currentItem = 1
+ finish()
}
fun registCancelSearch() {
@@ -316,8 +303,8 @@ internal class AppDrawer : Fragment() {
}
private fun setLayout() {
- binding.appsList.layoutManager = GridLayoutManager(requireContext(), 2, GridLayoutManager.HORIZONTAL,false)
- binding.contactList.layoutManager = GridLayoutManager(requireContext(), 2, GridLayoutManager.HORIZONTAL,false)
+ binding.appsList.layoutManager = GridLayoutManager(this, 2, GridLayoutManager.HORIZONTAL,false)
+ binding.contactList.layoutManager = GridLayoutManager(this, 2, GridLayoutManager.HORIZONTAL,false)
/* initialize apps list adapter */
binding.appsList.adapter = appsAdapter
binding.contactList.adapter = contactAdapter
@@ -388,7 +375,7 @@ internal class AppDrawer : Fragment() {
}
fun getHangule() {
- BLog.LOGE("on getHangule")
+ Blog.LOGE("on getHangule")
Executors.newSingleThreadScheduledExecutor().schedule({
if (appNames.size > 0) {
val info = appNames.first()
@@ -396,7 +383,7 @@ internal class AppDrawer : Fragment() {
if (info.koreanName?.length ?: 0 > 0 || info.appNameChosung?.length ?: 0 > 0) {
getHangule()
} else {
- BLog.LOGE("on getHangule ${info.appName}")
+ Blog.LOGE("on getHangule ${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 ->
// BLog.LOGE("on getHangule ${trans.title()}")
@@ -414,35 +401,35 @@ internal class AppDrawer : Fragment() {
// }.apply {
// getHangule()
// }
- Handler(Looper.getMainLooper()).post {
- LauncherActivity.Companion.lActivity?.doWebParseStart(
- "https://translate.google.com/?hl=ko&sl=en&tl=ko&text=${info.appName}&op=translate",
- object : CommadCallabck {
- override fun onConsoleLog(log: String) {
- if (log.contains("result::")) {
- val appHangulName = log.split("result::")[1]
- if(appHangulName?.length ?: 0 > 0) {
- info.appNameChosung = JamoUtils.split(appHangulName).joinToString("")
- info.koreanName = appHangulName
-// BLog.LOGE("appHangulName >>> $appHangulName")
-// BLog.LOGE("appHangulName >>> ${info.appNameChosung}")
- WorkersDb.update(info)
- getHangule()
- }
- }
- }
-
- override fun collectComplete() {
- getHangule()
- }
- })
- }
+// Handler(Looper.getMainLooper()).post {
+// LauncherActivity.Companion.lActivity?.doWebParseStart(
+// "https://translate.google.com/?hl=ko&sl=en&tl=ko&text=${info.appName}&op=translate",
+// object : CommadCallabck {
+// override fun onConsoleLog(log: String) {
+// if (log.contains("result::")) {
+// val appHangulName = log.split("result::")[1]
+// if(appHangulName?.length ?: 0 > 0) {
+// info.appNameChosung = JamoUtils.split(appHangulName).joinToString("")
+// info.koreanName = appHangulName
+//// BLog.LOGE("appHangulName >>> $appHangulName")
+//// BLog.LOGE("appHangulName >>> ${info.appNameChosung}")
+// WorkersDb.update(info)
+// getHangule()
+// }
+// }
+// }
+//
+// override fun collectComplete() {
+// getHangule()
+// }
+// })
+// }
} else {
info.appNameChosung = JamoUtils.split(info.appName).joinToString("")
info.koreanName = info.appName
WorkersDb.update(info)
getHangule()
- BLog.LOGE("on getHangule to next")
+ Blog.LOGE("on getHangule to next")
}
}
}
@@ -482,16 +469,14 @@ internal class AppDrawer : Fragment() {
fun openSearch() {
try {
- if(isAdded && isVisible) {
- binding.searchInput.apply {
- visibility = VISIBLE
- requestFocus()
- let {
- (lActivity?.getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager)?.showSoftInput(
- it,
- InputMethodManager.SHOW_IMPLICIT
- )
- }
+ binding.searchInput.apply {
+ visibility = VISIBLE
+ requestFocus()
+ let {
+ (getSystemService(Context.INPUT_METHOD_SERVICE) as? InputMethodManager)?.showSoftInput(
+ it,
+ InputMethodManager.SHOW_IMPLICIT
+ )
}
}
} catch (e : UninitializedPropertyAccessException) {
@@ -504,7 +489,7 @@ internal class AppDrawer : Fragment() {
binding.searchInput.apply {
let {
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)
}
}
}
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/apps/AppMenu.kt b/app/src/main/kotlin/bums/lunatic/launcher/apps/AppMenu.kt
index c15ee2f1..20b339e5 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/apps/AppMenu.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/apps/AppMenu.kt
@@ -104,7 +104,7 @@ internal class AppMenu : BottomSheetDialogFragment() {
var result = query("pkgName == $0", packageName).find()
if (result.size > 0) {
val app = result.first()
- delete(app)
+ app.currentInstalled = false
}
}
dismiss()
@@ -124,6 +124,7 @@ internal class AppMenu : BottomSheetDialogFragment() {
binding.totalTouch.text = "총 실행 횟수 : ".plus(app.clickCount.toString())
binding.lastTouchDate.text =
"최종 실행 일시 : ".plus(SimpleDateFormat("yyyy-MM-dd HH:mm").format(Date(app.lastUseDate)))
+ app.currentInstalled = true
binding.alterName.setText(app.koreanName)
// app.clickCount = app.clickCount + 15
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/apps/AppsAdapter.kt b/app/src/main/kotlin/bums/lunatic/launcher/apps/AppsAdapter.kt
index c8865ebf..e732d6f8 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/apps/AppsAdapter.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/apps/AppsAdapter.kt
@@ -33,7 +33,7 @@ import bums.lunatic.launcher.R
import bums.lunatic.launcher.apps.IconPackManager.Companion.getDrawableIconForPackage
import bums.lunatic.launcher.databinding.AppsChildBinding
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 io.realm.kotlin.ext.query
import kotlinx.coroutines.MainScope
@@ -81,7 +81,7 @@ internal class AppsAdapter(
setOnClickListener {
WorkersDb.getRealm().apply {
writeBlocking {
- BLog.LOGE("item.pkgName >>>> ${item.pkgName
+ Blog.LOGE("item.pkgName >>>> ${item.pkgName
}")
var result = query("pkgName == $0",item.pkgName).find()
if(result.size > 0) {
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/apps/ContactMenu.kt b/app/src/main/kotlin/bums/lunatic/launcher/apps/ContactMenu.kt
index 480afa74..39fe6187 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/apps/ContactMenu.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/apps/ContactMenu.kt
@@ -27,7 +27,7 @@ import android.view.View
import android.view.ViewGroup
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
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 com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
@@ -82,7 +82,7 @@ internal class ContactMenu : BottomSheetDialogFragment() {
ContactsContract.CommonDataKinds.Phone.NUMBER,
)
- BLog.LOGE("GetContact", "packageName ${contactId}")
+ Blog.LOGE("GetContact", "packageName ${contactId}")
try {
val cursor = resolver.query(phoneUri, projection, ContactsContract.CommonDataKinds.Phone.CONTACT_ID + " = " + contactId, null , null)
if (cursor != null) {
@@ -92,7 +92,7 @@ internal class ContactMenu : BottomSheetDialogFragment() {
contactName = cursor.getString(nameIndex)
var number = cursor.getString(numberIndex)
contactPhoneNumber = number.replace("-", "")
- BLog.LOGE("GetContact", "이름 : $contactName 번호 : $contactPhoneNumber ")
+ Blog.LOGE("GetContact", "이름 : $contactName 번호 : $contactPhoneNumber ")
}
}
// 데이터 계열은 반드시 닫아줘야 한다.
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/apps/IconPackManager.kt b/app/src/main/kotlin/bums/lunatic/launcher/apps/IconPackManager.kt
index dcfa768d..ee4566d9 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/apps/IconPackManager.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/apps/IconPackManager.kt
@@ -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.PREFS_PKGICS
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 kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
@@ -79,7 +79,7 @@ internal class IconPackManager {
}
} catch (e: IOException) {
e.printStackTrace()
- BLog.w("", "Couldn't find the appfilter.xml file")
+ Blog.w("", "Couldn't find the appfilter.xml file")
}
}
if (xpp != null) {
@@ -118,9 +118,9 @@ internal class IconPackManager {
}
loaded = true
} catch (e: PackageManager.NameNotFoundException) {
- BLog.w("", "Failed to load the icon pack")
+ Blog.w("", "Failed to load the icon pack")
} catch (e: XmlPullParserException) {
- BLog.w("", "Failed to parse the appfilter.xml file")
+ Blog.w("", "Failed to parse the appfilter.xml file")
} catch (e: IOException) {
e.printStackTrace()
}
@@ -193,7 +193,7 @@ internal class IconPackManager {
var componentName: String? = null
componentName = packagesConponentNames.get(appPackageName!!)
if (componentName == null || componentName.length ?: 0 <= 0 ) {
- BLog.LOGE("it's compo ${appPackageName}")
+ Blog.LOGE("it's compo ${appPackageName}")
var pkgIntent =
lActivity!!.packageManager.getLaunchIntentForPackage(
appPackageName!!
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/apps/SearchMenu.kt b/app/src/main/kotlin/bums/lunatic/launcher/apps/SearchMenu.kt
index f1bf7109..42af7495 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/apps/SearchMenu.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/apps/SearchMenu.kt
@@ -29,8 +29,9 @@ import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import bums.lunatic.launcher.BuildConfig
+import bums.lunatic.launcher.common.DismissCalback
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.BottomSheetDialogFragment
@@ -131,16 +132,16 @@ internal class SearchMenu : BottomSheetDialogFragment() {
}
override fun dismiss() {
- BLog.LOGE("dismiss()")
+ Blog.LOGE("dismiss()")
mDismissCalback?.invoke()
super.dismiss()
}
override fun onDismiss(dialog: DialogInterface) {
- BLog.LOGE("onDismiss(dialog: DialogInterface)")
+ Blog.LOGE("onDismiss(dialog: DialogInterface)")
mDismissCalback?.invoke()
super.onDismiss(dialog)
}
}
-typealias DismissCalback = ()->Unit
+
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/common/CommonActivity.kt b/app/src/main/kotlin/bums/lunatic/launcher/common/CommonActivity.kt
new file mode 100644
index 00000000..ec23f4b6
--- /dev/null
+++ b/app/src/main/kotlin/bums/lunatic/launcher/common/CommonActivity.kt
@@ -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 {
+ var result = HashMap()
+ readFromFile(file).let { base64String ->
+ String(Base64.getMimeDecoder().decode(base64String.toByteArray()))?.let { jsonString ->
+ Blog.LOGE("jsonString >>>> ${jsonString }")
+ result = Gson().fromJson(
+ jsonString, object : TypeToken?>() {}.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
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/common/typeAlias.kt b/app/src/main/kotlin/bums/lunatic/launcher/common/typeAlias.kt
new file mode 100644
index 00000000..586cd6c5
--- /dev/null
+++ b/app/src/main/kotlin/bums/lunatic/launcher/common/typeAlias.kt
@@ -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()
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/feeds/Feeds.kt b/app/src/main/kotlin/bums/lunatic/launcher/feeds/Feeds.kt
index 0ad618b5..4ce4f4f4 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/feeds/Feeds.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/feeds/Feeds.kt
@@ -19,9 +19,6 @@
package bums.lunatic.launcher.feeds
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.Intent
import android.content.SharedPreferences
@@ -35,52 +32,35 @@ import android.speech.RecognizerIntent
import android.speech.SpeechRecognizer
import android.text.method.ScrollingMovementMethod
import android.view.ContextMenu
-import android.view.Gravity
import android.view.LayoutInflater
-import android.view.MenuItem
import android.view.View
import android.view.ViewGroup
import android.widget.EditText
-import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AlertDialog
-import androidx.appcompat.widget.PopupMenu
-import androidx.constraintlayout.widget.ConstraintLayout
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.LauncherActivity.Companion.appWidgetHost
-import bums.lunatic.launcher.LauncherActivity.Companion.appWidgetManager
import bums.lunatic.launcher.LauncherActivity.Companion.getCal
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.LauncherActivity.Companion.refreshDeviceData
import bums.lunatic.launcher.LauncherActivity.Companion.refreshFeeds
import bums.lunatic.launcher.R
+import bums.lunatic.launcher.common.CommonActivity
import bums.lunatic.launcher.databinding.FeedsBinding
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_IDS
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_WIDGETS
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.PrefHelper
import bums.lunatic.launcher.helpers.PrefString
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.RssData
import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType
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.RssList.jGuruMain
-import bums.lunatic.launcher.utils.RssList.plist
import bums.lunatic.launcher.utils.getJ
import bums.lunatic.launcher.workers.RecentCallGetter
import bums.lunatic.launcher.workers.RecentSmsGetter
@@ -91,8 +71,6 @@ import io.realm.kotlin.ext.query
import io.realm.kotlin.query.Sort
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
-import kotlinx.coroutines.delay
-import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import org.jsoup.Jsoup
import java.net.URLEncoder
@@ -100,7 +78,7 @@ import java.nio.charset.Charset
import java.util.Base64
-internal class Feeds : DialogFragment() , CommadCallabck {
+internal class Feeds : CommonActivity() , CommadCallabck {
private lateinit var binding: FeedsBinding
private val requestCodeString = "requestCode"
@@ -109,24 +87,14 @@ internal class Feeds : DialogFragment() , CommadCallabck {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
- setStyle(STYLE_NO_TITLE, R.style.FilterFullScreenDialog)
- }
-
-
- override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
- binding = FeedsBinding.inflate(inflater, container, false)
- mRssAdapter = RssAdapter(requireContext())
- mRssAdapter2 = RssAdapter(requireContext())
+ binding = FeedsBinding.inflate(layoutInflater)
+ setContentView(binding.root)
+ mRssAdapter = RssAdapter(this)
+ mRssAdapter2 = RssAdapter(this)
binding.feedsRss.rss.adapter = mRssAdapter
binding.feedsRss.rss2.adapter = mRssAdapter2
binding.consoleLog.movementMethod = ScrollingMovementMethod();
- updateWidgets()
- return binding.root
- }
-
- override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
- super.onViewCreated(view, savedInstanceState)
-
+// updateWidgets()
expandCollapse()
systemInfo()
}
@@ -146,13 +114,13 @@ internal class Feeds : DialogFragment() , CommadCallabck {
override fun onCreateContextMenu(menu: ContextMenu, v: View, menuInfo: ContextMenu.ContextMenuInfo?) {
super.onCreateContextMenu(menu, v, menuInfo)
menu.clearHeader()
- lActivity!!.menuInflater.inflate(R.menu.add_widget, menu)
+ menuInflater.inflate(R.menu.add_widget, menu)
}
- override fun onContextItemSelected(item: MenuItem): Boolean {
- if (item.itemId == R.id.add_widget) selectWidget()
- return super.onContextItemSelected(item)
- }
+// override fun onContextItemSelected(item: MenuItem): Boolean {
+// if (item.itemId == R.id.add_widget) selectWidget()
+// return super.onContextItemSelected(item)
+// }
/* control view's expand-collapse actions */
private fun expandCollapse() {
@@ -187,16 +155,16 @@ internal class Feeds : DialogFragment() , CommadCallabck {
binding.consoleLog.text = binding.consoleLog.text.toString() + "\n" + str
}
mMainHandler.postDelayed(hideConsole,10000L)
- BLog.LOGE("consoleLog >>>> ${str}")
+ Blog.LOGE("consoleLog >>>> ${str}")
}
fun openOpera(schemeString : String) {
- BLog.LOGE("openOpera ${schemeString}")
+ Blog.LOGE("openOpera ${schemeString}")
val gmmIntentUri = Uri.parse(schemeString)
val mapIntent = Intent(Intent.ACTION_VIEW, gmmIntentUri)
mapIntent.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
mapIntent.setPackage("com.opera.browser")
- lActivity?.startActivity(mapIntent)
+ startActivity(mapIntent)
}
override fun onConsoleLog(log: String) {
@@ -223,10 +191,10 @@ internal class Feeds : DialogFragment() , CommadCallabck {
binding.feedsRss.rss2.visibility = View.GONE
binding.feedsRss.loading.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")
- val viewInflated: View = LayoutInflater.from(context)
- .inflate(R.layout.text_inpu_password, view as ViewGroup?, false)
+ val viewInflated: View = LayoutInflater.from(this)
+ .inflate(R.layout.text_inpu_password, binding.root as ViewGroup?, false)
val input = viewInflated.findViewById(R.id.input) as EditText
builder.setView(viewInflated)
builder.setPositiveButton(android.R.string.ok,
@@ -338,7 +306,7 @@ internal class Feeds : DialogFragment() , CommadCallabck {
speechRecognizer = null
}
"sps"->{
- lActivity?.let { lActivity ->
+ let { lActivity ->
if (lActivity.checkSelfPermission(Manifest.permission.RECORD_AUDIO) != PackageManager.PERMISSION_GRANTED) {
lActivity.requestPermissions(arrayOf(Manifest.permission.RECORD_AUDIO), 1)
} else {
@@ -396,13 +364,13 @@ internal class Feeds : DialogFragment() , CommadCallabck {
var nations = arrayListOf()
CoroutineScope(Dispatchers.IO).launch {
"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 ->
table.children().forEach {
it.getElementsByTag("td").forEach { td ->
td.children().forEach {
if (it.tag().name.equals("a")) {
- BLog.LOGE("TD>>A ${it}")
+ Blog.LOGE("TD>>A ${it}")
it.text()
}
}
@@ -413,12 +381,12 @@ internal class Feeds : DialogFragment() , CommadCallabck {
}
}
"loc_ck" -> {
- FeedsResult().show(parentFragmentManager, "")
+ FeedsResult().show(supportFragmentManager, "")
}
"loc_on" -> {
PrefBoolean.location.set(!PrefBoolean.location.get())
consoleLog("PrefHelper.isLocationOn() >>> ${PrefBoolean.location.get()}")
- lActivity?.updateLocationService()
+ updateLocationService()
}
"cal" ->{
getCal()
@@ -477,93 +445,93 @@ internal class Feeds : DialogFragment() , CommadCallabck {
}
}
"jjp" -> {
-// lActivity?.doWebParseStart("https://projectjav.com") {}
+// doWebParseStart("https://projectjav.com") {}
}
"jmnew" -> {
-// lActivity?.doWebParseStart("https://missav.com/dm507/en/release") {}
+// doWebParseStart("https://missav.com/dm507/en/release") {}
}
"jmiss" -> {
-// lActivity?.doWebParseStart("https://missav.com/dm16/en") {}
+// doWebParseStart("https://missav.com/dm16/en") {}
}
- "jreq" -> {
- consoleLog("current j req() ${WorkersDb.getRealm()
- .query("category == $0", RssDataType.GURU.name).find().size}")
- CoroutineScope(Dispatchers.IO).launch {
- var isOk = false
-// plist.forEach {
- if (!isOk) {
- try {
- 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")
- .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("Connection", "keep-alive")
- .header("scheme", "https")
- .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("cache-control", "no-cache")
- .header("pragma", "no-cache")
- .header("upgrade-insecure-requests", "1")
- .ignoreContentType(true)
- .timeout(30000).execute().let {
- BLog.LOGE("DOC -> ${it}")
- isOk = true
- }
- } catch (e: Exception) {
- e.printStackTrace()
- }
- }
+// "jreq" -> {
+// consoleLog("current j req() ${WorkersDb.getRealm()
+// .query("category == $0", RssDataType.GURU.name).find().size}")
+// CoroutineScope(Dispatchers.IO).launch {
+// var isOk = false
+//// plist.forEach {
+// if (!isOk) {
+// try {
+// 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")
+// .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("Connection", "keep-alive")
+// .header("scheme", "https")
+// .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("cache-control", "no-cache")
+// .header("pragma", "no-cache")
+// .header("upgrade-insecure-requests", "1")
+// .ignoreContentType(true)
+// .timeout(30000).execute().let {
+// BLog.LOGE("DOC -> ${it}")
+// isOk = true
+// }
+// } catch (e: Exception) {
+// e.printStackTrace()
+// }
// }
- BLog.LOGE("last state ${isOk}")
- }
-// lActivity?.doWebParseStart(jGuruMain,callBack = object : CommadCallabck {
-// override fun onConsoleLog(log: String) {
-// this@Feeds.consoleLog(log)
-// }
-//
-// override fun collectComplete() {
-// consoleLog("excuted j req() ${WorkersDb.getRealm()
-// .query("category == $0", RssDataType.GURU.name).find().size}")
-// }
-// })
- }
-
- "jtag" -> {
-// lActivity?.doWebPare(TEST_PAG.plus("tags")) {
- binding.feedsRss.apply {
- rss2.adapter = mRssAdapter2
-
- loading.visibility = View.VISIBLE
- if (listTags.size > 0) {
- mRssAdapter2?.updateData(listTags)
- rss2.visibility = View.VISIBLE
- loading.visibility = View.GONE
- refresh.visibility = View.GONE
- } else {
- refresh.visibility = View.VISIBLE
- rss2.visibility = View.GONE
- refresh.setOnClickListener {
- lActivity?.doWebParseStart(jGuruMain.plus("tags"), callBack = object : CommadCallabck {
- override fun onConsoleLog(log: String) {
- this@Feeds.consoleLog(log)
- }
-
- override fun collectComplete() {
- if (listTags.size > 0) {
- rss2?.postDelayed({
- mRssAdapter2?.updateData(listTags)
- loading.visibility = View.GONE
- refresh.visibility = View.GONE
- rss2.visibility = View.VISIBLE
- }, 500L)
- }
- }
- })
- }
- }
- }
+//// }
+// BLog.LOGE("last state ${isOk}")
+// }
+//// doWebParseStart(jGuruMain,callBack = object : CommadCallabck {
+//// override fun onConsoleLog(log: String) {
+//// this@Feeds.consoleLog(log)
+//// }
+////
+//// override fun collectComplete() {
+//// consoleLog("excuted j req() ${WorkersDb.getRealm()
+//// .query("category == $0", RssDataType.GURU.name).find().size}")
+//// }
+//// })
+// }
+//
+// "jtag" -> {
+//// doWebPare(TEST_PAG.plus("tags")) {
+// binding.feedsRss.apply {
+// rss2.adapter = mRssAdapter2
+//
+// loading.visibility = View.VISIBLE
+// if (listTags.size > 0) {
+// mRssAdapter2?.updateData(listTags)
+// rss2.visibility = View.VISIBLE
+// loading.visibility = View.GONE
+// refresh.visibility = View.GONE
+// } else {
+// refresh.visibility = View.VISIBLE
+// rss2.visibility = View.GONE
+// refresh.setOnClickListener {
+// doWebParseStart(jGuruMain.plus("tags"), callBack = object : CommadCallabck {
+// override fun onConsoleLog(log: String) {
+// this@Feeds.consoleLog(log)
+// }
+//
+// override fun collectComplete() {
+// if (listTags.size > 0) {
+// rss2?.postDelayed({
+// mRssAdapter2?.updateData(listTags)
+// loading.visibility = View.GONE
+// refresh.visibility = View.GONE
+// rss2.visibility = View.VISIBLE
+// }, 500L)
+// }
+// }
+// })
+// }
+// }
+// }
+//// }
// }
- }
else -> {
binding.expandRss.isChecked = false
@@ -619,171 +587,171 @@ internal class Feeds : DialogFragment() , CommadCallabck {
private fun systemInfo() {
- viewLifecycleOwner.lifecycleScope.launch {
- repeatOnLifecycle(Lifecycle.State.RESUMED) {
- SystemStats().apply {
- intStorage(binding.feedsSysInfos.intParent)
- extStorage(binding.feedsSysInfos.extParent)
- while (isActive) {
- ram(binding.feedsSysInfos.ramParent)
- cpu(binding.feedsSysInfos.cpuParent)
- misc(binding.feedsSysInfos.misc)
- delay(1000)
- }
- }
- }
+// viewLifecycleOwner.lifecycleScope.launch {
+// repeatOnLifecycle(Lifecycle.State.RESUMED) {
+ SystemStats().apply {
+ intStorage(binding.feedsSysInfos.intParent)
+ extStorage(binding.feedsSysInfos.extParent)
+// while (isActive) {
+ ram(binding.feedsSysInfos.ramParent)
+ cpu(binding.feedsSysInfos.cpuParent)
+ misc(binding.feedsSysInfos.misc)
+// delay(1000)
+// }
}
}
+// }
+// }
- private fun selectWidget() {
- Intent(AppWidgetManager.ACTION_APPWIDGET_PICK).apply {
- putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetHost?.allocateAppWidgetId())
- putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_INFO, ArrayList())
- putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_EXTRAS, ArrayList())
- putExtra(requestCodeString, requestPickWidget)
- }.let { widgetPicker.launch(it) }
- }
+// private fun selectWidget() {
+// Intent(AppWidgetManager.ACTION_APPWIDGET_PICK).apply {
+// putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetHost?.allocateAppWidgetId())
+// putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_INFO, ArrayList())
+// putParcelableArrayListExtra(AppWidgetManager.EXTRA_CUSTOM_EXTRAS, ArrayList())
+// putExtra(requestCodeString, requestPickWidget)
+// }.let { widgetPicker.launch(it) }
+// }
- private val widgetPicker =
- registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
- val data = result.data
- val appWidgetId = data?.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1)
- if (result.resultCode == RESULT_OK) {
- when (data?.getIntExtra(requestCodeString, requestPickWidget)) {
- requestPickWidget -> configureWidget(appWidgetId!!)
- requestCreateWidget -> createWidget(appWidgetId!!, null)
- }
- } else if (result.resultCode == RESULT_CANCELED && data != null) {
- if (appWidgetId != -1) appWidgetHost?.deleteAppWidgetId(appWidgetId!!)
- }
- }
-
- private fun configureWidget(appWidgetId: Int) {
- when (val appWidgetConfig = appWidgetManager!!.getAppWidgetInfo(appWidgetId).configure) {
- null -> createWidget(appWidgetId, null)
- else -> {
- Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE).apply {
- component = appWidgetConfig
- putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
- putExtra(requestCodeString, requestCreateWidget)
- }.let {
- try { widgetPicker.launch(it) }
- catch (e: Exception) { e.printStackTrace() }
- }
- }
- }
- }
-
- private fun createWidget(appWidgetId: Int, height: Int?) {
- if (appWidgetId == -1) return
-
- val appWidgetInfo = appWidgetManager!!.getAppWidgetInfo(appWidgetId)
- val params: ConstraintLayout.LayoutParams?
-
- when (height) {
- null -> {
- params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, appWidgetInfo.minHeight)
- val updatedIds = splitWidgetIds.plus("$appWidgetId")
- val updatedHeights = splitWidgetHeights.plus("${appWidgetInfo.minHeight}")
- saveWidgetData(updatedIds, updatedHeights)
- }
- else -> params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, height)
- }
-
- (appWidgetHost?.createView(lActivity!!.applicationContext, appWidgetId, appWidgetInfo) as WidgetHostView)
- .apply {
- setAppWidget(appWidgetId, appWidgetInfo)
- }.let {
- binding.widgetContainer.addView(it, params)
- widgetMenu(it)
- }
- }
-
- private fun updateWidgets() {
- if (splitWidgetIds.size > 0) {
- viewLifecycleOwner.lifecycleScope.launch {
- binding.widgetContainer.removeAllViews()
- splitWidgetIds.indices.forEach { i: Int ->
- createWidget(splitWidgetIds[i]!!.int(), splitWidgetHeights[i]!!.int())
- }
- }
- }
- }
-
- private fun widgetMenu(hostView: WidgetHostView) {
- val appWidgetId = hostView.appWidgetId
- hostView.setOnLongClickListener {
- PopupMenu(requireContext(), it, Gravity.END).apply {
- menuInflater.inflate(R.menu.widget_menu, this.menu)
- show()
- setOnMenuItemClickListener { menuItem ->
- when (menuItem.itemId) {
- R.id.move_up -> moveWidget(appWidgetId, true)
- R.id.move_down -> moveWidget(appWidgetId, false)
- R.id.increase_height -> resizeWidget(appWidgetId, true)
- R.id.decrease_height -> resizeWidget(appWidgetId, false)
- R.id.delete_widget -> removeWidget(it as WidgetHostView)
- }
- false
- }
- }
- true
- }
- }
-
- private fun moveWidget(widgetId: Int, moveUp: Boolean) {
- val tempIds = splitWidgetIds
- val tempHeights = splitWidgetHeights
-
- splitWidgetIds.indexOf(widgetId.toString()).let { i ->
- when {
- moveUp && i > 0 -> {
- tempIds.swap(i-1, i)
- tempHeights.swap(i-1, i)
- }
- !moveUp && i < splitWidgetIds.size - 1 -> {
- tempIds.swap(i, i+1)
- tempHeights.swap(i, i+1)
- }
- else -> return
- }
- }
-
- saveWidgetData(tempIds, tempHeights)
- updateWidgets()
- }
-
- private fun resizeWidget(widgetId: Int, shouldAdd: Boolean) {
- val tempList = splitWidgetHeights
-
- splitWidgetIds.indexOf(widgetId.toString()).let { i ->
- tempList[i] = when (shouldAdd) {
- true -> (splitWidgetHeights[i]!!.int().plus(50)).toString()
- false -> (splitWidgetHeights[i]!!.int().minus(50)).toString()
- }
- }
-
- widgetPref.edit().putString(KEY_WIDGET_HEIGHTS, tempList.joinToString(separator = SEPARATOR)).apply()
- updateWidgets()
- }
-
- private fun removeWidget(hostView: WidgetHostView) {
- hostView.let { v ->
- appWidgetHost?.deleteAppWidgetId(v.appWidgetId)
- binding.widgetContainer.removeView(v)
-
- splitWidgetIds.indexOf(v.appWidgetId.toString()).let { i ->
- saveWidgetData(splitWidgetIds.minus(splitWidgetIds[i]), splitWidgetHeights.minus(splitWidgetHeights[i]))
- }
- }
- }
-
- private fun saveWidgetData(idList: List, heightList: List) {
- widgetPref.edit()
- .putString(KEY_WIDGET_IDS, idList.joinToString(separator = SEPARATOR))
- .putString(KEY_WIDGET_HEIGHTS, heightList.joinToString(separator = SEPARATOR))
- .apply()
- }
+// private val widgetPicker =
+// registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
+// val data = result.data
+// val appWidgetId = data?.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, -1)
+// if (result.resultCode == RESULT_OK) {
+// when (data?.getIntExtra(requestCodeString, requestPickWidget)) {
+// requestPickWidget -> configureWidget(appWidgetId!!)
+// requestCreateWidget -> createWidget(appWidgetId!!, null)
+// }
+// } else if (result.resultCode == RESULT_CANCELED && data != null) {
+// if (appWidgetId != -1) appWidgetHost?.deleteAppWidgetId(appWidgetId!!)
+// }
+// }
+//
+// private fun configureWidget(appWidgetId: Int) {
+// when (val appWidgetConfig = appWidgetManager!!.getAppWidgetInfo(appWidgetId).configure) {
+// null -> createWidget(appWidgetId, null)
+// else -> {
+// Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE).apply {
+// component = appWidgetConfig
+// putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId)
+// putExtra(requestCodeString, requestCreateWidget)
+// }.let {
+// try { widgetPicker.launch(it) }
+// catch (e: Exception) { e.printStackTrace() }
+// }
+// }
+// }
+// }
+//
+// private fun createWidget(appWidgetId: Int, height: Int?) {
+// if (appWidgetId == -1) return
+//
+// val appWidgetInfo = appWidgetManager!!.getAppWidgetInfo(appWidgetId)
+// val params: ConstraintLayout.LayoutParams?
+//
+// when (height) {
+// null -> {
+// params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, appWidgetInfo.minHeight)
+// val updatedIds = splitWidgetIds.plus("$appWidgetId")
+// val updatedHeights = splitWidgetHeights.plus("${appWidgetInfo.minHeight}")
+// saveWidgetData(updatedIds, updatedHeights)
+// }
+// else -> params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, height)
+// }
+//
+// (appWidgetHost?.createView(lActivity!!.applicationContext, appWidgetId, appWidgetInfo) as WidgetHostView)
+// .apply {
+// setAppWidget(appWidgetId, appWidgetInfo)
+// }.let {
+// binding.widgetContainer.addView(it, params)
+// widgetMenu(it)
+// }
+// }
+//
+// private fun updateWidgets() {
+// if (splitWidgetIds.size > 0) {
+// viewLifecycleOwner.lifecycleScope.launch {
+// binding.widgetContainer.removeAllViews()
+// splitWidgetIds.indices.forEach { i: Int ->
+// createWidget(splitWidgetIds[i]!!.int(), splitWidgetHeights[i]!!.int())
+// }
+// }
+// }
+// }
+//
+// private fun widgetMenu(hostView: WidgetHostView) {
+// val appWidgetId = hostView.appWidgetId
+// hostView.setOnLongClickListener {
+// PopupMenu(requireContext(), it, Gravity.END).apply {
+// menuInflater.inflate(R.menu.widget_menu, this.menu)
+// show()
+// setOnMenuItemClickListener { menuItem ->
+// when (menuItem.itemId) {
+// R.id.move_up -> moveWidget(appWidgetId, true)
+// R.id.move_down -> moveWidget(appWidgetId, false)
+// R.id.increase_height -> resizeWidget(appWidgetId, true)
+// R.id.decrease_height -> resizeWidget(appWidgetId, false)
+// R.id.delete_widget -> removeWidget(it as WidgetHostView)
+// }
+// false
+// }
+// }
+// true
+// }
+// }
+//
+// private fun moveWidget(widgetId: Int, moveUp: Boolean) {
+// val tempIds = splitWidgetIds
+// val tempHeights = splitWidgetHeights
+//
+// splitWidgetIds.indexOf(widgetId.toString()).let { i ->
+// when {
+// moveUp && i > 0 -> {
+// tempIds.swap(i-1, i)
+// tempHeights.swap(i-1, i)
+// }
+// !moveUp && i < splitWidgetIds.size - 1 -> {
+// tempIds.swap(i, i+1)
+// tempHeights.swap(i, i+1)
+// }
+// else -> return
+// }
+// }
+//
+// saveWidgetData(tempIds, tempHeights)
+// updateWidgets()
+// }
+//
+// private fun resizeWidget(widgetId: Int, shouldAdd: Boolean) {
+// val tempList = splitWidgetHeights
+//
+// splitWidgetIds.indexOf(widgetId.toString()).let { i ->
+// tempList[i] = when (shouldAdd) {
+// true -> (splitWidgetHeights[i]!!.int().plus(50)).toString()
+// false -> (splitWidgetHeights[i]!!.int().minus(50)).toString()
+// }
+// }
+//
+// widgetPref.edit().putString(KEY_WIDGET_HEIGHTS, tempList.joinToString(separator = SEPARATOR)).apply()
+// updateWidgets()
+// }
+//
+// private fun removeWidget(hostView: WidgetHostView) {
+// hostView.let { v ->
+// appWidgetHost?.deleteAppWidgetId(v.appWidgetId)
+// binding.widgetContainer.removeView(v)
+//
+// splitWidgetIds.indexOf(v.appWidgetId.toString()).let { i ->
+// saveWidgetData(splitWidgetIds.minus(splitWidgetIds[i]), splitWidgetHeights.minus(splitWidgetHeights[i]))
+// }
+// }
+// }
+//
+// private fun saveWidgetData(idList: List, heightList: List) {
+// widgetPref.edit()
+// .putString(KEY_WIDGET_IDS, idList.joinToString(separator = SEPARATOR))
+// .putString(KEY_WIDGET_HEIGHTS, heightList.joinToString(separator = SEPARATOR))
+// .apply()
+// }
private val widgetPref: SharedPreferences get() = lActivity!!.getSharedPreferences(PREFS_WIDGETS, 0)
private val widgetIds: String? get() = widgetPref.getString(KEY_WIDGET_IDS, "")
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/feeds/FeedsResult.kt b/app/src/main/kotlin/bums/lunatic/launcher/feeds/FeedsResult.kt
index 58a98a25..960aa83c 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/feeds/FeedsResult.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/feeds/FeedsResult.kt
@@ -8,10 +8,10 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
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.model.LocationLog
-import bums.lunatic.launcher.utils.BLog
+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.BottomSheetDialogFragment
@@ -35,7 +35,7 @@ internal class FeedsResult : BottomSheetDialogFragment() {
WorkersDb.getRealm().query().sort("time", Sort.DESCENDING).find()?.let {
if (it.size > 0) {
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"))
}.joinToString( ",\n")
}
@@ -63,13 +63,13 @@ internal class FeedsResult : BottomSheetDialogFragment() {
}
override fun dismiss() {
- BLog.LOGE("dismiss()")
+ Blog.LOGE("dismiss()")
mDismissCalback?.invoke()
super.dismiss()
}
override fun onDismiss(dialog: DialogInterface) {
- BLog.LOGE("onDismiss(dialog: DialogInterface)")
+ Blog.LOGE("onDismiss(dialog: DialogInterface)")
mDismissCalback?.invoke()
super.onDismiss(dialog)
}
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/helpers/BluetoothManager.kt b/app/src/main/kotlin/bums/lunatic/launcher/helpers/BluetoothManager.kt
index 35a8b3aa..f0fd5ca1 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/helpers/BluetoothManager.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/helpers/BluetoothManager.kt
@@ -10,7 +10,7 @@ import android.content.Intent
import android.content.IntentFilter
import android.content.pm.PackageManager
import androidx.core.app.ActivityCompat
-import bums.lunatic.launcher.utils.BLog
+import bums.lunatic.launcher.utils.Blog
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -115,7 +115,7 @@ class BluetoothManager {
}
// BLog.LOGE("sendToI telegram response isSuccessful ${body}")
- } else BLog.LOGE("sendToI telegram Error Occurred")
+ } else Blog.LOGE("sendToI telegram Error Occurred")
}
}
}
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/helpers/HeadsetActionButtonReceiver.kt b/app/src/main/kotlin/bums/lunatic/launcher/helpers/HeadsetActionButtonReceiver.kt
index 21a16e74..d85bc8ca 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/helpers/HeadsetActionButtonReceiver.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/helpers/HeadsetActionButtonReceiver.kt
@@ -6,7 +6,7 @@ import android.content.Context
import android.content.Intent
import android.media.AudioManager
import android.view.KeyEvent
-import bums.lunatic.launcher.utils.BLog
+import bums.lunatic.launcher.utils.Blog
import java.util.Timer
import java.util.TimerTask
@@ -18,12 +18,12 @@ class HeadsetActionButtonReceiver : BroadcastReceiver() {
}
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
val keyEvent = intent.extras!![Intent.EXTRA_KEY_EVENT] as KeyEvent?
if (keyEvent == null || keyEvent.action != KeyEvent.ACTION_DOWN) return
- BLog.LOGE("HeadsetActionButtonReceiver keyEvent >>>>> ${keyEvent}")
+ Blog.LOGE("HeadsetActionButtonReceiver keyEvent >>>>> ${keyEvent}")
counter++
if (doublePressTimer != null) {
doublePressTimer!!.cancel()
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/helpers/PrefHelper.kt b/app/src/main/kotlin/bums/lunatic/launcher/helpers/PrefHelper.kt
index 781af71b..2ab27b9f 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/helpers/PrefHelper.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/helpers/PrefHelper.kt
@@ -1,9 +1,11 @@
package bums.lunatic.launcher.helpers
import android.content.SharedPreferences
+import bums.lunatic.launcher.model.RssDataType
import kr.lunaticbum.utils.preferences.PrefJsonConvert
import kr.lunaticbum.utils.preferences.PrefKey
import kr.lunaticbum.utils.preferences.PreferencesHelper
+import java.math.BigDecimal
enum class PrefString : PrefKey {
@@ -64,34 +66,45 @@ object PrefHelper : PreferencesHelper() {
PrefString.values().forEach { jsonObj.put(it.name,it.get("")) }
PrefBoolean.values().forEach { jsonObj.put(it.name,it.get(false)) }
PrefLong.values().forEach { jsonObj.put(it.name,it.get(0L)) }
+
+ RssDataType.values().forEach { jsonObj.put(it.name,getBoolean(it.name, false)) }
return jsonObj
}
override fun putSetting(json : Map) {
- PrefString.values().forEach { if(json.containsKey(it.getKey())) { 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(json.get(it.getKey()) as Long) } }
+ PrefString.values().forEach {
+ if (json.containsKey(it.getKey())) {
+ 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 putBoolean(key : String, value :Boolean) = put(getBooleanPrefix().plus(key),value)
- fun getLong(key : String, def :Long) = get(getLongPrefix().plus(key),def)
- fun putLong(key : String, value :Long) = put(getBooleanPrefix().plus(key),value)
- fun getString(key : String, def :String) = get(getStringPrefix().plus(key),def)
- fun putString(key : String, value :String) = put(getStringPrefix().plus(key),value)
+ fun getBoolean(key: String, def: Boolean) = get(getBooleanPrefix().plus(key), def)
+ fun putBoolean(key: String, value: Boolean) = put(getBooleanPrefix().plus(key), value)
+ fun getLong(key: String, def: Long) = get(getLongPrefix().plus(key), def)
+ fun putLong(key: String, value: Long) = put(getBooleanPrefix().plus(key), value)
+ fun getString(key: String, def: String) = get(getStringPrefix().plus(key), def)
+ fun putString(key: String, value: String) = put(getStringPrefix().plus(key), value)
// fun location(boolean: Boolean) = PrefBoolean.location.set(boolean)
// fun isLocationOn() = (PrefBoolean.location.get() as? Boolean) ?: false
-}
-typealias BLOCK = ()->Unit
-inline fun Boolean.letTrue(block: BLOCK) {
- if (this) {
- block.invoke()
- } else {
-// elseblock.invoke()
- }
+
}
\ No newline at end of file
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome.kt
index 13069422..be9f7425 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/LauncherHome.kt
@@ -25,8 +25,6 @@ import android.content.DialogInterface
import android.content.Intent
import android.content.IntentFilter
import android.content.SharedPreferences
-import android.graphics.Bitmap
-import android.graphics.Color
import android.media.AudioManager
import android.net.Uri
import android.os.Bundle
@@ -34,7 +32,6 @@ import android.os.Handler
import android.os.Looper
import android.os.SystemClock
import android.provider.AlarmClock
-import android.view.Gravity
import android.view.HapticFeedbackConstants
import android.view.KeyEvent
import android.view.LayoutInflater
@@ -42,7 +39,6 @@ import android.view.View
import android.view.ViewGroup
import android.widget.CheckBox
import android.widget.EditText
-import android.widget.PopupWindow
import android.widget.TableRow
import android.widget.Toast
import androidx.annotation.NonNull
@@ -52,26 +48,20 @@ import androidx.core.view.children
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.DividerItemDecoration
-import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.ItemTouchHelper
-import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.behavior.Behavior
+import bums.lunatic.launcher.common.letTrue
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.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.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.lockMethod
-import bums.lunatic.launcher.helpers.letTrue
import bums.lunatic.launcher.home.adapters.NotificationItemAdapter
import bums.lunatic.launcher.home.adapters.RecentCallsAdapter
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.qaccess.QuickAccess
import bums.lunatic.launcher.settings.SettingsActivity
-import bums.lunatic.launcher.utils.BLog
+import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.utils.BitmapConverter
-import bums.lunatic.launcher.utils.JamoUtils
import bums.lunatic.launcher.utils.SimpleFingerGestures
import bums.lunatic.launcher.utils.beforeDay
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.latitudeRange
import bums.lunatic.launcher.workers.longitudeRange
-import com.google.android.material.snackbar.Snackbar
import io.realm.kotlin.UpdatePolicy
import io.realm.kotlin.ext.query
import io.realm.kotlin.notifications.InitialResults
@@ -114,8 +102,6 @@ import io.realm.kotlin.query.Sort
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.Job
-import kotlinx.coroutines.flow.Flow
-import kotlinx.coroutines.flow.cancellable
import kotlinx.coroutines.launch
import org.json.JSONArray
import org.json.JSONObject
@@ -124,8 +110,6 @@ import java.math.RoundingMode
import java.net.URLEncoder
import java.util.Calendar
import java.util.Date
-import java.util.Locale
-import java.util.regex.Pattern
internal class LauncherHome : Fragment() {
@@ -376,7 +360,7 @@ internal class LauncherHome : Fragment() {
lonR.first(), lonR.last(),
(System.currentTimeMillis() / 1000L).toLong()
).also {
- BLog.LOGE("re >>> ${it.description()}")
+ Blog.LOGE("re >>> ${it.description()}")
}.find().let { hours ->
Handler(Looper.getMainLooper()).post {
weatherDressAdapter?.let {
@@ -399,7 +383,7 @@ internal class LauncherHome : Fragment() {
)
}
)
- BLog.LOGE("hour ${hours}")
+ Blog.LOGE("hour ${hours}")
it.notifyDataSetChanged()
}
mWeatherAdapter?.let {
@@ -417,14 +401,14 @@ internal class LauncherHome : Fragment() {
// @SuppressLint("NotifyDataSetChanged")
private fun queryWeather() {
result = WorkersDb.getRealm().query().also {
- BLog.LOGE("re >>> ${it.description()}") // 쿼리 로그
+ Blog.LOGE("re >>> ${it.description()}") // 쿼리 로그
}.find()
weatherJob?.cancel()
weatherJob = CoroutineScope(Dispatchers.Default).launch {
result?.asFlow()?.collect { li ->
- BLog.LOGE("queryWeather done. >>> ${li}")
+ //Blog.LOGE("queryWeather done. >>> ${li}")
if (li.list.size > 0) {
- BLog.LOGE("queryWeather done. >>> ${li.list.size}")
+ //Blog.LOGE("queryWeather done. >>> ${li.list.size}")
queryWeatherWithLoc()
}
}
@@ -561,7 +545,7 @@ internal class LauncherHome : Fragment() {
binding.functionLayer.setOnTouchListener(SimpleFingerGestures(context = requireContext(), binding.functionLayer, mFingerGestureListener))
binding.time.setOnTouchListener(SimpleFingerGestures(context = requireContext(), binding.time, mFingerGestureListener))
- BLog.LOGE("onViewCreated()")
+ Blog.LOGE("onViewCreated()")
binding.summaryChoose.visibility = View.GONE
(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 {
- BLog.LOGE("addOnBackStackChangedListener()")
+ Blog.LOGE("addOnBackStackChangedListener()")
shouldResume = if (fragManager.backStackEntryCount == 0) {
binding.root.visibility = View.VISIBLE
true
@@ -795,7 +779,7 @@ internal class LauncherHome : Fragment() {
val swipeToDeleteCallback: SwipeToDeleteCallback =
object : SwipeToDeleteCallback(requireContext()) {
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 ->
WorkersDb.getRealm().apply {
writeBlocking {
@@ -960,7 +944,7 @@ internal class LauncherHome : Fragment() {
// 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)){
targetView?.performHapticFeedback(HapticFeedbackConstants.CONFIRM)
when(fingers) {
@@ -991,7 +975,7 @@ internal class LauncherHome : Fragment() {
lActivity?.switchFeeds()
return true
}
- //
+ //
else ->{}
}
} else if (targetView.equals(binding.time) && fingers == 2) {
@@ -1008,7 +992,7 @@ internal class LauncherHome : Fragment() {
gestureDuration: Long,
gestureDistance: Double
): Boolean {
- BLog.LOGE("Maybe GA PINCH is Like Zoom out")
+ Blog.LOGE("Maybe GA PINCH is Like Zoom out")
return false
}
@@ -1018,7 +1002,7 @@ internal class LauncherHome : Fragment() {
gestureDuration: Long,
gestureDistance: Double
): Boolean {
- BLog.LOGE("Maybe GA UN PINCH is Like Zoom In")
+ Blog.LOGE("Maybe GA UN PINCH is Like Zoom In")
return false
}
@@ -1121,15 +1105,15 @@ internal class LauncherHome : Fragment() {
fun jsonObjLog(pkey: String, key: String, jsonObject: JSONObject) {
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) {
var obj = jsonObject.getJSONObject(key)
- BLog.LOGE("jsonObjLog $pkey JSONObject in $key >> ${obj}")
+ Blog.LOGE("jsonObjLog $pkey JSONObject in $key >> ${obj}")
obj?.keys()?.forEach {
// jsonObjLog(key,it, obj)
}
} 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)
for (i in 0..<(array?.length() ?: 0)) {
if (array?.get(i) is String) {
@@ -1140,11 +1124,11 @@ internal class LauncherHome : Fragment() {
// jsonObjLog(key, it, child)
}
} 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 {
- BLog.LOGE(
+ Blog.LOGE(
"jsonObjLog $pkey else in $key >> ${
if (jsonObject.has(key) == true) (jsonObject.get(
key
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/RssViewer.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/RssViewer.kt
index 0adae1f8..d10377ee 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/home/RssViewer.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/RssViewer.kt
@@ -18,26 +18,14 @@
package bums.lunatic.launcher.home
-import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
-import android.os.Environment
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
-import android.widget.Toast
-import androidx.core.content.FileProvider
-import androidx.core.net.toUri
import androidx.fragment.app.DialogFragment
-import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
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() {
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/RssViewerActivity.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/RssViewerActivity.kt
new file mode 100644
index 00000000..761f0b61
--- /dev/null
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/RssViewerActivity.kt
@@ -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 = ArrayList()
+ fun setRssId(rssId: String): RssViewBuilder {
+ this.rssId = rssId
+ return this
+ }
+ fun setRssList(rssList: ArrayList): 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 = 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().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().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().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}
+ }
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssFeedsParser.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssFeedsParser.kt
index 782248ed..96feaeb0 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssFeedsParser.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssFeedsParser.kt
@@ -4,7 +4,6 @@ import android.util.Xml
import bums.lunatic.launcher.model.NewsData
import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.others.Reddit
-import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.utils.beforeDay
import com.google.gson.Gson
import org.xmlpull.v1.XmlPullParser
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssItemAdapter.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssItemAdapter.kt
index b11ef8ea..7f09fcb2 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssItemAdapter.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssItemAdapter.kt
@@ -31,7 +31,7 @@ import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
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.RssDataInterface
import bums.lunatic.launcher.model.RssDataType
@@ -39,15 +39,16 @@ import bums.lunatic.launcher.openClient
import bums.lunatic.launcher.openDotax
import bums.lunatic.launcher.openReddit
import bums.lunatic.launcher.openYouTube
-import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.workers.WorkersDb
import com.google.android.material.imageview.ShapeableImageView
-import com.google.gson.Gson
import com.squareup.picasso.Picasso
import kr.lunaticbum.awesomewebview.AwesomeWebView
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.objects.CustomMenu
import java.text.SimpleDateFormat
import java.util.Date
@@ -58,6 +59,7 @@ internal class RssItemAdapter (
@SuppressLint("SimpleDateFormat")
val dateFormat = SimpleDateFormat("a HH:mm / yy - MM - dd")
val emptyDate = " - "
+ var rssList: ArrayList = ArrayList()
val webViewListener = object : WebViewListener() {
override fun onCustomMenuClick(menuCode: String?) {
super.onCustomMenuClick(menuCode)
@@ -89,16 +91,11 @@ internal class RssItemAdapter (
if (RssDataType.REDDIT_NSFW.equals(rss.category())) {
openReddit(rss.originPage())
} else {
-// RssViewer().apply {
-// show(lActivity!!.supportFragmentManager,rss.originPage)
-// }
- AwesomeWebView.Builder(lActivity!!)
-// .setWebViewListener(webViewListener).addCustomMenu(
-// CustomMenu("PDF 저장","PDF")
-// ).
+ RssViewBuilder(lActivity!!)
+ .setRssList(rssList)
+ .setRssId(rss.originPage())
.showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1)
.show(rss.originPage!!)
-// openOpera(rss.originPage())
}
}
}
@@ -107,7 +104,11 @@ internal class RssItemAdapter (
openReddit(rss.originPage())
}
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())
}
@@ -115,7 +116,9 @@ internal class RssItemAdapter (
openClient(rss.originPage())
}
else -> {
- AwesomeWebView.Builder(lActivity!!)
+ RssViewBuilder(lActivity!!)
+ .setRssList(rssList)
+ .setRssId(rss.originPage())
.showIconClose(true).showIconBack(false).showProgressBar(true).webViewMixedContentMode(0)
.show(rss.originPage!!)
}
@@ -208,7 +211,10 @@ internal class RssItemAdapter (
}
rssDataItemLis.clear()
rssDataItemLis.addAll(newList)
-// BLog.LOGE("rssDataItemLis >> ${rssDataItemLis}")
+ CoroutineScope(Dispatchers.IO).launch {
+ rssList.clear()
+ rssList.addAll(newList.map { it.originPage() })
+ }
} catch (e: Exception) {
e.printStackTrace()
}
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/SwipeToDeleteCallback.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/SwipeToDeleteCallback.kt
index ea583b94..d93d513e 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/SwipeToDeleteCallback.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/SwipeToDeleteCallback.kt
@@ -13,7 +13,6 @@ import androidx.annotation.NonNull
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.RecyclerView
-import bums.lunatic.launcher.utils.BLog
abstract class SwipeToDeleteCallback internal constructor(context: Context) :
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/WeatherAdapter.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/WeatherAdapter.kt
index 5dd1995b..8c1ba79d 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/WeatherAdapter.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/WeatherAdapter.kt
@@ -8,7 +8,7 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearSnapHelper
import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.databinding.WeatherBookBinding
-import bums.lunatic.launcher.utils.BLog
+import bums.lunatic.launcher.utils.Blog
class WeatherAdapter(
private val pages: List,
@@ -36,10 +36,10 @@ class WeatherAdapter(
fun syncScroll(newPosition: Int) {
childs[newPosition].let {recyclerView ->
- BLog.LOGE("recyclerView >>> ${recyclerView} 1 ")
+ Blog.LOGE("recyclerView >>> ${recyclerView} 1 ")
if (!isSyncingScroll) {
isSyncingScroll = true
- BLog.LOGE("recyclerView >>> ${recyclerView} 2 ")
+ Blog.LOGE("recyclerView >>> ${recyclerView} 2 ")
childs.forEach { c ->
// val visibleItemCount = (layoutManager?.findLastVisibleItemPosition() ?: 0) - (layoutManager?.findFirstVisibleItemPosition() ?: 0)
if (c != recyclerView) {
@@ -51,11 +51,11 @@ class WeatherAdapter(
// .scrollToPosition(it)
}
}
- BLog.LOGE("recyclerView >>> ${recyclerView} 3 ")
+ Blog.LOGE("recyclerView >>> ${recyclerView} 3 ")
}
}
isSyncingScroll = false
- BLog.LOGE("recyclerView >>> ${recyclerView} 4 ")
+ Blog.LOGE("recyclerView >>> ${recyclerView} 4 ")
}
}
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/WeatherDressAdatper.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/WeatherDressAdatper.kt
index 96f66ada..16a124f2 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/WeatherDressAdatper.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/WeatherDressAdatper.kt
@@ -9,7 +9,6 @@ import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.databinding.ItemRecHourlyDressBinding
import bums.lunatic.launcher.model.Hour
import bums.lunatic.launcher.model.WeatherInfoManager
-import bums.lunatic.launcher.utils.BLog
import java.util.Calendar
class WeatherDressAdatper (private val dataSet: ArrayList) : RecyclerView.Adapter(){
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/WeatherHourlyAdater.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/WeatherHourlyAdater.kt
index 60b987a5..3cbf0d49 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/WeatherHourlyAdater.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/WeatherHourlyAdater.kt
@@ -2,13 +2,12 @@ package bums.lunatic.launcher.home.adapters
import android.graphics.Color
import android.view.LayoutInflater
-import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.databinding.ItemHourlyWeatherBinding
import bums.lunatic.launcher.model.Hour
import bums.lunatic.launcher.model.WeatherInfoManager
-import bums.lunatic.launcher.utils.BLog
+import bums.lunatic.launcher.utils.Blog
import com.squareup.picasso.Picasso
class WeatherHourlyAdapter(private val dataSet: ArrayList): RecyclerView.Adapter() {
@@ -49,7 +48,7 @@ class WeatherHourlyAdapter(private val dataSet: ArrayList): RecyclerView.A
override fun getItemCount(): Int = dataSet.size
fun update(li: Collection) {
- BLog.LOGE("${this.javaClass.simpleName} update")
+ Blog.LOGE("${this.javaClass.simpleName} update")
li.toList()
this.dataSet.clear()
this.dataSet.addAll(li)
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/model/AppInfo.kt b/app/src/main/kotlin/bums/lunatic/launcher/model/AppInfo.kt
index f1ea93ab..b97c5e51 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/model/AppInfo.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/model/AppInfo.kt
@@ -16,4 +16,5 @@ class AppInfo : RealmObject {
var clickCount : Int = 0
var lastUseDate : Long = 0L
var category : String? = null
+ var currentInstalled : Boolean = false
}
\ No newline at end of file
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/model/WeatherInfoManager.kt b/app/src/main/kotlin/bums/lunatic/launcher/model/WeatherInfoManager.kt
index 1eff0b0c..f7e023ff 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/model/WeatherInfoManager.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/model/WeatherInfoManager.kt
@@ -1,7 +1,7 @@
package bums.lunatic.launcher.model
import bums.lunatic.launcher.R
-import bums.lunatic.launcher.utils.BLog
+import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.workers.WorkersDb
import io.realm.kotlin.ext.query
import io.realm.kotlin.types.RealmList
@@ -124,7 +124,7 @@ object WeatherInfoManager {
private fun getLocation(): Location? {
return if (info?.location == null) {
WorkersDb.getRealm().query().also {
- BLog.LOGE("re >>> ${it.description()}") // 쿼리 로그
+ Blog.LOGE("re >>> ${it.description()}") // 쿼리 로그
}.find().first()
} else {
info?.location
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/qaccess/QuickAccess.kt b/app/src/main/kotlin/bums/lunatic/launcher/qaccess/QuickAccess.kt
index 7f7a9a20..319e14ae 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/qaccess/QuickAccess.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/qaccess/QuickAccess.kt
@@ -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_URL
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 com.google.android.material.bottomsheet.BottomSheetDialog
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 io.realm.kotlin.ext.query
import io.realm.kotlin.query.RealmResults
-import java.text.SimpleDateFormat
-import java.util.Date
import java.util.Objects
import kotlin.properties.Delegates
@@ -249,7 +246,7 @@ internal class QuickAccess : BottomSheetDialogFragment() {
/* type is url */
if (shortcutType == SHORTCUT_TYPE_URL) {
var url = intentString
- BLog.LOGE("intentString >>>> ${intentString}")
+ Blog.LOGE("intentString >>>> ${intentString}")
/* add http before the url if it doesn't have http/https prefix */
if (!url.startsWith("http")) {
// url = "http://$intentString"
@@ -284,14 +281,14 @@ internal class QuickAccess : BottomSheetDialogFragment() {
/* make phone call */
WorkersDb.getRealm().writeBlocking {
- BLog.LOGE(">>>> ${query().query("phoneNumber CONTAINS $0", intentString).description()}")
+ Blog.LOGE(">>>> ${query().query("phoneNumber CONTAINS $0", intentString).description()}")
var result : RealmResults? = null
if (intentString.startsWith("0")) {
result = query().query("phoneNumber CONTAINS $0 or phoneNumber CONTAINS $1", intentString, intentString.removeRange(0,1)).find()
} else {
result = query().query("phoneNumber CONTAINS $0", intentString).find()
}
- BLog.LOGE(">>>> ${result.size}")
+ Blog.LOGE(">>>> ${result.size}")
if(result.size > 0){
result.forEach {
it.touchCount = 1 + it.touchCount
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/receiver/NLService.kt b/app/src/main/kotlin/bums/lunatic/launcher/receiver/NLService.kt
index f8a42dec..9b3ba9d8 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/receiver/NLService.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/receiver/NLService.kt
@@ -1,12 +1,10 @@
package bums.lunatic.launcher.receiver
-import android.annotation.SuppressLint
import android.content.BroadcastReceiver
import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
-import android.location.Location
import android.media.MediaMetadata
import android.media.session.MediaSessionManager
import android.os.Build
@@ -16,12 +14,9 @@ import androidx.annotation.RequiresApi
import androidx.core.content.getSystemService
import bums.lunatic.launcher.model.CurrentPlayItem
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.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.ext.query
@@ -115,7 +110,7 @@ class NLService : NotificationListenerService() {
} else {
current.albumArt = ""
}
- BLog.LOGE(
+ Blog.LOGE(
"Sessions",
"$session -- " + (session?.metadata?.getString(MediaMetadata.METADATA_KEY_TITLE))
)
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/receiver/PackageEventReceiver.kt b/app/src/main/kotlin/bums/lunatic/launcher/receiver/PackageEventReceiver.kt
index 75d3c5f2..96c72f94 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/receiver/PackageEventReceiver.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/receiver/PackageEventReceiver.kt
@@ -6,7 +6,7 @@ import android.content.Intent
import androidx.work.OneTimeWorkRequest
import androidx.work.WorkManager
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.WorkersDb
import io.realm.kotlin.ext.query
@@ -19,7 +19,7 @@ class PackageEventReceiver : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
val action = intent.action
- BLog.LOGE("action >>>> ${action}")
+ Blog.LOGE("action >>>> ${action}")
when(action) {
Intent.ACTION_PACKAGE_ADDED,Intent.ACTION_PACKAGE_INSTALL -> {
startAppInfoGetter(context)
@@ -30,7 +30,7 @@ class PackageEventReceiver : BroadcastReceiver() {
WorkersDb.getRealm().writeBlocking {
val result = query("pkgName == $0", packageName).find()
if (result.size == 1) {
- delete(result)
+ result.first().currentInstalled = false
}
}
}
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/settings/SettingsActivity.kt b/app/src/main/kotlin/bums/lunatic/launcher/settings/SettingsActivity.kt
index 87641845..864b3feb 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/settings/SettingsActivity.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/settings/SettingsActivity.kt
@@ -22,15 +22,18 @@ import android.annotation.SuppressLint
import android.content.SharedPreferences
import android.content.res.Resources
import android.os.Bundle
-import androidx.appcompat.app.AppCompatActivity
+import android.os.Environment
import bums.lunatic.launcher.BuildConfig
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.SettingsActivityBinding
import bums.lunatic.launcher.helpers.Constants.Companion.BOTTOM_SHEET_TAG
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import bums.lunatic.launcher.helpers.PrefBoolean
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.Appearances
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.TopInfos
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.color.DynamicColors
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 val sourceCode = "https://github.com/iamrasel/lunar-launcher"
@@ -150,18 +161,34 @@ internal class SettingsActivity : AppCompatActivity() {
}
}
- /* support dialog */
+
private fun supportDialog() {
MaterialAlertDialogBuilder(this)
.setTitle(R.string.support)
.setMessage(R.string.support_message)
/* star button */
- .setNeutralButton(R.string.star) { _, _ ->
-// startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(sourceCode)))
+ .setNeutralButton("backup") { _, _ ->
+ val path = File(Environment.getExternalStorageDirectory(),"bums")
+ if (path.exists() == false) {
+ path.mkdirs()
+ }
+ saveObjToJson(path,"prefSettings.txt",PrefHelper.getSettings())
+ WorkersDb.getRealm().apply {
+ val foundAppInfo = query().find()
+ Blog.LOGE("foundAppInfo >>> ${foundAppInfo}")
+ val apps = arrayListOf().apply { addAll((copyFromRealm(foundAppInfo))) }
+ Blog.LOGE("foundAppInfo >>> ${apps.size}")
+ saveObjToJson(path,"appInfos.txt",apps)
+ val foundSimpleContact = query().find()
+ Blog.LOGE("foundSimpleContact >>> ${foundSimpleContact.size}")
+ val contacts = arrayListOf().apply { addAll(copyFromRealm(foundSimpleContact)) }
+ saveObjToJson(path,"contactInfos.txt",contacts)
+ }
}
/* affiliate button */
- .setNegativeButton(R.string.amazon) { _, _ ->
-// startActivity(Intent(Intent.ACTION_VIEW, Uri.parse("https://amzn.to/44krAw9")))
+ .setNegativeButton("restore") { d, c ->
+ d.dismiss()
+ restoreSetting()
}
/* donate button */
.setPositiveButton(R.string.donate) { _, _ ->
@@ -170,4 +197,34 @@ internal class SettingsActivity : AppCompatActivity() {
.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?>() {}.type) as ArrayList
+ 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?>() {}.type) as ArrayList
+ 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("파일 없는뎅?!")
+ }
+ }
}
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/settings/childs/HomeSettings.kt b/app/src/main/kotlin/bums/lunatic/launcher/settings/childs/HomeSettings.kt
index a011aca8..a8d53346 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/settings/childs/HomeSettings.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/settings/childs/HomeSettings.kt
@@ -28,7 +28,7 @@ import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.SettingsTodoBinding
import bums.lunatic.launcher.helpers.PrefBoolean
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.BottomSheetDialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@@ -82,9 +82,9 @@ internal class HomeSettings : BottomSheetDialogFragment() {
} else {
}
- BLog.LOGE("field > 0 >>> ${field}")
+ Blog.LOGE("field > 0 >>> ${field}")
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?) {
super.onViewCreated(view, savedInstanceState)
(requireDialog() as BottomSheetDialog).dismissWithAnimation = true
-
-
}
override fun onDestroyView() {
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/settings/childs/TopInfos.kt b/app/src/main/kotlin/bums/lunatic/launcher/settings/childs/TopInfos.kt
index 7f268220..c3645f8a 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/settings/childs/TopInfos.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/settings/childs/TopInfos.kt
@@ -29,7 +29,7 @@ import bums.lunatic.launcher.databinding.SettingsTimeDateBinding
import bums.lunatic.launcher.helpers.PrefBoolean
import bums.lunatic.launcher.helpers.PrefHelper
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.BottomSheetDialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
@@ -48,7 +48,7 @@ internal class TopInfos : BottomSheetDialogFragment() {
binding.useBattery.isChecked = PrefBoolean.displayBattery.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 ->
PrefBoolean.displayBattery.set(b)
settingsChanged = true
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/utils/BLog.kt b/app/src/main/kotlin/bums/lunatic/launcher/utils/Blog.kt
similarity index 98%
rename from app/src/main/kotlin/bums/lunatic/launcher/utils/BLog.kt
rename to app/src/main/kotlin/bums/lunatic/launcher/utils/Blog.kt
index 96ed1b27..c181537d 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/utils/BLog.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/utils/Blog.kt
@@ -3,7 +3,7 @@ package bums.lunatic.launcher.utils
import android.util.Log
import bums.lunatic.launcher.BuildConfig
-object BLog {
+object Blog {
val DEFAULT_TAG = "Lunatic"
enum class BLogType {
D,I,E
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/utils/RssList.kt b/app/src/main/kotlin/bums/lunatic/launcher/utils/RssList.kt
index 648c1236..aec1e3b3 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/utils/RssList.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/utils/RssList.kt
@@ -2,14 +2,10 @@ package bums.lunatic.launcher.utils
import org.jsoup.nodes.Document
import java.net.URLEncoder
+import java.util.Base64
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(
"https://www.youtube.com/@zzanbro",
"https://www.youtube.com/@sungsikyung",
@@ -19,33 +15,13 @@ object RssList {
)
val newsFeeds = arrayListOf(
"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",
)
val feedJsons = arrayListOf(
-// "https://www.reddit.com/r/nsfw/.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/" }
@@ -60,310 +36,6 @@ object RssList {
"여행",
)
-
-
- val plist = arrayListOf>(
- 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 {
@@ -374,5 +46,4 @@ interface DocParser { fun parse(doc : Document) : T }
class JGuruMain {
var maxDate : Long = Long.MIN_VALUE
var minDate : Long = Long.MAX_VALUE
-
}
\ No newline at end of file
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/CalendarGetter.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/CalendarGetter.kt
index fbd3e5a7..ac2f29d7 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/workers/CalendarGetter.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/CalendarGetter.kt
@@ -4,7 +4,7 @@ import android.content.Context
import android.net.Uri
import androidx.work.WorkerParameters
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
-import bums.lunatic.launcher.utils.BLog
+import bums.lunatic.launcher.utils.Blog
class CalendarGetter : BaseGetter {
@@ -97,11 +97,11 @@ class CalendarGetter : BaseGetter {
for (i in title.indices) {
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)
// Log.i("Calendar", "htmlUri : " + htmlUri[i])
title[i] = managedCursor.getString(1)
- BLog.LOGE("Calendar title : " + title[i])
+ Blog.LOGE("Calendar title : " + title[i])
// eventLocation[i] = managedCursor.getString(3)
// Log.i("Calendar", "eventLocation : " + eventLocation[i])
description[i] = managedCursor.getString(2)
@@ -109,9 +109,9 @@ class CalendarGetter : BaseGetter {
// selfAttendeeStatus[i] = managedCursor.getInt(6)
// commentsUri[i] = managedCursor.getString(7)
dtstart[i] = managedCursor.getString(3)
- BLog.LOGE("Calendar dtstart : " + rdate[i])
+ Blog.LOGE("Calendar dtstart : " + rdate[i])
dtend[i] = managedCursor.getString(4)
- BLog.LOGE("Calendar dtend : " + rdate[i])
+ Blog.LOGE("Calendar dtend : " + rdate[i])
// eventTimezone[i] = managedCursor.getString(10)
// duration[i] = managedCursor.getString(11)
// allDay[i] = managedCursor.getInt(12)
@@ -121,7 +121,7 @@ class CalendarGetter : BaseGetter {
// hasExtendedProperties[i] = managedCursor.getInt(16)
// rrule[i] = managedCursor.getString(17)
rdate[i] = managedCursor.getString(5)
- BLog.LOGE("Calendar rdate : " + rdate[i])
+ Blog.LOGE("Calendar rdate : " + rdate[i])
// exrule[i] = managedCursor.getString(19)
// exdate[i] = managedCursor.getString(20)
// originalEvent[i] = managedCursor.getString(21)
@@ -136,7 +136,7 @@ class CalendarGetter : BaseGetter {
// deleted[i] = managedCursor.getInt(30)
if (title[i] != null) {
- BLog.LOGE("title[i] ${title[i]}")
+ Blog.LOGE("title[i] ${title[i]}")
}
managedCursor.moveToNext()
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/LocationGetter.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/LocationGetter.kt
index 2eb58304..90cd2e2d 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/workers/LocationGetter.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/LocationGetter.kt
@@ -5,10 +5,9 @@ import android.content.Context
import android.location.Location
import androidx.work.WorkerParameters
import bums.lunatic.launcher.LauncherActivity.Companion.runWeatherGetter
+import bums.lunatic.launcher.common.letTrue
import bums.lunatic.launcher.helpers.PrefBoolean
-import bums.lunatic.launcher.helpers.PrefHelper
-import bums.lunatic.launcher.helpers.letTrue
-import bums.lunatic.launcher.utils.BLog
+import bums.lunatic.launcher.utils.Blog
import bums.lunatic.launcher.workers.LocationUpdateService.Companion.pushLocation
import com.google.android.gms.location.LocationServices
import com.google.android.gms.location.Priority
@@ -24,14 +23,14 @@ class LocationGetter(context: Context, workerParams: WorkerParameters) : BaseGet
@SuppressLint("MissingPermission")
override fun realWork(): Result {
- BLog.LOGE("${OpenWeatherGetter.TAG} realWork()")
+ Blog.LOGE("${OpenWeatherGetter.TAG} realWork()")
LocationServices.getFusedLocationProviderClient(this.applicationContext)
.getCurrentLocation(Priority.PRIORITY_HIGH_ACCURACY, CancellationTokenSource().token)
.addOnSuccessListener{ success: Location? ->
success?.let {
- BLog.LOGE("Location >>> $it")
- BLog.LOGE("Location >>> (latitude)${it.longitude}/(longitude)${it.latitude}")
+ Blog.LOGE("Location >>> $it")
+ Blog.LOGE("Location >>> (latitude)${it.longitude}/(longitude)${it.latitude}")
longitude = it.longitude
latitude = it.latitude
runWeatherGetter()
@@ -40,7 +39,7 @@ class LocationGetter(context: Context, workerParams: WorkerParameters) : BaseGet
}
}
}.addOnFailureListener{
- BLog.LOGE("Location error >>> $it")
+ Blog.LOGE("Location error >>> $it")
}
return Result.success()
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/LocationUpdateService.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/LocationUpdateService.kt
index 28f7b4ae..47371bd8 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/workers/LocationUpdateService.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/LocationUpdateService.kt
@@ -1,11 +1,9 @@
package bums.lunatic.launcher.workers
-import android.Manifest
import android.annotation.SuppressLint
import android.app.Service
import android.content.Context
import android.content.Intent
-import android.content.pm.PackageManager
import android.location.Geocoder
import android.location.Location
import android.location.LocationListener
@@ -13,15 +11,13 @@ import android.location.LocationManager
import android.os.Build
import android.os.IBinder
import android.widget.Toast
-import androidx.core.app.ActivityCompat
import bums.lunatic.launcher.LauncherActivity.Companion.runWeatherGetter
+import bums.lunatic.launcher.common.letTrue
import bums.lunatic.launcher.helpers.PrefBoolean
-import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.helpers.PrefLong
import bums.lunatic.launcher.helpers.PrefString
-import bums.lunatic.launcher.helpers.letTrue
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.workers.LocationGetter.Companion.latitude
import bums.lunatic.launcher.workers.LocationGetter.Companion.longitude
@@ -69,7 +65,7 @@ class LocationUpdateService : Service(), LocationListener {
try {
//////-1002450229641
val url = PrefString.locationApi.get()
- BLog.LOGE("LocationLog ${url}")
+ Blog.LOGE("LocationLog ${url}")
if (url.length > 10) {
val client = OkHttpClient.Builder()
.connectionPool(ConnectionPool(5, 60, TimeUnit.SECONDS))
@@ -88,7 +84,7 @@ class LocationUpdateService : Service(), LocationListener {
)
val request: Request = builder.build()
- BLog.LOGE("telegram before request ")
+ Blog.LOGE("telegram before request ")
// OkHttp 클라이언트로 GET 요청 객체 전송
val response: Response = client.newCall(request).execute()
if (response.isSuccessful()) {
@@ -97,7 +93,7 @@ class LocationUpdateService : Service(), LocationListener {
if (body != null) {
}
- } else BLog.LOGE("telegram Error Occurred")
+ } else Blog.LOGE("telegram Error Occurred")
}
} catch (e: java.lang.Exception) {
e.printStackTrace()
@@ -141,7 +137,7 @@ class LocationUpdateService : Service(), LocationListener {
}
override fun onLocationChanged(p0: Location) {
- BLog.LOGE("p0")
+ Blog.LOGE("p0")
PrefBoolean.location.get().letTrue {
longitude = p0.longitude
latitude = p0.latitude
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/NewsFeedsGetter.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/NewsFeedsGetter.kt
index 57f40053..e72cf6d4 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/workers/NewsFeedsGetter.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/NewsFeedsGetter.kt
@@ -6,7 +6,6 @@ import androidx.work.WorkerParameters
import bums.lunatic.launcher.home.adapters.RssFeedsParser
import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.getRssData
-import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.utils.RssList
class NewsFeedsGetter : BaseGetter {
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/OpenWeatherGetter.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/OpenWeatherGetter.kt
index 4a5a6ecf..77d46d1c 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/workers/OpenWeatherGetter.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/OpenWeatherGetter.kt
@@ -5,7 +5,7 @@ import androidx.work.WorkerParameters
import bums.lunatic.launcher.helpers.PrefString
import bums.lunatic.launcher.model.WeatherForcast
import bums.lunatic.launcher.model.WeatherInfoManager
-import bums.lunatic.launcher.utils.BLog
+import bums.lunatic.launcher.utils.Blog
import io.realm.kotlin.UpdatePolicy
import retrofit2.Call
import retrofit2.Retrofit
@@ -32,20 +32,20 @@ class OpenWeatherGetter(context: Context, workerParams: WorkerParameters) : Base
//////////////////////////////////////////
override fun realWork(): Result {
- BLog.LOGE("${TAG} realWork()")
+ Blog.LOGE("${TAG} realWork()")
// 위치 값 가져오기
lat = LocationGetter.latitude
lon = LocationGetter.longitude
if (lat != null && lon != null) {
getWeather(lat!!, lon!!)
} else {
- BLog.LOGE("lat or lon is null")
+ Blog.LOGE("lat or lon is null")
}
return Result.success()
}
fun getWeather(latitude: Double, longitude: Double) {
- BLog.LOGE("into getWeather")
+ Blog.LOGE("into getWeather")
///saved weatherForcast
Retrofit.Builder()
.baseUrl(URI_WEATHERAPI)
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/workers/WorkersDb.kt b/app/src/main/kotlin/bums/lunatic/launcher/workers/WorkersDb.kt
index 16969ffa..36f12f8c 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/workers/WorkersDb.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/workers/WorkersDb.kt
@@ -2,7 +2,7 @@ package bums.lunatic.launcher.workers
import bums.lunatic.launcher.BuildConfig
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.Astro
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.TelegramMessage
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.beforeDay
import io.realm.kotlin.Realm
import io.realm.kotlin.RealmConfiguration
import io.realm.kotlin.UpdatePolicy
-import io.realm.kotlin.dynamic.getValue
import io.realm.kotlin.ext.query
import io.realm.kotlin.migration.AutomaticSchemaMigration
import io.realm.kotlin.query.RealmQuery
@@ -44,8 +43,8 @@ import kotlin.reflect.KClass
class CustMigration : AutomaticSchemaMigration {
override fun migrate(migrationContext: AutomaticSchemaMigration.MigrationContext) {
- BLog.LOGE(migrationContext.oldRealm.configuration.schemaVersion.toString())
- BLog.LOGE(migrationContext.newRealm.configuration.schemaVersion.toString())
+ Blog.LOGE(migrationContext.oldRealm.configuration.schemaVersion.toString())
+ Blog.LOGE(migrationContext.newRealm.configuration.schemaVersion.toString())
}
}
object WorkersDb {
@@ -67,7 +66,6 @@ object WorkersDb {
pRealm = Realm.open(RealmConfiguration.Builder(clazz as Set>)
.migration(CustMigration(),true)
.schemaVersion(schemaVersion)
-// .deleteRealmIfMigrationNeeded()
.build())
} catch (e : IllegalStateException) {
getRealm()
@@ -98,13 +96,14 @@ object WorkersDb {
if(catfillters.contains(it.category()) && query("chosung == $0",it.chosung).find().size == 0) {
this.copyToRealm(it, UpdatePolicy.ERROR)
} else {
- this.copyToRealm(it, UpdatePolicy.ALL)
+ this.copyToRealm(it, UpdatePolicy.ERROR)
}
} catch (e : Exception) {
}
}
} catch (e : Exception) {
+ e.printStackTrace()
}
}
}
@@ -123,6 +122,7 @@ object WorkersDb {
}
}
} catch (e : Exception) {
+ e.printStackTrace()
}
}
}
@@ -133,7 +133,7 @@ object WorkersDb {
try {
this.copyToRealm(data, UpdatePolicy.ALL)
} catch (e : Exception) {
-
+ e.printStackTrace()
}
}
}
@@ -145,7 +145,7 @@ object WorkersDb {
try {
this.copyToRealm(info, UpdatePolicy.ALL)
} catch (e : Exception) {
-
+ e.printStackTrace()
}
}
}
@@ -157,7 +157,7 @@ object WorkersDb {
try {
this.copyToRealm(contact, UpdatePolicy.ALL)
} catch (e : Exception) {
-
+ e.printStackTrace()
}
}
}
diff --git a/app/src/main/res/layout/feeds.xml b/app/src/main/res/layout/feeds.xml
index e24b818f..ff9779bf 100644
--- a/app/src/main/res/layout/feeds.xml
+++ b/app/src/main/res/layout/feeds.xml
@@ -4,7 +4,6 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
- android:background="@color/black"
android:orientation="vertical">
+// 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() {
@@ -1284,6 +1314,7 @@ LogUtil.e("url!!.toUri(). >> ${url!!.toUri().authority}")
webView!!.loadUrl(url!!, extraHeaders!!)
}
}
+
}
protected val maxWidth: Int
@@ -1432,7 +1463,6 @@ LogUtil.e("onBackPressed ${webChromeClient} && ${binding.menus.menuLayout.visibi
snackbarView.setBackgroundColor(toolbarColor)
if (snackbarView is ViewGroup) updateChildTextView(snackbarView)
snackbar.show()
-
hideMenu()
} else if (viewId == R.id.menuOpenWith) {
val browserIntent = Intent(
@@ -1441,8 +1471,8 @@ LogUtil.e("onBackPressed ${webChromeClient} && ${binding.menus.menuLayout.visibi
)
)
startActivity(browserIntent)
-
hideMenu()
+ finish()
}
}
@@ -1809,8 +1839,8 @@ LogUtil.e("onBackPressed ${webChromeClient} && ${binding.menus.menuLayout.visibi
view: WebView,
request: WebResourceRequest
): WebResourceResponse? {
- LogUtil.e("shouldInterceptRequest request >>> ${request.url.toString()}")
- if (request.url.toString().contains("gif")) {
+// LogUtil.e("shouldInterceptRequest request >>> ${request.url.toString()}")
+ if (request.url.toString().contains("gif") && request.url.toString().contains("sogirl")) {
return WebResourceResponse(
"text/plain", "utf-8",
ByteArrayInputStream("".toByteArray())
@@ -1863,12 +1893,13 @@ LogUtil.e("onBackPressed ${webChromeClient} && ${binding.menus.menuLayout.visibi
webView!!.loadUrl(injectJavaScript!!)
}
}
+ registCancelSearch()
}
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
handler.sendEmptyMessage(MSG_CLICK_ON_URL)
- LogUtil.e("host >>> ${host} , url >>> ${url}")
-// if (host?.length ?: 0 > 2 && url.contains(host!!)) {
+// LogUtil.e("host >>> ${host} , url >>> ${url}")
+ if (url.contains("coupang") == false && url.contains("aliex") == false) {
if (url.endsWith(".mp4")) {
val intent = Intent(Intent.ACTION_VIEW)
intent.setDataAndType(Uri.parse(url), "video/*")
@@ -1919,9 +1950,9 @@ LogUtil.e("onBackPressed ${webChromeClient} && ${binding.menus.menuLayout.visibi
return super.shouldOverrideUrlLoading(view, url)
}
}
-// } else {
-// return true
-// }
+ } else {
+ return true
+ }
}
override fun onLoadResource(view: WebView, url: String) {