This commit is contained in:
lunaticbum
2024-11-11 18:12:06 +09:00
parent f2311bd7f9
commit 256a13b7df
219 changed files with 12544 additions and 326 deletions
+9 -1
View File
@@ -120,6 +120,8 @@
</intent-filter>
</activity>
<service
android:name=".feeds.rss.RssService"
android:permission="android.permission.BIND_JOB_SERVICE"
@@ -151,9 +153,15 @@
</intent-filter>
</receiver>
<activity
android:name="com.wuadam.awesomewebview.AwesomeWebViewActivity"
android:configChanges="keyboardHidden|orientation|screenSize"
android:hardwareAccelerated="true"
android:theme="@style/FinestWebViewTheme.Light" />
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:authorities="bums.lunatic.launcher.fileprovider"
android:exported="false"
android:enabled="true"
android:grantUriPermissions="true">
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,121 @@
/*
* 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.home
import android.content.Intent
import android.content.pm.PackageManager
import android.os.Bundle
import android.os.Environment
import android.print.PDFPrint
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.core.content.FileProvider
import androidx.core.net.toUri
import androidx.fragment.app.DialogFragment
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.RssViewerBinding
import bums.lunatic.launcher.utils.BLog
import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.google.android.material.bottomsheet.BottomSheetDialog
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
import java.io.File
import java.io.IOException
internal class RssViewer : DialogFragment() {
private lateinit var binding: RssViewerBinding
private lateinit var packageName: String
private lateinit var packageManager: PackageManager
private lateinit var defAppName: String
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setStyle(STYLE_NO_TITLE, R.style.FilterFullScreenDialog)
}
override fun onStart() {
super.onStart()
if (dialog != null) {
// val metrics = resources.displayMetrics
// val screenHeight = metrics.heightPixels
// val bottomSheet =
// dialog!!.findViewById<View>(com.google.android.material.R.id.design_bottom_sheet)
// bottomSheet.layoutParams.height = (screenHeight * 0.95).toInt()
// val behavior = BottomSheetBehavior.from(bottomSheet)
// behavior.state = BottomSheetBehavior.STATE_EXPANDED
// behavior.skipCollapsed = true
}
}
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = RssViewerBinding.inflate(inflater, container, false)
binding.webview.loadUrl(tag!!)
binding.webview.setDesktopMode(false)
binding.pdfPrint.setOnClickListener { pdfPring() }
return binding.root
}
fun pdfPring() {
val fileName = tag?.toUri()?.path?.replace("/","_")?.replace(".","_")
val path = File(Environment.getExternalStorageDirectory(),"bums")
if (path.exists() == false) {
path.mkdirs()
}
val file = File(path, fileName.plus(".pdf"))
BLog.LOGE("file >>> ${file.absolutePath}")
try {
PDFPrint.generatePDFFromWebView(file,binding.webview, object : PDFPrint.OnPDFPrintListener {
override fun onSuccess(file: File?) {
BLog.LOGE("file >>>> ${file!!.absolutePath}")
val shareIntent: Intent = Intent().apply {
action = Intent.ACTION_SEND
this.`package` = "com.synology.dsdrive"
val imageUri = FileProvider.getUriForFile(
lActivity!!,
"bums.lunatic.launcher.fileprovider", //(use your app signature + ".provider" )
file
)
putExtra(Intent.EXTRA_STREAM, imageUri)
type = "pdf"
}
lActivity!!.startActivity(shareIntent)
}
override fun onError(exception: java.lang.Exception?) {
Toast.makeText(lActivity!!,
"Pdf Save Failk ${exception?.localizedMessage}", Toast.LENGTH_LONG).show()
exception?.printStackTrace()
}
} )
} catch (e: IOException) {
e.printStackTrace()
}
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
// (requireDialog() as BottomSheetDialog).dismissWithAnimation = true
}
}
@@ -28,14 +28,13 @@ import androidx.core.net.toUri
import androidx.recyclerview.widget.DiffUtil
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import bums.lunatic.launcher.LauncherActivity.Companion.lActivity
import bums.lunatic.launcher.R
import bums.lunatic.launcher.databinding.ListItemWithBinding
import bums.lunatic.launcher.home.RssViewer
import bums.lunatic.launcher.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 bums.lunatic.launcher.utils.BLog
@@ -43,12 +42,13 @@ import bums.lunatic.launcher.workers.WorkersDb
import com.google.android.material.imageview.ShapeableImageView
import com.google.gson.Gson
import com.squareup.picasso.Picasso
import com.wuadam.awesomewebview.AwesomeWebView
import io.realm.kotlin.UpdatePolicy
import java.text.SimpleDateFormat
import java.util.Date
internal class RssItemAdapter (
internal class RssItemAdapter (
private val context: Context) : RecyclerView.Adapter<RssHolder>() {
companion object {
@SuppressLint("SimpleDateFormat")
@@ -74,16 +74,39 @@ internal class RssItemAdapter (
} else {
if (RssDataType.REDDIT_NSFW.equals(rss.category())) {
openReddit(rss.originPage())
// RssViewer().apply {
// show(lActivity!!.supportFragmentManager,rss.originPage)
// }
} else {
openOpera(rss.originPage())
RssViewer().apply {
show(lActivity!!.supportFragmentManager,rss.originPage)
}
// openOpera(rss.originPage())
}
}
}
}
RssDataType.REDDIT -> { openReddit(rss.originPage()) }
RssDataType.DOTAX -> { openDotax(rss.originPage()) }
RssDataType.YOUTUBE -> { openYouTube(rss.originPage()) }
else -> { openNews(rss.originPage()) }
RssDataType.REDDIT -> {
RssViewer().apply {
show(lActivity!!.supportFragmentManager,rss.originPage)
}
// openReddit(rss.originPage())
}
RssDataType.DOTAX -> {
RssViewer().apply {
AwesomeWebView.Builder(lActivity!!).show(rss.originPage!!)
// show(lActivity!!.supportFragmentManager,rss.originPage)
}
// openDotax(rss.originPage())
}
RssDataType.YOUTUBE -> { openYouTube(rss.originPage())
}
else -> {
RssViewer().apply {
show(lActivity!!.supportFragmentManager,rss.originPage)
}
// openNews(rss.originPage())
}
}
}
}
@@ -19,12 +19,12 @@ object RssList {
)
val newsFeeds = arrayListOf(
"https://news.google.com/rss?hl=ko&gl=KR&ceid=KR:ko",
"https://imnews.imbc.com/rss/google_news/narrativeNews.rss",
// "https://imnews.imbc.com/rss/google_news/narrativeNews.rss",
"http://www.hani.co.kr/rss",
"http://biz.heraldcorp.com/common_prog/rssdisp.php?ct=010000000000.xml",
"https://rss.inews24.com/rss/news_inews.xml",
"https://rss.nocutnews.co.kr/category/it.xml",
"https://rss.nocutnews.co.kr/news/news.xml",
// "https://rss.inews24.com/rss/news_inews.xml",
// "https://rss.nocutnews.co.kr/category/it.xml",
// "https://rss.nocutnews.co.kr/news/news.xml",
"https://rss.nocutnews.co.kr/news/top.xml",
)
@@ -26,12 +26,12 @@ class ArcaGetter : BaseGetter {
temp.clear()
val urls = arrayListOf(
"https://arca.live/b/singbung?mode=best",
// "https://arca.live/b/headline",
"https://arca.live/b/headline",
// "https://arca.live/b/live",
"https://arca.live/b/namuhotnow",
"https://arca.live/b/society",
// "https://arca.live/b/replay",
// "https://arca.live/b/breaking"
"https://arca.live/b/breaking"
)
urls.forEach {
Jsoup.connect(it)
@@ -70,7 +70,7 @@ class ClienGetter : BaseGetter {
RssDataType.CLIEN.isOn {
try {
temp.clear()
val testUrl2 = arrayListOf("https://www.clien.net/service/group/community")
val testUrl2 = arrayListOf("https://www.clien.net/service/group/community","https://www.clien.net/service/board/park","https://www.clien.net/service/board/news","https://www.clien.net/service/board/useful","https://www.clien.net/service/board/pds")
testUrl2.forEach { url ->
Jsoup.connect(url)
.userAgent(USAGT)
@@ -23,7 +23,7 @@ class DotaxGetter : BaseGetter {
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"
// "https://m.cafe.daum.net/dotax/_rec?page=3"
)
dotaxUrls?.forEach {
Jsoup.connect(it).userAgent(USAGT).get()?.let { dotax ->
@@ -48,7 +48,7 @@ class TheQooGetter : BaseGetter {
override fun realWork(): Result {
RssDataType.THEQOO.isOn {
try {
val testUrl2 = arrayListOf("https://theqoo.net/hot")
val testUrl2 = arrayListOf("https://theqoo.net/hot","https://theqoo.net/hot/category/512000937","https://theqoo.net/hot/category/24784","https://theqoo.net/hot/category/24788")
testUrl2.forEach { url ->
Jsoup.connect(url)
.userAgent(USAGT)
@@ -85,7 +85,9 @@ object WorkersDb {
try {
getRealm().writeBlocking {
try {
this.copyToRealm(it, UpdatePolicy.ERROR)
if(query<RssData>("chosung == $0",it.chosung).find().size == 0) {
this.copyToRealm(it, UpdatePolicy.ERROR)
}
} catch (e : Exception) {
}
+12 -12
View File
@@ -62,21 +62,21 @@
</androidx.appcompat.widget.Toolbar>
<androidx.recyclerview.widget.RecyclerView
android:layout_gravity="bottom|center_horizontal"
android:id="@+id/calendarDateView"
android:background="#ddd000"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
android:orientation="vertical"
app:spanCount="7"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="bums.lunatic.launcher.behavior.behaviorimpl.BehaviorRecT"
/>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.recyclerview.widget.RecyclerView
android:layout_gravity="bottom|center_horizontal"
android:id="@+id/calendarDateView"
android:background="#ddd000"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
android:orientation="vertical"
app:spanCount="7"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="bums.lunatic.launcher.behavior.behaviorimpl.BehaviorRecT"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_main"
@@ -228,12 +228,16 @@
android:visibility="gone"
android:background="@drawable/base_bg"
android:scrollbars="none"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
/>
<androidx.recyclerview.widget.RecyclerView
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"
android:layout_margin="@dimen/default_layout_margin"
android:id="@+id/smsList"
android:layout_width="0dp"
@@ -251,6 +255,7 @@
/>
<androidx.recyclerview.widget.RecyclerView
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_margin="@dimen/default_layout_margin"
android:id="@+id/infoList"
android:layout_width="0dp"
@@ -269,6 +274,7 @@
<androidx.recyclerview.widget.RecyclerView
android:layout_margin="@dimen/default_layout_margin"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:id="@+id/notiList"
android:layout_width="0dp"
android:layout_height="0dp"
+26
View File
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
android:background="#22000000"
android:padding="@dimen/default_padding"
android:clickable="true"
android:focusableInTouchMode="true">
<im.delight.android.webview.AdvancedWebView
android:layout_margin="@dimen/default_layout_margin"
android:id="@+id/webview"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageButton
app:layout_constraintTop_toBottomOf="@id/webview"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:id="@+id/pdf_print"
android:src="@drawable/ic_down"
android:layout_width="60dp"
android:layout_height="60dp"/>
</androidx.constraintlayout.widget.ConstraintLayout>
+7
View File
@@ -88,4 +88,11 @@
<item name="fontFamily">sans-serif-light</item>
</style>
<style name="FilterFullScreenDialog" parent="Theme.AppCompat.Dialog">
<item name="android:windowIsFloating">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:statusBarColor">#22000000</item>
</style>
</resources>