This commit is contained in:
lunaticbum 2025-08-25 15:20:30 +09:00
parent 6c4d7e68f6
commit e646a72418
13 changed files with 129 additions and 121 deletions

View File

@ -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) {

View File

@ -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()

View File

@ -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()}
}

View File

@ -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()
}

View File

@ -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)

View File

@ -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) {

View File

@ -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()

View File

@ -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)
}

View File

@ -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 {

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

View File

@ -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" />
<ImageButton
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/fragment_container"
app:layout_constraintLeft_toRightOf="@id/back"
android:id="@+id/reload"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:visibility="visible"
android:background="@null"
android:src="@drawable/ic_refresh"
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"/>
<TextView
android:text="asdasdsadasd"
android:id="@+id/current_address"
@ -64,38 +50,25 @@
app:layout_constraintRight_toRightOf="parent"
android:layout_width="0dp"
android:layout_height="@dimen/main_top_height"/>
"/>
<ImageButton
app:layout_constraintTop_toTopOf="@id/back"
app:layout_constraintRight_toLeftOf="@id/share"
app:layout_constraintBottom_toBottomOf="parent"
android:id="@+id/dl_video"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:visibility="gone"
android:background="@null"
android:tint="@color/white"
android:foregroundTint="@color/white"
android:src="@drawable/dl_vid"
android:layout_width="@dimen/main_top_height"
tools:ignore="ContentDescription"
android:layout_height="@dimen/main_top_height" />
style="@style/CommonBottom"/>
<ImageButton
app:layout_constraintTop_toTopOf="@id/back"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_marginRight="60dp"
android:id="@+id/share"
android:scaleType="fitCenter"
android:adjustViewBounds="true"
android:visibility="visible"
android:background="@null"
android:tint="@color/white"
android:foregroundTint="@color/white"
android:src="@drawable/ic_share"
android:layout_width="@dimen/main_top_height"
tools:ignore="ContentDescription"
android:layout_height="@dimen/main_top_height" />
style="@style/CommonBottom"/>
<bums.lunatic.launcher.view.FloatingActionMenu
android:id="@+id/floating_action_menu"
android:layout_margin="5dp"

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="Theme.LunarLauncher.Starting" parent="Theme.SplashScreen">
<item name="windowSplashScreenBackground">@color/ic_launcher_primary</item>
<item name="windowSplashScreenBackground">@color/ic_launcher_secondary</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/ic_launcher</item>
<item name="windowSplashScreenAnimationDuration">1000</item>
<item name="postSplashScreenTheme">@style/Theme.LunarLauncher</item>
@ -37,8 +37,8 @@
<item name="civ_border_color">#000000</item>
</style>
<style name="asdda" parent="Widget.Material3.Button.OutlinedButton">
<!-- <item name="android:paddingLeft">@dimen/m3_btn_padding_left</item>-->
<!-- <item name="android:paddingRight">@dimen/m3_btn_padding_right</item>-->
<!-- <item name="android:paddingLeft">@dimen/m3_btn_padding_left</item>-->
<!-- <item name="android:paddingRight">@dimen/m3_btn_padding_right</item>-->
<item name="strokeColor">#00FFFFFF</item>
<item name="strokeWidth">2dp</item>
</style>
@ -117,4 +117,15 @@
</style>
<style name="CommonBottom">
<item name="android:scaleType">fitCenter</item>
<item name="android:adjustViewBounds">true</item>
<item name="android:visibility">visible</item>
<item name="android:background">@android:color/transparent</item>
<item name="android:tint">@color/white</item>
<item name="android:foregroundTint">@color/white</item>
<item name="android:layout_width">@dimen/main_top_height</item>
<item name="android:layout_height">@dimen/main_top_height</item>
</style>
</resources>

View File

@ -1,14 +1,15 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.LunarLauncher" parent="Theme.Material3.Light.NoActionBar">
<style name="Theme.LunarLauncher" parent="Theme.Material3.DynamicColors.DayNight.NoActionBar">
<!-- Background -->
<item name="android:windowShowWallpaper">true</item>
<!-- System bars -->
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@color/navigation_bar</item>
<item name="android:windowLightStatusBar">true</item>
<item name="android:windowLightNavigationBar" tools:targetApi="27">true</item>
<!-- <item name="android:windowDrawsSystemBarBackgrounds">true</item>-->
<!-- <item name="android:statusBarColor">@android:color/transparent</item>-->
<!-- <item name="android:navigationBarColor">@color/navigation_bar</item>-->
<!-- <item name="android:windowLightStatusBar">false</item>-->
<!-- <item name="android:windowLightNavigationBar" tools:targetApi="27">false</item>-->
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<!-- Widgets -->