dd
This commit is contained in:
parent
d00c97e7d7
commit
eb51ed944a
@ -89,7 +89,7 @@ dependencies {
|
|||||||
implementation ("androidx.core:core-splashscreen:1.0.1")
|
implementation ("androidx.core:core-splashscreen:1.0.1")
|
||||||
implementation ("androidx.lifecycle:lifecycle-runtime-ktx:2.8.7")
|
implementation ("androidx.lifecycle:lifecycle-runtime-ktx:2.8.7")
|
||||||
implementation ("com.google.android.material:material:1.12.0")
|
implementation ("com.google.android.material:material:1.12.0")
|
||||||
|
implementation ("com.ibm.icu:icu4j:68.1")
|
||||||
implementation (kotlin("stdlib", version = kotlinVersion))
|
implementation (kotlin("stdlib", version = kotlinVersion))
|
||||||
implementation ("com.github.cachapa:ExpandableLayout:2.9.2")
|
implementation ("com.github.cachapa:ExpandableLayout:2.9.2")
|
||||||
implementation ("com.squareup.picasso:picasso:2.71828")
|
implementation ("com.squareup.picasso:picasso:2.71828")
|
||||||
|
|||||||
@ -45,6 +45,7 @@ import android.telephony.TelephonyManager
|
|||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.KeyEvent.ACTION_UP
|
import android.view.KeyEvent.ACTION_UP
|
||||||
import android.view.KeyEvent.KEYCODE_BUTTON_A
|
import android.view.KeyEvent.KEYCODE_BUTTON_A
|
||||||
|
import android.view.KeyEvent.KEYCODE_BUTTON_B
|
||||||
import android.view.KeyEvent.KEYCODE_BUTTON_SELECT
|
import android.view.KeyEvent.KEYCODE_BUTTON_SELECT
|
||||||
import android.view.KeyEvent.KEYCODE_BUTTON_START
|
import android.view.KeyEvent.KEYCODE_BUTTON_START
|
||||||
import android.view.KeyEvent.KEYCODE_BUTTON_X
|
import android.view.KeyEvent.KEYCODE_BUTTON_X
|
||||||
@ -143,7 +144,6 @@ internal class LauncherActivity : CommonActivity() {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private var mWorkManager: WorkManager? = null
|
private var mWorkManager: WorkManager? = null
|
||||||
|
|
||||||
var isOpendFold = false
|
var isOpendFold = false
|
||||||
val qDayPeriod = 60L * 8L
|
val qDayPeriod = 60L * 8L
|
||||||
|
|
||||||
@ -152,37 +152,30 @@ internal class LauncherActivity : CommonActivity() {
|
|||||||
@JvmStatic var appWidgetHost: WidgetHost? = null
|
@JvmStatic var appWidgetHost: WidgetHost? = null
|
||||||
fun refreshDeviceData()
|
fun refreshDeviceData()
|
||||||
{
|
{
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
|
||||||
mWorkManager?.cancelAllWorkByTag(SMS_WORK_TAG)
|
|
||||||
mWorkManager?.enqueueUniquePeriodicWork(
|
|
||||||
SMS_WORK_TAG,
|
|
||||||
ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
|
||||||
PeriodicWorkRequestBuilder<RecentSmsGetter>(PrefLong.longTimePeriod.get(), TimeUnit.MINUTES)
|
|
||||||
.addTag(SMS_WORK_TAG)
|
|
||||||
.build())
|
|
||||||
}, 500, TimeUnit.MILLISECONDS)
|
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
|
||||||
mWorkManager?.cancelAllWorkByTag(RecentCallGetter.TAG)
|
|
||||||
mWorkManager?.enqueueUniquePeriodicWork(
|
|
||||||
RecentCallGetter.TAG,
|
|
||||||
ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
|
||||||
PeriodicWorkRequestBuilder<RecentCallGetter>(PrefLong.longTimePeriod.get(), TimeUnit.MINUTES)
|
|
||||||
.addTag(RecentCallGetter.TAG)
|
|
||||||
.build())
|
|
||||||
}, 500, TimeUnit.MILLISECONDS)
|
|
||||||
|
|
||||||
var delay = 3L
|
mWorkManager?.cancelAllWorkByTag(SMS_WORK_TAG)
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
mWorkManager?.enqueueUniquePeriodicWork(
|
||||||
mWorkManager?.cancelAllWorkByTag(ContactInfoGetter.TAG)
|
SMS_WORK_TAG,
|
||||||
mWorkManager?.enqueueUniquePeriodicWork(
|
ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
||||||
ContactInfoGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
PeriodicWorkRequestBuilder<RecentSmsGetter>(PrefLong.longTimePeriod.get(), TimeUnit.MINUTES)
|
||||||
PeriodicWorkRequestBuilder<ContactInfoGetter>(12, TimeUnit.HOURS)
|
.addTag(SMS_WORK_TAG)
|
||||||
.addTag(ContactInfoGetter.TAG)
|
.build())
|
||||||
.build())
|
mWorkManager?.cancelAllWorkByTag(RecentCallGetter.TAG)
|
||||||
}, delay, TimeUnit.SECONDS)
|
mWorkManager?.enqueueUniquePeriodicWork(
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
RecentCallGetter.TAG,
|
||||||
mWorkManager?.enqueue(OneTimeWorkRequest.from(AppInfoGetter::class.java))
|
ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
||||||
}, 5, TimeUnit.SECONDS)
|
PeriodicWorkRequestBuilder<RecentCallGetter>(PrefLong.longTimePeriod.get(), TimeUnit.MINUTES)
|
||||||
|
.addTag(RecentCallGetter.TAG)
|
||||||
|
.build())
|
||||||
|
|
||||||
|
mWorkManager?.cancelAllWorkByTag(ContactInfoGetter.TAG)
|
||||||
|
mWorkManager?.enqueueUniquePeriodicWork(
|
||||||
|
ContactInfoGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
||||||
|
PeriodicWorkRequestBuilder<ContactInfoGetter>(12, TimeUnit.HOURS)
|
||||||
|
.addTag(ContactInfoGetter.TAG)
|
||||||
|
.build())
|
||||||
|
|
||||||
|
mWorkManager?.enqueue(OneTimeWorkRequest.from(AppInfoGetter::class.java))
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,109 +194,75 @@ internal class LauncherActivity : CommonActivity() {
|
|||||||
val defaultDelay = 10L
|
val defaultDelay = 10L
|
||||||
|
|
||||||
fun refreshFeeds() {
|
fun refreshFeeds() {
|
||||||
var delay = defaultDelay
|
mWorkManager?.cancelAllWork()
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
mWorkManager?.cancelAllWorkByTag(RuliWebGetter.TAG)
|
||||||
mWorkManager?.cancelAllWorkByTag(FEDDS_WORK_TAG)
|
mWorkManager?.enqueueUniquePeriodicWork(
|
||||||
mWorkManager?.enqueueUniquePeriodicWork(
|
RuliWebGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
||||||
FEDDS_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
PeriodicWorkRequestBuilder<RuliWebGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
||||||
PeriodicWorkRequestBuilder<NewsFeedsGetter>(PrefLong.shortTimePeriod.get(), TimeUnit.MINUTES)
|
.addTag(RuliWebGetter.TAG)
|
||||||
.addTag(FEDDS_WORK_TAG)
|
.build())
|
||||||
.build())
|
|
||||||
}, delay, TimeUnit.SECONDS)
|
|
||||||
delay += defaultDelay
|
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
|
||||||
mWorkManager?.cancelAllWorkByTag(YT_WORK_TAG)
|
|
||||||
mWorkManager?.enqueueUniquePeriodicWork(
|
|
||||||
YT_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
|
||||||
PeriodicWorkRequestBuilder<YoutubeGetter>(PrefLong.longTimePeriod.get(), TimeUnit.MINUTES)
|
|
||||||
.addTag(YT_WORK_TAG)
|
|
||||||
.build())
|
|
||||||
}, delay, TimeUnit.SECONDS)
|
|
||||||
delay += defaultDelay
|
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
|
||||||
mWorkManager?.cancelAllWorkByTag(REDDIT_WORK_TAG)
|
|
||||||
mWorkManager?.enqueueUniquePeriodicWork(
|
|
||||||
REDDIT_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
|
||||||
PeriodicWorkRequestBuilder<RedditGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
|
||||||
.addTag(REDDIT_WORK_TAG)
|
|
||||||
.build())
|
|
||||||
}, delay, TimeUnit.SECONDS)
|
|
||||||
delay += defaultDelay
|
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
|
||||||
mWorkManager?.cancelAllWorkByTag(COMIC_WORK_TAG)
|
|
||||||
mWorkManager?.enqueueUniquePeriodicWork(
|
|
||||||
COMIC_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
|
||||||
PeriodicWorkRequestBuilder<FmKoreaGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
|
||||||
.addTag(COMIC_WORK_TAG)
|
|
||||||
.build())
|
|
||||||
}, delay, TimeUnit.SECONDS)
|
|
||||||
delay += defaultDelay
|
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
|
||||||
mWorkManager?.cancelAllWorkByTag(COMIC2_WORK_TAG)
|
|
||||||
mWorkManager?.enqueueUniquePeriodicWork(
|
|
||||||
COMIC2_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
|
||||||
PeriodicWorkRequestBuilder<DotaxGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
|
||||||
.addTag(COMIC2_WORK_TAG)
|
|
||||||
.build())
|
|
||||||
}, delay, TimeUnit.SECONDS)
|
|
||||||
delay += defaultDelay
|
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
|
||||||
mWorkManager?.cancelAllWorkByTag(ClienGetter.TAG)
|
|
||||||
mWorkManager?.enqueueUniquePeriodicWork(
|
|
||||||
ClienGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
|
||||||
PeriodicWorkRequestBuilder<ClienGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
|
||||||
.addTag(ClienGetter.TAG)
|
|
||||||
.build())
|
|
||||||
}, delay, TimeUnit.SECONDS)
|
|
||||||
delay += defaultDelay
|
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
|
||||||
mWorkManager?.cancelAllWorkByTag(DCGetter.TAG)
|
|
||||||
mWorkManager?.enqueueUniquePeriodicWork(
|
|
||||||
DCGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
|
||||||
PeriodicWorkRequestBuilder<DCGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
|
||||||
.addTag(DCGetter.TAG)
|
|
||||||
.build())
|
|
||||||
}, delay, TimeUnit.SECONDS)
|
|
||||||
delay += defaultDelay
|
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
|
||||||
mWorkManager?.cancelAllWorkByTag(RuliWebGetter.TAG)
|
|
||||||
mWorkManager?.enqueueUniquePeriodicWork(
|
|
||||||
RuliWebGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
|
||||||
PeriodicWorkRequestBuilder<RuliWebGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
|
||||||
.addTag(RuliWebGetter.TAG)
|
|
||||||
.build())
|
|
||||||
}, delay, TimeUnit.SECONDS)
|
|
||||||
delay += defaultDelay
|
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
|
||||||
mWorkManager?.cancelAllWorkByTag(TheQooGetter.TAG)
|
|
||||||
mWorkManager?.enqueueUniquePeriodicWork(
|
|
||||||
TheQooGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
|
||||||
PeriodicWorkRequestBuilder<TheQooGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
|
||||||
.addTag(TheQooGetter.TAG)
|
|
||||||
.build())
|
|
||||||
}, delay, TimeUnit.SECONDS)
|
|
||||||
delay += defaultDelay
|
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
|
||||||
mWorkManager?.cancelAllWorkByTag(ArcaGetter.TAG)
|
|
||||||
mWorkManager?.enqueueUniquePeriodicWork(
|
|
||||||
ArcaGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
|
||||||
PeriodicWorkRequestBuilder<ArcaGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
|
||||||
.addTag(ArcaGetter.TAG)
|
|
||||||
.build())
|
|
||||||
|
|
||||||
}, delay, TimeUnit.SECONDS)
|
|
||||||
|
|
||||||
delay += defaultDelay
|
|
||||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
|
||||||
mWorkManager?.cancelAllWorkByTag(LocationGetter.TAG)
|
|
||||||
mWorkManager?.enqueueUniquePeriodicWork(
|
|
||||||
LocationGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
|
||||||
PeriodicWorkRequestBuilder<LocationGetter>(PrefLong.locationTimePeriod.get(), TimeUnit.MINUTES)
|
|
||||||
.addTag(LocationGetter.TAG)
|
|
||||||
.build())
|
|
||||||
|
|
||||||
}, delay, TimeUnit.SECONDS)
|
|
||||||
|
|
||||||
|
mWorkManager?.cancelAllWorkByTag(FEDDS_WORK_TAG)
|
||||||
|
mWorkManager?.enqueueUniquePeriodicWork(
|
||||||
|
FEDDS_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
||||||
|
PeriodicWorkRequestBuilder<NewsFeedsGetter>(PrefLong.shortTimePeriod.get(), TimeUnit.MINUTES)
|
||||||
|
.addTag(FEDDS_WORK_TAG)
|
||||||
|
.build())
|
||||||
|
mWorkManager?.cancelAllWorkByTag(YT_WORK_TAG)
|
||||||
|
mWorkManager?.enqueueUniquePeriodicWork(
|
||||||
|
YT_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
||||||
|
PeriodicWorkRequestBuilder<YoutubeGetter>(PrefLong.longTimePeriod.get(), TimeUnit.MINUTES)
|
||||||
|
.addTag(YT_WORK_TAG)
|
||||||
|
.build())
|
||||||
|
mWorkManager?.cancelAllWorkByTag(REDDIT_WORK_TAG)
|
||||||
|
mWorkManager?.enqueueUniquePeriodicWork(
|
||||||
|
REDDIT_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
||||||
|
PeriodicWorkRequestBuilder<RedditGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
||||||
|
.addTag(REDDIT_WORK_TAG)
|
||||||
|
.build())
|
||||||
|
mWorkManager?.cancelAllWorkByTag(COMIC_WORK_TAG)
|
||||||
|
mWorkManager?.enqueueUniquePeriodicWork(
|
||||||
|
COMIC_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
||||||
|
PeriodicWorkRequestBuilder<FmKoreaGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
||||||
|
.addTag(COMIC_WORK_TAG)
|
||||||
|
.build())
|
||||||
|
mWorkManager?.cancelAllWorkByTag(COMIC2_WORK_TAG)
|
||||||
|
mWorkManager?.enqueueUniquePeriodicWork(
|
||||||
|
COMIC2_WORK_TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
||||||
|
PeriodicWorkRequestBuilder<DotaxGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
||||||
|
.addTag(COMIC2_WORK_TAG)
|
||||||
|
.build())
|
||||||
|
mWorkManager?.cancelAllWorkByTag(ClienGetter.TAG)
|
||||||
|
mWorkManager?.enqueueUniquePeriodicWork(
|
||||||
|
ClienGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
||||||
|
PeriodicWorkRequestBuilder<ClienGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
||||||
|
.addTag(ClienGetter.TAG)
|
||||||
|
.build())
|
||||||
|
mWorkManager?.cancelAllWorkByTag(DCGetter.TAG)
|
||||||
|
mWorkManager?.enqueueUniquePeriodicWork(
|
||||||
|
DCGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
||||||
|
PeriodicWorkRequestBuilder<DCGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
||||||
|
.addTag(DCGetter.TAG)
|
||||||
|
.build())
|
||||||
|
mWorkManager?.cancelAllWorkByTag(TheQooGetter.TAG)
|
||||||
|
mWorkManager?.enqueueUniquePeriodicWork(
|
||||||
|
TheQooGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
||||||
|
PeriodicWorkRequestBuilder<TheQooGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
||||||
|
.addTag(TheQooGetter.TAG)
|
||||||
|
.build())
|
||||||
|
mWorkManager?.cancelAllWorkByTag(ArcaGetter.TAG)
|
||||||
|
mWorkManager?.enqueueUniquePeriodicWork(
|
||||||
|
ArcaGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
||||||
|
PeriodicWorkRequestBuilder<ArcaGetter>(PrefLong.midTimePeriod.get(), TimeUnit.MINUTES)
|
||||||
|
.addTag(ArcaGetter.TAG)
|
||||||
|
.build())
|
||||||
|
mWorkManager?.cancelAllWorkByTag(LocationGetter.TAG)
|
||||||
|
mWorkManager?.enqueueUniquePeriodicWork(
|
||||||
|
LocationGetter.TAG, ExistingPeriodicWorkPolicy.CANCEL_AND_REENQUEUE,
|
||||||
|
PeriodicWorkRequestBuilder<LocationGetter>(PrefLong.locationTimePeriod.get(), TimeUnit.MINUTES)
|
||||||
|
.addTag(LocationGetter.TAG)
|
||||||
|
.build())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -375,6 +334,13 @@ internal class LauncherActivity : CommonActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
KEYCODE_BUTTON_B->{
|
||||||
|
RssViewBuilder(lActivity!!)
|
||||||
|
.setRssId("https://jav.guru")
|
||||||
|
.webViewJavaScriptEnabled(true)
|
||||||
|
.showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1)
|
||||||
|
.show("https://jav.guru")
|
||||||
|
}
|
||||||
KEYCODE_DPAD_DOWN->{
|
KEYCODE_DPAD_DOWN->{
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -382,7 +348,7 @@ internal class LauncherActivity : CommonActivity() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
KEYCODE_BUTTON_START->{
|
KEYCODE_BUTTON_START->{
|
||||||
onClickCenterButton()
|
onClickCenterButton()
|
||||||
}
|
}
|
||||||
KEYCODE_BUTTON_SELECT->{
|
KEYCODE_BUTTON_SELECT->{
|
||||||
WorkersDb.getRealm().apply {
|
WorkersDb.getRealm().apply {
|
||||||
@ -417,12 +383,13 @@ internal class LauncherActivity : CommonActivity() {
|
|||||||
writeBlocking {
|
writeBlocking {
|
||||||
var ddd = copyFromRealm(WorkersDb.getRssQuery("", RssDataType.getExcAdt(),false).limit(100).query("read == $0", 0).query("vote != $0", true).find()).map { it.originPage() }
|
var ddd = copyFromRealm(WorkersDb.getRssQuery("", RssDataType.getExcAdt(),false).limit(100).query("read == $0", 0).query("vote != $0", true).find()).map { it.originPage() }
|
||||||
var origin = ddd.first()
|
var origin = ddd.first()
|
||||||
|
var jjjj = hashSetOf<String>()
|
||||||
|
jjjj.addAll(ddd)
|
||||||
RssViewBuilder(lActivity!!)
|
RssViewBuilder(lActivity!!)
|
||||||
.setRssList(arrayListOf<String>().apply {
|
.setRssList(arrayListOf<String>().apply {
|
||||||
var jjjj = hashSetOf<String>()
|
this.addAll(jjjj)})
|
||||||
jjjj.addAll(ddd)
|
|
||||||
this.addAll(jjjj) })
|
|
||||||
.setRssId(origin)
|
.setRssId(origin)
|
||||||
|
// .webViewDesktopMode(true)
|
||||||
.showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1)
|
.showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1)
|
||||||
.show(origin)
|
.show(origin)
|
||||||
}
|
}
|
||||||
@ -574,6 +541,7 @@ internal class LauncherActivity : CommonActivity() {
|
|||||||
@SuppressLint("NewApi", "MissingPermission")
|
@SuppressLint("NewApi", "MissingPermission")
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
installSplashScreen()
|
installSplashScreen()
|
||||||
|
|
||||||
mWorkManager = WorkManager.getInstance(this)
|
mWorkManager = WorkManager.getInstance(this)
|
||||||
DynamicColors.applyToActivityIfAvailable(this)
|
DynamicColors.applyToActivityIfAvailable(this)
|
||||||
lActivity = this
|
lActivity = this
|
||||||
|
|||||||
@ -35,6 +35,7 @@ import android.view.inputmethod.InputMethodManager
|
|||||||
import androidx.core.widget.doOnTextChanged
|
import androidx.core.widget.doOnTextChanged
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import bums.lunatic.launcher.BuildConfig
|
import bums.lunatic.launcher.BuildConfig
|
||||||
|
import bums.lunatic.launcher.LauncherActivity
|
||||||
import bums.lunatic.launcher.common.CommonActivity
|
import bums.lunatic.launcher.common.CommonActivity
|
||||||
import bums.lunatic.launcher.common.letTrue
|
import bums.lunatic.launcher.common.letTrue
|
||||||
import bums.lunatic.launcher.databinding.AppDrawerBinding
|
import bums.lunatic.launcher.databinding.AppDrawerBinding
|
||||||
@ -66,7 +67,7 @@ internal class AppDrawer : CommonActivity() {
|
|||||||
private var isKeyboardShowing: Boolean = false
|
private var isKeyboardShowing: Boolean = false
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
lateinit var packageManager: PackageManager
|
|
||||||
private var appsAdapter: AppsAdapter? = null
|
private var appsAdapter: AppsAdapter? = null
|
||||||
private var contactAdapter : ContactAdapter? = null
|
private var contactAdapter : ContactAdapter? = null
|
||||||
private var packageList = mutableListOf<AppInfo>()
|
private var packageList = mutableListOf<AppInfo>()
|
||||||
@ -74,34 +75,14 @@ internal class AppDrawer : CommonActivity() {
|
|||||||
@JvmStatic var appNamesPrefs: SharedPreferences? = null
|
@JvmStatic var appNamesPrefs: SharedPreferences? = null
|
||||||
|
|
||||||
|
|
||||||
fun appName(resolver: ResolveInfo): String {
|
|
||||||
return resolver.loadLabel(packageManager).toString().apply {
|
|
||||||
appNamesPrefs?.edit()?.putString(resolver.activityInfo.packageName, this)?.apply()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getCategory(category : Int) : String {
|
|
||||||
return when(category) {
|
|
||||||
ApplicationInfo.CATEGORY_UNDEFINED -> "UNDEFINED"
|
|
||||||
ApplicationInfo.CATEGORY_GAME -> "GAME"
|
|
||||||
ApplicationInfo.CATEGORY_AUDIO -> "AUDIO"
|
|
||||||
ApplicationInfo.CATEGORY_VIDEO -> "VIDEO"
|
|
||||||
ApplicationInfo.CATEGORY_IMAGE -> "IMAGE"
|
|
||||||
ApplicationInfo.CATEGORY_SOCIAL -> "SOCIAL"
|
|
||||||
ApplicationInfo.CATEGORY_NEWS -> "NEWS"
|
|
||||||
ApplicationInfo.CATEGORY_MAPS -> "MAPS"
|
|
||||||
ApplicationInfo.CATEGORY_PRODUCTIVITY -> "PRODUCTIVITY"
|
|
||||||
ApplicationInfo.CATEGORY_ACCESSIBILITY -> "ACCESSIBILITY"
|
|
||||||
else -> {"UNKNOWN"}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
fun getInputText() = binding.searchInput.text.toString()
|
fun getInputText() = binding.searchInput.text.toString()
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
// setStyle(STYLE_NO_TITLE, R.style.FilterFullScreenDialog)
|
// setStyle(STYLE_NO_TITLE, R.style.FilterFullScreenDialog)
|
||||||
// packageManager = lActivity?.packageManager!!
|
// packageManager
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// override fun onAttach(context: Context) {
|
// override fun onAttach(context: Context) {
|
||||||
@ -118,7 +99,7 @@ internal class AppDrawer : CommonActivity() {
|
|||||||
appNamesPrefs = this.getSharedPreferences(PREFS_APP_NAMES, 0)
|
appNamesPrefs = this.getSharedPreferences(PREFS_APP_NAMES, 0)
|
||||||
layoutType = settingsPrefs!!.getInt(KEY_APPS_LAYOUT, 0)
|
layoutType = settingsPrefs!!.getInt(KEY_APPS_LAYOUT, 0)
|
||||||
|
|
||||||
appsAdapter = AppsAdapter(layoutType, packageManager!!, supportFragmentManager, binding.appsCount)
|
appsAdapter = AppsAdapter(packageManager!!, supportFragmentManager, binding.appsCount)
|
||||||
contactAdapter = ContactAdapter(packageManager!!, supportFragmentManager)
|
contactAdapter = ContactAdapter(packageManager!!, supportFragmentManager)
|
||||||
|
|
||||||
binding.appsCount.visibility = if (settingsPrefs!!.getBoolean(KEY_APPS_COUNT, true)) VISIBLE else GONE
|
binding.appsCount.visibility = if (settingsPrefs!!.getBoolean(KEY_APPS_COUNT, true)) VISIBLE else GONE
|
||||||
@ -496,9 +477,3 @@ internal class AppDrawer : CommonActivity() {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun normalize(str: String): String {
|
|
||||||
val normalizedString =
|
|
||||||
Normalizer.normalize(str.replace("\\W".toRegex(), ""), Normalizer.Form.NFC)
|
|
||||||
val pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+")
|
|
||||||
return pattern.matcher(normalizedString).replaceAll("").toLowerCase()
|
|
||||||
}
|
|
||||||
@ -41,10 +41,9 @@ import kotlinx.coroutines.async
|
|||||||
|
|
||||||
|
|
||||||
internal class AppsAdapter(
|
internal class AppsAdapter(
|
||||||
private val layoutType: Int,
|
|
||||||
private val packageManager: PackageManager,
|
private val packageManager: PackageManager,
|
||||||
private val fragmentManager: FragmentManager,
|
private val fragmentManager: FragmentManager,
|
||||||
private val appsCount: TextView) : RecyclerView.Adapter<AppsAdapter.AppsViewHolder>() {
|
private val appsCount: TextView?) : RecyclerView.Adapter<AppsAdapter.AppsViewHolder>() {
|
||||||
|
|
||||||
private var oldList = mutableListOf<AppInfo>()
|
private var oldList = mutableListOf<AppInfo>()
|
||||||
// private var appGravity: Int = Gravity.CENTER
|
// private var appGravity: Int = Gravity.CENTER
|
||||||
@ -125,7 +124,7 @@ internal class AppsAdapter(
|
|||||||
oldList.clear()
|
oldList.clear()
|
||||||
oldList.addAll(newList)
|
oldList.addAll(newList)
|
||||||
newList.size.let {
|
newList.size.let {
|
||||||
appsCount.text = it.toString()
|
appsCount?.text = it.toString()
|
||||||
appsSize = it
|
appsSize = it
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -134,7 +134,7 @@ class BluetoothManager {
|
|||||||
//블루투스 상태(켜짐 / 꺼짐 / 지원 불가 기기)
|
//블루투스 상태(켜짐 / 꺼짐 / 지원 불가 기기)
|
||||||
fun blueToothState(): String {
|
fun blueToothState(): String {
|
||||||
if (blueToothAdapter != null) {
|
if (blueToothAdapter != null) {
|
||||||
if (blueToothAdapter!!.isEnabled) {
|
if (blueToothAdapter?.isEnabled == true) {
|
||||||
return BLUETOOTH_STATE.ENABLED.statestr
|
return BLUETOOTH_STATE.ENABLED.statestr
|
||||||
} else {
|
} else {
|
||||||
return BLUETOOTH_STATE.DISABLED.statestr
|
return BLUETOOTH_STATE.DISABLED.statestr
|
||||||
@ -167,7 +167,6 @@ class BluetoothManager {
|
|||||||
val action = intent!!.action
|
val action = intent!!.action
|
||||||
if (context == null) return
|
if (context == null) return
|
||||||
if (ActivityCompat.checkSelfPermission(context!!, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) return
|
if (ActivityCompat.checkSelfPermission(context!!, Manifest.permission.BLUETOOTH_CONNECT) != PackageManager.PERMISSION_GRANTED) return
|
||||||
val device: BluetoothDevice = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE)!!
|
|
||||||
getPairedDevices()
|
getPairedDevices()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2,6 +2,7 @@ package bums.lunatic.launcher.helpers
|
|||||||
|
|
||||||
import android.content.SharedPreferences
|
import android.content.SharedPreferences
|
||||||
import bums.lunatic.launcher.model.RssDataType
|
import bums.lunatic.launcher.model.RssDataType
|
||||||
|
import bums.lunatic.launcher.utils.Blog
|
||||||
import kr.lunaticbum.utils.preferences.PrefJsonConvert
|
import kr.lunaticbum.utils.preferences.PrefJsonConvert
|
||||||
import kr.lunaticbum.utils.preferences.PrefKey
|
import kr.lunaticbum.utils.preferences.PrefKey
|
||||||
import kr.lunaticbum.utils.preferences.PreferencesHelper
|
import kr.lunaticbum.utils.preferences.PreferencesHelper
|
||||||
@ -30,7 +31,13 @@ enum class PrefLong(val def : Long) : PrefKey<Long> {
|
|||||||
midTimePeriod(30L),
|
midTimePeriod(30L),
|
||||||
maxQueryCount(18L);
|
maxQueryCount(18L);
|
||||||
override fun set(value : Long) { PrefHelper.putLong(this.name, value) }
|
override fun set(value : Long) { PrefHelper.putLong(this.name, value) }
|
||||||
override fun get(def : Long?) : Long = PrefHelper.getLong(this.name, def as? Long ?: this.def) ?: 0L
|
override fun get(def : Long?) : Long {
|
||||||
|
val value = PrefHelper.getLong(this.name, def ?: this.def) ?: this.def
|
||||||
|
|
||||||
|
// Blog.LOGE("$name : $value")
|
||||||
|
|
||||||
|
return value
|
||||||
|
}
|
||||||
override fun getKey() = this.name
|
override fun getKey() = this.name
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,7 +104,7 @@ object PrefHelper : PreferencesHelper() {
|
|||||||
fun getBoolean(key: String, def: Boolean) = get(getBooleanPrefix().plus(key), def)
|
fun getBoolean(key: String, def: Boolean) = get(getBooleanPrefix().plus(key), def)
|
||||||
fun putBoolean(key: String, value: Boolean) = put(getBooleanPrefix().plus(key), value)
|
fun putBoolean(key: String, value: Boolean) = put(getBooleanPrefix().plus(key), value)
|
||||||
fun getLong(key: String, def: Long) = get(getLongPrefix().plus(key), def)
|
fun getLong(key: String, def: Long) = get(getLongPrefix().plus(key), def)
|
||||||
fun putLong(key: String, value: Long) = put(getBooleanPrefix().plus(key), value)
|
fun putLong(key: String, value: Long) = put(getLongPrefix().plus(key), value)
|
||||||
fun getString(key: String, def: String) = get(getStringPrefix().plus(key), def)
|
fun getString(key: String, def: String) = get(getStringPrefix().plus(key), def)
|
||||||
fun putString(key: String, value: String) = put(getStringPrefix().plus(key), value)
|
fun putString(key: String, value: String) = put(getStringPrefix().plus(key), value)
|
||||||
|
|
||||||
|
|||||||
@ -53,6 +53,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
import androidx.viewpager2.widget.ViewPager2
|
import androidx.viewpager2.widget.ViewPager2
|
||||||
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
|
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
|
||||||
import bums.lunatic.launcher.R
|
import bums.lunatic.launcher.R
|
||||||
|
import bums.lunatic.launcher.apps.AppsAdapter
|
||||||
import bums.lunatic.launcher.behavior.Behavior
|
import bums.lunatic.launcher.behavior.Behavior
|
||||||
import bums.lunatic.launcher.common.letTrue
|
import bums.lunatic.launcher.common.letTrue
|
||||||
import bums.lunatic.launcher.databinding.LauncherHomeBinding
|
import bums.lunatic.launcher.databinding.LauncherHomeBinding
|
||||||
@ -70,6 +71,7 @@ import bums.lunatic.launcher.home.adapters.SwipeToDeleteCallback
|
|||||||
import bums.lunatic.launcher.home.adapters.WeatherAdapter
|
import bums.lunatic.launcher.home.adapters.WeatherAdapter
|
||||||
import bums.lunatic.launcher.home.adapters.WeatherDressAdatper
|
import bums.lunatic.launcher.home.adapters.WeatherDressAdatper
|
||||||
import bums.lunatic.launcher.home.adapters.WeatherHourlyAdapter
|
import bums.lunatic.launcher.home.adapters.WeatherHourlyAdapter
|
||||||
|
import bums.lunatic.launcher.model.AppInfo
|
||||||
import bums.lunatic.launcher.model.CurrentPlayItem
|
import bums.lunatic.launcher.model.CurrentPlayItem
|
||||||
import bums.lunatic.launcher.model.Hour
|
import bums.lunatic.launcher.model.Hour
|
||||||
import bums.lunatic.launcher.model.NotificationItem
|
import bums.lunatic.launcher.model.NotificationItem
|
||||||
@ -103,6 +105,8 @@ import io.realm.kotlin.query.Sort
|
|||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
|
import kotlinx.coroutines.flow.cancellable
|
||||||
|
import kotlinx.coroutines.flow.collect
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.json.JSONArray
|
import org.json.JSONArray
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
@ -158,6 +162,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
lateinit var mSmsLogsAdapter: SmsLogsAdapter
|
lateinit var mSmsLogsAdapter: SmsLogsAdapter
|
||||||
lateinit var mRssAdapter: RssItemAdapter
|
lateinit var mRssAdapter: RssItemAdapter
|
||||||
lateinit var mNotiAdapter: NotificationItemAdapter
|
lateinit var mNotiAdapter: NotificationItemAdapter
|
||||||
|
lateinit var mAppsAdapter: AppsAdapter
|
||||||
var mWeatherAdapter: WeatherAdapter? = null
|
var mWeatherAdapter: WeatherAdapter? = null
|
||||||
var weatherDressAdapter: WeatherDressAdatper? = null
|
var weatherDressAdapter: WeatherDressAdatper? = null
|
||||||
var weatherHourlyAdapter: WeatherHourlyAdapter? = null
|
var weatherHourlyAdapter: WeatherHourlyAdapter? = null
|
||||||
@ -182,6 +187,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
mRecentCallsAdapter = RecentCallsAdapter(arrayListOf(), requireContext())
|
mRecentCallsAdapter = RecentCallsAdapter(arrayListOf(), requireContext())
|
||||||
mSmsLogsAdapter = SmsLogsAdapter(arrayListOf(), requireContext())
|
mSmsLogsAdapter = SmsLogsAdapter(arrayListOf(), requireContext())
|
||||||
mNotiAdapter = NotificationItemAdapter(requireContext())
|
mNotiAdapter = NotificationItemAdapter(requireContext())
|
||||||
|
mAppsAdapter = AppsAdapter(requireContext().packageManager , fragManager, null)
|
||||||
mRssAdapter = RssItemAdapter(requireContext())
|
mRssAdapter = RssItemAdapter(requireContext())
|
||||||
|
|
||||||
weatherDressAdapter = WeatherDressAdatper(arrayListOf())
|
weatherDressAdapter = WeatherDressAdatper(arrayListOf())
|
||||||
@ -212,6 +218,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
binding.smsList.adapter = mSmsLogsAdapter
|
binding.smsList.adapter = mSmsLogsAdapter
|
||||||
binding.infoList.adapter = mRssAdapter
|
binding.infoList.adapter = mRssAdapter
|
||||||
binding.notiList.adapter = mNotiAdapter
|
binding.notiList.adapter = mNotiAdapter
|
||||||
|
binding.appsList.adapter = mAppsAdapter
|
||||||
binding.weathers.weatherViewPager.adapter = mWeatherAdapter
|
binding.weathers.weatherViewPager.adapter = mWeatherAdapter
|
||||||
binding.weathers.weatherViewPager.registerOnPageChangeCallback(object :
|
binding.weathers.weatherViewPager.registerOnPageChangeCallback(object :
|
||||||
ViewPager2.OnPageChangeCallback() {
|
ViewPager2.OnPageChangeCallback() {
|
||||||
@ -224,31 +231,14 @@ internal class LauncherHome : Fragment() {
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
// binding.favAppsGroup.setOnLongClickListener {
|
binding.notice.setOnLongClickListener {
|
||||||
// binding.otherCheck.isSelected = true
|
RssViewBuilder(lActivity!!)
|
||||||
// queryVotes()
|
.setRssId("https://jav.guru")
|
||||||
// true
|
.webViewJavaScriptEnabled(true)
|
||||||
// }
|
.showIconClose(true).showIconBack(false).showProgressBar(true).backPressToClose(false).webViewMixedContentMode(1)
|
||||||
// binding.favAppsGroup.setOnClickListener {
|
.show("https://jav.guru")
|
||||||
// if (binding.otherCheck.isSelected) {
|
true
|
||||||
// searchData()
|
}
|
||||||
// }
|
|
||||||
//// else if (binding.otherCheck.isSelected) {
|
|
||||||
//// searchData()
|
|
||||||
//// }
|
|
||||||
//// else if (binding.otherCheck.isSelected) {
|
|
||||||
//// searchData()
|
|
||||||
//// }
|
|
||||||
//// else if (binding.otherCheck.isSelected) {
|
|
||||||
//// searchData()
|
|
||||||
//// }
|
|
||||||
//// else if (binding.otherCheck.isSelected) {
|
|
||||||
//// searchData()
|
|
||||||
//// }
|
|
||||||
// else {
|
|
||||||
// QuickAccess().show(fragManager, BOTTOM_SHEET_TAG)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
arrayListOf(binding.mainList,binding.smsList,binding.infoList,binding.notiList).forEach {
|
arrayListOf(binding.mainList,binding.smsList,binding.infoList,binding.notiList).forEach {
|
||||||
try {
|
try {
|
||||||
@ -264,10 +254,26 @@ internal class LauncherHome : Fragment() {
|
|||||||
queryInfos()
|
queryInfos()
|
||||||
queryNotice()
|
queryNotice()
|
||||||
queryWeather()
|
queryWeather()
|
||||||
|
queryApps()
|
||||||
setMusicFunction()
|
setMusicFunction()
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun queryApps() {
|
||||||
|
WorkersDb.getRealm().apply {
|
||||||
|
var newQ = query<AppInfo>()
|
||||||
|
newQ.sort(Pair("clickCount", Sort.DESCENDING),Pair("lastUseDate",Sort.DESCENDING)).limit(30).find()?.let {
|
||||||
|
if(it.size > 0) {
|
||||||
|
WorkersDb.getRealm().apply {
|
||||||
|
var packageList = arrayListOf<AppInfo>()
|
||||||
|
packageList.addAll(copyFromRealm(it))
|
||||||
|
mAppsAdapter?.updateData(packageList)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun setMusicFunction() {
|
fun setMusicFunction() {
|
||||||
binding.currentMusic.setOnClickListener {
|
binding.currentMusic.setOnClickListener {
|
||||||
lActivity?.apply {
|
lActivity?.apply {
|
||||||
@ -484,8 +490,8 @@ internal class LauncherHome : Fragment() {
|
|||||||
try { System.gc() } catch (e: Exception) { e.printStackTrace() }
|
try { System.gc() } catch (e: Exception) { e.printStackTrace() }
|
||||||
}
|
}
|
||||||
fun beforeQuery() {
|
fun beforeQuery() {
|
||||||
mRssDataResult = null
|
|
||||||
clearJob(infosJob)
|
clearJob(infosJob)
|
||||||
|
mRssDataResult = null
|
||||||
WorkersDb.getRealm().writeBlocking {
|
WorkersDb.getRealm().writeBlocking {
|
||||||
delete(
|
delete(
|
||||||
query<RssData>()
|
query<RssData>()
|
||||||
@ -498,24 +504,28 @@ internal class LauncherHome : Fragment() {
|
|||||||
|
|
||||||
fun updateQuery(q: RealmQuery<RssData>) {
|
fun updateQuery(q: RealmQuery<RssData>) {
|
||||||
mRssDataResult = q.sort("pubDate ", Sort.DESCENDING).limit(300).distinct("title").find()
|
mRssDataResult = q.sort("pubDate ", Sort.DESCENDING).limit(300).distinct("title").find()
|
||||||
infosJob = CoroutineScope(Dispatchers.Default).launch {
|
mRssDataResult?.asFlow()?.let { flow ->
|
||||||
mRssDataResult?.asFlow()?.collect { changes: ResultsChange<RssData> ->
|
infosJob = CoroutineScope(Dispatchers.IO).launch {
|
||||||
commandHandler.removeCallbacks(hideListView)
|
flow.collect { changes: ResultsChange<RssData> ->
|
||||||
commandHandler.removeCallbacks(infoUpdate)
|
commandHandler.removeCallbacks(hideListView)
|
||||||
when (changes) {
|
commandHandler.removeCallbacks(infoUpdate)
|
||||||
is InitialResults, is UpdatedResults -> {
|
// when (changes) {
|
||||||
WorkersDb.getRealm().apply {
|
// is InitialResults, is UpdatedResults -> {
|
||||||
lasted = copyFromRealm(changes.list)
|
WorkersDb.getRealm().apply {
|
||||||
}
|
lasted = copyFromRealm(changes.list)
|
||||||
commandHandler.postDelayed(infoUpdate, UPDATE_DELAY)
|
|
||||||
}
|
}
|
||||||
else -> {
|
commandHandler.postDelayed(infoUpdate, UPDATE_DELAY)
|
||||||
|
// }
|
||||||
|
|
||||||
}
|
// else -> {
|
||||||
|
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
infosJob?.start()
|
||||||
}
|
}
|
||||||
infosJob?.start()
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -589,8 +599,8 @@ internal class LauncherHome : Fragment() {
|
|||||||
var checkListner = object : View.OnClickListener {
|
var checkListner = object : View.OnClickListener {
|
||||||
override fun onClick(v: View?) {
|
override fun onClick(v: View?) {
|
||||||
commandHandler.removeCallbacks(hideListView)
|
commandHandler.removeCallbacks(hideListView)
|
||||||
var views = arrayListOf(binding.mainList, binding.smsList, binding.infoList, binding.notiList)
|
var views = arrayListOf(binding.mainList, binding.smsList, binding.infoList, binding.notiList,binding.appsList)
|
||||||
var chechboxs = arrayListOf(binding.missedCalls, binding.recentSms, binding.otherCheck, binding.notice)
|
var chechboxs = arrayListOf(binding.missedCalls, binding.recentSms, binding.otherCheck, binding.notice, binding.favApps)
|
||||||
chechboxs.remove(v)
|
chechboxs.remove(v)
|
||||||
when (v) {
|
when (v) {
|
||||||
binding.missedCalls -> {
|
binding.missedCalls -> {
|
||||||
@ -635,6 +645,15 @@ internal class LauncherHome : Fragment() {
|
|||||||
binding.notiList.visibility = View.VISIBLE
|
binding.notiList.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
binding.favApps -> {
|
||||||
|
if (binding.favApps.isSelected) {
|
||||||
|
binding.favApps.isSelected = false
|
||||||
|
} else {
|
||||||
|
binding.favApps.isSelected = true
|
||||||
|
views.remove(binding.appsList)
|
||||||
|
binding.appsList.visibility = View.VISIBLE
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
chechboxs.forEach { it.isSelected = false }
|
chechboxs.forEach { it.isSelected = false }
|
||||||
views.forEach { it.visibility = View.GONE }
|
views.forEach { it.visibility = View.GONE }
|
||||||
@ -646,6 +665,7 @@ internal class LauncherHome : Fragment() {
|
|||||||
binding.recentSms.setOnClickListener(checkListner)
|
binding.recentSms.setOnClickListener(checkListner)
|
||||||
binding.missedCalls.setOnClickListener(checkListner)
|
binding.missedCalls.setOnClickListener(checkListner)
|
||||||
binding.notice.setOnClickListener(checkListner)
|
binding.notice.setOnClickListener(checkListner)
|
||||||
|
binding.favApps.setOnClickListener(checkListner)
|
||||||
binding.otherCheck.setOnLongClickListener {
|
binding.otherCheck.setOnLongClickListener {
|
||||||
queryInfos()
|
queryInfos()
|
||||||
true
|
true
|
||||||
@ -740,6 +760,12 @@ internal class LauncherHome : Fragment() {
|
|||||||
|
|
||||||
fun chooseAdpater() {
|
fun chooseAdpater() {
|
||||||
commandHandler.removeCallbacks(hideListView)
|
commandHandler.removeCallbacks(hideListView)
|
||||||
|
var tabs = arrayOf(binding.missedCalls,binding.recentSms,binding.otherCheck,binding.notice,binding.favApps)
|
||||||
|
fun unsel(view: View) {
|
||||||
|
tabs.filter {
|
||||||
|
it.equals(view) == false
|
||||||
|
}.forEach { it.isSelected = false }
|
||||||
|
}
|
||||||
binding.mainList.visibility = View.INVISIBLE
|
binding.mainList.visibility = View.INVISIBLE
|
||||||
binding.smsList.visibility = View.INVISIBLE
|
binding.smsList.visibility = View.INVISIBLE
|
||||||
binding.infoList.visibility = View.INVISIBLE
|
binding.infoList.visibility = View.INVISIBLE
|
||||||
@ -754,9 +780,6 @@ internal class LauncherHome : Fragment() {
|
|||||||
binding.missedCalls.text = "통화 목록 [${list.size}]"
|
binding.missedCalls.text = "통화 목록 [${list.size}]"
|
||||||
binding.mainList.visibility = View.VISIBLE
|
binding.mainList.visibility = View.VISIBLE
|
||||||
mRecentCallsAdapter.updateData(list)
|
mRecentCallsAdapter.updateData(list)
|
||||||
binding.recentSms.isSelected = false
|
|
||||||
binding.otherCheck.isSelected = false
|
|
||||||
binding.notice.isSelected = false
|
|
||||||
}
|
}
|
||||||
} else if (binding.recentSms.isSelected) {
|
} else if (binding.recentSms.isSelected) {
|
||||||
WorkersDb.getRealm().apply {
|
WorkersDb.getRealm().apply {
|
||||||
@ -768,28 +791,25 @@ internal class LauncherHome : Fragment() {
|
|||||||
binding.smsList.visibility = View.VISIBLE
|
binding.smsList.visibility = View.VISIBLE
|
||||||
val list = copyFromRealm(result)
|
val list = copyFromRealm(result)
|
||||||
mSmsLogsAdapter.updateData(list)
|
mSmsLogsAdapter.updateData(list)
|
||||||
binding.missedCalls.isSelected = false
|
|
||||||
binding.otherCheck.isSelected = false
|
|
||||||
binding.notice.isSelected = false
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (binding.otherCheck.isSelected) {
|
} else if (binding.otherCheck.isSelected) {
|
||||||
binding.missedCalls.isSelected = false
|
unsel(binding.otherCheck)
|
||||||
binding.recentSms.isSelected = false
|
|
||||||
binding.notice.isSelected = false
|
|
||||||
binding.infoList.visibility = View.VISIBLE
|
binding.infoList.visibility = View.VISIBLE
|
||||||
binding.otherCheck.text = "글타래 [${lasted?.size ?: "-"}]"
|
// binding.otherCheck.text = "글타래 [${lasted?.size ?: "-"}]"
|
||||||
lasted?.let { mRssAdapter.updateData(it) }
|
lasted?.let { mRssAdapter.updateData(it) }
|
||||||
} else if (binding.notice.isSelected) {
|
} else if (binding.notice.isSelected) {
|
||||||
binding.missedCalls.isSelected = false
|
unsel(binding.notice)
|
||||||
binding.recentSms.isSelected = false
|
|
||||||
binding.otherCheck.isSelected = false
|
|
||||||
binding.notiList.visibility = View.VISIBLE
|
binding.notiList.visibility = View.VISIBLE
|
||||||
binding.notice.text = "알림 [${lastedNoti?.size ?: "-"}]"
|
// binding.notice.text = "알림 [${lastedNoti?.size ?: "-"}]"
|
||||||
lastedNoti?.let { mNotiAdapter.updateData(it) }
|
lastedNoti?.let { mNotiAdapter.updateData(it) }
|
||||||
|
} else if (binding.favApps.isSelected) {
|
||||||
|
unsel(binding.favApps)
|
||||||
|
binding.appsList.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
commandHandler.postDelayed(hideListView, hideListViewTime)
|
commandHandler.postDelayed(hideListView, hideListViewTime)
|
||||||
}
|
}
|
||||||
@ -810,16 +830,13 @@ internal class LauncherHome : Fragment() {
|
|||||||
} else {
|
} else {
|
||||||
rss.read += nomoreShowCount
|
rss.read += nomoreShowCount
|
||||||
}
|
}
|
||||||
copyToRealm(rss, UpdatePolicy.ALL)
|
// copyToRealm(rss, UpdatePolicy.ALL)
|
||||||
|
query<RssData>("originPage == $0",rss.originPage).find().forEach { it ->
|
||||||
|
it.read += nomoreShowCount
|
||||||
|
}
|
||||||
query<RssData>("chosung == $0",rss.chosung).find().forEach { it ->
|
query<RssData>("chosung == $0",rss.chosung).find().forEach { it ->
|
||||||
if (!rss.originPage().equals(it.originPage())) {
|
if (!rss.originPage().equals(it.originPage())) {
|
||||||
if (rssStateVote() && rss.vote) {
|
it.read += nomoreShowCount
|
||||||
it.vote = false
|
|
||||||
it.read = 0
|
|
||||||
} else {
|
|
||||||
it.read += nomoreShowCount
|
|
||||||
}
|
|
||||||
copyToRealm(it, UpdatePolicy.ALL)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -831,11 +848,11 @@ internal class LauncherHome : Fragment() {
|
|||||||
rss.vote = true
|
rss.vote = true
|
||||||
|
|
||||||
}
|
}
|
||||||
copyToRealm(rss,UpdatePolicy.ALL)
|
// copyToRealm(rss,UpdatePolicy.ALL)
|
||||||
}
|
}
|
||||||
else ->{}
|
else ->{}
|
||||||
}
|
}
|
||||||
binding.infoList.post { mRssAdapter.refresh() }
|
// binding.infoList.post { mRssAdapter.refresh() }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -5,6 +5,7 @@ import android.content.Intent
|
|||||||
import android.os.Environment
|
import android.os.Environment
|
||||||
import android.webkit.CookieManager
|
import android.webkit.CookieManager
|
||||||
import androidx.core.content.FileProvider
|
import androidx.core.content.FileProvider
|
||||||
|
import bums.lunatic.launcher.utils.CompressStringUtil
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
@ -66,34 +67,38 @@ class OfflineContents(val context: Context, val host : String, val cookie: Strin
|
|||||||
fun enofLoop() {
|
fun enofLoop() {
|
||||||
if (onItEndof) return
|
if (onItEndof) return
|
||||||
onItEndof = true
|
onItEndof = true
|
||||||
LogUtil.e("on it enofLoop")
|
LogUtil.e("on it enofLoop before compressString ${htmlString.length}")
|
||||||
urlPathMap.forEach { t, u ->
|
|
||||||
val file = File(u)
|
|
||||||
var contentsUriString = FileProvider.getUriForFile(
|
|
||||||
context,
|
|
||||||
"${context.packageName}.fileprovider",
|
|
||||||
file
|
|
||||||
).toString()
|
|
||||||
|
|
||||||
var targetString = t
|
CompressStringUtil.compressString(htmlString.toString())?.apply {
|
||||||
var targetIdx = htmlString.indexOf(targetString)
|
LogUtil.e("on it enofLoop 2 compressed String ${this.length}")
|
||||||
if (targetIdx > 0) {
|
|
||||||
htmlString?.replace(
|
|
||||||
targetIdx,
|
|
||||||
targetIdx.plus(targetString.length),
|
|
||||||
contentsUriString
|
|
||||||
)
|
|
||||||
}
|
|
||||||
targetString = t.replace("&", "&")
|
|
||||||
targetIdx = htmlString.indexOf(targetString)
|
|
||||||
if (targetIdx > 0) {
|
|
||||||
htmlString?.replace(
|
|
||||||
targetIdx,
|
|
||||||
targetIdx.plus(targetString.length),
|
|
||||||
contentsUriString
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
// urlPathMap.forEach { t, u ->
|
||||||
|
// val file = File(u)
|
||||||
|
// var contentsUriString = FileProvider.getUriForFile(
|
||||||
|
// context,
|
||||||
|
// "${context.packageName}.fileprovider",
|
||||||
|
// file
|
||||||
|
// ).toString()
|
||||||
|
//
|
||||||
|
// var targetString = t
|
||||||
|
// var targetIdx = htmlString.indexOf(targetString)
|
||||||
|
// if (targetIdx > 0) {
|
||||||
|
// htmlString?.replace(
|
||||||
|
// targetIdx,
|
||||||
|
// targetIdx.plus(targetString.length),
|
||||||
|
// contentsUriString
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
// targetString = t.replace("&", "&")
|
||||||
|
// targetIdx = htmlString.indexOf(targetString)
|
||||||
|
// if (targetIdx > 0) {
|
||||||
|
// htmlString?.replace(
|
||||||
|
// targetIdx,
|
||||||
|
// targetIdx.plus(targetString.length),
|
||||||
|
// contentsUriString
|
||||||
|
// )
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
if (autoCheck) {
|
if (autoCheck) {
|
||||||
LogUtil.e("on it enofLoop autoCheck ${autoCheck}")
|
LogUtil.e("on it enofLoop autoCheck ${autoCheck}")
|
||||||
|
|||||||
@ -1,9 +1,10 @@
|
|||||||
package bums.lunatic.launcher.home
|
package bums.lunatic.launcher.home
|
||||||
|
|
||||||
|
import android.content.ClipData
|
||||||
|
import android.content.ClipboardManager
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.os.Environment
|
|
||||||
import android.print.PDFPrint
|
import android.print.PDFPrint
|
||||||
import android.util.Base64
|
import android.util.Base64
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
@ -23,39 +24,34 @@ import android.view.MotionEvent.ACTION_MOVE
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.webkit.CookieManager
|
import android.webkit.CookieManager
|
||||||
import android.webkit.CookieSyncManager
|
import android.webkit.CookieSyncManager
|
||||||
|
import android.webkit.JavascriptInterface
|
||||||
import android.webkit.ValueCallback
|
import android.webkit.ValueCallback
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
import androidx.core.content.FileProvider
|
import androidx.appcompat.app.AlertDialog
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
|
import androidx.core.view.postDelayed
|
||||||
|
import bums.lunatic.launcher.model.CiliMagnet
|
||||||
import bums.lunatic.launcher.model.RssData
|
import bums.lunatic.launcher.model.RssData
|
||||||
import bums.lunatic.launcher.utils.Blog
|
import bums.lunatic.launcher.utils.Blog
|
||||||
import bums.lunatic.launcher.workers.WorkersDb
|
import bums.lunatic.launcher.workers.WorkersDb
|
||||||
import io.realm.kotlin.ext.query
|
import io.realm.kotlin.ext.query
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.delay
|
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kr.lunaticbum.awesomewebview.AwesomeWebView
|
import kr.lunaticbum.awesomewebview.AwesomeWebView
|
||||||
import kr.lunaticbum.awesomewebview.AwesomeWebViewActivity
|
import kr.lunaticbum.awesomewebview.AwesomeWebViewActivity
|
||||||
import kr.lunaticbum.awesomewebview.helpers.DownPicUtil
|
|
||||||
import kr.lunaticbum.awesomewebview.helpers.DownPicUtil.DownFinishListener
|
|
||||||
import kr.lunaticbum.awesomewebview.listeners.BroadCastManager
|
import kr.lunaticbum.awesomewebview.listeners.BroadCastManager
|
||||||
import kr.lunaticbum.utils.content.ContextUtil
|
import kr.lunaticbum.utils.content.ContextUtil
|
||||||
import kr.lunaticbum.utils.log.LogUtil
|
import kr.lunaticbum.utils.log.LogUtil
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import org.jsoup.UnsupportedMimeTypeException
|
|
||||||
import java.io.BufferedWriter
|
|
||||||
import java.io.ByteArrayOutputStream
|
import java.io.ByteArrayOutputStream
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import java.io.FileInputStream
|
import java.io.FileInputStream
|
||||||
import java.io.FileWriter
|
|
||||||
import java.io.IOException
|
import java.io.IOException
|
||||||
import java.io.InputStream
|
import java.io.InputStream
|
||||||
import java.lang.Thread.sleep
|
import java.net.URLEncoder
|
||||||
import java.net.URL
|
import java.nio.charset.Charset
|
||||||
import java.security.MessageDigest
|
import java.security.MessageDigest
|
||||||
import java.text.SimpleDateFormat
|
|
||||||
import java.util.Date
|
|
||||||
import java.util.concurrent.Executors
|
import java.util.concurrent.Executors
|
||||||
import java.util.concurrent.TimeUnit
|
import java.util.concurrent.TimeUnit
|
||||||
import kotlin.text.Charsets.UTF_8
|
import kotlin.text.Charsets.UTF_8
|
||||||
@ -93,7 +89,7 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
var actionButtonPressX = 0f
|
var actionButtonPressX = 0f
|
||||||
var actionButtonPressY = 0f
|
var actionButtonPressY = 0f
|
||||||
var rssId : String = ""
|
var rssId : String = ""
|
||||||
var currentIdx = 0
|
// var currentIdx = 0
|
||||||
var double = false
|
var double = false
|
||||||
var rssList: MutableList<String> = ArrayList()
|
var rssList: MutableList<String> = ArrayList()
|
||||||
|
|
||||||
@ -108,6 +104,7 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
} else {
|
} else {
|
||||||
loadWithIntent = false
|
loadWithIntent = false
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onResume() {
|
override fun onResume() {
|
||||||
@ -131,7 +128,7 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
if(ev.action == ACTION_MOVE && ev.x != ev.y) {
|
if(ev.action == ACTION_MOVE && ev.x != ev.y) {
|
||||||
val correctTime = (ev.eventTime - lasteventTime) > 2
|
val correctTime = (ev.eventTime - lasteventTime) > 2
|
||||||
if (correctTime) {
|
if (correctTime) {
|
||||||
Blog.LOGE("onGenericMotionEvent webviews ${p0} ev?.device?.name >>> ${ev?.device?.name} >> ${ev}")
|
// Blog.LOGE("onGenericMotionEvent webviews ${p0} ev?.device?.name >>> ${ev?.device?.name} >> ${ev}")
|
||||||
if (ev.x <= -1.0f) {
|
if (ev.x <= -1.0f) {
|
||||||
leftClick()
|
leftClick()
|
||||||
} else if (ev.x >= 1.0f) {
|
} else if (ev.x >= 1.0f) {
|
||||||
@ -154,15 +151,15 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
override fun onGenericMotionEvent(ev: MotionEvent?): Boolean {
|
override fun onGenericMotionEvent(ev: MotionEvent?): Boolean {
|
||||||
|
|
||||||
if (ev?.device?.name?.contains("SM-031N Mouse") == true) {
|
if (ev?.device?.name?.contains("SM-031N Mouse") == true) {
|
||||||
Blog.LOGE("onGenericMotionEvent ev?.device?.name >>> ${ev?.device?.name} >> ${ev}")
|
// Blog.LOGE("onGenericMotionEvent ev?.device?.name >>> ${ev?.device?.name} >> ${ev}")
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
return super.onGenericMotionEvent(ev)
|
return super.onGenericMotionEvent(ev)
|
||||||
}
|
}
|
||||||
override fun dispatchKeyEvent(ev: KeyEvent): Boolean {
|
override fun dispatchKeyEvent(ev: KeyEvent): Boolean {
|
||||||
Blog.LOGE("dispatch ev?.device?.name >>> ${ev?.device?.name}")
|
// Blog.LOGE("dispatch ev?.device?.name >>> ${ev?.device?.name}")
|
||||||
if (ev?.device?.name?.contains("SM-031N Mouse") == true) {
|
if (ev?.device?.name?.contains("SM-031N Mouse") == true) {
|
||||||
Blog.LOGE("onGenericMotionEvent ev?.device?.name >>> ${ev?.device?.name} >> ${ev}")
|
// Blog.LOGE("onGenericMotionEvent ev?.device?.name >>> ${ev?.device?.name} >> ${ev}")
|
||||||
when(ev.action) {
|
when(ev.action) {
|
||||||
ACTION_UP -> {
|
ACTION_UP -> {
|
||||||
when(ev.keyCode) {
|
when(ev.keyCode) {
|
||||||
@ -229,16 +226,9 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun doNextPage() {
|
fun doNextPage() {
|
||||||
rssList.remove(rssId)
|
rssList.removeAll { it.equals(rssId) }
|
||||||
if (currentIdx < rssList.size - 1) {
|
if (rssList.size > 0) {
|
||||||
currentIdx += 1
|
rssId = rssList.removeAt(0)
|
||||||
rssId = rssList.get(currentIdx)
|
|
||||||
Blog.LOGE("Arrow Right Click ${currentIdx} ${rssId}")
|
|
||||||
load(rssId)
|
|
||||||
} else if (currentIdx > 0) {
|
|
||||||
currentIdx -= 1
|
|
||||||
rssId = rssList.get(currentIdx)
|
|
||||||
Blog.LOGE("Arrow Left Click ${currentIdx} ${rssId}")
|
|
||||||
load(rssId)
|
load(rssId)
|
||||||
} else {
|
} else {
|
||||||
Toast.makeText(this, "없어 끄자", Toast.LENGTH_LONG).show()
|
Toast.makeText(this, "없어 끄자", Toast.LENGTH_LONG).show()
|
||||||
@ -379,26 +369,33 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
Blog.LOGE("Arrow Up Click")
|
Blog.LOGE("Arrow Up Click")
|
||||||
registCancelSearch()
|
registCancelSearch()
|
||||||
}
|
}
|
||||||
|
|
||||||
protected fun load(newUrl: String) {
|
protected fun load(newUrl: String) {
|
||||||
LogUtil.e("newUrl >>> ${newUrl}")
|
newUrl?.let { it ->
|
||||||
newUrl.toUri().host?.let {
|
var url = if(it.startsWith("http://")) {
|
||||||
val splits = it.replace("http://","").replace("https://","").split(".")
|
"https://${it.replace("http://","")}"
|
||||||
when(splits.size) {
|
} else it
|
||||||
1-> host = splits[0]
|
// LogUtil.e("newUrl >>> ${url}")
|
||||||
2-> host = splits[0]
|
url.toUri().host?.let {
|
||||||
3-> host = splits[1]
|
val splits = it.replace("http://","").replace("https://","").split(".")
|
||||||
4-> host = splits[2]
|
when(splits.size) {
|
||||||
else -> {
|
1-> host = splits[0]
|
||||||
host = null
|
2-> host = splits[0]
|
||||||
|
3-> host = splits[1]
|
||||||
|
4-> host = splits[2]
|
||||||
|
else -> {
|
||||||
|
host = null
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (extraHeaders == null) {
|
||||||
|
webView!!.loadUrl(url)
|
||||||
|
} else {
|
||||||
|
webView!!.loadUrl(url, extraHeaders!!)
|
||||||
|
}
|
||||||
|
registCancelSearch()
|
||||||
}
|
}
|
||||||
if (extraHeaders == null) {
|
|
||||||
webView!!.loadUrl(newUrl!!)
|
|
||||||
} else {
|
|
||||||
webView!!.loadUrl(newUrl!!, extraHeaders!!)
|
|
||||||
}
|
|
||||||
registCancelSearch()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun initializeOptions() {
|
override fun initializeOptions() {
|
||||||
@ -410,10 +407,15 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
builder?.rssList?.let { this.rssList.addAll(it) }
|
builder?.rssList?.let { this.rssList.addAll(it) }
|
||||||
|
|
||||||
Blog.LOGE("this.rssList >>>> ${this.rssList}")
|
Blog.LOGE("this.rssList >>>> ${this.rssList}")
|
||||||
this.rssList.forEachIndexed { index, s ->
|
}
|
||||||
if (s.equals(rssId)) {
|
|
||||||
currentIdx = index
|
override fun bindViews() {
|
||||||
return@forEachIndexed}
|
super.bindViews()
|
||||||
|
if (this.rssId.contains(".guru")) {
|
||||||
|
Blog.LOGE("this.webView >>>> ${this.rssId}")
|
||||||
|
Blog.LOGE("this.webView >>>> ${this.webView}")
|
||||||
|
webView?.alpha = 0.2f
|
||||||
|
webView?.addJavascriptInterface(gji, "GJI")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -470,6 +472,126 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onTrimMemory(level: Int) {
|
||||||
|
LogUtil.e("onTrimMemory >>> ${level} current ${url} current ${webView?.url ?: ""}")
|
||||||
|
super.onTrimMemory(level)
|
||||||
|
|
||||||
|
}
|
||||||
|
fun showDi(code : String, items : ArrayList<String>, links : ArrayList<String>) {
|
||||||
|
runOnUiThread {
|
||||||
|
registCancelSearch()
|
||||||
|
hideBlock()
|
||||||
|
val builder = AlertDialog.Builder(this@RssViewerActivity)
|
||||||
|
builder.setTitle("code : ${code}")
|
||||||
|
builder?.setItems(
|
||||||
|
items.toTypedArray()
|
||||||
|
) { dialog, which ->
|
||||||
|
LogUtil.e("hitTestResult.extra >>> ${dialog} ,${which}")
|
||||||
|
links?.get(which)?.let { link ->
|
||||||
|
(this.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager)?.let { mng ->
|
||||||
|
Blog.LOGE("link >>> ${link}")
|
||||||
|
mng.clearPrimaryClip()
|
||||||
|
mng.addPrimaryClipChangedListener {
|
||||||
|
mng.primaryClip?.getItemAt(0)?.text?.let {
|
||||||
|
if (it.length > 0 && it.startsWith("magnet:?xt=urn:")) {
|
||||||
|
Blog.LOGE("magnet >>>> $it")
|
||||||
|
try {
|
||||||
|
val launchIntent =
|
||||||
|
packageManager.getLaunchIntentForPackage("com.pikcloud.pikpak")
|
||||||
|
launchIntent?.addFlags(Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS)
|
||||||
|
startActivity(launchIntent)
|
||||||
|
}catch (e:Exception) {e.printStackTrace()}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mng.setPrimaryClip(ClipData.newPlainText("",link))
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val dialog = builder?.create()
|
||||||
|
dialog?.show()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val gji = GJInterface(this)
|
||||||
|
inner class GJInterface(val context: Context) {
|
||||||
|
@JavascriptInterface
|
||||||
|
fun onResult(result : String?) {
|
||||||
|
registCancelSearch()
|
||||||
|
result.toString()?.replace("\\u003C","<")?.replace("\\"","")?.let {
|
||||||
|
Jsoup.parse(it)?.let { guru ->
|
||||||
|
Blog.LOGE("guru >>> ${guru.title()} ")
|
||||||
|
guru.getElementsByClass("row")?.forEach { row ->
|
||||||
|
row.getElementsByClass("grid1").first().getElementsByTag("a")?.first()?.attr("title")?.let { title ->
|
||||||
|
Blog.LOGE("row >>> ${title.split("]")?.first()?.replace("[","")}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@JavascriptInterface
|
||||||
|
fun onCode(code : String) {
|
||||||
|
Blog.LOGE("onCode ${code}")
|
||||||
|
registCancelSearch()
|
||||||
|
CoroutineScope(Dispatchers.IO).launch {
|
||||||
|
var temp = arrayListOf<CiliMagnet>()
|
||||||
|
Jsoup.connect("https://cili.site/search?q=${URLEncoder.encode(code, Charset.defaultCharset().name())}").get().let { cili ->
|
||||||
|
|
||||||
|
cili.getElementsByTag("tr").forEach { cili_tr ->
|
||||||
|
CiliMagnet().let { ciliMgn ->
|
||||||
|
ciliMgn.link = if(cili_tr.getElementsByTag("a").size > 0)cili_tr.getElementsByTag("a").get(0).attr("href") else ""
|
||||||
|
ciliMgn.title = if(cili_tr.getElementsByTag("p").size > 0)cili_tr.getElementsByTag("p").text() else ""
|
||||||
|
ciliMgn.size = if(cili_tr.getElementsByClass("td-size").size > 0)cili_tr.getElementsByClass("td-size").text() else ""
|
||||||
|
Blog.LOGE("ciliMgn.size >>>> ${ciliMgn.size}")
|
||||||
|
Blog.LOGE("ciliMgn.size >>>> ${ciliMgn.title}")
|
||||||
|
if(ciliMgn.isValid() && temp.size < 8 ) {
|
||||||
|
try {
|
||||||
|
Jsoup.connect(ciliMgn.getMagnetPageLink()).get()
|
||||||
|
.let { mgn_Page ->
|
||||||
|
if (mgn_Page.getElementsByClass("input-group magnet-box").size > 0) {
|
||||||
|
mgn_Page.getElementsByClass("input-group magnet-box")
|
||||||
|
.get(0)?.let { magnet_box ->
|
||||||
|
magnet_box.getElementById(
|
||||||
|
"input-magnet"
|
||||||
|
)?.let { input_magnet ->
|
||||||
|
Blog.LOGE("input_magnet >>> ${input_magnet}")
|
||||||
|
ciliMgn.magnetLink =
|
||||||
|
input_magnet.attr("value")
|
||||||
|
.replace("&", "&")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.apply {
|
||||||
|
temp.add(ciliMgn)
|
||||||
|
|
||||||
|
}
|
||||||
|
}catch (e:Exception) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(temp.size > 3) {
|
||||||
|
return@forEach
|
||||||
|
}
|
||||||
|
}.apply {
|
||||||
|
if (temp.size > 0) {
|
||||||
|
showDi(
|
||||||
|
code,
|
||||||
|
temp.map {
|
||||||
|
it.title.plus(" | ").plus(it.size).plus(" | ")
|
||||||
|
} as ArrayList<String>, temp.map {
|
||||||
|
it.magnetLink
|
||||||
|
} as ArrayList<String>)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.start()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
override fun onHtml(value: String?, autoCheck : Boolean) {
|
override fun onHtml(value: String?, autoCheck : Boolean) {
|
||||||
chechHandler.removeCallbacks(cancelSearch)
|
chechHandler.removeCallbacks(cancelSearch)
|
||||||
if (loadWithIntent){
|
if (loadWithIntent){
|
||||||
@ -528,52 +650,73 @@ class RssViewerActivity : AwesomeWebViewActivity(), View.OnGenericMotionListene
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
override fun webviewOnPageFinished() {
|
override fun webviewOnPageFinished() {
|
||||||
double = false
|
if (rssId.contains(".guru")) {
|
||||||
if(hasYoutubePlayer) {
|
registCancelSearch()
|
||||||
LogUtil.e("hasYoutubePlayer >>> ${hasYoutubePlayer}")
|
// webView?.scaleX = 0.2f
|
||||||
}
|
// webView?.scaleY = 0.2f
|
||||||
WorkersDb.getRealm().apply {
|
// webView?.post { webView?.addJavascriptInterface(gji,"GJI") }
|
||||||
writeBlocking {
|
webView?.postDelayed(2000L,{
|
||||||
val result =
|
webView?.evaluateJavascript("try{GJI.log();}catch(e){console.log(e);}", {})
|
||||||
query<RssData>().query("originPage == $0", rssId)
|
webView?.evaluateJavascript("try{GJI.onResult(document.documentElement.outerHTML);}catch(e){console.log(e);}", {})
|
||||||
.find()
|
webView?.evaluateJavascript("document.getElementsByClassName('banner-ad-wrapper')[0].remove()",{})
|
||||||
if (result.size == 1) {
|
})
|
||||||
result.first().read += 1
|
} else {
|
||||||
} else {
|
double = false
|
||||||
|
registCancelSearch()
|
||||||
|
if (hasYoutubePlayer) {
|
||||||
|
LogUtil.e("hasYoutubePlayer >>> ${hasYoutubePlayer}")
|
||||||
|
}
|
||||||
|
WorkersDb.getRealm().apply {
|
||||||
|
writeBlocking {
|
||||||
|
val result =
|
||||||
|
query<RssData>().query("originPage == $0", rssId)
|
||||||
|
.find()
|
||||||
|
// if (result.size == 1) {
|
||||||
|
// result.first().read += 1
|
||||||
|
// } else {
|
||||||
result.forEach { it.read += 1 }
|
result.forEach { it.read += 1 }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
registCancelSearch()
|
|
||||||
//<meta name="viewport" content="initial-scale=1.0">
|
|
||||||
if (loadWithIntent) {
|
|
||||||
webView?.evaluateJavascript(
|
|
||||||
"try{document.querySelector('meta[name=viewport]').setAttribute('content','initial-scale=1.0')}catch(e){}",
|
|
||||||
null
|
|
||||||
)
|
|
||||||
webView?.evaluateJavascript(
|
|
||||||
"try{document.querySelector('meta[name=viewport]').setAttribute('content','initial-scale=1.0')}catch(e){}",
|
|
||||||
null
|
|
||||||
)
|
|
||||||
webView?.settings?.useWideViewPort = true
|
|
||||||
}
|
|
||||||
if (webView?.url?.contains("dcinside") == true){
|
|
||||||
webView?.evaluateJavascript("try{document.querySelector('#div_adnmore_area').hidden = true;}catch(e){}",null)
|
|
||||||
} else if(webView?.url?.contains("fmkorea") == true) {
|
|
||||||
if (loadWithIntent) {
|
|
||||||
|
|
||||||
} else {
|
//<meta name="viewport" content="initial-scale=1.0">
|
||||||
webView?.postDelayed({
|
if (loadWithIntent) {
|
||||||
webView?.evaluateJavascript(
|
webView?.evaluateJavascript(
|
||||||
"try{document.querySelector('.m_rd_nav_side').hidden = true;}catch(e){}",
|
"try{document.querySelector('meta[name=viewport]').setAttribute('content','initial-scale=1.0')}catch(e){}",
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
webView?.evaluateJavascript(
|
webView?.evaluateJavascript(
|
||||||
"try{document.querySelector('[class*='bd bd_mobile ']').remove();}catch(e){}",
|
"try{document.querySelector('meta[name=viewport]').setAttribute('content','initial-scale=1.0')}catch(e){}",
|
||||||
null
|
null
|
||||||
)
|
)
|
||||||
}, 500L)
|
webView?.settings?.useWideViewPort = true
|
||||||
|
}
|
||||||
|
if (webView?.url?.contains("dcinside") == true) {
|
||||||
|
webView?.evaluateJavascript(
|
||||||
|
"try{document.querySelector('#div_adnmore_area').hidden = true;}catch(e){}",
|
||||||
|
null
|
||||||
|
)
|
||||||
|
} else if (webView?.url?.contains("fmkorea") == true) {
|
||||||
|
if (loadWithIntent) {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
webView?.postDelayed({
|
||||||
|
webView?.evaluateJavascript(
|
||||||
|
"try{document.querySelector('.m_rd_nav_side').hidden = true;}catch(e){}",
|
||||||
|
null
|
||||||
|
)
|
||||||
|
webView?.evaluateJavascript(
|
||||||
|
"try{document.querySelector('[class*='bd bd_mobile ']').remove();}catch(e){}",
|
||||||
|
null
|
||||||
|
)
|
||||||
|
}, 500L)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,7 +48,6 @@ class WeatherHourlyAdapter(private val dataSet: ArrayList<Hour>): RecyclerView.A
|
|||||||
override fun getItemCount(): Int = dataSet.size
|
override fun getItemCount(): Int = dataSet.size
|
||||||
|
|
||||||
fun update(li: Collection<Hour>) {
|
fun update(li: Collection<Hour>) {
|
||||||
Blog.LOGE("${this.javaClass.simpleName} update")
|
|
||||||
li.toList()
|
li.toList()
|
||||||
this.dataSet.clear()
|
this.dataSet.clear()
|
||||||
this.dataSet.addAll(li)
|
this.dataSet.addAll(li)
|
||||||
|
|||||||
@ -179,7 +179,7 @@ open class DcInside : RssDataInterface {
|
|||||||
dateTiemL = cal.timeInMillis
|
dateTiemL = cal.timeInMillis
|
||||||
dateTiemL
|
dateTiemL
|
||||||
} else {
|
} else {
|
||||||
0L
|
Date().time
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return dateTiemL
|
return dateTiemL
|
||||||
@ -232,7 +232,7 @@ class RssData : RealmObject, RssDataInterface {
|
|||||||
}
|
}
|
||||||
else -> title ?: ""
|
else -> title ?: ""
|
||||||
}.apply {
|
}.apply {
|
||||||
chosung = JamoUtils.split(this).joinToString("")
|
chosung = JamoUtils.split(title).joinToString("")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,40 @@
|
|||||||
|
package bums.lunatic.launcher.model
|
||||||
|
|
||||||
|
import com.ibm.icu.util.ChineseCalendar
|
||||||
|
import io.realm.kotlin.types.RealmObject
|
||||||
|
import java.util.Calendar
|
||||||
|
import java.util.Date
|
||||||
|
|
||||||
|
class UserActionModel: RealmObject {
|
||||||
|
|
||||||
|
var actionType: String = ""
|
||||||
|
var timestamp: Date = Date()
|
||||||
|
|
||||||
|
var weekOfYear : Int = 0
|
||||||
|
var weekOfMonth : Int = 0
|
||||||
|
var dayOfWeek : Int = 0
|
||||||
|
var dayOfYear : Int = 0
|
||||||
|
var dayOfMonth : Int = 0
|
||||||
|
var hourOfDay : Int = 0
|
||||||
|
var month: Int = 0
|
||||||
|
var lunMonth : Int = 0
|
||||||
|
var lunDayOFMonth : Int = 0
|
||||||
|
var lunDayOfYear : Int = 0
|
||||||
|
|
||||||
|
init {
|
||||||
|
val cal = Calendar.getInstance()
|
||||||
|
cal.time = timestamp
|
||||||
|
weekOfYear = cal.get(Calendar.WEEK_OF_YEAR)
|
||||||
|
weekOfMonth = cal.get(Calendar.WEEK_OF_MONTH)
|
||||||
|
dayOfWeek = cal.get(Calendar.DAY_OF_WEEK)
|
||||||
|
hourOfDay = cal.get(Calendar.HOUR_OF_DAY)
|
||||||
|
month = cal.get(Calendar.MONTH)
|
||||||
|
dayOfYear = cal.get(Calendar.DAY_OF_YEAR)
|
||||||
|
dayOfMonth = cal.get(Calendar.DAY_OF_MONTH)
|
||||||
|
var cinCal = ChineseCalendar()
|
||||||
|
cinCal.time = timestamp
|
||||||
|
lunMonth = cinCal.get(ChineseCalendar.MONTH)
|
||||||
|
lunDayOFMonth = cinCal.get(ChineseCalendar.DAY_OF_MONTH)
|
||||||
|
lunDayOfYear = cinCal.get(ChineseCalendar.DAY_OF_YEAR)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -47,38 +47,43 @@ class NLService : NotificationListenerService() {
|
|||||||
// sbn.notification.extras.keySet().forEach {
|
// sbn.notification.extras.keySet().forEach {
|
||||||
// BLog.LOGE("NLService********** keySet >> ${it} ${sbn.notification.extras.get(it)}")
|
// BLog.LOGE("NLService********** keySet >> ${it} ${sbn.notification.extras.get(it)}")
|
||||||
// }
|
// }
|
||||||
if (sbn.id != 0 && (sbn.packageName.contains(".") || sbn.packageName.contains("android")) && sbn.packageName.length > 0) {
|
try {
|
||||||
NotificationItem().apply {
|
if (sbn.id != 0 && (sbn.packageName.contains(".") || sbn.packageName.contains("android")) && sbn.packageName.length > 0) {
|
||||||
notiId = sbn.id
|
NotificationItem().apply {
|
||||||
pkgName = sbn.packageName
|
notiId = sbn.id
|
||||||
title = sbn.notification?.extras?.getString("android.title") ?: ""
|
pkgName = sbn.packageName
|
||||||
subtext = sbn.notification?.extras?.getString("android.subText") ?: ""
|
title = sbn.notification?.extras?.getString("android.title") ?: ""
|
||||||
selfDisplayName = sbn.notification?.extras?.getString("android.selfDisplayName") ?: ""
|
subtext = sbn.notification?.extras?.getString("android.subText") ?: ""
|
||||||
tikerMsg = sbn.notification?.tickerText?.toString() ?: ""
|
selfDisplayName = sbn.notification?.extras?.getString("android.selfDisplayName") ?: ""
|
||||||
postTime = sbn.postTime
|
tikerMsg = sbn.notification?.tickerText?.toString() ?: ""
|
||||||
var uniq = title ?: subtext ?: selfDisplayName ?: tikerMsg ?: ""
|
postTime = sbn.postTime
|
||||||
uniq_id = "${sbn.id}_${sbn.packageName}_${if (uniq.length > 3) uniq.substring(0,3) else uniq}"
|
var uniq = title ?: subtext ?: selfDisplayName ?: tikerMsg ?: ""
|
||||||
|
uniq_id = "${sbn.id}_${sbn.packageName}_${if (uniq.length > 3) uniq.substring(0,3) else uniq}"
|
||||||
// BLog.LOGE("NLService********** enqueue TelegramBotGetter ${true == "bumssavor".equals(title)}")
|
// BLog.LOGE("NLService********** enqueue TelegramBotGetter ${true == "bumssavor".equals(title)}")
|
||||||
// BLog.LOGE("NLService********** enqueue TelegramBotGetter ${(true == "org.telegram.messenger".equals(pkgName))}")
|
// BLog.LOGE("NLService********** enqueue TelegramBotGetter ${(true == "org.telegram.messenger".equals(pkgName))}")
|
||||||
// BLog.LOGE("NLService********** enqueue TelegramBotGetter ${sbn.notification?.extras?.getString("android.text")?.startsWith("/") == true}")
|
// BLog.LOGE("NLService********** enqueue TelegramBotGetter ${sbn.notification?.extras?.getString("android.text")?.startsWith("/") == true}")
|
||||||
}.apply {
|
}.apply {
|
||||||
if (skips.contains(pkgName)) {
|
if (skips.contains(pkgName)) {
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
WorkersDb.insertNoti(this)
|
// WorkersDb.insertNoti(this)
|
||||||
// BLog.LOGE("NLService********** onNotificationPosted ${Gson().toJson(this)}")
|
// BLog.LOGE("NLService********** onNotificationPosted ${Gson().toJson(this)}")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} catch (e : Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
if (sbn.packageName.contains("youtube")) {
|
if (sbn.packageName.contains("youtube")) {
|
||||||
val m = getSystemService<MediaSessionManager>()!!
|
val m = getSystemService<MediaSessionManager>()!!
|
||||||
val component = ComponentName(this, NLService::class.java)
|
val component = ComponentName(this, NLService::class.java)
|
||||||
val sessions = m.getActiveSessions(component)
|
val sessions = m.getActiveSessions(component)
|
||||||
sessions.forEach { session ->
|
sessions.forEach { session ->
|
||||||
WorkersDb.getRealm().writeBlocking {
|
WorkersDb.getRealm().writeBlocking {
|
||||||
Blog.LOGE("session.playbackState >>> ${session.playbackState}")
|
// Blog.LOGE("session.playbackState >>> ${session.playbackState}")
|
||||||
if (session.playbackState != null) {
|
if (session.playbackState != null) {
|
||||||
if (session.playbackState?.isActive == true && session.playbackState?.state?.equals(
|
if (session.playbackState?.isActive == true && session.playbackState?.state?.equals(
|
||||||
STATE_PLAYING
|
STATE_PLAYING
|
||||||
@ -111,6 +116,8 @@ class NLService : NotificationListenerService() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}}catch (e : Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
// val i = Intent("com.kpbird.nlsexample.NOTIFICATION_LISTENER_EXAMPLE")
|
// val i = Intent("com.kpbird.nlsexample.NOTIFICATION_LISTENER_EXAMPLE")
|
||||||
// i.putExtra("notification_event", "onNotificationPosted :" + sbn.packageName + "\n")
|
// i.putExtra("notification_event", "onNotificationPosted :" + sbn.packageName + "\n")
|
||||||
@ -118,19 +125,19 @@ class NLService : NotificationListenerService() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun onNotificationRemoved(sbn: StatusBarNotification) {
|
override fun onNotificationRemoved(sbn: StatusBarNotification) {
|
||||||
// BLog.LOGE("NLService********** onNOtificationRemoved")
|
//// BLog.LOGE("NLService********** onNOtificationRemoved")
|
||||||
// BLog.LOGE("NLService ID :" + sbn.id + "\t" + sbn.notification.tickerText + "\t" + sbn.packageName)
|
//// BLog.LOGE("NLService ID :" + sbn.id + "\t" + sbn.notification.tickerText + "\t" + sbn.packageName)
|
||||||
var uniq_id = "${sbn.id}_${sbn.packageName}"
|
// var uniq_id = "${sbn.id}_${sbn.packageName}"
|
||||||
try {
|
// try {
|
||||||
WorkersDb.getRealm()?.apply {
|
// WorkersDb.getRealm()?.apply {
|
||||||
this.writeBlocking {
|
// this.writeBlocking {
|
||||||
// delete(query<NotificationItem>().query("pkgName == $0", sbn.packageName).find())
|
//// delete(query<NotificationItem>().query("pkgName == $0", sbn.packageName).find())
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}catch (e : Exception){e.printStackTrace()}
|
// }catch (e : Exception){e.printStackTrace()}
|
||||||
// val i = Intent("com.kpbird.nlsexample.NOTIFICATION_LISTENER_EXAMPLE")
|
//// val i = Intent("com.kpbird.nlsexample.NOTIFICATION_LISTENER_EXAMPLE")
|
||||||
// i.putExtra("notification_event", "onNotificationRemoved :" + sbn.packageName + "\n")
|
//// i.putExtra("notification_event", "onNotificationRemoved :" + sbn.packageName + "\n")
|
||||||
// sendBroadcast(i)
|
//// sendBroadcast(i)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal inner class NLServiceReceiver : BroadcastReceiver() {
|
internal inner class NLServiceReceiver : BroadcastReceiver() {
|
||||||
|
|||||||
@ -30,6 +30,7 @@ import bums.lunatic.launcher.databinding.SettingsAppsBinding
|
|||||||
import bums.lunatic.launcher.helpers.PrefBoolean
|
import bums.lunatic.launcher.helpers.PrefBoolean
|
||||||
import bums.lunatic.launcher.helpers.PrefHelper
|
import bums.lunatic.launcher.helpers.PrefHelper
|
||||||
import bums.lunatic.launcher.helpers.PrefLong
|
import bums.lunatic.launcher.helpers.PrefLong
|
||||||
|
import bums.lunatic.launcher.utils.Blog
|
||||||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||||
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
||||||
@ -132,16 +133,19 @@ internal class Apps : BottomSheetDialogFragment() {
|
|||||||
settingsChanged = true
|
settingsChanged = true
|
||||||
PrefLong.shortTimePeriod.set(value.toLong())
|
PrefLong.shortTimePeriod.set(value.toLong())
|
||||||
binding.shortTimeTitle.text = getString(R.string.shortTimeTitle) +" [${value.toInt()}분 마다]"
|
binding.shortTimeTitle.text = getString(R.string.shortTimeTitle) +" [${value.toInt()}분 마다]"
|
||||||
|
Blog.LOGE("binding.shortTimeTitle.text >>> ${binding.shortTimeTitle.text}")
|
||||||
})
|
})
|
||||||
binding.middleTime.addOnChangeListener(Slider.OnChangeListener { _, value, _ ->
|
binding.middleTime.addOnChangeListener(Slider.OnChangeListener { _, value, _ ->
|
||||||
settingsChanged = true
|
settingsChanged = true
|
||||||
PrefLong.midTimePeriod.set(value.toLong())
|
PrefLong.midTimePeriod.set(value.toLong())
|
||||||
binding.middleTimeTitle.text = getString(R.string.middleTimeTitle) +" [${value.toInt()}분 마다]"
|
binding.middleTimeTitle.text = getString(R.string.middleTimeTitle) +" [${value.toInt()}분 마다]"
|
||||||
|
Blog.LOGE("binding.shortTimeTitle.text >>> ${binding.middleTimeTitle.text}")
|
||||||
})
|
})
|
||||||
binding.longTime.addOnChangeListener(Slider.OnChangeListener { _, value, _ ->
|
binding.longTime.addOnChangeListener(Slider.OnChangeListener { _, value, _ ->
|
||||||
settingsChanged = true
|
settingsChanged = true
|
||||||
PrefLong.longTimePeriod.set(value.toLong())
|
PrefLong.longTimePeriod.set(value.toLong())
|
||||||
binding.longTimeTitle.text = getString(R.string.longTimeTitle) +" [${value.toInt()}]분 마다]"
|
binding.longTimeTitle.text = getString(R.string.longTimeTitle) +" [${value.toInt()}]분 마다]"
|
||||||
|
Blog.LOGE("binding.shortTimeTitle.text >>> ${binding.longTimeTitle.text}")
|
||||||
})
|
})
|
||||||
|
|
||||||
binding.locationDistance.addOnChangeListener(Slider.OnChangeListener { _, value, _ ->
|
binding.locationDistance.addOnChangeListener(Slider.OnChangeListener { _, value, _ ->
|
||||||
|
|||||||
@ -0,0 +1,99 @@
|
|||||||
|
package bums.lunatic.launcher.utils
|
||||||
|
|
||||||
|
import java.io.ByteArrayInputStream
|
||||||
|
import java.io.ByteArrayOutputStream
|
||||||
|
import java.io.IOException
|
||||||
|
import java.io.InputStream
|
||||||
|
import java.io.OutputStream
|
||||||
|
import java.io.UnsupportedEncodingException
|
||||||
|
import java.util.zip.DeflaterOutputStream
|
||||||
|
import java.util.zip.InflaterInputStream
|
||||||
|
import kotlin.math.floor
|
||||||
|
|
||||||
|
|
||||||
|
object CompressStringUtil {
|
||||||
|
val charsetName: String = "UTF-8"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String 객체를 압축하여 String 으로 리턴한다.
|
||||||
|
* @param string
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Synchronized
|
||||||
|
fun compressString(string: String): String? {
|
||||||
|
return byteToString(compress(string))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 압축된 스트링을 복귀시켜서 String 으로 리턴한다.
|
||||||
|
* @param compressed
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Synchronized
|
||||||
|
fun decompressString(compressed: String?): String {
|
||||||
|
return decompress(hexToByteArray(compressed))
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun byteToString(bytes: ByteArray?): String? {
|
||||||
|
val sb = StringBuilder()
|
||||||
|
try {
|
||||||
|
for (b in bytes!!) {
|
||||||
|
sb.append(String.format("%02X", b))
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
e.printStackTrace()
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
return sb.toString()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun compress(text: String): ByteArray? {
|
||||||
|
val baos = ByteArrayOutputStream()
|
||||||
|
try {
|
||||||
|
val out: OutputStream = DeflaterOutputStream(baos)
|
||||||
|
out.write(text.toByteArray(charset(charsetName)))
|
||||||
|
out.close()
|
||||||
|
} catch (e: UnsupportedEncodingException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
return null
|
||||||
|
} catch (e: IOException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return baos.toByteArray()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun decompress(bytes: ByteArray): String {
|
||||||
|
val `in`: InputStream = InflaterInputStream(ByteArrayInputStream(bytes))
|
||||||
|
val baos = ByteArrayOutputStream()
|
||||||
|
try {
|
||||||
|
val buffer = ByteArray(8192)
|
||||||
|
var len: Int
|
||||||
|
while ((`in`.read(buffer).also { len = it }) > 0) baos.write(buffer, 0, len)
|
||||||
|
return String(baos.toByteArray(), charset(charsetName))
|
||||||
|
} catch (e: IOException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
throw AssertionError(e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 16진 문자열을 byte 배열로 변환한다.
|
||||||
|
*/
|
||||||
|
private fun hexToByteArray(hex: String?): ByteArray {
|
||||||
|
if (hex == null || hex.length % 2 != 0) {
|
||||||
|
return byteArrayOf()
|
||||||
|
}
|
||||||
|
|
||||||
|
val bytes = ByteArray(hex.length / 2)
|
||||||
|
var i = 0
|
||||||
|
while (i < hex.length) {
|
||||||
|
val value = hex.substring(i, i + 2).toInt(16).toByte()
|
||||||
|
bytes[floor((i / 2).toDouble()).toInt()] = value
|
||||||
|
i += 2
|
||||||
|
}
|
||||||
|
return bytes
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -18,8 +18,8 @@ fun before30Min(date: Date): Long {
|
|||||||
fun beforeOneDay(): Long {
|
fun beforeOneDay(): Long {
|
||||||
val cal: Calendar = Calendar.getInstance()
|
val cal: Calendar = Calendar.getInstance()
|
||||||
cal.setTime(Date())
|
cal.setTime(Date())
|
||||||
cal.add(Calendar.DAY_OF_YEAR, -1)
|
// cal.add(Calendar.DAY_OF_YEAR, -1)
|
||||||
cal.add(Calendar.HOUR_OF_DAY, -3)
|
cal.add(Calendar.HOUR_OF_DAY, -4)
|
||||||
return cal.timeInMillis
|
return cal.timeInMillis
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -2,19 +2,21 @@ package bums.lunatic.launcher.workers
|
|||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.content.pm.ApplicationInfo
|
||||||
import android.content.pm.PackageManager
|
import android.content.pm.PackageManager
|
||||||
import android.content.pm.ResolveInfo
|
import android.content.pm.ResolveInfo
|
||||||
import android.os.Build
|
import android.os.Build
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
import bums.lunatic.launcher.BuildConfig
|
import bums.lunatic.launcher.BuildConfig
|
||||||
|
import bums.lunatic.launcher.LauncherActivity
|
||||||
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
|
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
|
||||||
import bums.lunatic.launcher.apps.AppDrawer.Companion.appName
|
import bums.lunatic.launcher.apps.AppDrawer.Companion.appNamesPrefs
|
||||||
import bums.lunatic.launcher.apps.AppDrawer.Companion.getCategory
|
|
||||||
import bums.lunatic.launcher.apps.normalize
|
|
||||||
import bums.lunatic.launcher.model.AppInfo
|
import bums.lunatic.launcher.model.AppInfo
|
||||||
import bums.lunatic.launcher.utils.AlphabetToChosungMap
|
import bums.lunatic.launcher.utils.AlphabetToChosungMap
|
||||||
import bums.lunatic.launcher.utils.JamoUtils
|
import bums.lunatic.launcher.utils.JamoUtils
|
||||||
import io.realm.kotlin.ext.query
|
import io.realm.kotlin.ext.query
|
||||||
|
import java.text.Normalizer
|
||||||
|
import java.util.regex.Pattern
|
||||||
|
|
||||||
class AppInfoGetter : BaseGetter {
|
class AppInfoGetter : BaseGetter {
|
||||||
companion object {
|
companion object {
|
||||||
@ -61,4 +63,32 @@ class AppInfoGetter : BaseGetter {
|
|||||||
} catch (e : Exception) {e.printStackTrace()}
|
} catch (e : Exception) {e.printStackTrace()}
|
||||||
return Result.success()
|
return Result.success()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun appName(resolver: ResolveInfo): String {
|
||||||
|
return resolver.loadLabel(lActivity?.packageManager!!).toString().apply {
|
||||||
|
appNamesPrefs?.edit()?.putString(resolver.activityInfo.packageName, this)?.apply()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getCategory(category : Int) : String {
|
||||||
|
return when(category) {
|
||||||
|
ApplicationInfo.CATEGORY_UNDEFINED -> "UNDEFINED"
|
||||||
|
ApplicationInfo.CATEGORY_GAME -> "GAME"
|
||||||
|
ApplicationInfo.CATEGORY_AUDIO -> "AUDIO"
|
||||||
|
ApplicationInfo.CATEGORY_VIDEO -> "VIDEO"
|
||||||
|
ApplicationInfo.CATEGORY_IMAGE -> "IMAGE"
|
||||||
|
ApplicationInfo.CATEGORY_SOCIAL -> "SOCIAL"
|
||||||
|
ApplicationInfo.CATEGORY_NEWS -> "NEWS"
|
||||||
|
ApplicationInfo.CATEGORY_MAPS -> "MAPS"
|
||||||
|
ApplicationInfo.CATEGORY_PRODUCTIVITY -> "PRODUCTIVITY"
|
||||||
|
ApplicationInfo.CATEGORY_ACCESSIBILITY -> "ACCESSIBILITY"
|
||||||
|
else -> {"UNKNOWN"}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
fun normalize(str: String): String {
|
||||||
|
val normalizedString =
|
||||||
|
Normalizer.normalize(str.replace("\\W".toRegex(), ""), Normalizer.Form.NFC)
|
||||||
|
val pattern = Pattern.compile("\\p{InCombiningDiacriticalMarks}+")
|
||||||
|
return pattern.matcher(normalizedString).replaceAll("").toLowerCase()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -8,13 +8,13 @@ import bums.lunatic.launcher.model.RssDataType
|
|||||||
import bums.lunatic.launcher.model.getRssData
|
import bums.lunatic.launcher.model.getRssData
|
||||||
import bums.lunatic.launcher.model.getT
|
import bums.lunatic.launcher.model.getT
|
||||||
import bums.lunatic.launcher.utils.beforeOneDay
|
import bums.lunatic.launcher.utils.beforeOneDay
|
||||||
import bums.lunatic.launcher.workers.WorkersDb.blockKeyword
|
//import bums.lunatic.launcher.workers.WorkersDb.blockKeyword
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import org.jsoup.nodes.Element
|
import org.jsoup.nodes.Element
|
||||||
|
|
||||||
class ArcaGetter : BaseGetter {
|
class ArcaGetter : BaseGetter {
|
||||||
companion object {
|
companion object {
|
||||||
val TAG = "DCGetter"
|
val TAG = "ArcaGetter"
|
||||||
}
|
}
|
||||||
constructor(context: Context, workerParams: WorkerParameters) : super(context, workerParams) {
|
constructor(context: Context, workerParams: WorkerParameters) : super(context, workerParams) {
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ class ArcaGetter : BaseGetter {
|
|||||||
var tumbnail = aracaLi.getElementsByTag("img").attr("src")
|
var tumbnail = aracaLi.getElementsByTag("img").attr("src")
|
||||||
var link = "https://arca.live".plus(if(aracaLi.getElementsByClass("title hybrid-title").size > 0) aracaLi.getElementsByClass("title hybrid-title").get(0).attr("href") else if(aracaLi.getElementsByTag("a").size > 0) aracaLi.getElementsByTag("a").get(0).attr("href") else "")
|
var link = "https://arca.live".plus(if(aracaLi.getElementsByClass("title hybrid-title").size > 0) aracaLi.getElementsByClass("title hybrid-title").get(0).attr("href") else if(aracaLi.getElementsByTag("a").size > 0) aracaLi.getElementsByTag("a").get(0).attr("href") else "")
|
||||||
if (title.length > 0 && link.length > 20) {
|
if (title.length > 0 && link.length > 20) {
|
||||||
if(blockKeyword.filter { desc.contains(it) }.size == 0) {
|
// if(blockKeyword.filter { desc.contains(it) }.size == 0) {
|
||||||
Arca().apply {
|
Arca().apply {
|
||||||
this.link = link
|
this.link = link
|
||||||
this.title = title
|
this.title = title
|
||||||
@ -90,7 +90,7 @@ class ArcaGetter : BaseGetter {
|
|||||||
tempArray.add(this)
|
tempArray.add(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
return tempArray
|
return tempArray
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,46 @@
|
|||||||
|
package bums.lunatic.launcher.workers
|
||||||
|
|
||||||
|
import android.Manifest
|
||||||
|
import android.app.Service
|
||||||
|
import android.content.Intent
|
||||||
|
import android.media.AudioFormat
|
||||||
|
import android.media.AudioManager
|
||||||
|
import android.media.AudioRecord
|
||||||
|
import android.media.MediaRecorder
|
||||||
|
import android.os.IBinder
|
||||||
|
import androidx.annotation.RequiresPermission
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class AudioRecordService : Service() {
|
||||||
|
override fun onBind(intent: Intent?): IBinder? {
|
||||||
|
TODO("Not yet implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||||
|
return super.onStartCommand(intent, flags, startId)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
var sampleRate: Int = 44100 // 샘플링 레이트 (Hz)
|
||||||
|
var channelConfig: Int = AudioFormat.CHANNEL_IN_MONO // 채널 구성 (모노)
|
||||||
|
var audioFormat: Int = AudioFormat.ENCODING_PCM_16BIT // 오디오 포맷 (16비트 PCM)
|
||||||
|
var bufferSize: Int = AudioRecord.getMinBufferSize(sampleRate, channelConfig, audioFormat)
|
||||||
|
|
||||||
|
var recorder: AudioRecord? = null
|
||||||
|
@RequiresPermission(Manifest.permission.RECORD_AUDIO)
|
||||||
|
fun startAudioRec() {
|
||||||
|
recorder = AudioRecord(
|
||||||
|
MediaRecorder.AudioSource.MIC,
|
||||||
|
sampleRate,
|
||||||
|
channelConfig,
|
||||||
|
audioFormat,
|
||||||
|
bufferSize
|
||||||
|
)
|
||||||
|
|
||||||
|
recorder?.registerAudioRecordingCallback({},object : AudioManager.AudioRecordingCallback() {
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -2,13 +2,17 @@ package bums.lunatic.launcher.workers
|
|||||||
|
|
||||||
import android.annotation.SuppressLint
|
import android.annotation.SuppressLint
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import androidx.core.net.toUri
|
||||||
import androidx.work.WorkerParameters
|
import androidx.work.WorkerParameters
|
||||||
|
import bums.lunatic.launcher.helpers.PrefHelper
|
||||||
import bums.lunatic.launcher.model.DcInside
|
import bums.lunatic.launcher.model.DcInside
|
||||||
import bums.lunatic.launcher.model.RssData
|
import bums.lunatic.launcher.model.RssData
|
||||||
import bums.lunatic.launcher.model.RssDataInterface
|
import bums.lunatic.launcher.model.RssDataInterface
|
||||||
import bums.lunatic.launcher.model.RssDataType
|
import bums.lunatic.launcher.model.RssDataType
|
||||||
import bums.lunatic.launcher.model.getRssData
|
import bums.lunatic.launcher.model.getRssData
|
||||||
|
import bums.lunatic.launcher.utils.Blog
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
|
import java.text.SimpleDateFormat
|
||||||
|
|
||||||
class DCGetter : BaseGetter {
|
class DCGetter : BaseGetter {
|
||||||
companion object {
|
companion object {
|
||||||
@ -20,6 +24,9 @@ class DCGetter : BaseGetter {
|
|||||||
fun parseDcLi(dc_li : org.jsoup.nodes.Element) : ArrayList<RssDataInterface>{
|
fun parseDcLi(dc_li : org.jsoup.nodes.Element) : ArrayList<RssDataInterface>{
|
||||||
var temp = arrayListOf<RssDataInterface>()
|
var temp = arrayListOf<RssDataInterface>()
|
||||||
if (dc_li.html().contains("<ul class=>") && dc_li.html().contains("con_list img")) {
|
if (dc_li.html().contains("<ul class=>") && dc_li.html().contains("con_list img")) {
|
||||||
|
|
||||||
|
}
|
||||||
|
else if (dc_li.html().contains("<ul class=>") && dc_li.html().contains("con_list img")) {
|
||||||
dc_li.child(0).getElementsByTag("li").forEach {
|
dc_li.child(0).getElementsByTag("li").forEach {
|
||||||
parseDcLi(it)
|
parseDcLi(it)
|
||||||
}
|
}
|
||||||
@ -64,31 +71,94 @@ class DCGetter : BaseGetter {
|
|||||||
}
|
}
|
||||||
return temp
|
return temp
|
||||||
}
|
}
|
||||||
|
val df = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
|
||||||
@SuppressLint("RestrictedApi")
|
@SuppressLint("RestrictedApi")
|
||||||
override fun realWork(): Result {
|
override fun realWork(): Result {
|
||||||
|
// Blog.LOGE("${TAG} RssDataType.DCINSIDE.isOn >>>> ${PrefHelper.getBoolean(RssDataType.DCINSIDE.name,false)}")
|
||||||
RssDataType.DCINSIDE.isOn {
|
RssDataType.DCINSIDE.isOn {
|
||||||
temp.clear()
|
temp.clear()
|
||||||
|
// https://m.dcinside.com/board/singlebungle1472
|
||||||
|
var urls = arrayListOf(
|
||||||
|
"https://m.dcinside.com",
|
||||||
|
"https://m.dcinside.com/board/singlebungle1472",
|
||||||
|
"https://m.dcinside.com/board/programming",
|
||||||
|
"https://m.dcinside.com/board/cartoon",
|
||||||
|
"https://m.dcinside.com/board/reading",
|
||||||
|
"https://m.dcinside.com/board/chiangmai",
|
||||||
|
"https://m.dcinside.com/board/hit",
|
||||||
|
"https://m.dcinside.com/board/dcbest"
|
||||||
|
)
|
||||||
try {
|
try {
|
||||||
val testUrl2 = "https://www.dcinside.com/"
|
urls.forEach { testUrl2 ->
|
||||||
Jsoup.connect(testUrl2)
|
try {
|
||||||
.userAgent(USAGT)
|
// Blog.LOGE("${TAG} ${testUrl2} ")
|
||||||
.get().let { dc ->
|
Jsoup.connect(testUrl2)
|
||||||
// BLog.LOGE("test ${testUrl2} >> ${this}")
|
.userAgent(USAGT)
|
||||||
dc.getElementsByTag("li").forEach { dc_li ->
|
.get().let { dc ->
|
||||||
if (dc_li.html().contains("main_log") == true) {
|
// Blog.LOGE("${TAG} ${testUrl2} >> ${this}")
|
||||||
parseDcLi(dc_li).apply {
|
var tbody = dc.getElementsByTag("tbody")
|
||||||
this.forEach {
|
|
||||||
if (it.pubDate() > commicsDateTime) {
|
|
||||||
temp.add(it.getRssData())
|
if((tbody?.size ?: 0) == 1) {
|
||||||
|
|
||||||
|
var from = dc.getElementsByClass("page_head clear")?.first()?.getElementsByTag("a")?.first()?.text()
|
||||||
|
// Blog.LOGE("${TAG} ${from} ")
|
||||||
|
dc.getElementsByTag("tbody").first().children().forEach {
|
||||||
|
var title = it.getElementsByClass("gall_tit ub-word")?.first()?.text()
|
||||||
|
var date = it.getElementsByClass("gall_date")?.first()?.attr("title")
|
||||||
|
var link = it.getElementsByTag("a")?.first()?.attr("href")
|
||||||
|
if (link?.length ?: 0 > 10 && title?.length ?: 0 > 2 && date?.length ?: 0 > 1) {
|
||||||
|
// Blog.LOGE("${TAG} ${title} ")
|
||||||
|
// Blog.LOGE("${TAG} ${date} ${df.parse(date)}")
|
||||||
|
// Blog.LOGE("${TAG} ${link} ")
|
||||||
|
DcInside().apply {
|
||||||
|
"https://gall.dcinside.com".plus(
|
||||||
|
link?.replace(
|
||||||
|
"&",
|
||||||
|
"&"
|
||||||
|
)
|
||||||
|
)?.toUri()?.apply {
|
||||||
|
|
||||||
|
link = "https://m.dcinside.com/board/".plus(getQueryParameter("id")).plus("/").plus(getQueryParameter("no"))
|
||||||
|
}
|
||||||
|
// this.link = "https://gall.dcinside.com".plus(
|
||||||
|
// link?.replace(
|
||||||
|
// "&",
|
||||||
|
// "&"
|
||||||
|
// )
|
||||||
|
// )
|
||||||
|
|
||||||
|
this.link = link
|
||||||
|
// Blog.LOGE("${TAG} ${link} ")
|
||||||
|
// Blog.LOGE("${TAG} ${from} ")
|
||||||
|
this.title = title
|
||||||
|
this.desc = from
|
||||||
|
this.dateTiemL = df.parse(date).time
|
||||||
|
}.apply {
|
||||||
|
if (this.pubDate() > limitDateTime) {
|
||||||
|
temp.add(this.getRssData())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dc.getElementsByTag("li").forEach { dc_li ->
|
||||||
|
if (dc_li.html().contains("main_log") == true) {
|
||||||
|
parseDcLi(dc_li).apply {
|
||||||
|
this.forEach {
|
||||||
|
|
||||||
|
if (it.pubDate() > commicsDateTime) {
|
||||||
|
// Blog.LOGE("${TAG} ${it.title()}")
|
||||||
|
temp.add(it.getRssData())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}catch (e :Exception){e.printStackTrace()}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,6 +6,7 @@ import androidx.work.WorkerParameters
|
|||||||
import bums.lunatic.launcher.model.FmKorea
|
import bums.lunatic.launcher.model.FmKorea
|
||||||
import bums.lunatic.launcher.model.RssDataType
|
import bums.lunatic.launcher.model.RssDataType
|
||||||
import bums.lunatic.launcher.model.getRssData
|
import bums.lunatic.launcher.model.getRssData
|
||||||
|
import bums.lunatic.launcher.utils.Blog
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
import java.util.Date
|
import java.util.Date
|
||||||
|
|
||||||
@ -22,42 +23,49 @@ class FmKoreaGetter : BaseGetter {
|
|||||||
RssDataType.FMKORAE.isOn {
|
RssDataType.FMKORAE.isOn {
|
||||||
val now = Date()
|
val now = Date()
|
||||||
try {
|
try {
|
||||||
val fmkoreaUrls = arrayListOf("https://www.fmkorea.com/best","https://www.fmkorea.com/best2")
|
val fmkoreaUrls = arrayListOf("https://m.fmkorea.com","https://m.fmkorea.com/best","https://m.fmkorea.com/best2")
|
||||||
fmkoreaUrls.forEach {
|
fmkoreaUrls.forEach {
|
||||||
Jsoup.connect(it).userAgent(USAGT).get().let { fmkorea ->
|
try {
|
||||||
// BLog.LOGE("fmkorea >>> ${fmkorea.title()}")
|
Jsoup.connect(it).userAgent(USAGT).timeout(5000).ignoreHttpErrors(true).get().let { fmkorea ->
|
||||||
fmkorea.getElementsByTag("li").forEach { fmkorea_li ->
|
if (it.contains("guru")) {
|
||||||
if (fmkorea_li.getElementsByClass("title")
|
// Blog.LOGE("GURU -> ${fmkorea}")
|
||||||
.text().length > 0 && fmkorea_li.getElementsByTag("a").size > 0 && fmkorea_li.getElementsByTag(
|
} else {
|
||||||
"a"
|
fmkorea.getElementsByTag("li").forEach { fmkorea_li ->
|
||||||
).get(0).attr("href").length > 0
|
if (fmkorea_li.getElementsByClass("title")
|
||||||
) {
|
.text().length > 0 && fmkorea_li.getElementsByTag("a").size > 0 && fmkorea_li.getElementsByTag(
|
||||||
// BLog.LOGE("fmkorea_li >>> ${fmkorea_li}")
|
"a"
|
||||||
val title = fmkorea_li.getElementsByClass("title").text()
|
).get(0).attr("href").length > 0
|
||||||
val tumb = "https://".plus(
|
|
||||||
fmkorea_li.getElementsByClass("thumb").attr("data-original")
|
|
||||||
)
|
|
||||||
val pageUrl = "https://www.fmkorea.com".plus(
|
|
||||||
fmkorea_li.getElementsByTag("a").get(0).attr("href")
|
|
||||||
)
|
|
||||||
val desc = fmkorea_li.getElementsByClass("category").text()
|
|
||||||
val date = fmkorea_li.getElementsByClass("regdate").text()
|
|
||||||
FmKorea(pageUrl, desc, date, title, tumb).apply {
|
|
||||||
if (desc?.contains("유머") == true || desc?.contains("음악") == true || desc?.contains(
|
|
||||||
"영화"
|
|
||||||
) == true ||
|
|
||||||
desc?.contains("TV") == true || desc?.contains("미스터리") == true || desc?.contains(
|
|
||||||
"역사"
|
|
||||||
) == true
|
|
||||||
) {
|
) {
|
||||||
if (this.pubDate() > commicsDateTime && tumb.length > 10) {
|
val title = fmkorea_li.getElementsByClass("title").text()
|
||||||
temp.add(this.getRssData())
|
val tumb = "https://".plus(
|
||||||
|
fmkorea_li.getElementsByClass("thumb")
|
||||||
|
.attr("data-original")
|
||||||
|
)
|
||||||
|
val pageUrl = "https://www.fmkorea.com".plus(
|
||||||
|
fmkorea_li.getElementsByTag("a").get(0).attr("href")
|
||||||
|
)
|
||||||
|
val desc = fmkorea_li.getElementsByClass("category").text()
|
||||||
|
val date = fmkorea_li.getElementsByClass("regdate").text()
|
||||||
|
FmKorea(pageUrl, desc, date, title, tumb).apply {
|
||||||
|
if (desc?.contains("유머") == true || desc?.contains("음악") == true || desc?.contains(
|
||||||
|
"영화"
|
||||||
|
) == true ||
|
||||||
|
desc?.contains("TV") == true || desc?.contains("미스터리") == true || desc?.contains(
|
||||||
|
"역사"
|
||||||
|
) == true
|
||||||
|
) {
|
||||||
|
if (this.pubDate() > commicsDateTime && tumb.length > 10) {
|
||||||
|
temp.add(this.getRssData())
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}catch (e:Exception){
|
||||||
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|||||||
@ -152,6 +152,7 @@ class LocationUpdateService : Service(), LocationListener {
|
|||||||
try{
|
try{
|
||||||
locationManager = applicationContext
|
locationManager = applicationContext
|
||||||
.getSystemService(LOCATION_SERVICE) as LocationManager
|
.getSystemService(LOCATION_SERVICE) as LocationManager
|
||||||
|
|
||||||
checkGPS = locationManager!!
|
checkGPS = locationManager!!
|
||||||
.isProviderEnabled(LocationManager.GPS_PROVIDER)
|
.isProviderEnabled(LocationManager.GPS_PROVIDER)
|
||||||
checkNetwork = locationManager!!
|
checkNetwork = locationManager!!
|
||||||
|
|||||||
@ -24,10 +24,10 @@ class NewsFeedsGetter : BaseGetter {
|
|||||||
feddsUrls.addAll(RssList.getFeedUrls())
|
feddsUrls.addAll(RssList.getFeedUrls())
|
||||||
|
|
||||||
for (url in feddsUrls) {
|
for (url in feddsUrls) {
|
||||||
for (it in RssFeedsParser.getFeeds(url)) {
|
try {
|
||||||
if (it.pubDate() >= limitDateTime) {
|
for (it in RssFeedsParser.getFeeds(url)) { if (it.pubDate() >= limitDateTime) { try {temp.add(it.getRssData())}catch (e : Exception) {e.printStackTrace()} } }
|
||||||
temp.add(it.getRssData())
|
}catch (e : Exception) {
|
||||||
}
|
e.printStackTrace()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -7,6 +7,7 @@ import androidx.work.WorkerParameters
|
|||||||
import bums.lunatic.launcher.model.RssDataType
|
import bums.lunatic.launcher.model.RssDataType
|
||||||
import bums.lunatic.launcher.model.RuliWeb
|
import bums.lunatic.launcher.model.RuliWeb
|
||||||
import bums.lunatic.launcher.model.getRssData
|
import bums.lunatic.launcher.model.getRssData
|
||||||
|
import bums.lunatic.launcher.utils.Blog
|
||||||
import org.jsoup.Jsoup
|
import org.jsoup.Jsoup
|
||||||
|
|
||||||
class RuliWebGetter : BaseGetter {
|
class RuliWebGetter : BaseGetter {
|
||||||
@ -26,7 +27,9 @@ class RuliWebGetter : BaseGetter {
|
|||||||
var dateTimeTxt = ""
|
var dateTimeTxt = ""
|
||||||
if(ruli_tr.getElementsByTag("a").size > tagIdx) {
|
if(ruli_tr.getElementsByTag("a").size > tagIdx) {
|
||||||
pageLink = aTags.get(tagIdx).attr("href").replace("&","&")
|
pageLink = aTags.get(tagIdx).attr("href").replace("&","&")
|
||||||
thumbnailUrl = aTags.get(tagIdx).attr("style").split("(")[1].replace(");","")
|
if(aTags.get(tagIdx).attr("style").split("(").size > 1) {
|
||||||
|
thumbnailUrl = aTags.get(tagIdx).attr("style").split("(")[1].replace(");", "")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
tagIdx = 1
|
tagIdx = 1
|
||||||
if(ruli_tr.getElementsByTag("a").size > tagIdx) { title = aTags.get(tagIdx).text() }
|
if(ruli_tr.getElementsByTag("a").size > tagIdx) { title = aTags.get(tagIdx).text() }
|
||||||
@ -37,11 +40,11 @@ class RuliWebGetter : BaseGetter {
|
|||||||
var timeClass = ruli_tr.getElementsByClass("time")
|
var timeClass = ruli_tr.getElementsByClass("time")
|
||||||
if(timeClass.size > 0) { dateTimeTxt = timeClass.get(0).text() }
|
if(timeClass.size > 0) { dateTimeTxt = timeClass.get(0).text() }
|
||||||
|
|
||||||
// BLog.LOGE("pageLink >>>> $pageLink ")
|
// Blog.LOGE(TAG.plus("pageLink >>>> $pageLink "))
|
||||||
// BLog.LOGE("thumbnailUrl >>>> $thumbnailUrl ")
|
// Blog.LOGE(TAG.plus("thumbnailUrl >>>> $thumbnailUrl "))
|
||||||
// BLog.LOGE("title >>>> $title ")
|
// Blog.LOGE(TAG.plus("title >>>> $title "))
|
||||||
// BLog.LOGE("desc >>>> $desc ")
|
// Blog.LOGE(TAG.plus("desc >>>> $desc "))
|
||||||
// BLog.LOGE("dateTimeTxt >>>> $dateTimeTxt ")
|
// Blog.LOGE(TAG.plus("dateTimeTxt >>>> $dateTimeTxt "))
|
||||||
if (title.length > 0 && pageLink.length > 0) {
|
if (title.length > 0 && pageLink.length > 0) {
|
||||||
RuliWeb().let { ru ->
|
RuliWeb().let { ru ->
|
||||||
ru.title = title
|
ru.title = title
|
||||||
@ -62,10 +65,10 @@ class RuliWebGetter : BaseGetter {
|
|||||||
try {
|
try {
|
||||||
val testUrl2 = arrayListOf("https://bbs.ruliweb.com/best/humor_only","https://bbs.ruliweb.com/best/humor_only/now?m=humor_only&t=default&page=2")
|
val testUrl2 = arrayListOf("https://bbs.ruliweb.com/best/humor_only","https://bbs.ruliweb.com/best/humor_only/now?m=humor_only&t=default&page=2")
|
||||||
testUrl2.forEach { url ->
|
testUrl2.forEach { url ->
|
||||||
Jsoup.connect(url)
|
Jsoup.connect(url).timeout(5000).ignoreHttpErrors(true)
|
||||||
.userAgent(USAGT)
|
.userAgent(USAGT)
|
||||||
.get().let { ruli ->
|
.get().let { ruli ->
|
||||||
// BLog.LOGE("test ${testUrl2} >> ${ruli.title()}")
|
// Blog.LOGE(TAG.plus("test ${testUrl2} >> ${ruli.title()}"))
|
||||||
ruli.getElementsByTag("tr").forEach { ruli_tr ->
|
ruli.getElementsByTag("tr").forEach { ruli_tr ->
|
||||||
parseRuli(ruli_tr)
|
parseRuli(ruli_tr)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import bums.lunatic.launcher.model.TelegramChat
|
|||||||
import bums.lunatic.launcher.model.TelegramData
|
import bums.lunatic.launcher.model.TelegramData
|
||||||
import bums.lunatic.launcher.model.TelegramFrom
|
import bums.lunatic.launcher.model.TelegramFrom
|
||||||
import bums.lunatic.launcher.model.TelegramMessage
|
import bums.lunatic.launcher.model.TelegramMessage
|
||||||
|
import bums.lunatic.launcher.model.UserActionModel
|
||||||
import bums.lunatic.launcher.model.WeatherForcast
|
import bums.lunatic.launcher.model.WeatherForcast
|
||||||
import bums.lunatic.launcher.utils.Blog
|
import bums.lunatic.launcher.utils.Blog
|
||||||
import bums.lunatic.launcher.utils.JamoUtils
|
import bums.lunatic.launcher.utils.JamoUtils
|
||||||
@ -36,6 +37,8 @@ import io.realm.kotlin.migration.AutomaticSchemaMigration
|
|||||||
import io.realm.kotlin.query.RealmQuery
|
import io.realm.kotlin.query.RealmQuery
|
||||||
import io.realm.kotlin.types.BaseRealmObject
|
import io.realm.kotlin.types.BaseRealmObject
|
||||||
import io.realm.kotlin.types.TypedRealmObject
|
import io.realm.kotlin.types.TypedRealmObject
|
||||||
|
import java.util.Calendar
|
||||||
|
import java.util.Date
|
||||||
import java.util.Locale
|
import java.util.Locale
|
||||||
import java.util.regex.Pattern
|
import java.util.regex.Pattern
|
||||||
import kotlin.reflect.KClass
|
import kotlin.reflect.KClass
|
||||||
@ -48,12 +51,21 @@ class CustMigration : AutomaticSchemaMigration {
|
|||||||
}
|
}
|
||||||
object WorkersDb {
|
object WorkersDb {
|
||||||
|
|
||||||
|
fun recommendApps() {
|
||||||
|
val cal = Calendar.getInstance()
|
||||||
|
cal.time = Date()
|
||||||
|
val weekOfYear = cal.get(Calendar.WEEK_OF_YEAR)
|
||||||
|
val weekOfMonth = cal.get(Calendar.WEEK_OF_MONTH)
|
||||||
|
val dayOfWeek = cal.get(Calendar.DAY_OF_WEEK)
|
||||||
|
getRealm().apply {
|
||||||
|
this.query<UserActionModel>().query("weekOfYear == $0 OR weekOfMonth == $1 OR dayOfWeek == $2").limit()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val clazz : Set<KClass<out BaseRealmObject>> = setOf(RssData::class, NotificationItem::class, AppInfo::class,SimpleContact::class, RecentCall::class, RecentSms::class, CurrentPlayItem::class,
|
val clazz : Set<KClass<out BaseRealmObject>> = setOf(RssData::class, NotificationItem::class, AppInfo::class,SimpleContact::class, RecentCall::class, RecentSms::class, CurrentPlayItem::class,
|
||||||
TelegramBotUpdate::class, TelegramData::class, TelegramMessage::class, TelegramChat::class, BotCommandEentitie::class, TelegramFrom::class,
|
TelegramBotUpdate::class, TelegramData::class, TelegramMessage::class, TelegramChat::class, BotCommandEentitie::class, TelegramFrom::class,
|
||||||
WeatherForcast::class, Location::class, Current::class, Forecast::class, Condition::class, Forecastday::class, Day::class, Astro::class, Hour::class,
|
WeatherForcast::class, Location::class, Current::class, Forecast::class, Condition::class, Forecastday::class, Day::class, Astro::class, Hour::class,
|
||||||
LocationLog::class
|
LocationLog::class,UserActionModel::class
|
||||||
)
|
)
|
||||||
|
|
||||||
val schemaVersion : Long = BuildConfig.BuildDateTime
|
val schemaVersion : Long = BuildConfig.BuildDateTime
|
||||||
@ -85,7 +97,7 @@ object WorkersDb {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val blockKeyword = arrayListOf<String>("붕괴 스타레일","붕괴 스타일","트릭컬 RE:VIVE","원신","메이플스토리","")
|
// val blockKeyword = arrayListOf<String>("붕괴 스타레일","붕괴 스타일","트릭컬 RE:VIVE","원신","메이플스토리","")
|
||||||
fun insertBulkData(rssDatas: Collection<RssData>) {
|
fun insertBulkData(rssDatas: Collection<RssData>) {
|
||||||
rssDatas.forEach {
|
rssDatas.forEach {
|
||||||
try {
|
try {
|
||||||
@ -94,7 +106,7 @@ object WorkersDb {
|
|||||||
val catfillters = arrayListOf<RssDataType>(RssDataType.THEQOO,RssDataType.RULIWEB,RssDataType.ARCA,RssDataType.CLIEN,RssDataType.FMKORAE,RssDataType.DOTAX,RssDataType.DCINSIDE)
|
val catfillters = arrayListOf<RssDataType>(RssDataType.THEQOO,RssDataType.RULIWEB,RssDataType.ARCA,RssDataType.CLIEN,RssDataType.FMKORAE,RssDataType.DOTAX,RssDataType.DCINSIDE)
|
||||||
if(catfillters.contains(it.category()) && query<RssData>("chosung == $0",it.chosung).find().size == 0) {
|
if(catfillters.contains(it.category()) && query<RssData>("chosung == $0",it.chosung).find().size == 0) {
|
||||||
this.copyToRealm(it, UpdatePolicy.ERROR)
|
this.copyToRealm(it, UpdatePolicy.ERROR)
|
||||||
} else {
|
} else if(!catfillters.contains(it.category())){
|
||||||
this.copyToRealm(it, UpdatePolicy.ERROR)
|
this.copyToRealm(it, UpdatePolicy.ERROR)
|
||||||
}
|
}
|
||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
|
|||||||
@ -189,6 +189,18 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"/>
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
style="@style/normal"
|
||||||
|
android:id="@+id/favApps"
|
||||||
|
android:gravity="center"
|
||||||
|
android:background="@null"
|
||||||
|
android:text="앱스"
|
||||||
|
android:textColor="@color/tabs"
|
||||||
|
android:checked="false"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
style="@style/normal"
|
style="@style/normal"
|
||||||
android:id="@+id/recentSms"
|
android:id="@+id/recentSms"
|
||||||
@ -254,7 +266,6 @@
|
|||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
android:layout_alignParentRight="true"
|
android:layout_alignParentRight="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
@ -274,6 +285,23 @@
|
|||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||||
|
android:layout_margin="@dimen/default_layout_margin"
|
||||||
|
android:id="@+id/appsList"
|
||||||
|
android:layout_width="0dp"
|
||||||
|
android:layout_height="0dp"
|
||||||
|
android:overScrollMode="never"
|
||||||
|
android:padding="@dimen/default_padding"
|
||||||
|
app:spanCount="3"
|
||||||
|
android:scrollbars="none"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:background="@drawable/base_bg"
|
||||||
|
android:layout_alignParentTop="true"
|
||||||
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
/>
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:layout_margin="@dimen/default_layout_margin"
|
android:layout_margin="@dimen/default_layout_margin"
|
||||||
|
|||||||
@ -553,7 +553,7 @@ open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
protected fun bindViews() {
|
open fun bindViews() {
|
||||||
binding.toolbarContent.close.setOnClickListener(this)
|
binding.toolbarContent.close.setOnClickListener(this)
|
||||||
binding.toolbarContent.back.setOnClickListener(this)
|
binding.toolbarContent.back.setOnClickListener(this)
|
||||||
binding.toolbarContent.forward.setOnClickListener(this)
|
binding.toolbarContent.forward.setOnClickListener(this)
|
||||||
@ -824,12 +824,29 @@ open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
|
|||||||
val items = arrayOf(
|
val items = arrayOf(
|
||||||
resources.getString(stringResSavePhoto)
|
resources.getString(stringResSavePhoto)
|
||||||
)
|
)
|
||||||
|
val url = hitTestResult.extra
|
||||||
|
if (webView?.url?.contains(".guru") == true) {
|
||||||
|
url?.split("/")?.last()?.let { last ->
|
||||||
|
var code = if(last.contains("_") && last.split("_")?.first()?.length ?: 0 > 2) {
|
||||||
|
last.split("_").first()
|
||||||
|
} else if(last.contains("-") && last.split("-")?.first()?.length ?: 0 > 2) {
|
||||||
|
last.split("-").first()
|
||||||
|
} else {
|
||||||
|
last
|
||||||
|
}
|
||||||
|
LogUtil.e("hitTestResult code >>> ${code}")
|
||||||
|
webView?.evaluateJavascript("try{GJI.onCode('${code}');}catch(e){console.log(e);}", {})
|
||||||
|
}
|
||||||
|
showBlock()
|
||||||
|
return@OnLongClickListener false
|
||||||
|
}
|
||||||
|
|
||||||
builder?.setItems(
|
builder?.setItems(
|
||||||
items
|
items
|
||||||
) { dialog, which ->
|
) { dialog, which ->
|
||||||
LogUtil.e("hitTestResult.extra >>> ${dialog} ,${which}")
|
LogUtil.e("hitTestResult.extra >>> ${dialog} ,${which}")
|
||||||
val url = hitTestResult.extra
|
val url = hitTestResult.extra
|
||||||
LogUtil.e("hitTestResult.extra >>> ${hitTestResult.extra}")
|
|
||||||
CookieSyncManager.createInstance(applicationContext)
|
CookieSyncManager.createInstance(applicationContext)
|
||||||
CookieSyncManager.getInstance().sync()
|
CookieSyncManager.getInstance().sync()
|
||||||
val cookieManager =
|
val cookieManager =
|
||||||
@ -1253,8 +1270,16 @@ open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
|
|||||||
|
|
||||||
protected fun showBlock() {
|
protected fun showBlock() {
|
||||||
binding.blocking.visibility = View.VISIBLE
|
binding.blocking.visibility = View.VISIBLE
|
||||||
val ress = arrayListOf(R.raw.lt_lodaing_01,R.raw.lt_lodaing_02,R.raw.lt_lodaing_03)
|
val ress = arrayListOf(R.raw.dlottie_001,R.raw.lt_lodaing_01,R.raw.dlottie_003,R.raw.lt_lodaing_02,R.raw.lt_lodaing_03,R.raw.dlottie_002)
|
||||||
binding.lotti.setAnimation(ress[Math.abs(Random(8736).nextInt()) % ress.size])
|
var isEven = ((System.currentTimeMillis() % 2).toInt() == 0)
|
||||||
|
var firstSeed = Random(if(isEven)8739 else 7531)
|
||||||
|
var randomSeed_01 = Math.abs(firstSeed.nextInt()) % if(isEven) 879 else 56
|
||||||
|
var randomSeed_02 = Math.abs(firstSeed.nextInt()) % if(!isEven) 758 else 397
|
||||||
|
var randomSeed_03 = Math.abs(firstSeed.nextInt()) % if(!isEven) 353 else 49
|
||||||
|
var totalSeed = Math.abs((Math.abs(randomSeed_01) * Math.abs(randomSeed_02)) + Math.abs(randomSeed_03))
|
||||||
|
var randomResult = Math.abs(totalSeed % ress.size)
|
||||||
|
LogUtil.e("randomResult >>> randomSeed_01 {${randomSeed_01}} | randomSeed_02 {${randomSeed_02}} | randomSeed_03 {${randomSeed_03}} | resSize {${ress.size}} | ${randomResult}")
|
||||||
|
binding.lotti.setAnimation(ress[Math.abs(randomResult)])
|
||||||
binding.lotti.playAnimation()
|
binding.lotti.playAnimation()
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1912,7 +1937,7 @@ open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
|
|||||||
url.toLowerCase(Locale.ROOT).contains(".svg") ||
|
url.toLowerCase(Locale.ROOT).contains(".svg") ||
|
||||||
url.toLowerCase(Locale.ROOT).contains(".webp")) {
|
url.toLowerCase(Locale.ROOT).contains(".webp")) {
|
||||||
mediaUrls.add(url)
|
mediaUrls.add(url)
|
||||||
LogUtil.e("mediaUrls >>>>> add(${url})")
|
// LogUtil.e("mediaUrls >>>>> add(${url})")
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!hasYoutubePlayer) {
|
if(!hasYoutubePlayer) {
|
||||||
@ -1924,9 +1949,11 @@ open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
|
|||||||
|
|
||||||
if (url.toLowerCase(Locale.ROOT)
|
if (url.toLowerCase(Locale.ROOT)
|
||||||
.contains("ads".toLowerCase(Locale.ROOT))) {
|
.contains("ads".toLowerCase(Locale.ROOT))) {
|
||||||
LogUtil.e("shouldInterceptRequest request url contains ads >>> ${request.url.toString()}")
|
// LogUtil.e("shouldInterceptRequest request url contains ads >>> ${request.url.toString()}")
|
||||||
}
|
}
|
||||||
var adblockKeyWords = arrayOf("adcr.naver.com","daumcdn.net/biz/ui/ad/adcm","imgad","ad.daum.net","cr.adsappier.com","ar-adview","adtrafficquality","criteo","adlib.nhnace.com","google.com/ads","googleads.","/pagead","/adpost/","ads/search","plugin.adplex","google-analytics.com")
|
var callSupers = arrayListOf("google-analytics.com","analytics.google.com","api.dable.io")
|
||||||
|
var adblockKeyWords = arrayOf("adcr.naver.com","daumcdn.net/biz/ui/ad/adcm","imgad","ad.daum.net","cr.adsappier.com","ar-adview","adtrafficquality","criteo","adlib.nhnace.com","google.com/ads","googleads.","/pagead","/adpost/","ads/search","plugin.adplex")
|
||||||
|
val supers = callSupers.filter { url.toLowerCase(Locale.ROOT).contains(it.toLowerCase(Locale.ROOT)) }.size > 0
|
||||||
val adblock = adblockKeyWords.filter { url.toLowerCase(Locale.ROOT).contains(it.toLowerCase(Locale.ROOT)) }.size > 0
|
val adblock = adblockKeyWords.filter { url.toLowerCase(Locale.ROOT).contains(it.toLowerCase(Locale.ROOT)) }.size > 0
|
||||||
return if(adblock) {
|
return if(adblock) {
|
||||||
try {
|
try {
|
||||||
@ -1935,7 +1962,9 @@ open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
|
|||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
super.shouldInterceptRequest(view, url)
|
super.shouldInterceptRequest(view, url)
|
||||||
}
|
}
|
||||||
}else if(url.toLowerCase(Locale.ROOT).contains(".jpg") || url.toLowerCase(Locale.ROOT).contains(".jpeg")){
|
} else if(supers) {
|
||||||
|
super.shouldInterceptRequest(view, url)
|
||||||
|
} else if(url.toLowerCase(Locale.ROOT).contains(".jpg") || url.toLowerCase(Locale.ROOT).contains(".jpeg")){
|
||||||
try {
|
try {
|
||||||
val bitmap = Glide.with(this@AwesomeWebViewActivity).asBitmap().timeout(30000).diskCacheStrategy(DiskCacheStrategy.ALL).load(url).submit().get()
|
val bitmap = Glide.with(this@AwesomeWebViewActivity).asBitmap().timeout(30000).diskCacheStrategy(DiskCacheStrategy.ALL).load(url).submit().get()
|
||||||
WebResourceResponse("image/jpg", "UTF-8",getBitmapInputStream(bitmap,Bitmap.CompressFormat.JPEG)).apply {
|
WebResourceResponse("image/jpg", "UTF-8",getBitmapInputStream(bitmap,Bitmap.CompressFormat.JPEG)).apply {
|
||||||
@ -1958,7 +1987,7 @@ open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
|
|||||||
try {
|
try {
|
||||||
val bitmap = Glide.with(this@AwesomeWebViewActivity).asBitmap().timeout(30000).diskCacheStrategy(DiskCacheStrategy.ALL).load(url).submit().get()
|
val bitmap = Glide.with(this@AwesomeWebViewActivity).asBitmap().timeout(30000).diskCacheStrategy(DiskCacheStrategy.ALL).load(url).submit().get()
|
||||||
WebResourceResponse("image/webp", "UTF-8",getBitmapInputStream(bitmap,Bitmap.CompressFormat.WEBP)).apply {
|
WebResourceResponse("image/webp", "UTF-8",getBitmapInputStream(bitmap,Bitmap.CompressFormat.WEBP)).apply {
|
||||||
LogUtil.e("shouldInterceptRequest request url down from Glide >>> ${request.url.toString()}")
|
// LogUtil.e("shouldInterceptRequest request url down from Glide >>> ${request.url.toString()}")
|
||||||
}
|
}
|
||||||
} catch (e : Exception) {
|
} catch (e : Exception) {
|
||||||
super.shouldInterceptRequest(view, url)
|
super.shouldInterceptRequest(view, url)
|
||||||
@ -2038,7 +2067,15 @@ open class AwesomeWebViewActivity : AppCompatActivity(), View.OnClickListener,
|
|||||||
|
|
||||||
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
|
override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
|
||||||
handler.sendEmptyMessage(MSG_CLICK_ON_URL)
|
handler.sendEmptyMessage(MSG_CLICK_ON_URL)
|
||||||
|
if (url.contains("http:")) {
|
||||||
|
var newUrl = url.replace("http:","https:")
|
||||||
|
LogUtil.e("is StartWith ${url} , ${newUrl}")
|
||||||
|
if (newUrl.length > 10) {
|
||||||
|
view.stopLoading()
|
||||||
|
view.loadUrl(newUrl)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
}
|
||||||
var skipResource = host!= null && ((url.contains(host!!) ?: true) == false) && (host!!.contains("google") == false)
|
var skipResource = host!= null && ((url.contains(host!!) ?: true) == false) && (host!!.contains("google") == false)
|
||||||
if (skipResource || loadWithIntent) {
|
if (skipResource || loadWithIntent) {
|
||||||
LogUtil.e("shouldOverrideUrlLoading block url $url , host >>>> $host ")
|
LogUtil.e("shouldOverrideUrlLoading block url $url , host >>>> $host ")
|
||||||
|
|||||||
BIN
library/src/main/res/raw/dlottie_001
Normal file
BIN
library/src/main/res/raw/dlottie_001
Normal file
Binary file not shown.
BIN
library/src/main/res/raw/dlottie_002
Normal file
BIN
library/src/main/res/raw/dlottie_002
Normal file
Binary file not shown.
BIN
library/src/main/res/raw/dlottie_003
Normal file
BIN
library/src/main/res/raw/dlottie_003
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user