This commit is contained in:
lunaticbum
2024-10-18 16:16:41 +09:00
parent edca12a137
commit 94000c4b67
134 changed files with 1663 additions and 2373 deletions
+4 -4
View File
@@ -60,9 +60,9 @@
</queries>
<application
android:name=".LunarLauncher"
android:icon="@mipmap/ic_launcher"
android:roundIcon="@mipmap/ic_launcher"
android:name=".LunaticLauncher"
android:icon="@drawable/ic_launcher"
android:roundIcon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.LunarLauncher"
android:excludeFromRecents="true"
@@ -155,7 +155,7 @@
<action android:name="android.service.notification.NotificationListenerService" />
</intent-filter>
</service>
<service android:name="rasel.lunar.launcher.workers.LocationUpdateService" />
<service android:name="bums.lunatic.launcher.workers.LocationUpdateService" />
<receiver android:name=".LauncherActivity$EndCallReceiver"
android:enabled="true"
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher
package bums.lunatic.launcher
//import rasel.lunar.launcher.home.LauncherHome.Companion.rssSet
@@ -37,11 +37,9 @@ import android.net.Uri
import android.net.http.SslError
import android.os.Build
import android.os.Bundle
import android.os.Environment
import android.os.Environment.isExternalStorageManager
import android.os.Handler
import android.os.Looper
import android.print.PDFPrint
import android.provider.Settings
import android.telephony.TelephonyManager
import android.view.View
@@ -60,8 +58,6 @@ import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
import androidx.core.content.FileProvider
import androidx.core.net.toUri
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
import androidx.core.view.ViewCompat
import androidx.core.view.WindowCompat
@@ -73,76 +69,72 @@ import androidx.work.ExistingPeriodicWorkPolicy
import androidx.work.OneTimeWorkRequest
import androidx.work.PeriodicWorkRequestBuilder
import androidx.work.WorkManager
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.apps.AppDrawer
import bums.lunatic.launcher.apps.DismissCalback
import bums.lunatic.launcher.apps.SearchMenu
import bums.lunatic.launcher.databinding.LauncherActivityBinding
import bums.lunatic.launcher.feeds.Feeds
import bums.lunatic.launcher.feeds.WidgetHost
import bums.lunatic.launcher.helpers.BluetoothManager
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_APPLICATION_THEME
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_FIRST_LAUNCH
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_STATUS_BAR
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_FIRST_LAUNCH
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import bums.lunatic.launcher.helpers.Constants.Companion.widgetHostId
import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.helpers.ViewPagerAdapter
import bums.lunatic.launcher.helpers.letTrue
import bums.lunatic.launcher.home.LauncherHome
import bums.lunatic.launcher.home.LauncherHome.Companion.lastedFinishedPageUrl
import bums.lunatic.launcher.home.LauncherHome.Companion.listTags
import bums.lunatic.launcher.model.JGuru
import bums.lunatic.launcher.model.MissD
import bums.lunatic.launcher.model.RssData
import bums.lunatic.launcher.model.getRssData
import bums.lunatic.launcher.model.getT
import bums.lunatic.launcher.model.jGuruTag
import bums.lunatic.launcher.receiver.NLService
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.utils.RssList.jGuruMain
import bums.lunatic.launcher.utils.beforeDay
import bums.lunatic.launcher.utils.make0H
import bums.lunatic.launcher.workers.AppInfoGetter
import bums.lunatic.launcher.workers.ArcaGetter
import bums.lunatic.launcher.workers.CalendarGetter
import bums.lunatic.launcher.workers.ClienGetter
import bums.lunatic.launcher.workers.ContactInfoGetter
import bums.lunatic.launcher.workers.DCGetter
import bums.lunatic.launcher.workers.DotaxGetter
import bums.lunatic.launcher.workers.DotaxGetter.Companion.COMIC2_WORK_TAG
import bums.lunatic.launcher.workers.FmKoreaGetter
import bums.lunatic.launcher.workers.FmKoreaGetter.Companion.COMIC_WORK_TAG
import bums.lunatic.launcher.workers.LocationGetter
import bums.lunatic.launcher.workers.LocationUpdateService
import bums.lunatic.launcher.workers.NewsFeedsGetter
import bums.lunatic.launcher.workers.NewsFeedsGetter.Companion.FEDDS_WORK_TAG
import bums.lunatic.launcher.workers.OpenWeatherGetter
import bums.lunatic.launcher.workers.RecentCallGetter
import bums.lunatic.launcher.workers.RecentSmsGetter
import bums.lunatic.launcher.workers.RecentSmsGetter.Companion.SMS_WORK_TAG
import bums.lunatic.launcher.workers.RedditGetter
import bums.lunatic.launcher.workers.RedditGetter.Companion.REDDIT_WORK_TAG
import bums.lunatic.launcher.workers.RuliWebGetter
import bums.lunatic.launcher.workers.TheQooGetter
import bums.lunatic.launcher.workers.WorkersDb
import bums.lunatic.launcher.workers.YoutubeGetter
import bums.lunatic.launcher.workers.YoutubeGetter.Companion.YT_WORK_TAG
import com.google.android.material.color.DynamicColors
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.apps.AppDrawer
import rasel.lunar.launcher.apps.DismissCalback
import rasel.lunar.launcher.apps.SearchMenu
import rasel.lunar.launcher.databinding.LauncherActivityBinding
import rasel.lunar.launcher.databinding.RecommendedHourlyDressBinding
import rasel.lunar.launcher.feeds.Feeds
import rasel.lunar.launcher.feeds.WidgetHost
import rasel.lunar.launcher.helpers.BluetoothManager
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_APPLICATION_THEME
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_FIRST_LAUNCH
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_STATUS_BAR
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_FIRST_LAUNCH
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import rasel.lunar.launcher.helpers.Constants.Companion.widgetHostId
import rasel.lunar.launcher.helpers.PrefHelper
import rasel.lunar.launcher.helpers.ViewPagerAdapter
import rasel.lunar.launcher.helpers.letTrue
import rasel.lunar.launcher.home.LauncherHome
import rasel.lunar.launcher.home.LauncherHome.Companion.lastedFinishedPageUrl
import rasel.lunar.launcher.home.LauncherHome.Companion.listTags
import rasel.lunar.launcher.model.MissD
import rasel.lunar.launcher.model.RssData
import rasel.lunar.launcher.model.JGuru
import rasel.lunar.launcher.model.jGuruTag
import rasel.lunar.launcher.model.getRssData
import rasel.lunar.launcher.model.getT
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.receiver.NLService
import rasel.lunar.launcher.utils.RssList.jGuruMain
import rasel.lunar.launcher.utils.beforeDay
import rasel.lunar.launcher.utils.make0H
import rasel.lunar.launcher.workers.AppInfoGetter
import rasel.lunar.launcher.workers.ArcaGetter
import rasel.lunar.launcher.workers.CalendarGetter
import rasel.lunar.launcher.workers.ClienGetter
import rasel.lunar.launcher.workers.ContactInfoGetter
import rasel.lunar.launcher.workers.DCGetter
import rasel.lunar.launcher.workers.DotaxGetter
import rasel.lunar.launcher.workers.DotaxGetter.Companion.COMIC2_WORK_TAG
import rasel.lunar.launcher.workers.FmKoreaGetter
import rasel.lunar.launcher.workers.FmKoreaGetter.Companion.COMIC_WORK_TAG
import rasel.lunar.launcher.workers.LocationGetter
import rasel.lunar.launcher.workers.LocationUpdateService
import rasel.lunar.launcher.workers.NewsFeedsGetter
import rasel.lunar.launcher.workers.NewsFeedsGetter.Companion.FEDDS_WORK_TAG
import rasel.lunar.launcher.workers.OpenWeatherGetter
import rasel.lunar.launcher.workers.RecentCallGetter
import rasel.lunar.launcher.workers.RecentSmsGetter
import rasel.lunar.launcher.workers.RecentSmsGetter.Companion.SMS_WORK_TAG
import rasel.lunar.launcher.workers.RedditGetter
import rasel.lunar.launcher.workers.RedditGetter.Companion.REDDIT_WORK_TAG
import rasel.lunar.launcher.workers.RuliWebGetter
import rasel.lunar.launcher.workers.TheQooGetter
import rasel.lunar.launcher.workers.WorkersDb
import rasel.lunar.launcher.workers.YoutubeGetter
import rasel.lunar.launcher.workers.YoutubeGetter.Companion.YT_WORK_TAG
import java.io.File
import java.io.IOException
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Date
import java.util.Locale
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
import kotlin.random.Random
internal class LauncherActivity : AppCompatActivity() {
@@ -16,17 +16,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher
package bums.lunatic.launcher
import android.app.Application
import android.content.ComponentCallbacks2
import android.content.Context
import android.content.SharedPreferences
import android.database.sqlite.SQLiteDatabase
import rasel.lunar.launcher.helpers.PrefHelper
import bums.lunatic.launcher.helpers.PrefHelper
internal class LunarLauncher : Application() {
internal class LunaticLauncher : Application() {
companion object {
var appContext : Context? = null
}
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.apps
package bums.lunatic.launcher.apps
import android.annotation.SuppressLint
import android.content.Context
@@ -39,26 +39,25 @@ import android.view.inputmethod.InputMethodManager
import androidx.core.widget.doOnTextChanged
import androidx.fragment.app.Fragment
import androidx.recyclerview.widget.GridLayoutManager
import bums.lunatic.launcher.BuildConfig
import bums.lunatic.launcher.CommadCallabck
import bums.lunatic.launcher.LauncherActivity
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.databinding.AppDrawerBinding
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_APPS_COUNT
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_APPS_LAYOUT
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_APP_NAMES
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import bums.lunatic.launcher.helpers.PrefBoolean
import bums.lunatic.launcher.helpers.PrefLong
import bums.lunatic.launcher.helpers.letTrue
import bums.lunatic.launcher.model.AppInfo
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.utils.JamoUtils
import bums.lunatic.launcher.workers.WorkersDb
import io.realm.kotlin.ext.query
import io.realm.kotlin.query.RealmResults
import io.realm.kotlin.query.Sort
import rasel.lunar.launcher.BuildConfig
import rasel.lunar.launcher.CommadCallabck
import rasel.lunar.launcher.LauncherActivity
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.databinding.AppDrawerBinding
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_APPS_COUNT
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_APPS_LAYOUT
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_APP_NAMES
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import rasel.lunar.launcher.helpers.PrefBoolean
import rasel.lunar.launcher.helpers.PrefKey
import rasel.lunar.launcher.helpers.PrefLong
import rasel.lunar.launcher.helpers.letTrue
import rasel.lunar.launcher.model.AppInfo
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.utils.JamoUtils
import rasel.lunar.launcher.workers.WorkersDb
import java.net.URLEncoder
import java.text.Normalizer
import java.util.concurrent.Executors
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.apps
package bums.lunatic.launcher.apps
import android.annotation.SuppressLint
import android.app.ActivityOptions
@@ -26,7 +26,6 @@ import android.content.Context
import android.content.Intent
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
import android.content.res.ColorStateList
import android.graphics.Rect
import android.icu.text.SimpleDateFormat
import android.net.Uri
@@ -41,31 +40,25 @@ import android.view.inputmethod.InputMethodManager
import android.widget.AdapterView
import android.widget.ArrayAdapter
import android.widget.Toast
import androidx.appcompat.widget.LinearLayoutCompat
import androidx.core.content.FileProvider
import androidx.core.content.pm.PackageInfoCompat
import androidx.core.widget.doOnTextChanged
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.apps.AppDrawer.Companion.appNamesPrefs
import bums.lunatic.launcher.databinding.ActivityBrowserDialogBinding
import bums.lunatic.launcher.databinding.AppInfoDialogBinding
import bums.lunatic.launcher.databinding.AppMenuBinding
import bums.lunatic.launcher.helpers.UniUtils.Companion.copyToClipboard
import bums.lunatic.launcher.helpers.UniUtils.Companion.screenHeight
import bums.lunatic.launcher.helpers.UniUtils.Companion.screenWidth
import bums.lunatic.launcher.model.AppInfo
import bums.lunatic.launcher.utils.JamoUtils
import bums.lunatic.launcher.workers.WorkersDb
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.button.MaterialButton
import com.google.android.material.button.MaterialButtonToggleGroup
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.gson.Gson
import io.realm.kotlin.ext.query
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.R
import rasel.lunar.launcher.apps.AppDrawer.Companion.appNamesPrefs
import rasel.lunar.launcher.databinding.ActivityBrowserDialogBinding
import rasel.lunar.launcher.databinding.AppInfoDialogBinding
import rasel.lunar.launcher.databinding.AppMenuBinding
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_APP_NO_
import rasel.lunar.launcher.helpers.Constants.Companion.MAX_FAVORITE_APPS
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_FAVORITE_APPS
import rasel.lunar.launcher.helpers.UniUtils.Companion.copyToClipboard
import rasel.lunar.launcher.helpers.UniUtils.Companion.screenHeight
import rasel.lunar.launcher.helpers.UniUtils.Companion.screenWidth
import rasel.lunar.launcher.model.AppInfo
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.workers.WorkersDb
import java.io.File
import java.io.FileInputStream
import java.io.FileOutputStream
@@ -131,6 +124,7 @@ internal class AppMenu : BottomSheetDialogFragment() {
binding.totalTouch.text = "총 실행 횟수 : ".plus(app.clickCount.toString())
binding.lastTouchDate.text =
"최종 실행 일시 : ".plus(SimpleDateFormat("yyyy-MM-dd HH:mm").format(Date(app.lastUseDate)))
binding.alterName.setText(app.koreanName)
// app.clickCount = app.clickCount + 15
// app.lastUseDate = Math.max(app.lastUseDate, System.currentTimeMillis())
@@ -154,6 +148,19 @@ internal class AppMenu : BottomSheetDialogFragment() {
}
binding.totalTouch.setOnClickListener { update() }
binding.lastTouchDate.setOnClickListener { update() }
binding.alterName.doOnTextChanged { text, start, before, count ->
WorkersDb.getRealm().apply {
writeBlocking {
var result = query<AppInfo>("pkgName == $0",packageName).find()
if(result.size > 0) {
val app = result.first()
app.koreanName = text.toString()
app.appNameChosung = JamoUtils.split(app.koreanName).joinToString("")
}
}
}
}
/* set application name and package name */
binding.appName.apply {
setText(appNamesPrefs?.getString(packageName, defAppName))
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.apps
package bums.lunatic.launcher.apps
import android.content.pm.PackageManager
import android.util.TypedValue
@@ -28,15 +28,15 @@ import android.widget.TextView
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.apps.IconPackManager.Companion.getDrawableIconForPackage
import bums.lunatic.launcher.databinding.AppsChildBinding
import bums.lunatic.launcher.model.AppInfo
import bums.lunatic.launcher.workers.WorkersDb
import io.realm.kotlin.ext.query
import kotlinx.coroutines.MainScope
import kotlinx.coroutines.async
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.R
import rasel.lunar.launcher.apps.IconPackManager.Companion.getDrawableIconForPackage
import rasel.lunar.launcher.databinding.AppsChildBinding
import rasel.lunar.launcher.model.AppInfo
import rasel.lunar.launcher.workers.WorkersDb
internal class AppsAdapter(
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.apps
package bums.lunatic.launcher.apps
import android.annotation.SuppressLint
import android.content.pm.PackageManager
@@ -26,13 +26,10 @@ import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.databinding.ContactItemBinding
import bums.lunatic.launcher.utils.JamoUtils
import io.realm.kotlin.types.RealmObject
import io.realm.kotlin.types.annotations.PrimaryKey
import rasel.lunar.launcher.databinding.ContactItemBinding
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.utils.JamoUtils
import rasel.lunar.launcher.workers.RecentCallGetter
import java.util.Date
internal class ContactAdapter (
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.apps
package bums.lunatic.launcher.apps
import android.content.Intent
import android.net.Uri
@@ -25,13 +25,13 @@ import android.provider.ContactsContract
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.databinding.ContactMenuBinding
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.workers.WorkersDb
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import io.realm.kotlin.ext.query
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.databinding.ContactMenuBinding
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.workers.WorkersDb
import java.text.SimpleDateFormat
import java.util.Date
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.apps
package bums.lunatic.launcher.apps
import android.annotation.SuppressLint
import android.content.pm.PackageManager
@@ -26,18 +26,18 @@ import android.graphics.drawable.BitmapDrawable
import android.graphics.drawable.Drawable
import androidx.collection.LruCache
import androidx.core.content.res.ResourcesCompat
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.helpers.Constants.Companion.DEFAULT_ICON_PACK
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_ICON_PACK
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_PKGICS
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.utils.ImageUtils
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.async
import org.xmlpull.v1.XmlPullParser
import org.xmlpull.v1.XmlPullParserException
import org.xmlpull.v1.XmlPullParserFactory
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.helpers.Constants.Companion.DEFAULT_ICON_PACK
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_ICON_PACK
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_PKGICS
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.utils.ImageUtils
import java.io.IOException
import java.util.Locale
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.apps
package bums.lunatic.launcher.apps
import android.content.DialogInterface
import android.content.Intent
@@ -28,11 +28,11 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import bums.lunatic.launcher.BuildConfig
import bums.lunatic.launcher.databinding.SearchMenuBinding
import bums.lunatic.launcher.utils.BLog
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import rasel.lunar.launcher.BuildConfig
import rasel.lunar.launcher.databinding.SearchMenuBinding
import rasel.lunar.launcher.utils.BLog
internal class SearchMenu : BottomSheetDialogFragment() {
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.apps
package bums.lunatic.launcher.apps
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
@@ -6,10 +6,10 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.databinding.ContactMenuBinding
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.databinding.ContactMenuBinding
class SmmsMenu: BottomSheetDialogFragment() {
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.feeds
package bums.lunatic.launcher.feeds
import android.Manifest
import android.app.Activity.RESULT_CANCELED
@@ -50,6 +50,37 @@ import androidx.fragment.app.Fragment
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.lifecycleScope
import androidx.lifecycle.repeatOnLifecycle
import bums.lunatic.launcher.CommadCallabck
import bums.lunatic.launcher.LauncherActivity.Companion.appWidgetHost
import bums.lunatic.launcher.LauncherActivity.Companion.appWidgetManager
import bums.lunatic.launcher.LauncherActivity.Companion.getCal
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.LauncherActivity.Companion.refreshDeviceData
import bums.lunatic.launcher.LauncherActivity.Companion.refreshFeeds
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.FeedsBinding
import bums.lunatic.launcher.feeds.rss.RssAdapter
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_WIDGET_HEIGHTS
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_WIDGET_IDS
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_WIDGETS
import bums.lunatic.launcher.helpers.Constants.Companion.SEPARATOR
import bums.lunatic.launcher.helpers.Constants.Companion.requestCreateWidget
import bums.lunatic.launcher.helpers.Constants.Companion.requestPickWidget
import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.home.LauncherHome.Companion.home
import bums.lunatic.launcher.home.LauncherHome.Companion.listTags
import bums.lunatic.launcher.model.CiliMagnet
import bums.lunatic.launcher.model.RssData
import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.jGuruTag
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.utils.FeedParseManager
import bums.lunatic.launcher.utils.RssList.jGuruMain
import bums.lunatic.launcher.utils.getJ
import bums.lunatic.launcher.workers.RecentCallGetter
import bums.lunatic.launcher.workers.RecentSmsGetter
import bums.lunatic.launcher.workers.WorkersDb
import com.google.android.material.button.MaterialButtonToggleGroup
import com.google.gson.Gson
import io.realm.kotlin.ext.query
@@ -60,37 +91,6 @@ import kotlinx.coroutines.delay
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch
import org.jsoup.Jsoup
import rasel.lunar.launcher.CommadCallabck
import rasel.lunar.launcher.LauncherActivity.Companion.appWidgetHost
import rasel.lunar.launcher.LauncherActivity.Companion.appWidgetManager
import rasel.lunar.launcher.LauncherActivity.Companion.getCal
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.LauncherActivity.Companion.refreshDeviceData
import rasel.lunar.launcher.LauncherActivity.Companion.refreshFeeds
import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.FeedsBinding
import rasel.lunar.launcher.feeds.rss.RssAdapter
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_WIDGET_HEIGHTS
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_WIDGET_IDS
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_WIDGETS
import rasel.lunar.launcher.helpers.Constants.Companion.SEPARATOR
import rasel.lunar.launcher.helpers.Constants.Companion.requestCreateWidget
import rasel.lunar.launcher.helpers.Constants.Companion.requestPickWidget
import rasel.lunar.launcher.helpers.PrefHelper
import rasel.lunar.launcher.home.LauncherHome.Companion.home
import rasel.lunar.launcher.home.LauncherHome.Companion.listTags
import rasel.lunar.launcher.model.CiliMagnet
import rasel.lunar.launcher.model.RssData
import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.RssDataType
import rasel.lunar.launcher.model.jGuruTag
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.utils.FeedParseManager
import rasel.lunar.launcher.utils.RssList.jGuruMain
import rasel.lunar.launcher.utils.getJ
import rasel.lunar.launcher.workers.RecentCallGetter
import rasel.lunar.launcher.workers.RecentSmsGetter
import rasel.lunar.launcher.workers.WorkersDb
import java.net.URLEncoder
import java.nio.charset.Charset
import java.util.Base64
@@ -401,14 +401,14 @@ internal class Feeds : Fragment() , CommadCallabck {
"ojs" -> home?.queryInfos(arrayListOf<RssDataType>().apply {
addAll(RssDataType.values())
remove(RssDataType.GURU)
remove(RssDataType.Most)
remove(RssDataType.MOST)
})
"all" -> home?.queryInfos(arrayListOf<RssDataType>().apply {
})
"onews" -> home?.queryInfos(arrayListOf<RssDataType>().apply {
addAll(RssDataType.values())
remove(RssDataType.NewsFeed)
remove(RssDataType.NEWSFEED)
})
"ored" -> home?.queryInfos(arrayListOf<RssDataType>().apply {
addAll(RssDataType.values())
@@ -444,7 +444,7 @@ internal class Feeds : Fragment() , CommadCallabck {
rss.adapter = mRssAdapter
loading.visibility = View.VISIBLE
mRssAdapter?.updateData(WorkersDb.getRealm()
.query<RssData>("category == $0 || category == $1", RssDataType.GURU.name, RssDataType.Most.name)
.query<RssData>("category == $0 || category == $1", RssDataType.GURU.name, RssDataType.MOST.name)
.sort("pubDate", Sort.DESCENDING).find())
rss.visibility = View.VISIBLE
loading.visibility = View.GONE
@@ -1,27 +1,22 @@
package rasel.lunar.launcher.feeds
package bums.lunatic.launcher.feeds
import android.content.DialogInterface
import android.content.Intent
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.FragmentManager
import bums.lunatic.launcher.apps.DismissCalback
import bums.lunatic.launcher.databinding.FeedsResultMenuBinding
import bums.lunatic.launcher.model.LocationLog
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.workers.WorkersDb
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.gson.Gson
import io.realm.kotlin.ext.query
import io.realm.kotlin.query.Sort
import rasel.lunar.launcher.BuildConfig
import rasel.lunar.launcher.apps.DismissCalback
import rasel.lunar.launcher.databinding.FeedsResultMenuBinding
import rasel.lunar.launcher.databinding.SearchMenuBinding
import rasel.lunar.launcher.model.LocationLog
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.workers.WorkersDb
import java.text.SimpleDateFormat
import java.util.Date
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.feeds
package bums.lunatic.launcher.feeds
import android.annotation.SuppressLint
import android.app.ActivityManager
@@ -32,14 +32,14 @@ import android.view.LayoutInflater
import android.view.View
import androidx.appcompat.widget.LinearLayoutCompat
import androidx.core.content.ContextCompat
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.ChildSysInfoBinding
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_TEMP_UNIT
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import bums.lunatic.launcher.helpers.UniUtils.Companion.isNetworkAvailable
import com.google.android.material.progressindicator.LinearProgressIndicator
import com.google.android.material.textview.MaterialTextView
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.ChildSysInfoBinding
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_TEMP_UNIT
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import rasel.lunar.launcher.helpers.UniUtils.Companion.isNetworkAvailable
import java.io.BufferedReader
import java.io.File
import java.io.InputStreamReader
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package rasel.lunar.launcher.feeds
package bums.lunatic.launcher.feeds
import android.appwidget.AppWidgetHost
import android.appwidget.AppWidgetHostView
@@ -14,7 +14,7 @@
* limitations under the License.
*/
package rasel.lunar.launcher.feeds
package bums.lunatic.launcher.feeds
import android.appwidget.AppWidgetHostView
import android.content.Context
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.feeds.rss
package bums.lunatic.launcher.feeds.rss
internal class Rss(
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.feeds.rss
package bums.lunatic.launcher.feeds.rss
import android.annotation.SuppressLint
import android.content.Context
@@ -28,13 +28,13 @@ import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.databinding.ListItemWithBinding
import bums.lunatic.launcher.home.adapters.RssItemDiffUtil
import bums.lunatic.launcher.model.JGuru
import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType
import com.squareup.picasso.Picasso
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.databinding.ListItemWithBinding
import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.RssDataType
import rasel.lunar.launcher.model.JGuru
import rasel.lunar.launcher.home.adapters.RssItemDiffUtil
import java.net.URLEncoder
import java.nio.charset.Charset
import java.text.SimpleDateFormat
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.feeds.rss
package bums.lunatic.launcher.feeds.rss
import android.util.Xml
import org.xmlpull.v1.XmlPullParser
@@ -16,17 +16,17 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.feeds.rss
package bums.lunatic.launcher.feeds.rss
import android.content.Intent
import android.os.Build
import android.os.Bundle
import android.os.ResultReceiver
import androidx.core.app.JobIntentService
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_RSS_URL
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import rasel.lunar.launcher.helpers.Constants.Companion.RSS_ITEMS
import rasel.lunar.launcher.helpers.Constants.Companion.RSS_RECEIVER
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_RSS_URL
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import bums.lunatic.launcher.helpers.Constants.Companion.RSS_ITEMS
import bums.lunatic.launcher.helpers.Constants.Companion.RSS_RECEIVER
import java.io.IOException
import java.io.InputStream
import java.io.Serializable
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.helpers
package bums.lunatic.launcher.helpers
import android.app.admin.DeviceAdminReceiver
import android.content.Context
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.helpers
package bums.lunatic.launcher.helpers
import android.Manifest
import android.annotation.SuppressLint
@@ -10,6 +10,7 @@ import android.content.Intent
import android.content.IntentFilter
import android.content.pm.PackageManager
import androidx.core.app.ActivityCompat
import bums.lunatic.launcher.utils.BLog
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@@ -18,9 +19,6 @@ import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import okhttp3.ResponseBody
import org.apache.commons.lang3.ObjectUtils.Null
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.utils.BLog.LOGE
import java.util.concurrent.TimeUnit
@@ -79,18 +77,22 @@ class BluetoothManager {
val isConnected = isConnected(i)
if(PrefHelper.carName.length > 2 && i.name.equals(PrefHelper.carName) && isConnected != PrefHelper.isConnectedCar) {
PrefHelper.isConnectedCar = isConnected
sendToI()
sendToI(PrefHelper.isConnectedCar)
}
}
}
}
fun sendToI() {
fun sendToI(boolean: Boolean) {
if (PrefHelper.telegramSendTarget.length > 5) {
CoroutineScope(Dispatchers.IO).launch {
val url =
"https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/sendMessage?chat_id=${PrefHelper.telegramSendTarget}&text=돼지가쏘울레탔다요."
"https://api.telegram.org/bot7934509464:AAE_xUbICxMdywLGnxo7BkeIqA1nVza4P9w/sendMessage?chat_id=${PrefHelper.telegramSendTarget}&text=${if(boolean) {
"돼지가 ${PrefHelper.carName}에 탔다요."
}else {
"${PrefHelper.carName}의 시동이 꺼졌다요."
}}"
//7068729507
// OkHttp 클라이언트 객체 생성
val client = OkHttpClient.Builder()
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.helpers
package bums.lunatic.launcher.helpers
import android.annotation.SuppressLint
import android.graphics.Color
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.helpers
package bums.lunatic.launcher.helpers
import androidx.biometric.BiometricManager.Authenticators.BIOMETRIC_WEAK
import androidx.biometric.BiometricManager.Authenticators.DEVICE_CREDENTIAL
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.helpers
package bums.lunatic.launcher.helpers
import android.accessibilityservice.AccessibilityService
import android.accessibilityservice.AccessibilityServiceInfo
@@ -1,17 +1,9 @@
package rasel.lunar.launcher.helpers
package bums.lunatic.launcher.helpers
import android.content.Context
import android.content.SharedPreferences
import rasel.lunar.launcher.helpers.PrefHelper.BOOL_PRE
import rasel.lunar.launcher.helpers.PrefHelper.LONG_PRE
import rasel.lunar.launcher.helpers.PrefHelper.STRING_PRE
import rasel.lunar.launcher.helpers.PrefHelper.sharedPreferences
import rasel.lunar.launcher.helpers.PrefKey.TYPE_BOOL
import rasel.lunar.launcher.helpers.PrefKey.TYPE_END
import rasel.lunar.launcher.helpers.PrefKey.TYPE_LONG
import rasel.lunar.launcher.helpers.PrefKey.TYPE_STRING
enum class PrefString {
weatherApiKey,
locationApi,
telegramBotApi,
telegramMyId,
@@ -22,6 +14,8 @@ enum class PrefString {
}
enum class PrefLong {
locationTimePeriod,
locationDistance,
shortTimePeriod,
longTimePeriod,
midTimePeriod,
@@ -32,10 +26,19 @@ enum class PrefLong {
enum class PrefBoolean {
location,
rootPermisssion,
isConnectedCar,
useQuickLaunch,
openWithKayboard,
showAppResultCount,;
showAppResultCount,
weatherDress,
weatherState,
showCallHistory,
showSMSHistory,
showNotificationHistory,
showNewsHistory,
showNowPlaying,
;
fun set(value : Boolean) = PrefHelper.putBoolean(this.name, value)
fun get(def : Boolean? = null) : Boolean = PrefHelper.getBoolean(this.name, def as? Boolean ?: false) ?: false
}
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.helpers
package bums.lunatic.launcher.helpers
import android.annotation.SuppressLint
import android.content.Context
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.helpers
package bums.lunatic.launcher.helpers
import android.annotation.SuppressLint
import android.app.admin.DevicePolicyManager
@@ -37,10 +37,10 @@ import androidx.appcompat.widget.LinearLayoutCompat
import androidx.biometric.BiometricManager
import androidx.biometric.BiometricManager.BIOMETRIC_SUCCESS
import androidx.biometric.BiometricPrompt
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.R
import rasel.lunar.launcher.helpers.Constants.Companion.ACCESSIBILITY_SERVICE_LOCK_SCREEN
import rasel.lunar.launcher.helpers.Constants.Companion.AUTHENTICATOR_TYPE
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.helpers.Constants.Companion.ACCESSIBILITY_SERVICE_LOCK_SCREEN
import bums.lunatic.launcher.helpers.Constants.Companion.AUTHENTICATOR_TYPE
import java.io.DataOutputStream
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.helpers
package bums.lunatic.launcher.helpers
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.home
package bums.lunatic.launcher.home
import android.content.BroadcastReceiver
import android.content.Context
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.home
package bums.lunatic.launcher.home
import android.annotation.SuppressLint
import android.content.ComponentName
@@ -52,6 +52,46 @@ import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import androidx.viewpager2.widget.ViewPager2
import androidx.work.WorkManager
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.LauncherHomeBinding
import bums.lunatic.launcher.helpers.Constants.Companion.BOTTOM_SHEET_TAG
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_LOCK_METHOD
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_TODO_LOCK
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import bums.lunatic.launcher.helpers.PrefBoolean
import bums.lunatic.launcher.helpers.UniUtils.Companion.biometricPromptInfo
import bums.lunatic.launcher.helpers.UniUtils.Companion.canAuthenticate
import bums.lunatic.launcher.helpers.UniUtils.Companion.expandNotificationPanel
import bums.lunatic.launcher.helpers.UniUtils.Companion.lockMethod
import bums.lunatic.launcher.helpers.letTrue
import bums.lunatic.launcher.home.adapters.NotificationItemAdapter
import bums.lunatic.launcher.home.adapters.RecentCallsAdapter
import bums.lunatic.launcher.home.adapters.RssItemAdapter
import bums.lunatic.launcher.home.adapters.SmsLogsAdapter
import bums.lunatic.launcher.home.adapters.WeatherAdapter
import bums.lunatic.launcher.home.adapters.WeatherDressAdatper
import bums.lunatic.launcher.home.adapters.WeatherHourlyAdapter
import bums.lunatic.launcher.model.CurrentPlayItem
import bums.lunatic.launcher.model.Hour
import bums.lunatic.launcher.model.NotificationItem
import bums.lunatic.launcher.model.RssData
import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.WeatherForcast
import bums.lunatic.launcher.model.WeatherInfoManager
import bums.lunatic.launcher.qaccess.QuickAccess
import bums.lunatic.launcher.settings.SettingsActivity
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.utils.BitmapConverter
import bums.lunatic.launcher.utils.JamoUtils
import bums.lunatic.launcher.utils.SimpleFingerGestures
import bums.lunatic.launcher.utils.beforeDay
import bums.lunatic.launcher.view.TableRadioGroup
import bums.lunatic.launcher.workers.LocationGetter
import bums.lunatic.launcher.workers.RecentCall
import bums.lunatic.launcher.workers.RecentSms
import bums.lunatic.launcher.workers.WorkersDb
import io.realm.kotlin.ext.query
import io.realm.kotlin.notifications.InitialResults
import io.realm.kotlin.notifications.ResultsChange
@@ -64,44 +104,6 @@ import kotlinx.coroutines.Job
import kotlinx.coroutines.launch
import org.json.JSONArray
import org.json.JSONObject
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.LauncherHomeBinding
import rasel.lunar.launcher.helpers.Constants.Companion.BOTTOM_SHEET_TAG
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_LOCK_METHOD
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_TODO_LOCK
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import rasel.lunar.launcher.helpers.UniUtils.Companion.biometricPromptInfo
import rasel.lunar.launcher.helpers.UniUtils.Companion.canAuthenticate
import rasel.lunar.launcher.helpers.UniUtils.Companion.expandNotificationPanel
import rasel.lunar.launcher.helpers.UniUtils.Companion.lockMethod
import rasel.lunar.launcher.home.adapters.NotificationItemAdapter
import rasel.lunar.launcher.home.adapters.RecentCallsAdapter
import rasel.lunar.launcher.home.adapters.RssItemAdapter
import rasel.lunar.launcher.home.adapters.SmsLogsAdapter
import rasel.lunar.launcher.home.adapters.WeatherAdapter
import rasel.lunar.launcher.home.adapters.WeatherDressAdatper
import rasel.lunar.launcher.home.adapters.WeatherHourlyAdapter
import rasel.lunar.launcher.model.CurrentPlayItem
import rasel.lunar.launcher.model.Hour
import rasel.lunar.launcher.model.NotificationItem
import rasel.lunar.launcher.model.RssData
import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.RssDataType
import rasel.lunar.launcher.model.WeatherForcast
import rasel.lunar.launcher.model.WeatherInfoManager
import rasel.lunar.launcher.qaccess.QuickAccess
import rasel.lunar.launcher.settings.SettingsActivity
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.utils.BitmapConverter
import rasel.lunar.launcher.utils.JamoUtils
import rasel.lunar.launcher.utils.SimpleFingerGestures
import rasel.lunar.launcher.utils.beforeDay
import rasel.lunar.launcher.view.TableRadioGroup
import rasel.lunar.launcher.workers.LocationGetter
import rasel.lunar.launcher.workers.RecentCall
import rasel.lunar.launcher.workers.RecentSms
import rasel.lunar.launcher.workers.WorkersDb
import java.math.BigDecimal
import java.net.URLEncoder
import java.util.Calendar
@@ -181,19 +183,25 @@ internal class LauncherHome : Fragment() {
weatherDressAdapter = WeatherDressAdatper(arrayListOf())
weatherHourlyAdapter = WeatherHourlyAdapter(arrayListOf())
mWeatherAdapter = WeatherAdapter(
listOf(
R.layout.hourly_weather,
R.layout.recommended_hourly_dress
),
listOf(
weatherDressAdapter,
weatherHourlyAdapter
),
binding.noticeSummary)
binding.noticeSummary.weatherViewPager.offscreenPageLimit = 2
var weatherPages = arrayListOf<Int>()
var weatherAdapter = arrayListOf<RecyclerView.Adapter<out RecyclerView.ViewHolder>?>()
PrefBoolean.weatherDress.get(false).letTrue {
weatherPages.add(R.layout.hourly_weather)
weatherAdapter.add(weatherDressAdapter!!)}
PrefBoolean.weatherState.get(false).letTrue { weatherPages.add(R.layout.recommended_hourly_dress)
weatherAdapter.add(weatherHourlyAdapter!!)}
if (weatherPages.size > 0) {
mWeatherAdapter = WeatherAdapter(
weatherPages,
adatpers = weatherAdapter,
binding.noticeSummary
)
binding.noticeSummary.weatherViewPager.offscreenPageLimit = 2
} else {
binding.noticeSummary.root.visibility = View.GONE
}
// mWeatherAdapter = WeatherAdapter(arrayListOf(),binding.noticeSummary)
// WorkersDb.getRealm().query<WeatherForcast>().first().find()?.forecast?.let {
// mWeatherAdapter?.update(it.forecastday)
@@ -261,20 +269,21 @@ internal class LauncherHome : Fragment() {
WorkersDb.getRealm().apply {
query<CurrentPlayItem>().find().asFlow().collect { changes: ResultsChange<CurrentPlayItem> ->
binding.currentMusic?.postDelayed({
if (changes.list.size > 0) {
changes.list?.first()?.let {
binding.currentMusic.visibility = View.VISIBLE
binding.nextPlay.visibility = View.GONE
binding.artist.text = it.artists
binding.title.text = it.title
var bitmap: Bitmap? = null
try {
bitmap = BitmapConverter.StringToBitmap(it.albumArt)
binding.albumArt.setImageBitmap(bitmap)
} catch (exception: java.lang.Exception) {
// log error
PrefBoolean.showNowPlaying.get(false).letTrue {
changes.list?.first()?.let {
binding.currentMusic.visibility = View.VISIBLE
binding.nextPlay.visibility = View.GONE
binding.artist.text = it.artists
binding.title.text = it.title
var bitmap: Bitmap? = null
try {
bitmap = BitmapConverter.StringToBitmap(it.albumArt)
binding.albumArt.setImageBitmap(bitmap)
} catch (exception: java.lang.Exception) {
// log error
}
}
}
} else {
@@ -326,42 +335,42 @@ internal class LauncherHome : Fragment() {
suspend fun queryWeatherWithLoc(){
WorkersDb.getRealm().apply {
query<Hour>()
.query("lat == $0 AND lon == $1",
LocationGetter.latitude?.let { BigDecimal.valueOf(it).toDouble() },
LocationGetter.longitude?.let { BigDecimal.valueOf(it).toDouble() }
).also {
BLog.LOGE("re >>> ${it.description()}")
}.find().let {hours ->
Handler(Looper.getMainLooper()).post {
weatherDressAdapter?.let {
it.update(
mutableListOf<Hour>().apply {
this.addAll(
.query("lat == $0 AND lon == $1",
LocationGetter.latitude?.let { BigDecimal.valueOf(it).toDouble() },
LocationGetter.longitude?.let { BigDecimal.valueOf(it).toDouble() }
).also {
BLog.LOGE("re >>> ${it.description()}")
}.find().let {hours ->
Handler(Looper.getMainLooper()).post {
weatherDressAdapter?.let {
it.update(
mutableListOf<Hour>().apply {
this.addAll(
// it.filter(hours)
copyFromRealm(hours)
)
}
)
it.notifyDataSetChanged()
}
weatherHourlyAdapter?.let {
it.update(
mutableListOf<Hour>().apply {
this.addAll(
copyFromRealm(hours)
)
}
)
it.notifyDataSetChanged()
}
weatherHourlyAdapter?.let {
it.update(
mutableListOf<Hour>().apply {
this.addAll(
// it.filter(hours)
copyFromRealm(hours)
)
}
)
BLog.LOGE("hour ${hours}")
it.notifyDataSetChanged()
}
mWeatherAdapter?.let {
binding.noticeSummary.textLocation = if (hours.isNotEmpty()) WeatherInfoManager.getShowingInfo(hours.first()).textLocation else "도시 / 나라"
it.notifyDataSetChanged()
copyFromRealm(hours)
)
}
)
BLog.LOGE("hour ${hours}")
it.notifyDataSetChanged()
}
mWeatherAdapter?.let {
binding.noticeSummary.textLocation = if (hours.isNotEmpty()) WeatherInfoManager.getShowingInfo(hours.first()).textLocation else "도시 / 나라"
it.notifyDataSetChanged()
}
}
}
}
}
// .asFlow()
// .collect { changes ->
@@ -471,7 +480,7 @@ internal class LauncherHome : Fragment() {
noticeJob?.start()
}
fun queryInfos(filter: Collection<RssDataType>? = arrayListOf(RssDataType.GURU,RssDataType.Most,RssDataType.REDDIT_nsfw)) {
fun queryInfos(filter: Collection<RssDataType>? = arrayListOf(RssDataType.GURU,RssDataType.MOST,RssDataType.REDDIT_NSFW), noLimit : Boolean = false) {
try { infosJob?.cancel() } catch (e:Exception) {e.printStackTrace()}
mRssDataResult = null
try {
@@ -479,9 +488,10 @@ internal class LauncherHome : Fragment() {
}catch (e : Exception){e.printStackTrace()}
WorkersDb.getRealm().apply { writeBlocking {
delete(query<RssData>().query("pubDate < $0",beforeDay(Date(),3)).query("category != $0 || category != $1 ", RssDataType.GURU.name,RssDataType.Most.name).find())
delete(query<RssData>().query("pubDate < $0",beforeDay(Date(),3)).query("category != $0 || category != $1 ", RssDataType.GURU.name,RssDataType.MOST.name).find())
}}
var rQ = WorkersDb.getRealm().query<RssData>().query("pubDate > $0", beforeDay(Date(),3))
var rQ = WorkersDb.getRealm().query<RssData>()
if(!noLimit) rQ.query("pubDate > $0", beforeDay(Date(),3))
filter!!.forEach {
rQ = rQ.query("category != $0", it.name)
}
@@ -512,7 +522,7 @@ internal class LauncherHome : Fragment() {
infosJob?.start()
}
fun queryInfos(keyword : String, category : ArrayList<String> = arrayListOf()) {
fun queryInfos(keyword : String, category : ArrayList<String> = arrayListOf(), noLimit : Boolean = false) {
try { infosJob?.cancel() } catch (e:Exception) {e.printStackTrace()}
mRssDataResult = null
try {
@@ -520,9 +530,10 @@ internal class LauncherHome : Fragment() {
}catch (e : Exception){e.printStackTrace()}
WorkersDb.getRealm().apply { writeBlocking {
delete(query<RssData>().query("pubDate < $0",beforeDay(Date(),3)).query("category != $0 || category != $1 ", RssDataType.GURU.name,RssDataType.Most.name).find())
delete(query<RssData>().query("pubDate < $0",beforeDay(Date(),3)).query("category != $0 || category != $1 ", RssDataType.GURU.name,RssDataType.MOST.name).find())
}}
var rQ = WorkersDb.getRealm().query<RssData>().query("pubDate > $0", beforeDay(Date(),3))
var rQ = WorkersDb.getRealm().query<RssData>()
if (!noLimit)rQ.query("pubDate > $0", beforeDay(Date(),3))
if(keyword.length > 0) {
// BLog.LOGE("queryInfos it >>> ${keyword}")
if (JamoUtils.CHOSUNG.contains(keyword.split("")[0])) {
@@ -628,8 +639,14 @@ internal class LauncherHome : Fragment() {
rootViewGestures()
batteryProgressGestures()
todosGestures()
BLog.LOGE("onViewCreated()")
binding.missedCalls.visibility = if (PrefBoolean.showCallHistory.get(false)) View.VISIBLE else View.GONE
binding.recentSms.visibility = if (PrefBoolean.showSMSHistory.get(false)) View.VISIBLE else View.GONE
binding.notice.visibility = if (PrefBoolean.showNotificationHistory.get(false)) View.VISIBLE else View.GONE
binding.otherCheck.visibility = if (PrefBoolean.showNewsHistory.get(false)) View.VISIBLE else View.GONE
binding.summaryChoose.visibility = View.GONE
(PrefBoolean.showCallHistory.get(false) || PrefBoolean.showSMSHistory.get(false) || PrefBoolean.showNotificationHistory.get(false) || PrefBoolean.showNewsHistory.get(false)).letTrue { binding.summaryChoose.visibility = View.VISIBLE }
// mWorkManager.
/* refresh the to-do list after getting back from TodoManager */
fragManager.addOnBackStackChangedListener {
@@ -759,7 +776,7 @@ internal class LauncherHome : Fragment() {
}
}
}
queryInfos(keyword =input.text.toString(),category)
queryInfos(keyword =input.text.toString(),category, false)
})
builder.setNegativeButton(android.R.string.cancel,
DialogInterface.OnClickListener { dialog, which -> dialog.cancel() })
@@ -802,7 +819,7 @@ internal class LauncherHome : Fragment() {
WorkersDb.getRealm().apply {
val result = query<RecentCall>().query("callDayTime >= $0", dateParam).sort("callDayTime", Sort.DESCENDING).find()
val list = copyFromRealm(result)
binding.missedCalls.text = "최근 통화 [${list.size}]"
binding.missedCalls.text = "통화 목록 [${list.size}]"
binding.mainList.visibility = View.VISIBLE
mRecentCallsAdapter.updateData(list)
binding.recentSms.isSelected = false
@@ -815,7 +832,7 @@ internal class LauncherHome : Fragment() {
.sort("rcvDate",Sort.DESCENDING).find()
if (result.size > 0) {
try {
binding.recentSms.text = "최근 문자 [${result.size}]"
binding.recentSms.text = "문자 내역 [${result.size}]"
binding.smsList.visibility = View.VISIBLE
val list = copyFromRealm(result)
mSmsLogsAdapter.updateData(list)
@@ -832,7 +849,7 @@ internal class LauncherHome : Fragment() {
binding.recentSms.isSelected = false
binding.notice.isSelected = false
binding.infoList.visibility = View.VISIBLE
binding.otherCheck.text = "최근 정보[${lasted?.size ?: "-"}]"
binding.otherCheck.text = "글타래 [${lasted?.size ?: "-"}]"
lasted?.let { mRssAdapter.updateData(it) }
}
else if(binding.notice.isSelected) {
@@ -840,7 +857,7 @@ internal class LauncherHome : Fragment() {
binding.recentSms.isSelected = false
binding.otherCheck.isSelected = false
binding.notiList.visibility = View.VISIBLE
binding.notice.text = "알림 센터[${lastedNoti?.size ?: "-"}]"
binding.notice.text = "알림 [${lastedNoti?.size ?: "-"}]"
lastedNoti?.let { mNotiAdapter.updateData(it)}
}
commandHandler.postDelayed(hideListView, hideListViewTime)
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.home.adapters
package bums.lunatic.launcher.home.adapters
import android.content.Context
import android.util.AttributeSet
@@ -16,25 +16,22 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.home.adapters
package bums.lunatic.launcher.home.adapters
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.content.pm.PackageManager
import android.graphics.drawable.Drawable
import android.net.Uri
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.databinding.ListItemWithBinding
import rasel.lunar.launcher.model.NotificationItem
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.workers.WorkersDb
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.databinding.ListItemWithBinding
import bums.lunatic.launcher.model.NotificationItem
import bums.lunatic.launcher.workers.WorkersDb
import java.text.SimpleDateFormat
import java.util.Date
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.home.adapters
package bums.lunatic.launcher.home.adapters
import android.annotation.SuppressLint
import android.content.Context
@@ -29,11 +29,11 @@ import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.RecyclerView
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.CalllogItemBinding
import rasel.lunar.launcher.utils.getContactId
import rasel.lunar.launcher.workers.RecentCall
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.CalllogItemBinding
import bums.lunatic.launcher.utils.getContactId
import bums.lunatic.launcher.workers.RecentCall
internal class RecentCallsAdapter(
@@ -1,13 +1,13 @@
package rasel.lunar.launcher.home.adapters
package bums.lunatic.launcher.home.adapters
import android.util.Xml
import bums.lunatic.launcher.model.NewsData
import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.others.Reddit
import bums.lunatic.launcher.utils.beforeDay
import com.google.gson.Gson
import org.xmlpull.v1.XmlPullParser
import org.xmlpull.v1.XmlPullParserException
import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.NewsData
import rasel.lunar.launcher.model.others.Reddit
import rasel.lunar.launcher.utils.beforeDay
import java.io.IOException
import java.io.InputStream
import java.io.InputStreamReader
@@ -30,15 +30,18 @@ object RssFeedsParser {
return returnList
}
fun getReddit(url : String): List<RssDataInterface> {
fun getReddit(url : String, nsfw : Boolean): List<RssDataInterface> {
var returnList = mutableListOf<RssDataInterface>()
var dateTime = beforeDay(Date(),3)
try {
var mReddit = Gson().fromJson(InputStreamReader(getInputStream(url)!!), Reddit::class.java)
mReddit.data?.children?.forEach {
it.data?.nsfw = nsfw
if(((it.data?.created_utc ?: 0).toLong() * 1000L > dateTime)) {
(it.data as? RssDataInterface)?.let { rss ->
returnList.add(rss)
if (rss.title().contains("request") == false) {
returnList.add(rss)
}
}
}
}
@@ -16,35 +16,30 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.home.adapters
package bums.lunatic.launcher.home.adapters
import android.annotation.SuppressLint
import android.content.Context
import android.content.Intent
import android.net.Uri
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.net.toUri
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.ListItemWithBinding
import bums.lunatic.launcher.model.RssData
import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.openDotax
import bums.lunatic.launcher.openNews
import bums.lunatic.launcher.openOpera
import bums.lunatic.launcher.openReddit
import bums.lunatic.launcher.openYouTube
import com.google.android.material.imageview.ShapeableImageView
import com.squareup.picasso.Picasso
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.ListItemWithBinding
import rasel.lunar.launcher.model.RssData
import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.RssDataType
import rasel.lunar.launcher.openDotax
import rasel.lunar.launcher.openNews
import rasel.lunar.launcher.openOpera
import rasel.lunar.launcher.openReddit
import rasel.lunar.launcher.openYouTube
import rasel.lunar.launcher.utils.BLog
import java.text.SimpleDateFormat
import java.util.Date
@@ -59,7 +54,7 @@ internal class RssItemAdapter (
val dateViewClick = View.OnClickListener { v ->
(v?.tag as? RssData)?.let { rss ->
when(rss.category()) {
RssDataType.GURU,RssDataType.Most,RssDataType.REDDIT_nsfw -> {
RssDataType.GURU,RssDataType.MOST,RssDataType.REDDIT_NSFW -> {
v.findViewById<ShapeableImageView>(R.id.circle_preview)?.let {
if (it.visibility == View.GONE) {
it.visibility = View.VISIBLE
@@ -72,7 +67,7 @@ internal class RssItemAdapter (
}
}
RssDataType.REDDIT -> { openReddit(rss.originPage()) }
RssDataType.Dotax -> { openDotax(rss.originPage()) }
RssDataType.DOTAX -> { openDotax(rss.originPage()) }
RssDataType.YOUTUBE -> { openYouTube(rss.originPage()) }
else -> { openNews(rss.originPage()) }
}
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.home.adapters
package bums.lunatic.launcher.home.adapters
import android.annotation.SuppressLint
import android.content.Context
@@ -24,11 +24,11 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.ListItemBinding
import bums.lunatic.launcher.model.jGuruTag
import com.google.gson.Gson
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.ListItemBinding
import rasel.lunar.launcher.model.jGuruTag
internal class RssTagAdapter(
private val smsList: ArrayList<jGuruTag>,
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.home.adapters
package bums.lunatic.launcher.home.adapters
import android.annotation.SuppressLint
import android.content.Context
@@ -26,11 +26,11 @@ import android.view.LayoutInflater
import android.view.ViewGroup
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.RecyclerView
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.SmsItemBinding
import rasel.lunar.launcher.utils.getContactName
import rasel.lunar.launcher.workers.RecentSms
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.SmsItemBinding
import bums.lunatic.launcher.utils.getContactName
import bums.lunatic.launcher.workers.RecentSms
import java.text.SimpleDateFormat
import java.util.Date
@@ -1,18 +1,14 @@
package rasel.lunar.launcher.home.adapters
package bums.lunatic.launcher.home.adapters
import android.annotation.SuppressLint
import android.os.Handler
import android.os.Looper
import android.view.LayoutInflater
import android.view.MotionEvent
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearSnapHelper
import androidx.recyclerview.widget.RecyclerView
import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.WeatherBookBinding
import rasel.lunar.launcher.utils.BLog
import bums.lunatic.launcher.databinding.WeatherBookBinding
import bums.lunatic.launcher.utils.BLog
class WeatherAdapter(
private val pages: List<Int>,
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.home.adapters
package bums.lunatic.launcher.home.adapters
import android.annotation.SuppressLint
import android.graphics.Color
@@ -6,11 +6,10 @@ import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.recyclerview.widget.RecyclerView
import rasel.lunar.launcher.databinding.ItemRecHourlyDressBinding
import rasel.lunar.launcher.databinding.RecommendedHourlyDressBinding
import rasel.lunar.launcher.model.Hour
import rasel.lunar.launcher.model.WeatherInfoManager
import rasel.lunar.launcher.utils.BLog
import bums.lunatic.launcher.databinding.ItemRecHourlyDressBinding
import bums.lunatic.launcher.model.Hour
import bums.lunatic.launcher.model.WeatherInfoManager
import bums.lunatic.launcher.utils.BLog
import java.util.Calendar
class WeatherDressAdatper (private val dataSet: ArrayList<Hour>) : RecyclerView.Adapter<WeatherDressAdatper.ViewHolder>(){
@@ -39,7 +38,7 @@ class WeatherDressAdatper (private val dataSet: ArrayList<Hour>) : RecyclerView.
@SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: WeatherDressAdatper.ViewHolder, position: Int) {
val data = dataSet[position] as? Hour
BLog.LOGE("saved weatherForcast >>> asFlow ${dataSet.size}")
// BLog.LOGE("saved weatherForcast >>> asFlow ${dataSet.size}")
// val today = Calendar.getInstance()
// today.time = Date(data?.time_epoch?.toLong()?.times(1000L) ?: 0L)
// val dayOfItem = today.get(Calendar.DAY_OF_YEAR)
@@ -51,7 +50,7 @@ class WeatherDressAdatper (private val dataSet: ArrayList<Hour>) : RecyclerView.
// total.setInfo(this)
holder.viewItem.setInfo(this)
}
BLog.LOGE("reeeeeeeeeee >>> ${holder.viewItem.hour.text}")
// BLog.LOGE("reeeeeeeeeee >>> ${holder.viewItem.hour.text}")
holder.viewItem.amOrPm.visibility =
if (arrayListOf(12, 0).contains(WeatherInfoManager.toZonedDateTime(it.time_epoch).hour) || position == 0) {
View.VISIBLE
@@ -1,18 +1,15 @@
package rasel.lunar.launcher.home.adapters
package bums.lunatic.launcher.home.adapters
import android.annotation.SuppressLint
import android.graphics.Color
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.net.toUri
import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.databinding.ItemHourlyWeatherBinding
import bums.lunatic.launcher.model.Hour
import bums.lunatic.launcher.model.WeatherInfoManager
import bums.lunatic.launcher.utils.BLog
import com.squareup.picasso.Picasso
import rasel.lunar.launcher.databinding.ItemHourlyWeatherBinding
import rasel.lunar.launcher.databinding.ItemRecHourlyDressBinding
import rasel.lunar.launcher.model.Hour
import rasel.lunar.launcher.model.WeatherInfoManager
import rasel.lunar.launcher.utils.BLog
class WeatherHourlyAdapter(private val dataSet: ArrayList<Hour>): RecyclerView.Adapter<WeatherHourlyAdapter.ViewHolder>() {
class ViewHolder(val viewItem: ItemHourlyWeatherBinding): RecyclerView.ViewHolder(viewItem.root)
@@ -24,7 +21,7 @@ class WeatherHourlyAdapter(private val dataSet: ArrayList<Hour>): RecyclerView.A
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
val data = dataSet[position] as? Hour
BLog.LOGE("saved weatherForcast >>> asFlow ${dataSet.size}")
// BLog.LOGE("saved weatherForcast >>> asFlow ${dataSet.size}")
data?.let {
WeatherInfoManager.getShowingInfo(it).apply {
holder.viewItem.setInfo(this)
@@ -32,7 +29,7 @@ class WeatherHourlyAdapter(private val dataSet: ArrayList<Hour>): RecyclerView.A
.load(this.urlImgWeather)
.into(holder.viewItem.imgWeather)
}
BLog.LOGE("reeeeeeeeeee >>> ${holder.viewItem.hour.text}")
// BLog.LOGE("reeeeeeeeeee >>> ${holder.viewItem.hour.text}")
holder.viewItem.amOrPm.visibility =
if (arrayListOf(12, 0).contains(WeatherInfoManager.toZonedDateTime(it.time_epoch).hour) || position == 0) {
View.VISIBLE
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.home.weather
package bums.lunatic.launcher.home.weather
import org.json.JSONException
import org.json.JSONObject
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.home.weather
package bums.lunatic.launcher.home.weather
internal class Weather {
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.home.weather
package bums.lunatic.launcher.home.weather
import java.io.BufferedReader
import java.io.InputStreamReader
@@ -16,19 +16,19 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.home.weather
package bums.lunatic.launcher.home.weather
import android.annotation.SuppressLint
import android.content.SharedPreferences
import android.os.Handler
import android.os.Looper
import android.view.View
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_CITY_NAME
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_OWM_API
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_SHOW_CITY
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_TEMP_UNIT
import bums.lunatic.launcher.helpers.UniUtils.Companion.isNetworkAvailable
import com.google.android.material.textview.MaterialTextView
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_CITY_NAME
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_OWM_API
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_SHOW_CITY
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_TEMP_UNIT
import rasel.lunar.launcher.helpers.UniUtils.Companion.isNetworkAvailable
import java.util.concurrent.Executors
@@ -1,7 +1,7 @@
package rasel.lunar.launcher.model
package bums.lunatic.launcher.model
import rasel.lunar.launcher.beforeDay
import rasel.lunar.launcher.utils.JamoUtils
import bums.lunatic.launcher.beforeDay
import bums.lunatic.launcher.utils.JamoUtils
import java.util.Date
class MissD : RssDataInterface {
@@ -67,7 +67,7 @@ class MostItem : JGuru , RssDataInterface {
}
override fun category(): RssDataType {
return RssDataType.Most
return RssDataType.MOST
}
override fun getCho(): String? {
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.model
package bums.lunatic.launcher.model
import io.realm.kotlin.types.RealmObject
import io.realm.kotlin.types.annotations.PrimaryKey
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.model
package bums.lunatic.launcher.model
class CiliMagnet {
var link : String? = null
@@ -1,12 +1,12 @@
package rasel.lunar.launcher.model
package bums.lunatic.launcher.model
import bums.lunatic.launcher.utils.JamoUtils
import bums.lunatic.launcher.utils.afterDay
import bums.lunatic.launcher.utils.beforeDay
import io.realm.kotlin.types.RealmObject
import io.realm.kotlin.types.annotations.Ignore
import io.realm.kotlin.types.annotations.PrimaryKey
import org.jsoup.select.Elements
import rasel.lunar.launcher.utils.JamoUtils
import rasel.lunar.launcher.utils.afterDay
import rasel.lunar.launcher.utils.beforeDay
import java.text.SimpleDateFormat
import java.util.Calendar
import java.util.Date
@@ -21,7 +21,7 @@ class Clien : DcInside() {
val dateFormat = SimpleDateFormat("yyyy-MM-dd HH:mm:ss")
}
override fun category(): RssDataType {
return RssDataType.Clien
return RssDataType.CLIEN
}
@@ -119,7 +119,7 @@ class Arca : RssDataInterface {
}
override fun category(): RssDataType {
return RssDataType.Arca
return RssDataType.ARCA
}
override fun getCho(): String? {
return JamoUtils.split(title!!).joinToString("")
@@ -187,7 +187,7 @@ open class DcInside : RssDataInterface {
}
override fun category(): RssDataType {
return RssDataType.DcInside
return RssDataType.DCINSIDE
}
override fun getCho(): String? {
@@ -198,12 +198,12 @@ open class DcInside : RssDataInterface {
class RuliWeb : DcInside() {
override fun category(): RssDataType {
return RssDataType.RuliWeb
return RssDataType.RULIWEB
}
}
class TheQoo : DcInside() {
override fun category(): RssDataType {
return RssDataType.TheQoo
return RssDataType.THEQOO
}
}
@@ -224,7 +224,7 @@ class RssData : RealmObject, RssDataInterface {
var mRssDataType : RssDataType? = null
override fun title(): String {
return when(category()){
RssDataType.NewsFeed -> {
RssDataType.NEWSFEED -> {
if(title?.length ?: 0 > 30) title?.substring(0,30).plus("...") else title ?: ""
}
else -> title ?: ""
@@ -247,7 +247,7 @@ class RssData : RealmObject, RssDataInterface {
RssDataType.YOUTUBE -> {
if(description?.contains("게시자") == true) description!!.split("게시자")[0] else description ?: ""
}
RssDataType.NewsFeed -> {
RssDataType.NEWSFEED -> {
category().name
}
else -> description.plus(" / ").plus(category().name)
@@ -260,7 +260,7 @@ class RssData : RealmObject, RssDataInterface {
override fun category(): RssDataType {
if (mRssDataType == null)
mRssDataType = RssDataType.valueOf(category!!)
mRssDataType = RssDataType.valueOf(category!!.uppercase())
return mRssDataType!!
}
@@ -344,7 +344,7 @@ open class Dotax(var pageLink : String,
return dateTime
}
override fun category(): RssDataType {
return RssDataType.Dotax
return RssDataType.DOTAX
}
override fun getCho(): String? {
return JamoUtils.split(title!!).joinToString("")
@@ -360,7 +360,7 @@ data class FmKorea(var apageLink : String,
return pageLink
}
override fun category(): RssDataType {
return RssDataType.FmKorae
return RssDataType.FMKORAE
}
}
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.model
package bums.lunatic.launcher.model
import io.realm.kotlin.types.RealmObject
import io.realm.kotlin.types.annotations.PrimaryKey
@@ -1,14 +1,11 @@
package rasel.lunar.launcher.model
package bums.lunatic.launcher.model
import android.location.Address
import android.os.Bundle
import io.realm.kotlin.ext.realmAnyListOf
import io.realm.kotlin.ext.realmListOf
import io.realm.kotlin.types.RealmList
import io.realm.kotlin.types.RealmObject
import java.text.SimpleDateFormat
import java.util.Date
import java.util.Locale
class LocationLog : RealmObject {
var mFeatureName: String? = null
@@ -25,12 +22,12 @@ class LocationLog : RealmObject {
var mCountryName: String? = null
var mLatitude = 0.0
var mLongitude = 0.0
var mHasLatitude = false
var mHasLongitude = false
var mPhone: String? = null
var mUrl: String? = null
var time : Long = 0L
var timeString : String? = null
var userId : String? = null
fun fillData(address: Address) {
time = System.currentTimeMillis()
@@ -1,6 +1,6 @@
package rasel.lunar.launcher.model
package bums.lunatic.launcher.model
import rasel.lunar.launcher.utils.JamoUtils
import bums.lunatic.launcher.utils.JamoUtils
class NewsData : RssDataInterface {
@@ -37,7 +37,7 @@ class NewsData : RssDataInterface {
}
override fun category(): RssDataType {
return RssDataType.NewsFeed
return RssDataType.NEWSFEED
}
override fun getCho(): String? {
return JamoUtils.split(title()).joinToString("")
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.model
package bums.lunatic.launcher.model
import io.realm.kotlin.types.RealmObject
import io.realm.kotlin.types.annotations.PrimaryKey
@@ -1,32 +1,33 @@
package rasel.lunar.launcher.model
package bums.lunatic.launcher.model
import android.view.View
import rasel.lunar.launcher.R
import bums.lunatic.launcher.R
import bums.lunatic.launcher.helpers.PrefHelper
enum class RssDataType {
NO_DATA,
YOUTUBE,
NewsFeed,
NEWSFEED,
GURU,
Most,
MOST,
TAGS,
REDDIT,
REDDIT_nsfw,
Dotax,
FmKorae,
DcInside,
RuliWeb,
Clien,
TheQoo,
Arca;
REDDIT_NSFW,
DOTAX,
FMKORAE,
DCINSIDE,
RULIWEB,
CLIEN,
THEQOO,
ARCA;
fun getResId() = when (this) {
YOUTUBE -> R.drawable.youtube
REDDIT, REDDIT_nsfw -> R.drawable.reddit
Dotax -> R.drawable.daum
FmKorae -> R.drawable.fmk
DcInside -> R.drawable.dcinside
Arca -> R.drawable.arca
REDDIT, REDDIT_NSFW -> R.drawable.reddit
DOTAX -> R.drawable.daum
FMKORAE -> R.drawable.fmk
DCINSIDE -> R.drawable.dcinside
ARCA -> R.drawable.arca
else -> {
0
}
@@ -34,14 +35,20 @@ enum class RssDataType {
fun defaultImgSize() = when (this) {
YOUTUBE -> 200
REDDIT_nsfw,GURU,Most -> 360
REDDIT_NSFW,GURU,MOST -> 360
else -> { 120 }
}
fun getDefaultVisibiliy() = when (this) {
REDDIT_nsfw,GURU,Most,NewsFeed -> View.GONE
REDDIT_NSFW,GURU,MOST,NEWSFEED -> View.GONE
else -> { View.VISIBLE }
}
fun isOn(block : ()->Unit) {
if(PrefHelper.getBoolean(name,false)) {
block.invoke()
}
}
}
interface RssDataInterface {
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.model
package bums.lunatic.launcher.model
import io.realm.kotlin.ext.realmListOf
import io.realm.kotlin.types.RealmList
@@ -1,14 +1,10 @@
package rasel.lunar.launcher.model
package bums.lunatic.launcher.model
import io.realm.kotlin.ext.realmListOf
import io.realm.kotlin.types.RealmList
import io.realm.kotlin.types.RealmObject
import io.realm.kotlin.types.annotations.Ignore
import io.realm.kotlin.types.annotations.PrimaryKey
import rasel.lunar.launcher.R
import java.time.Instant
import java.time.ZoneId
import java.util.Calendar
class WeatherForcast: RealmObject {
@@ -1,11 +1,10 @@
package rasel.lunar.launcher.model
package bums.lunatic.launcher.model
import bums.lunatic.launcher.R
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.workers.WorkersDb
import io.realm.kotlin.ext.query
import io.realm.kotlin.types.RealmList
import rasel.lunar.launcher.R
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.workers.OpenWeatherGetter
import rasel.lunar.launcher.workers.WorkersDb
import java.time.Instant
import java.time.ZoneId
import java.time.ZonedDateTime
@@ -1,8 +1,8 @@
package rasel.lunar.launcher.model.others
package bums.lunatic.launcher.model.others
import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.RssDataType
import rasel.lunar.launcher.utils.JamoUtils
import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.utils.JamoUtils
class Child {
@@ -242,6 +242,7 @@ class Data : RssDataInterface {
var media: Media? = null
var is_video: Boolean = false
var nsfw : Boolean = false
override fun title(): String {
return title ?: ""
}
@@ -272,8 +273,8 @@ class Data : RssDataInterface {
}
override fun category(): RssDataType {
return if (description()?.contains("nsfw") == true) {
RssDataType.REDDIT_nsfw
return if (nsfw || description()?.contains("nsfw") == true) {
RssDataType.REDDIT_NSFW
} else RssDataType.REDDIT
}
override fun getCho(): String? {
@@ -1,11 +1,11 @@
package rasel.lunar.launcher.model.others
package bums.lunatic.launcher.model.others
import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.utils.JamoUtils
import bums.lunatic.launcher.utils.afterDay
import bums.lunatic.launcher.utils.beforeDay
import org.json.JSONObject
import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.RssDataType
import rasel.lunar.launcher.utils.JamoUtils
import rasel.lunar.launcher.utils.afterDay
import rasel.lunar.launcher.utils.beforeDay
import java.util.Date
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.qaccess
package bums.lunatic.launcher.qaccess
import android.Manifest
import android.app.AlertDialog
@@ -43,27 +43,27 @@ import android.view.ViewGroup
import android.widget.RelativeLayout
import androidx.appcompat.widget.LinearLayoutCompat
import androidx.core.content.ContextCompat
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.QuickAccessBinding
import bums.lunatic.launcher.databinding.ShortcutMakerBinding
import bums.lunatic.launcher.helpers.ColorPicker
import bums.lunatic.launcher.helpers.Constants.Companion.DEFAULT_ICON_SIZE
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_ICON_SIZE
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_SHORTCUT_COUNT
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_SHORTCUT_NO_
import bums.lunatic.launcher.helpers.Constants.Companion.MAX_SHORTCUTS
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SHORTCUTS
import bums.lunatic.launcher.helpers.Constants.Companion.SEPARATOR
import bums.lunatic.launcher.helpers.Constants.Companion.SHORTCUT_TYPE_PHONE
import bums.lunatic.launcher.helpers.Constants.Companion.SHORTCUT_TYPE_URL
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.button.MaterialButtonToggleGroup
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.slider.Slider
import com.google.android.material.textview.MaterialTextView
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.QuickAccessBinding
import rasel.lunar.launcher.databinding.ShortcutMakerBinding
import rasel.lunar.launcher.helpers.ColorPicker
import rasel.lunar.launcher.helpers.Constants.Companion.DEFAULT_ICON_SIZE
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_ICON_SIZE
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_SHORTCUT_COUNT
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_SHORTCUT_NO_
import rasel.lunar.launcher.helpers.Constants.Companion.MAX_SHORTCUTS
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_SHORTCUTS
import rasel.lunar.launcher.helpers.Constants.Companion.SEPARATOR
import rasel.lunar.launcher.helpers.Constants.Companion.SHORTCUT_TYPE_PHONE
import rasel.lunar.launcher.helpers.Constants.Companion.SHORTCUT_TYPE_URL
import java.util.Objects
import kotlin.properties.Delegates
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.receiver
package bums.lunatic.launcher.receiver
import android.annotation.SuppressLint
import android.content.BroadcastReceiver
@@ -6,8 +6,6 @@ import android.content.ComponentName
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.location.Address
import android.location.Geocoder
import android.location.Location
import android.media.MediaMetadata
import android.media.session.MediaSessionManager
@@ -16,29 +14,16 @@ import android.service.notification.NotificationListenerService
import android.service.notification.StatusBarNotification
import androidx.annotation.RequiresApi
import androidx.core.content.getSystemService
import androidx.work.OneTimeWorkRequest
import androidx.work.WorkManager
import bums.lunatic.launcher.model.CurrentPlayItem
import bums.lunatic.launcher.model.NotificationItem
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.utils.BitmapConverter
import bums.lunatic.launcher.workers.WorkersDb
import com.google.android.gms.location.FusedLocationProviderClient
import com.google.android.gms.location.LocationServices
import com.google.android.gms.tasks.OnSuccessListener
import com.google.gson.Gson
import io.realm.kotlin.UpdatePolicy
import io.realm.kotlin.ext.query
import okhttp3.ConnectionPool
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.Response
import okhttp3.ResponseBody
import rasel.lunar.launcher.model.CurrentPlayItem
import rasel.lunar.launcher.model.NotificationItem
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.utils.BitmapConverter
import rasel.lunar.launcher.workers.TelegramBotGetter
import rasel.lunar.launcher.workers.WorkersDb
import java.io.IOException
import java.util.Locale
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
class NLService : NotificationListenerService() {
@@ -1,15 +1,15 @@
package rasel.lunar.launcher.receiver
package bums.lunatic.launcher.receiver
import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import androidx.work.OneTimeWorkRequest
import androidx.work.WorkManager
import bums.lunatic.launcher.model.AppInfo
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.workers.AppInfoGetter
import bums.lunatic.launcher.workers.WorkersDb
import io.realm.kotlin.ext.query
import rasel.lunar.launcher.model.AppInfo
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.workers.AppInfoGetter
import rasel.lunar.launcher.workers.WorkersDb
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
@@ -16,29 +16,31 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.settings
package bums.lunatic.launcher.settings
import android.annotation.SuppressLint
import android.content.SharedPreferences
import android.content.res.Resources
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import bums.lunatic.launcher.BuildConfig
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.AboutBinding
import bums.lunatic.launcher.databinding.SettingsActivityBinding
import bums.lunatic.launcher.helpers.Constants.Companion.BOTTOM_SHEET_TAG
import bums.lunatic.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import bums.lunatic.launcher.helpers.PrefBoolean
import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.settings.childs.Advance
import bums.lunatic.launcher.settings.childs.Appearances
import bums.lunatic.launcher.settings.childs.Apps
import bums.lunatic.launcher.settings.childs.HomeSettings
import bums.lunatic.launcher.settings.childs.Misc
import bums.lunatic.launcher.settings.childs.TimeDate
import bums.lunatic.launcher.settings.childs.WeatherSettings
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.color.DynamicColors
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import rasel.lunar.launcher.BuildConfig
import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.AboutBinding
import rasel.lunar.launcher.databinding.SettingsActivityBinding
import rasel.lunar.launcher.helpers.Constants.Companion.BOTTOM_SHEET_TAG
import rasel.lunar.launcher.helpers.Constants.Companion.PREFS_SETTINGS
import rasel.lunar.launcher.settings.childs.Advance
import rasel.lunar.launcher.settings.childs.Appearances
import rasel.lunar.launcher.settings.childs.Apps
import rasel.lunar.launcher.settings.childs.Misc
import rasel.lunar.launcher.settings.childs.TimeDate
import rasel.lunar.launcher.settings.childs.HomeSettings
import rasel.lunar.launcher.settings.childs.WeatherSettings
internal class SettingsActivity : AppCompatActivity() {
@@ -94,10 +96,29 @@ internal class SettingsActivity : AppCompatActivity() {
binding.about.setOnClickListener { aboutDialog() }
binding.support.setOnClickListener { supportDialog() }
/* show app version name */
binding.version.text = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})"
binding.version.text = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})${if(PrefBoolean.rootPermisssion.get(false)) "[Root]" else ""}"
binding.version.setOnClickListener {
binding.version.removeCallbacks(cancelCount)
clickCount += 1
binding.version.postDelayed(cancelCount, 2000L)
if (clickCount > 5) {
PrefHelper.putBoolean("rootPermisssion",!PrefBoolean.rootPermisssion.get(false))
binding.version.text = "${BuildConfig.VERSION_NAME} (${BuildConfig.VERSION_CODE})${if(PrefBoolean.rootPermisssion.get(false)) "[Root]" else ""}"
}
}
}
var cancelCount = Runnable{
clickCount = 0
}
var clickCount = 0
override fun getTheme(): Resources.Theme {
val theme = super.getTheme()
theme.applyStyle(R.style.SettingsNavBar, true)
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.settings.childs
package bums.lunatic.launcher.settings.childs
import android.content.Intent
import android.os.Bundle
@@ -24,11 +24,11 @@ import android.provider.Settings
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.SettingsAdvanceBinding
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.SettingsAdvanceBinding
import kotlin.system.exitProcess
@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.settings.childs
package bums.lunatic.launcher.settings.childs
import android.Manifest.permission.READ_EXTERNAL_STORAGE
import android.Manifest.permission.READ_MEDIA_IMAGES
@@ -42,18 +42,18 @@ import androidx.appcompat.app.AppCompatDelegate
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_NO
import androidx.appcompat.app.AppCompatDelegate.MODE_NIGHT_YES
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.ColorPickerBinding
import bums.lunatic.launcher.databinding.SettingsAppearancesBinding
import bums.lunatic.launcher.helpers.ColorPicker
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_APPLICATION_THEME
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_STATUS_BAR
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_WINDOW_BACKGROUND
import bums.lunatic.launcher.helpers.UniUtils.Companion.getColorResId
import bums.lunatic.launcher.settings.SettingsActivity.Companion.settingsPrefs
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.ColorPickerBinding
import rasel.lunar.launcher.databinding.SettingsAppearancesBinding
import rasel.lunar.launcher.helpers.ColorPicker
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_APPLICATION_THEME
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_STATUS_BAR
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_WINDOW_BACKGROUND
import rasel.lunar.launcher.helpers.UniUtils.Companion.getColorResId
import rasel.lunar.launcher.settings.SettingsActivity.Companion.settingsPrefs
import java.io.IOException
import java.util.Objects
@@ -16,50 +16,25 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.settings.childs
package bums.lunatic.launcher.settings.childs
import android.annotation.SuppressLint
import android.app.Dialog
import android.content.Intent
import android.content.pm.ApplicationInfo
import android.content.pm.PackageManager
import android.os.Build
import android.os.Bundle
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.ViewGroup.LayoutParams.MATCH_PARENT
import android.view.ViewGroup.LayoutParams.WRAP_CONTENT
import android.widget.Toast
import androidx.appcompat.widget.LinearLayoutCompat
import androidx.core.view.children
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.SettingsAppsBinding
import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.helpers.PrefKey
import bums.lunatic.launcher.helpers.PrefLong
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.chip.Chip
import com.google.android.material.chip.ChipDrawable
import com.google.android.material.chip.ChipGroup
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.slider.Slider
import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.SettingsAppsBinding
import rasel.lunar.launcher.helpers.Constants.Companion.DEFAULT_GRID_COLUMNS
import rasel.lunar.launcher.helpers.Constants.Companion.DEFAULT_ICON_PACK
import rasel.lunar.launcher.helpers.Constants.Companion.DEFAULT_SCROLLBAR_HEIGHT
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_APPS_COUNT
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_APPS_LAYOUT
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_DRAW_ALIGN
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_GRID_COLUMNS
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_ICON_PACK
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_KEYBOARD_SEARCH
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_QUICK_LAUNCH
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_SCROLLBAR_HEIGHT
import rasel.lunar.launcher.helpers.PrefHelper
import rasel.lunar.launcher.helpers.PrefKey
import rasel.lunar.launcher.helpers.PrefLong
import rasel.lunar.launcher.helpers.UniUtils.Companion.dpToPx
import rasel.lunar.launcher.settings.SettingsActivity.Companion.settingsPrefs
import kotlin.system.exitProcess
@@ -126,6 +101,16 @@ internal class Apps : BottomSheetDialogFragment() {
binding.longTime.value = it.toFloat()
}
PrefLong.locationTimePeriod.get(20L).let {
binding.locationTimeTitle.text = getString(R.string.locationTimeTitle) +" [${it.toInt()}분 마다]"
binding.locationTime.value = it.toFloat()
}
PrefLong.locationDistance.get(200L).let {
binding.locationDistanceTitle.text = getString(R.string.locationDistanceTitle) +" [${it.toInt()}분 마다]"
binding.locationDistance.value = it.toFloat()
}
// binding.scrollbarHeight.value = settingsPrefs!!.getInt(KEY_SCROLLBAR_HEIGHT, DEFAULT_SCROLLBAR_HEIGHT).toFloat()
return binding.root
@@ -159,6 +144,16 @@ internal class Apps : BottomSheetDialogFragment() {
binding.longTimeTitle.text = getString(R.string.longTimeTitle) +" [${value.toInt()}]분 마다]"
})
binding.locationDistance.addOnChangeListener(Slider.OnChangeListener { _, value, _ ->
settingsChanged = true
PrefLong.locationDistance.set(value.toLong())
binding.locationDistanceTitle.text = getString(R.string.locationDistanceTitle) +" [${value.toInt()}]미터 마다]"
})
binding.locationTime.addOnChangeListener(Slider.OnChangeListener { _, value, _ ->
settingsChanged = true
PrefLong.locationTimePeriod.set(value.toLong())
binding.locationTimeTitle.text = getString(R.string.locationTimeTitle) +" [${value.toInt()}]분 마다]"
})
}
@@ -0,0 +1,119 @@
/*
* Lunar Launcher
* Copyright (C) 2022 Md Rasel Hossain
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package bums.lunatic.launcher.settings.childs
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TableRow
import androidx.core.view.children
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.SettingsTodoBinding
import bums.lunatic.launcher.helpers.PrefBoolean
import bums.lunatic.launcher.helpers.PrefHelper
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.dialog.MaterialAlertDialogBuilder
import com.google.android.material.switchmaterial.SwitchMaterial
import kotlin.system.exitProcess
internal class HomeSettings : BottomSheetDialogFragment() {
private lateinit var binding : SettingsTodoBinding
private var settingsChanged: Boolean = false
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = SettingsTodoBinding.inflate(inflater, container, false)
setTableItem(binding.admin02)
setTableItem(binding.admin01)
setTableItem(binding.normal01)
setTableItem(binding.normal02)
setTableItem(binding.normal03)
setTableItem(binding.normal04)
binding.callInfo.isChecked = PrefBoolean.showCallHistory.get(false)
binding.callInfo.setOnCheckedChangeListener { buttonView, isChecked -> PrefBoolean.showCallHistory.set(isChecked)
settingsChanged = true}
binding.smsInfos.isChecked = PrefBoolean.showSMSHistory.get(false)
binding.smsInfos.setOnCheckedChangeListener { buttonView, isChecked -> PrefBoolean.showSMSHistory.set(isChecked)
settingsChanged = true}
binding.notificationInfos.isChecked = PrefBoolean.showNotificationHistory.get(false)
binding.notificationInfos.setOnCheckedChangeListener { buttonView, isChecked -> PrefBoolean.showNotificationHistory.set(isChecked)
settingsChanged = true}
binding.nowPlaying.isChecked = PrefBoolean.showNowPlaying.get(false)
binding.nowPlaying.setOnCheckedChangeListener { buttonView, isChecked -> PrefBoolean.showNowPlaying.set(isChecked)
settingsChanged = true}
if(!PrefHelper.getBoolean("rootPermisssion",false)) {
binding.admin01.visibility = View.GONE
binding.admin02.visibility = View.GONE
}
return binding.root
}
var checkdCount = 0
set(value) {
field = value
PrefBoolean.showNewsHistory.set(field > 0)
}
fun setTableItem(tableRow : TableRow) {
tableRow.children.forEach { (it as? SwitchMaterial)?.let {
it.text?.toString()?.toUpperCase()?.let { key ->
it.isChecked = PrefHelper.getBoolean(key, false)
checkdCount += if (it.isChecked) 1 else -1
it.setOnCheckedChangeListener { v , isBool ->
PrefHelper.putBoolean(key, isBool)
checkdCount += if (isBool) 1 else -1
settingsChanged = true
}
} }
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
(requireDialog() as BottomSheetDialog).dismissWithAnimation = true
}
override fun onDestroyView() {
super.onDestroyView()
if (settingsChanged) {
MaterialAlertDialogBuilder(requireActivity())
.setTitle(R.string.restart_now)
.setMessage(R.string.restart_message)
.setPositiveButton(R.string.restart) { _, _ ->
exitProcess(0)
}
.setNeutralButton(R.string.later, null)
.show()
}
}
}
@@ -16,31 +16,21 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.settings.childs
package bums.lunatic.launcher.settings.childs
import android.content.DialogInterface
import android.os.Build
import android.os.Bundle
import android.text.SpannableStringBuilder
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.widget.doOnTextChanged
import bums.lunatic.launcher.databinding.SettingsPrivitServiceBinding
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_RSS_URL
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_RSS_URL2
import bums.lunatic.launcher.helpers.PrefString
import bums.lunatic.launcher.settings.SettingsActivity.Companion.settingsPrefs
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import com.google.android.material.slider.Slider
import rasel.lunar.launcher.databinding.SettingsPrivitServiceBinding
import rasel.lunar.launcher.helpers.Constants.Companion.DEFAULT_ICON_SIZE
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_BACK_HOME
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_ICON_SIZE
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_LOCK_METHOD
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_RSS_URL
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_RSS_URL2
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_SHORTCUT_COUNT
import rasel.lunar.launcher.helpers.Constants.Companion.MAX_SHORTCUTS
import rasel.lunar.launcher.helpers.PrefString
import rasel.lunar.launcher.helpers.UniUtils.Companion.isRooted
import rasel.lunar.launcher.settings.SettingsActivity.Companion.settingsPrefs
import java.util.Objects
@@ -70,6 +60,9 @@ internal class Misc : BottomSheetDialogFragment() {
binding.inputFeedUrl4.setText(PrefString.locationApi.get(""))
binding.inputFeedUrl4.doOnTextChanged { t,s,b,l -> PrefString.locationApi.set(t.toString())}
binding.inputFeedUrl5.setText(PrefString.carName.get(""))
binding.inputFeedUrl5.doOnTextChanged { t,s,b,l -> PrefString.carName.set(t.toString())}
return binding.root
}
@@ -16,20 +16,20 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package rasel.lunar.launcher.settings.childs
package bums.lunatic.launcher.settings.childs
import android.content.DialogInterface
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import bums.lunatic.launcher.databinding.SettingsTimeDateBinding
import bums.lunatic.launcher.helpers.Constants.Companion.DEFAULT_DATE_FORMAT
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_DATE_FORMAT
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_TIME_FORMAT
import bums.lunatic.launcher.settings.SettingsActivity.Companion.settingsPrefs
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import rasel.lunar.launcher.databinding.SettingsTimeDateBinding
import rasel.lunar.launcher.helpers.Constants.Companion.DEFAULT_DATE_FORMAT
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_DATE_FORMAT
import rasel.lunar.launcher.helpers.Constants.Companion.KEY_TIME_FORMAT
import rasel.lunar.launcher.settings.SettingsActivity.Companion.settingsPrefs
import java.util.Objects
@@ -0,0 +1,72 @@
/*
* Lunar Launcher
* Copyright (C) 2022 Md Rasel Hossain
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package bums.lunatic.launcher.settings.childs
import android.content.DialogInterface
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.widget.doOnTextChanged
import bums.lunatic.launcher.databinding.SettingsWeatherBinding
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_CITY_NAME
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_OWM_API
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_SHOW_CITY
import bums.lunatic.launcher.helpers.Constants.Companion.KEY_TEMP_UNIT
import bums.lunatic.launcher.helpers.PrefBoolean
import bums.lunatic.launcher.helpers.PrefString
import bums.lunatic.launcher.settings.SettingsActivity.Companion.settingsPrefs
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import java.util.Objects
internal class WeatherSettings : BottomSheetDialogFragment() {
private lateinit var binding : SettingsWeatherBinding
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = SettingsWeatherBinding.inflate(inflater, container, false)
/* initialize views according to the saved values */
binding.inputOwm.setText(PrefString.weatherApiKey.get(""))
binding.inputOwm.doOnTextChanged { text, start, before, count ->
PrefString.weatherApiKey.set(text.toString())
}
binding.dress.isChecked = PrefBoolean.weatherDress.get(false)
binding.weather.isChecked = PrefBoolean.weatherState.get(false)
binding.weather.setOnCheckedChangeListener { buttonView, isChecked -> PrefBoolean.weatherState.set(isChecked)}
binding.dress.setOnCheckedChangeListener { buttonView, isChecked -> PrefBoolean.weatherDress.set(isChecked)}
return binding.root
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
(requireDialog() as BottomSheetDialog).dismissWithAnimation = true
}
/* save input field values while closing the dialog */
override fun onDismiss(dialog: DialogInterface) {
super.onDismiss(dialog)
}
}
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.utils
package bums.lunatic.launcher.utils
object AlphabetToChosungMap {
val map = hashMapOf<String,String>(
@@ -1,7 +1,7 @@
package rasel.lunar.launcher.utils
package bums.lunatic.launcher.utils
import android.util.Log
import rasel.lunar.launcher.BuildConfig
import bums.lunatic.launcher.BuildConfig
object BLog {
val DEFAULT_TAG = "Lunatic"
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.utils
package bums.lunatic.launcher.utils
import android.graphics.Bitmap
import android.graphics.BitmapFactory
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.utils
package bums.lunatic.launcher.utils
import android.content.ContentResolver
import android.net.Uri
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.utils
package bums.lunatic.launcher.utils
object EnToKo {
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.utils
package bums.lunatic.launcher.utils
import java.lang.Long.toHexString
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.utils
package bums.lunatic.launcher.utils
import android.graphics.Bitmap
import android.graphics.BitmapFactory
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.utils
package bums.lunatic.launcher.utils
import android.annotation.SuppressLint
@@ -1,16 +1,15 @@
package rasel.lunar.launcher.utils
package bums.lunatic.launcher.utils
import bums.lunatic.launcher.home.LauncherHome.Companion.lastedFinishedPageUrl
import bums.lunatic.launcher.model.MostItem
import bums.lunatic.launcher.model.RssData
import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.dateFormat
import bums.lunatic.launcher.model.getRssData
import bums.lunatic.launcher.workers.WorkersDb
import io.realm.kotlin.ext.query
import org.jsoup.Jsoup
import org.jsoup.nodes.Document
import rasel.lunar.launcher.home.LauncherHome.Companion.lastedFinishedPageUrl
import rasel.lunar.launcher.model.MostItem
import rasel.lunar.launcher.model.RssData
import rasel.lunar.launcher.model.RssDataType
import rasel.lunar.launcher.model.dateFormat
import rasel.lunar.launcher.model.getRssData
import rasel.lunar.launcher.workers.WorkersDb
import java.nio.charset.Charset
import java.text.SimpleDateFormat
import java.util.Base64
import java.util.Date
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.utils
package bums.lunatic.launcher.utils
import org.jsoup.nodes.Document
import java.net.URLEncoder
@@ -22,10 +22,21 @@ object RssList {
)
val feedJsons = arrayListOf(
"https://www.reddit.com/r/nsfw/.json",
// "https://www.reddit.com/r/nsfw/.json",
"https://www.reddit.com/r/Mogong/.json",
// "https://www.reddit.com/r/Mogong/comments/e6tu50/19_%ED%9B%84%EB%B0%A9%EA%B0%80%EB%93%9D%ED%95%9C_%EC%84%9C%EB%B8%8C%EB%A0%88%EB%94%A7/.json"
// "https://www.reddit.com/r/${URLEncoder.encode("모공")}/.json",
)
val feedJsons_nsfw = arrayListOf(
"https://www.reddit.com/r/nsfw/.json",
"https://www.reddit.com/r/nsfw411/.json",
"https://www.reddit.com/r/nsfw2/.json",
"https://www.reddit.com/r/nudes/.json",
"https://www.reddit.com/r/cuckold/.json",
// "https://www.reddit.com/r/Mogong/.json",
// "https://www.reddit.com/r/Mogong/comments/e6tu50/19_%ED%9B%84%EB%B0%A9%EA%B0%80%EB%93%9D%ED%95%9C_%EC%84%9C%EB%B8%8C%EB%A0%88%EB%94%A7/.json"
// "https://www.reddit.com/r/${URLEncoder.encode("모공")}/.json",
)
@@ -1,12 +1,11 @@
package rasel.lunar.launcher.utils
package bums.lunatic.launcher.utils
import android.content.Context
import android.os.SystemClock
import android.util.Log
import android.view.MotionEvent
import android.view.View
import android.view.View.OnTouchListener
import rasel.lunar.launcher.BuildConfig
import bums.lunatic.launcher.BuildConfig
import kotlin.math.abs
import kotlin.math.pow
import kotlin.math.sqrt
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.view
package bums.lunatic.launcher.view
import android.annotation.SuppressLint
import android.content.Context
@@ -26,7 +26,7 @@ import androidx.annotation.ColorRes
import androidx.annotation.DrawableRes
import androidx.annotation.NonNull
import androidx.annotation.RequiresApi
import rasel.lunar.launcher.R
import bums.lunatic.launcher.R
import kotlin.math.min
import kotlin.math.pow
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.view
package bums.lunatic.launcher.view
import android.content.Context
import android.os.Handler
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.view
package bums.lunatic.launcher.view
import android.content.Context
import android.util.AttributeSet
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.workers
package bums.lunatic.launcher.workers
import android.content.Context
import android.content.Intent
@@ -6,15 +6,15 @@ import android.content.pm.PackageManager
import android.content.pm.ResolveInfo
import android.os.Build
import androidx.work.WorkerParameters
import bums.lunatic.launcher.BuildConfig
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.apps.AppDrawer.Companion.appName
import bums.lunatic.launcher.apps.AppDrawer.Companion.getCategory
import bums.lunatic.launcher.apps.normalize
import bums.lunatic.launcher.model.AppInfo
import bums.lunatic.launcher.utils.AlphabetToChosungMap
import bums.lunatic.launcher.utils.JamoUtils
import io.realm.kotlin.ext.query
import rasel.lunar.launcher.BuildConfig
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.apps.AppDrawer.Companion.appName
import rasel.lunar.launcher.apps.AppDrawer.Companion.getCategory
import rasel.lunar.launcher.apps.normalize
import rasel.lunar.launcher.model.AppInfo
import rasel.lunar.launcher.utils.AlphabetToChosungMap
import rasel.lunar.launcher.utils.JamoUtils
class AppInfoGetter : BaseGetter {
companion object {
@@ -1,14 +1,15 @@
package rasel.lunar.launcher.workers
package bums.lunatic.launcher.workers
import android.content.Context
import androidx.work.WorkerParameters
import bums.lunatic.launcher.model.Arca
import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.getRssData
import bums.lunatic.launcher.model.getT
import bums.lunatic.launcher.utils.beforeDay
import org.jsoup.Jsoup
import org.jsoup.nodes.Element
import rasel.lunar.launcher.model.Arca
import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.getRssData
import rasel.lunar.launcher.model.getT
import rasel.lunar.launcher.utils.beforeDay
import java.util.Date
class ArcaGetter : BaseGetter {
@@ -20,39 +21,43 @@ class ArcaGetter : BaseGetter {
}
override fun realWork(): Result {
try {
val urls = arrayListOf(
"https://arca.live/b/singbung?mode=best",
RssDataType.ARCA.isOn {
try {
temp.clear()
val urls = arrayListOf(
"https://arca.live/b/singbung?mode=best",
// "https://arca.live/b/headline",
// "https://arca.live/b/live",
"https://arca.live/b/namuhotnow",
"https://arca.live/b/society",
"https://arca.live/b/namuhotnow",
"https://arca.live/b/society",
// "https://arca.live/b/replay",
// "https://arca.live/b/breaking"
)
urls.forEach {
Jsoup.connect(it)
.userAgent(USAGT)
.get().let { arca ->
)
urls.forEach {
Jsoup.connect(it)
.userAgent(USAGT)
.get().let { arca ->
// BLog.LOGE("url >> ${it} >> ${arca}")
arca.getElementsByClass("vrow hybrid").forEach { araca_li ->
if (araca_li.html().contains("title ") == true) {
parseArcaLi(araca_li).apply {
this.forEach {
if (it.pubDate() > commicsDateTime) {
temp.add(it.getRssData())
arca.getElementsByClass("vrow hybrid").forEach { araca_li ->
if (araca_li.html().contains("title ") == true) {
parseArcaLi(araca_li).apply {
this.forEach {
if (it.pubDate() > commicsDateTime) {
temp.add(it.getRssData())
}
}
}
}
}
}
}
}
}
// Jsoup.connect("https://projrctjav.com").userAgent(USAGT).get().let { projectj ->
// BLog.LOGE("projectj >>>>> ${projectj}")
// }
} catch (e:Exception){e.printStackTrace()}
} catch (e: Exception) {
e.printStackTrace()
}
}
return Result.success().apply {
WorkersDb.insertBulkData(temp)
}
@@ -1,11 +1,11 @@
package rasel.lunar.launcher.workers
package bums.lunatic.launcher.workers
import android.content.Context
import androidx.annotation.CallSuper
import androidx.work.Worker
import androidx.work.WorkerParameters
import rasel.lunar.launcher.model.RssData
import rasel.lunar.launcher.utils.beforeDay
import bums.lunatic.launcher.model.RssData
import bums.lunatic.launcher.utils.beforeDay
import java.util.Calendar
import java.util.Date
@@ -1,10 +1,10 @@
package rasel.lunar.launcher.workers
package bums.lunatic.launcher.workers
import android.content.Context
import android.net.Uri
import androidx.work.WorkerParameters
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.utils.BLog
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.utils.BLog
class CalendarGetter : BaseGetter {
@@ -1,14 +1,14 @@
package rasel.lunar.launcher.workers
package bums.lunatic.launcher.workers
import android.annotation.SuppressLint
import android.content.Context
import androidx.work.WorkerParameters
import bums.lunatic.launcher.model.Clien
import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.getHref
import bums.lunatic.launcher.model.getRssData
import bums.lunatic.launcher.model.getT
import org.jsoup.Jsoup
import rasel.lunar.launcher.model.Clien
import rasel.lunar.launcher.model.getHref
import rasel.lunar.launcher.model.getRssData
import rasel.lunar.launcher.model.getT
import rasel.lunar.launcher.utils.BLog
class ClienGetter : BaseGetter {
companion object {
@@ -25,21 +25,21 @@ class ClienGetter : BaseGetter {
// BLog.LOGE("div_clien >>>> ${div_clien.getElementsByClass("list_subject").getHref()}")
// BLog.LOGE("div_clien >>>> ${div_clien.getElementsByClass("timestamp").getT()}")
val title = div_clien.getElementsByClass("subject_fixed").getT()
val desc = div_clien.getElementsByClass("shortname fixed").getT()
val link = div_clien.getElementsByClass("list_subject").getHref()
val timeStamp = div_clien.getElementsByClass("timestamp").getT()
if (title.length > 0 && timeStamp.length > 0) {
Clien().let { c ->
c.title = title
c.link = "https://www.clien.net".plus(link)
c.desc = desc
c.dateTiem = timeStamp
if (c.pubDate() > limitDateTime) {
temp.add(c.getRssData())
val title = div_clien.getElementsByClass("subject_fixed").getT()
val desc = div_clien.getElementsByClass("shortname fixed").getT()
val link = div_clien.getElementsByClass("list_subject").getHref()
val timeStamp = div_clien.getElementsByClass("timestamp").getT()
if (title.length > 0 && timeStamp.length > 0) {
Clien().let { c ->
c.title = title
c.link = "https://www.clien.net".plus(link)
c.desc = desc
c.dateTiem = timeStamp
if (c.pubDate() > limitDateTime) {
temp.add(c.getRssData())
}
}
}
}
// var desc = tq_tr.getElementsByClass("cate").getT()
// var title = tq_tr.getElementsByClass("title").getT()
// var pageLink = tq_tr.getElementsByTag("a").getHref()
@@ -67,20 +67,24 @@ class ClienGetter : BaseGetter {
@SuppressLint("RestrictedApi")
override fun realWork(): Result {
try {
val testUrl2 = arrayListOf("https://www.clien.net/service/group/community")
testUrl2.forEach { url ->
Jsoup.connect(url)
.userAgent(USAGT)
.get().let { ruli ->
RssDataType.CLIEN.isOn {
try {
temp.clear()
val testUrl2 = arrayListOf("https://www.clien.net/service/group/community")
testUrl2.forEach { url ->
Jsoup.connect(url)
.userAgent(USAGT)
.get().let { ruli ->
// BLog.LOGE("test ${url} >> ${ruli.title()}")
ruli.getElementsByClass("list_item symph_row ").forEach { ruli_tr ->
parseClien(ruli_tr)
ruli.getElementsByClass("list_item symph_row ").forEach { ruli_tr ->
parseClien(ruli_tr)
}
}
}
}
} catch (e: Exception) {
e.printStackTrace()
}
} catch (e:Exception){e.printStackTrace()}
}
return Result.success().apply {
WorkersDb.insertBulkData(temp)
}
@@ -1,11 +1,11 @@
package rasel.lunar.launcher.workers
package bums.lunatic.launcher.workers
import android.content.Context
import android.provider.ContactsContract
import androidx.work.WorkerParameters
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.apps.SimpleContact
import io.realm.kotlin.ext.query
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.apps.SimpleContact
class ContactInfoGetter : BaseGetter {
companion object {
@@ -1,13 +1,14 @@
package rasel.lunar.launcher.workers
package bums.lunatic.launcher.workers
import android.annotation.SuppressLint
import android.content.Context
import androidx.work.WorkerParameters
import bums.lunatic.launcher.model.DcInside
import bums.lunatic.launcher.model.RssData
import bums.lunatic.launcher.model.RssDataInterface
import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.getRssData
import org.jsoup.Jsoup
import rasel.lunar.launcher.model.DcInside
import rasel.lunar.launcher.model.RssData
import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.getRssData
class DCGetter : BaseGetter {
companion object {
@@ -66,32 +67,34 @@ class DCGetter : BaseGetter {
@SuppressLint("RestrictedApi")
override fun realWork(): Result {
var tempArray = arrayListOf<RssData>()
try {
val testUrl2 = "https://www.dcinside.com/"
Jsoup.connect(testUrl2)
.userAgent(USAGT)
.get().let { dc ->
RssDataType.DCINSIDE.isOn {
temp.clear()
try {
val testUrl2 = "https://www.dcinside.com/"
Jsoup.connect(testUrl2)
.userAgent(USAGT)
.get().let { dc ->
// BLog.LOGE("test ${testUrl2} >> ${this}")
dc.getElementsByTag("li").forEach { dc_li ->
if (dc_li.html().contains("main_log") == true) {
parseDcLi(dc_li).apply {
this.forEach {
if (it.pubDate() > commicsDateTime) {
tempArray.add(it.getRssData())
dc.getElementsByTag("li").forEach { dc_li ->
if (dc_li.html().contains("main_log") == true) {
parseDcLi(dc_li).apply {
this.forEach {
if (it.pubDate() > commicsDateTime) {
temp.add(it.getRssData())
}
}
}
}
}
}
}
} catch (e:Exception){e.printStackTrace()}
} catch (e: Exception) {
e.printStackTrace()
}
}
return Result.success().apply {
WorkersDb.insertBulkData(tempArray)
WorkersDb.insertBulkData(temp)
}
}
}
@@ -1,11 +1,12 @@
package rasel.lunar.launcher.workers
package bums.lunatic.launcher.workers
import android.annotation.SuppressLint
import android.content.Context
import androidx.work.WorkerParameters
import bums.lunatic.launcher.model.Dotax
import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.getRssData
import org.jsoup.Jsoup
import rasel.lunar.launcher.model.Dotax
import rasel.lunar.launcher.model.getRssData
class DotaxGetter : BaseGetter {
companion object {
@@ -17,7 +18,9 @@ class DotaxGetter : BaseGetter {
@SuppressLint("RestrictedApi")
override fun realWork(): Result {
RssDataType.DOTAX.isOn {
try {
temp.clear()
val dotaxUrls = arrayListOf("https://m.cafe.daum.net/dotax",
"https://m.cafe.daum.net/dotax/_rec?page=2",
"https://m.cafe.daum.net/dotax/_rec?page=3"
@@ -44,7 +47,7 @@ class DotaxGetter : BaseGetter {
}
}
}
} catch (e : Exception) {e.printStackTrace()}
} catch (e : Exception) {e.printStackTrace()}}
return Result.success().apply {
WorkersDb.insertBulkData(temp)
}
@@ -0,0 +1,71 @@
package bums.lunatic.launcher.workers
import android.annotation.SuppressLint
import android.content.Context
import androidx.work.WorkerParameters
import bums.lunatic.launcher.model.FmKorea
import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.getRssData
import org.jsoup.Jsoup
import java.util.Date
class FmKoreaGetter : BaseGetter {
companion object {
val COMIC_WORK_TAG = "ComicGetter"
}
constructor(context: Context, workerParams: WorkerParameters) : super(context, workerParams) {
}
@SuppressLint("RestrictedApi")
override fun realWork(): Result {
RssDataType.FMKORAE.isOn {
val now = Date()
try {
val fmkoreaUrls = arrayListOf("https://www.fmkorea.com")
fmkoreaUrls.forEach {
Jsoup.connect(it).userAgent(USAGT).get().let { fmkorea ->
// BLog.LOGE("fmkorea >>> ${fmkorea.title()}")
fmkorea.getElementsByTag("li").forEach { fmkorea_li ->
if (fmkorea_li.getElementsByClass("title")
.text().length > 0 && fmkorea_li.getElementsByTag("a").size > 0 && fmkorea_li.getElementsByTag(
"a"
).get(0).attr("href").length > 0
) {
// BLog.LOGE("fmkorea_li >>> ${fmkorea_li}")
val title = fmkorea_li.getElementsByClass("title").text()
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) {
temp.add(this.getRssData())
}
}
}
}
}
}
}
} catch (e: Exception) {
e.printStackTrace()
}
}
return Result.success().apply {
WorkersDb.insertBulkData(temp)
}
}
}
@@ -1,36 +1,17 @@
package rasel.lunar.launcher.workers
package bums.lunatic.launcher.workers
import android.annotation.SuppressLint
import android.content.Context
import android.location.Address
import android.location.Geocoder
import android.location.Location
import android.os.Build
import androidx.work.WorkerParameters
import bums.lunatic.launcher.LauncherActivity.Companion.runWeatherGetter
import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.helpers.letTrue
import bums.lunatic.launcher.utils.BLog
import bums.lunatic.launcher.workers.LocationUpdateService.Companion.pushLocation
import com.google.android.gms.location.LocationServices
import com.google.android.gms.location.Priority
import com.google.android.gms.tasks.CancellationTokenSource
import com.google.gson.Gson
import okhttp3.ConnectionPool
import okhttp3.MediaType
import okhttp3.OkHttpClient
import okhttp3.Request
import okhttp3.RequestBody
import okhttp3.Response
import okhttp3.ResponseBody
import rasel.lunar.launcher.LauncherActivity.Companion.runWeatherGetter
import rasel.lunar.launcher.helpers.PrefHelper
import rasel.lunar.launcher.helpers.letTrue
import rasel.lunar.launcher.model.LocationLog
import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.workers.LocationUpdateService.Companion.pushLocation
import java.io.IOException
import java.math.BigDecimal
import java.math.RoundingMode
import java.util.Base64
import java.util.Locale
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
import kotlin.math.cos
class LocationGetter(context: Context, workerParams: WorkerParameters) : BaseGetter(context, workerParams) {
@@ -1,4 +1,4 @@
package rasel.lunar.launcher.workers
package bums.lunatic.launcher.workers
import android.Manifest
import android.app.Service
@@ -13,8 +13,15 @@ import android.os.Build
import android.os.IBinder
import android.widget.Toast
import androidx.core.app.ActivityCompat
import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.helpers.PrefString
import bums.lunatic.launcher.helpers.letTrue
import bums.lunatic.launcher.model.LocationLog
import bums.lunatic.launcher.utils.BLog
import com.google.android.gms.location.LocationServices
import com.google.gson.Gson
import io.realm.kotlin.ext.query
import io.realm.kotlin.query.Sort
import okhttp3.ConnectionPool
import okhttp3.MediaType
import okhttp3.OkHttpClient
@@ -22,14 +29,7 @@ import okhttp3.Request
import okhttp3.RequestBody
import okhttp3.Response
import okhttp3.ResponseBody
import rasel.lunar.launcher.helpers.PrefHelper
import rasel.lunar.launcher.helpers.PrefString
import rasel.lunar.launcher.helpers.letTrue
import rasel.lunar.launcher.model.LocationLog
import rasel.lunar.launcher.utils.BLog
import java.io.IOException
import java.math.BigDecimal
import java.math.RoundingMode
import java.util.Base64
import java.util.Locale
import java.util.concurrent.Executors
@@ -48,47 +48,52 @@ class LocationUpdateService : Service(), LocationListener {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
geocoder.getFromLocation(lat, long, 1) { addresses ->
addresses.first()?.let {
LocationLog().apply {
fillData(it)
Executors.newSingleThreadScheduledExecutor().schedule({
try {
//////-1002450229641
val url = PrefString.locationApi.get()
if (url.length > 10) {
val client = OkHttpClient.Builder()
.connectionPool(ConnectionPool(5, 60, TimeUnit.SECONDS))
.build()
WorkersDb.getRealm()?.apply {
LocationLog().let { loc ->
loc.fillData(it)
var list = query<LocationLog>().sort("time", Sort.DESCENDING).find()
(list.size == 0 || (list.size > 0 && list.first().time < System.currentTimeMillis() - (1000L * 60L * 10L))).letTrue {
Executors.newSingleThreadScheduledExecutor().schedule({
try {
//////-1002450229641
val url = PrefString.locationApi.get()
if (url.length > 10) {
val client = OkHttpClient.Builder()
.connectionPool(ConnectionPool(5, 60, TimeUnit.SECONDS))
.build()
// GET 요청 객체 생성
val builder: Request.Builder = Request.Builder().url(url)
.addHeader("Content-Type", "application/json").get()
builder.method(
"POST", RequestBody.create(
MediaType.parse("application/text"),
Base64.getEncoder().encode(
Gson().toJson(this@apply).toByteArray()
// GET 요청 객체 생성
val builder: Request.Builder = Request.Builder().url(url)
.addHeader("Content-Type", "application/json").get()
builder.method(
"POST", RequestBody.create(
MediaType.parse("application/text"),
Base64.getEncoder().encode(
Gson().toJson(this@apply).toByteArray()
)
)
)
)
)
val request: Request = builder.build()
val request: Request = builder.build()
BLog.LOGE("telegram before request ")
// OkHttp 클라이언트로 GET 요청 객체 전송
val response: Response = client.newCall(request).execute()
if (response.isSuccessful()) {
// 응답 받아서 처리
val body: ResponseBody? = response.body()
if (body != null) {
BLog.LOGE("telegram before request ")
// OkHttp 클라이언트로 GET 요청 객체 전송
val response: Response = client.newCall(request).execute()
if (response.isSuccessful()) {
// 응답 받아서 처리
val body: ResponseBody? = response.body()
if (body != null) {
}
} else BLog.LOGE("telegram Error Occurred")
}
} else BLog.LOGE("telegram Error Occurred")
}
} catch (e: java.lang.Exception) {
e.printStackTrace()
} catch (e: java.lang.Exception) {
e.printStackTrace()
}
}, 5, TimeUnit.SECONDS)
}
writeBlocking {
copyToRealm(loc)
}
}, 5, TimeUnit.SECONDS)
WorkersDb.getRealm().writeBlocking {
copyToRealm(this@apply)
}
}
}
@@ -1,11 +1,12 @@
package rasel.lunar.launcher.workers
package bums.lunatic.launcher.workers
import android.annotation.SuppressLint
import android.content.Context
import androidx.work.WorkerParameters
import rasel.lunar.launcher.model.getRssData
import rasel.lunar.launcher.home.adapters.RssFeedsParser
import rasel.lunar.launcher.utils.RssList
import bums.lunatic.launcher.home.adapters.RssFeedsParser
import bums.lunatic.launcher.model.RssDataType
import bums.lunatic.launcher.model.getRssData
import bums.lunatic.launcher.utils.RssList
class NewsFeedsGetter : BaseGetter {
companion object {
@@ -17,19 +18,20 @@ class NewsFeedsGetter : BaseGetter {
@SuppressLint("RestrictedApi")
override fun realWork(): Result {
feddsUrls.clear()
feddsUrls.addAll(RssList.newsFeeds)
feddsUrls.addAll(RssList.getFeedUrls())
RssDataType.NEWSFEED.isOn {
feddsUrls.clear()
feddsUrls.addAll(RssList.newsFeeds)
feddsUrls.addAll(RssList.getFeedUrls())
for(url in feddsUrls) {
for (it in RssFeedsParser.getFeeds(url)) {
if (it.pubDate() >= limitDateTime) {
temp.add(it.getRssData())
for (url in feddsUrls) {
for (it in RssFeedsParser.getFeeds(url)) {
if (it.pubDate() >= limitDateTime) {
temp.add(it.getRssData())
}
}
}
}
return Result.success().apply {
WorkersDb.insertBulkData(temp)
}

Some files were not shown because too many files have changed in this diff Show More