diff --git a/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt b/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt
index ae92ebe1..6883e08d 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/LauncherActivity.kt
@@ -26,7 +26,6 @@ import android.content.Context
import android.content.Intent
import android.content.SharedPreferences
import android.content.res.Configuration
-import android.graphics.Color
import android.net.Uri
import android.os.Build
import android.os.Bundle
@@ -485,14 +484,24 @@ open class LauncherActivity : CommonActivity() {
getWindow().addFlags(WindowManager.LayoutParams.FLAG_SECURE);
lActivity = this
- DynamicColors.applyToActivityIfAvailable(this)
+// DynamicColors.applyToActivityIfAvailable(this)
settingsPrefs = getSharedPreferences(PREFS_SETTINGS, 0)
binding = LauncherActivityBinding.inflate(layoutInflater)
setContentView(binding.root)
HeadsetActionButtonReceiver.register(this)
+ ViewCompat.setOnApplyWindowInsetsListener(binding.root) { view, windowInsets ->
+ // 시스템바 인셋 가져오기 (상단 상태바 + 하단 네비게이션바)
+ val insets = windowInsets.getInsets(WindowInsetsCompat.Type.systemBars())
+
+ // 뷰에 패딩 적용 (겹치지 않도록)
+ view.setPadding(insets.left, insets.top, insets.right, insets.bottom)
+
+ // 변경된 인셋 반환
+ WindowInsetsCompat.CONSUMED
+ }
/* handle navigation back events */
handleBackPress()
@@ -502,6 +511,13 @@ open class LauncherActivity : CommonActivity() {
showContents(binding.feeds.id)
+ binding.floatingActionMenu.setOnTouchListener { v,e->
+ if (binding.floatingActionMenu.isOpened) {
+ binding.floatingActionMenu.close(true)
+ return@setOnTouchListener true
+ }
+ return@setOnTouchListener false
+ }
binding.floatingActionMenu.setOnMenuButtonClickListener { v->
Blog.LOGE("v >> ${v}")
showContents(v.id)
@@ -614,16 +630,10 @@ open class LauncherActivity : CommonActivity() {
super.onDestroy()
}
- // var blutoothManager : BluetoothManager? = null
+
override fun onStart() {
super.onStart()
-// blutoothManager = BluetoothManager(this)
-// blutoothManager?.register()
-// blutoothManager?.initBluetoothAdapter()
-// blutoothManager?.blueToothState()
-// blutoothManager?.getPairedDevices()
- statusBarView()
- setBgColor()
+
}
@RequiresApi(Build.VERSION_CODES.O_MR1)
@@ -647,42 +657,6 @@ open class LauncherActivity : CommonActivity() {
}
- val appDrawer by lazy { AppDrawer() }
-
-
- fun switchAppDrawer() {
- startActivity(Intent(this,AppDrawer::class.java))
- }
-
-
-
-
- private fun setBgColor() {
- binding.root.setBackgroundColor(Color.parseColor("#22000000"))
- }
-
- private fun statusBarView() {
- if (settingsPrefs.getBoolean(KEY_STATUS_BAR, false)) {
- /* hide status bar */
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
- window.insetsController?.hide(WindowInsets.Type.statusBars())
- } else {
- @Suppress("DEPRECATION")
- window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN)
- }
- topPadding(false)
- } else {
- /* show status bar */
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
- window.insetsController?.show(WindowInsets.Type.statusBars())
- } else {
- @Suppress("DEPRECATION")
- window.clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
- }
- topPadding(true)
- }
- }
-
/* alternative of deprecated onBackPressed method */
private fun handleBackPress() {
onBackPressedDispatcher.addCallback(this, object : OnBackPressedCallback(true) {
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/LunaticLauncher.kt b/app/src/main/kotlin/bums/lunatic/launcher/LunaticLauncher.kt
index b9f0cbb6..cf622b58 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/LunaticLauncher.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/LunaticLauncher.kt
@@ -20,8 +20,8 @@ package bums.lunatic.launcher
import android.app.Application
import android.content.ComponentCallbacks2
-import android.content.Context
import android.database.sqlite.SQLiteDatabase
+import android.net.Uri
import bums.lunatic.launcher.helpers.HourlyLogWriter
import bums.lunatic.launcher.helpers.PrefHelper
import bums.lunatic.launcher.utils.Blog
@@ -30,12 +30,9 @@ import com.squareup.picasso.Picasso
import kr.lunaticbum.Base
import okhttp3.Cache
import okhttp3.OkHttpClient
-import org.json.JSONObject
-import org.mozilla.geckoview.ExperimentDelegate
-import org.mozilla.geckoview.GeckoResult
-import org.mozilla.geckoview.GeckoRuntime
-import org.mozilla.geckoview.GeckoRuntimeSettings
import java.io.File
+import java.io.IOException
+import java.net.HttpURLConnection
import java.util.concurrent.TimeUnit
@@ -64,16 +61,17 @@ internal class LunaticLauncher : Application() {
.cache(cache)
.addInterceptor { chain ->
val newRequest = chain.request().newBuilder()
- .addHeader("Host","images.ijavtorrent.com")
+ .addHeader("Host",chain.request().url().host())
.addHeader("User-Agent","Mozilla/5.0 (Android 15; Mobile; rv:139.0) Gecko/139.0 Firefox/139.0")
.addHeader("Accept","image/avif,image/webp,image/png,image/svg+xml,image/*;q=0.8,*/*;q=0.5")
.addHeader("Accept-Language","ko-KR,en-US;q=0.5")
.addHeader("Accept-Encoding","gzip, deflate, br, zstd")
- .addHeader("Referer","https://ijavtorrent.com/")
+ .addHeader("Referer",chain.request().url().host())
.build()
+ Blog.LOGE("chain.request().url() >>> ${chain.request().url()}")
chain.proceed(newRequest)
}
- .connectTimeout(10, TimeUnit.SECONDS) // 연결 타임아웃
+ .connectTimeout(30, TimeUnit.SECONDS) // 연결 타임아웃
.readTimeout(30, TimeUnit.SECONDS) // 읽기 타임아웃
.writeTimeout(30, TimeUnit.SECONDS) // 쓰기 타임아웃
.build()
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/common/CommonActivity.kt b/app/src/main/kotlin/bums/lunatic/launcher/common/CommonActivity.kt
index eb09b956..4a8e8529 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/common/CommonActivity.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/common/CommonActivity.kt
@@ -1,8 +1,16 @@
package bums.lunatic.launcher.common
import android.content.Intent
+import android.graphics.Color
+import android.os.Build
+import android.os.Bundle
import android.os.Environment
+import androidx.annotation.RequiresApi
import androidx.appcompat.app.AppCompatActivity
+import androidx.core.view.ViewCompat
+import androidx.core.view.WindowCompat
+import androidx.core.view.WindowInsetsCompat
+import androidx.core.view.WindowInsetsControllerCompat
import bums.lunatic.launcher.apps.SearchMenu
import bums.lunatic.launcher.helpers.PrefBoolean
import bums.lunatic.launcher.utils.Blog
@@ -23,6 +31,29 @@ import java.util.Base64
abstract class CommonActivity : AppCompatActivity() {
+ @RequiresApi(Build.VERSION_CODES.R)
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+
+
+ WindowCompat.setDecorFitsSystemWindows(window, false)
+ val insetsController = WindowInsetsControllerCompat(window, window.decorView)
+ var forWhite = false
+ if (forWhite) {
+ insetsController.isAppearanceLightStatusBars = true
+ insetsController.isAppearanceLightNavigationBars = true
+
+ window.statusBarColor = Color.WHITE
+ window.navigationBarColor = Color.WHITE
+ } else {
+ insetsController.isAppearanceLightStatusBars = false
+ insetsController.isAppearanceLightNavigationBars = false
+
+ window.statusBarColor = Color.BLACK
+ window.navigationBarColor = Color.BLACK
+ }
+ }
+
fun openSearchMenus(keyword : String, dismissCalback: DismissCalback) {
SearchMenu().show(supportFragmentManager,keyword) {dismissCalback.invoke()}
}
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/RssHome.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/RssHome.kt
index f15c0b9b..2089f540 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/home/RssHome.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/RssHome.kt
@@ -437,7 +437,6 @@ internal class RssHome : Fragment() {
}
}
appendReadCount(it, 1, false)
- Blog.LOGE("removeFirst >>> ${Gson().toJson(it)}")
binding.layoutRssSummary.title.setOnLongClickListener {
currentRss?.originPage?.let { binding.geckoWeb.loadUrl(it)}
binding.layoutRssSummary.root.visibility = View.GONE
@@ -461,18 +460,12 @@ internal class RssHome : Fragment() {
val regex = Regex("[A-Za-z0-9-]+")
val pattern = Regex("^(?=[A-Za-z0-9-]*$)(?=.*[A-Za-z])(?=.*\\d)(?=.*-)[A-Za-z0-9-]+$")
val results = regex.findAll(it)
- .map {
- Blog.LOGE("Regex:map >>> ${it.value}")
- it.value }
- .filter {
- Blog.LOGE("Regex:filter >>> ${it.matches(pattern)}")
- Blog.LOGE("Regex:filter >>> ${!it.contains(" ")}")
- it.matches(pattern) && !it.contains(" ") }
+ .map { it.value }
+ .filter { it.matches(pattern) && !it.contains(" ") }
.toList()
if (results.isNotEmpty()) {
keyword = results.first()
}
- Blog.LOGE("Regex:results >>> ${results}")
}
it.pubDate()?.let {
@@ -592,11 +585,12 @@ internal class RssHome : Fragment() {
}
binding.home.setOnClickListener {
- if (binding.geckoWeb.isVisible) {
+ if (binding.geckoWeb.isVisible || binding.layoutRssSummary.root.isVisible) {
binding.geckoWeb.visibility = View.GONE
+ binding.layoutRssSummary.root.visibility = View.GONE
+ } else {
+ queryInfos()
}
- binding.layoutRssSummary.root.visibility = View.GONE
- queryInfos()
}
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssItemAdapter.kt b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssItemAdapter.kt
index 2ee88563..ef43e73f 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssItemAdapter.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/home/adapters/RssItemAdapter.kt
@@ -209,14 +209,18 @@ internal class RssItemAdapter (
holder.view.circlePreview.visibility = rssData.category().getDefaultVisibiliy()
Picasso.get().cancelRequest(holder.view.circlePreview)
+ if (rssData.category().getResId() > 0) {
+ holder.view.circlePreview.setImageResource(rssData.category().getResId())
+ }
+
if (rssData.thumbnailUrl()?.length ?: 0 > 6) {
+ Blog.LOGE("rssData.thumbnailUrl() >>> ${rssData.thumbnailUrl()}")
Picasso.get().load(rssData.thumbnailUrl().replace("&", "&").toUri())
.into(holder.view.circlePreview)
- } else if (rssData.category().getResId() > 0) {
- holder.view.circlePreview.setImageResource(rssData.category().getResId())
- } else {
- holder.view.circlePreview.setImageDrawable(null)
}
+// else {
+// holder.view.circlePreview.setImageDrawable(null)
+// }
holder.itemView.tag = rssData
holder.itemView.setOnClickListener(dateViewClick)
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/model/RssDataInterface.kt b/app/src/main/kotlin/bums/lunatic/launcher/model/RssDataInterface.kt
index 8ad80ba2..612e63e1 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/model/RssDataInterface.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/model/RssDataInterface.kt
@@ -34,21 +34,20 @@ enum class RssDataType {
DCINSIDE -> R.drawable.dcinside
ARCA -> R.drawable.arca
else -> {
- 0
+ R.drawable.ic_news
}
}
fun defaultImgSize() = when (this) {
YOUTUBE -> 200
- REDDIT_NSFW,PRIVATE -> 360
- //,GURU,MOST
- else -> { 120 }
+ REDDIT_NSFW,PRIVATE -> 240
+ else -> { 160 }
}
fun getDefaultVisibiliy() = when (this) {
- //,GURU,MOST
- REDDIT_NSFW,PRIVATE -> View.GONE
+// REDDIT_NSFW,PRIVATE -> View.INVISIBLE
else -> { View.VISIBLE }
+
}
fun isOn(block : ()->Unit) {
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/tokiz/BaseToki.kt b/app/src/main/kotlin/bums/lunatic/launcher/tokiz/BaseToki.kt
index ba5eb26d..9673987b 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/tokiz/BaseToki.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/tokiz/BaseToki.kt
@@ -109,6 +109,7 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface {
var lastInfo: LastInfo? = null
var currentPage: ContentsPageInfo? = null
var saveContinuation = false
+ open var isPrivateMode = false
val handle = object : Handler(Looper.getMainLooper()) {
override fun handleMessage(msg: Message) {
if (msg.what == 0) {
@@ -614,8 +615,9 @@ abstract class BaseToki : Fragment(), PagedTextViewInterface {
goToHome()
}
getRuntime()?.apply {
+
val sessionSettings = GeckoSessionSettings.Builder()
- .usePrivateMode(true)
+ .usePrivateMode(isPrivateMode)
.allowJavascript(true)
.screenId(Random(Int.MAX_VALUE).nextInt())
.build()
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/tokiz/YouTube.kt b/app/src/main/kotlin/bums/lunatic/launcher/tokiz/YouTube.kt
index b3f8866c..ed378761 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/tokiz/YouTube.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/tokiz/YouTube.kt
@@ -12,6 +12,8 @@ class YouTube : BaseToki(){
override var lastNumber : Int = 143
override val webcontentsName : String = "youtube"
override val afterDot = "com"
+ override var isPrivateMode: Boolean = true
+
override fun getLastedDoamin(): String {
return String.format("https://%s.%s", webcontentsName, afterDot)
}
diff --git a/app/src/main/kotlin/bums/lunatic/launcher/tokiz/view/BWebview.kt b/app/src/main/kotlin/bums/lunatic/launcher/tokiz/view/BWebview.kt
index ac677880..8cd96d63 100644
--- a/app/src/main/kotlin/bums/lunatic/launcher/tokiz/view/BWebview.kt
+++ b/app/src/main/kotlin/bums/lunatic/launcher/tokiz/view/BWebview.kt
@@ -9,6 +9,7 @@ import android.util.AttributeSet
import android.view.MotionEvent
import android.view.PointerIcon
import android.view.View
+import androidx.core.net.toUri
import androidx.core.view.isVisible
import bums.lunatic.launcher.R
import bums.lunatic.launcher.helpers.ForeGroundService
@@ -102,7 +103,24 @@ open class BWebview : GeckoView {
var request = YoutubeDLRequest(url)
(mGKCookie?.COOKIES)?.let{
Blog.LOGE(it)
-// request.addOption("--cookies-from-browser", "$it")
+ val cookies = it.split(";")
+ .map { it.trim() }
+ .mapNotNull {
+ val parts = it.split("=", limit = 2)
+ if (parts.size == 2) parts[0] to parts[1] else null
+ }
+ .toMap()
+ val expires = (System.currentTimeMillis() / 1000) + 3600 * 24 * 7 // 일주일 후 만료 예시
+
+ val cookieFileContent = buildString {
+ appendLine("# Netscape HTTP Cookie File")
+ for ((name, value) in cookies) {
+ appendLine(".${url.toUri().host}\tTRUE\t/\tTRUE\t$expires\t$name\t$value")
+ }
+ }
+ val cookieFile = File(context.filesDir, "cookies.txt")
+ cookieFile.writeText(cookieFileContent)
+ request.addOption("--cookies", cookieFile.absolutePath)
}
val videoInfo = YoutubeDL.getInstance().getInfo(request)
@@ -121,6 +139,7 @@ open class BWebview : GeckoView {
}
} catch (e: Exception) {
+ e.printStackTrace()
Blog.LOGE("checkIfDownloadable ${url} ${e}")
CoroutineScope(Dispatchers.Main).launch {
runOnUiThread {
diff --git a/app/src/main/res/drawable/ic_news.png b/app/src/main/res/drawable/ic_news.png
new file mode 100644
index 00000000..2e38e843
Binary files /dev/null and b/app/src/main/res/drawable/ic_news.png differ
diff --git a/app/src/main/res/layout/launcher_activity.xml b/app/src/main/res/layout/launcher_activity.xml
index 8c9a967d..4471b012 100644
--- a/app/src/main/res/layout/launcher_activity.xml
+++ b/app/src/main/res/layout/launcher_activity.xml
@@ -5,7 +5,7 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
- android:background="@drawable/base_bg"
+ android:background="@android:color/transparent"
android:orientation="vertical"
android:id="@+id/mainFragmentsContainer"
>
@@ -26,31 +26,17 @@
app:layout_constraintTop_toBottomOf="@id/fragment_container"
app:layout_constraintLeft_toLeftOf="parent"
android:id="@+id/back"
- android:scaleType="fitCenter"
- android:adjustViewBounds="true"
- android:visibility="visible"
- android:background="@null"
android:src="@drawable/back_vector"
- android:tint="@color/white"
- android:foregroundTint="@color/white"
- android:layout_width="@dimen/main_top_height"
tools:ignore="ContentDescription"
- android:layout_height="@dimen/main_top_height" />
+ style="@style/CommonBottom" />
+ style="@style/CommonBottom"/>
- "/>
+
+ style="@style/CommonBottom"/>
+ style="@style/CommonBottom"/>
@@ -117,4 +117,15 @@
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml
index a4dd9b76..f1337d37 100644
--- a/app/src/main/res/values/themes.xml
+++ b/app/src/main/res/values/themes.xml
@@ -1,14 +1,15 @@
-