This commit is contained in:
lunaticbum 2024-09-13 11:11:28 +09:00
parent 68839e1e73
commit c8bd83689e
28 changed files with 160 additions and 2009 deletions

View File

@ -94,8 +94,8 @@ import rasel.lunar.launcher.home.LauncherHome.Companion.lastedFinishedPageUrl
import rasel.lunar.launcher.home.LauncherHome.Companion.listTags import rasel.lunar.launcher.home.LauncherHome.Companion.listTags
import rasel.lunar.launcher.model.MissD import rasel.lunar.launcher.model.MissD
import rasel.lunar.launcher.model.RssData import rasel.lunar.launcher.model.RssData
import rasel.lunar.launcher.model.RssItem import rasel.lunar.launcher.model.JGuru
import rasel.lunar.launcher.model.RssTagItem import rasel.lunar.launcher.model.jGuruTag
import rasel.lunar.launcher.model.getRssData import rasel.lunar.launcher.model.getRssData
import rasel.lunar.launcher.model.getT import rasel.lunar.launcher.model.getT
import rasel.lunar.launcher.utils.BLog import rasel.lunar.launcher.utils.BLog
@ -146,9 +146,9 @@ internal class LauncherActivity : AppCompatActivity() {
val COMIC_WORK_TAG = "ComicGetter" val COMIC_WORK_TAG = "ComicGetter"
val COMIC2_WORK_TAG = "ComicGetter2" val COMIC2_WORK_TAG = "ComicGetter2"
val REDDIT_WORK_TAG = "RedditGetter" val REDDIT_WORK_TAG = "RedditGetter"
val shortTimePeriod = 200L val shortTimePeriod = 20L
val longTimePeriod = 600L val longTimePeriod = 60L
val midTimePeriod = 300L val midTimePeriod = 30L
var isOpendFold = false var isOpendFold = false
val qDayPeriod = 60L * 8L val qDayPeriod = 60L * 8L
@ -165,7 +165,7 @@ internal class LauncherActivity : AppCompatActivity() {
.addTag(SMS_WORK_TAG) .addTag(SMS_WORK_TAG)
.build()) .build())
}, 1, TimeUnit.SECONDS) }, 1, TimeUnit.SECONDS)
var delay = 1L var delay = 3L
Executors.newSingleThreadScheduledExecutor().schedule({ Executors.newSingleThreadScheduledExecutor().schedule({
mWorkManager?.cancelAllWorkByTag(ContactInfoGetter.TAG) mWorkManager?.cancelAllWorkByTag(ContactInfoGetter.TAG)
mWorkManager?.enqueueUniquePeriodicWork( mWorkManager?.enqueueUniquePeriodicWork(
@ -183,7 +183,6 @@ internal class LauncherActivity : AppCompatActivity() {
.addTag(AppInfoGetter.TAG) .addTag(AppInfoGetter.TAG)
.build()) .build())
}, delay, TimeUnit.SECONDS) }, delay, TimeUnit.SECONDS)
delay = delay + 3L delay = delay + 3L
Executors.newSingleThreadScheduledExecutor().schedule({ Executors.newSingleThreadScheduledExecutor().schedule({
mWorkManager?.cancelAllWorkByTag(RecentCallGetter.TAG) mWorkManager?.cancelAllWorkByTag(RecentCallGetter.TAG)
@ -859,7 +858,7 @@ internal class LauncherActivity : AppCompatActivity() {
var actor = if (it.getElementsByClass("wpptax").size > 0 )it.getElementsByClass("wpptax").get(0).text() else "" var actor = if (it.getElementsByClass("wpptax").size > 0 )it.getElementsByClass("wpptax").get(0).text() else ""
if (pageLink.length > 0 && imgg.length > 0 && title.length > 0 && model.length > 0) { if (pageLink.length > 0 && imgg.length > 0 && title.length > 0 && model.length > 0) {
temp.add( temp.add(
RssItem( JGuru(
model = model, model = model,
title = title, title = title,
pageLink = pageLink, pageLink = pageLink,
@ -893,7 +892,7 @@ internal class LauncherActivity : AppCompatActivity() {
minDate = Math.min(minDate,regDate) minDate = Math.min(minDate,regDate)
maxDate = Math.max(maxDate,regDate) maxDate = Math.max(maxDate,regDate)
temp.add(RssItem(model = model, title = title, pageLink = pageLink, image = imgg, tags = tags, date = make0H(simpldateFormat.parse(date))).getRssData()) temp.add(JGuru(model = model, title = title, pageLink = pageLink, image = imgg, tags = tags, date = make0H(simpldateFormat.parse(date))).getRssData())
}.apply { }.apply {
var itemC = 0 var itemC = 0
WorkersDb.insertBulkInteface(temp) WorkersDb.insertBulkInteface(temp)
@ -911,7 +910,7 @@ internal class LauncherActivity : AppCompatActivity() {
it.children().forEach { it.children().forEach {
if (it.tag().name.contains("li")) { if (it.tag().name.contains("li")) {
listTags.add( listTags.add(
RssTagItem( jGuruTag(
tagTitle = it.getElementsByTag("a").get(0).text(), tagTitle = it.getElementsByTag("a").get(0).text(),
link = it.getElementsByTag("a").get(0).attr("href") link = it.getElementsByTag("a").get(0).attr("href")
) )

View File

@ -40,6 +40,7 @@ import android.widget.EditText
import androidx.activity.result.contract.ActivityResultContracts import androidx.activity.result.contract.ActivityResultContracts
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.appcompat.widget.PopupMenu import androidx.appcompat.widget.PopupMenu
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.core.view.isVisible import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.Lifecycle import androidx.lifecycle.Lifecycle
@ -77,7 +78,7 @@ import rasel.lunar.launcher.model.MostItem
import rasel.lunar.launcher.model.RssData import rasel.lunar.launcher.model.RssData
import rasel.lunar.launcher.model.RssDataInterface import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.RssDataType import rasel.lunar.launcher.model.RssDataType
import rasel.lunar.launcher.model.RssTagItem import rasel.lunar.launcher.model.jGuruTag
import rasel.lunar.launcher.model.dateFormat import rasel.lunar.launcher.model.dateFormat
import rasel.lunar.launcher.model.getRssData import rasel.lunar.launcher.model.getRssData
import rasel.lunar.launcher.utils.BLog import rasel.lunar.launcher.utils.BLog
@ -96,7 +97,7 @@ internal class Feeds : Fragment() , CommadCallabck {
private lateinit var binding: FeedsBinding private lateinit var binding: FeedsBinding
private val requestCodeString = "requestCode" private val requestCodeString = "requestCode"
var mRssAdapter : RssAdapter<RssDataInterface>? = null var mRssAdapter : RssAdapter<RssDataInterface>? = null
var mRssAdapter2 : RssAdapter<RssTagItem>? = null var mRssAdapter2 : RssAdapter<jGuruTag>? = null
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View { override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View {
binding = FeedsBinding.inflate(inflater, container, false) binding = FeedsBinding.inflate(inflater, container, false)
mRssAdapter = RssAdapter(requireContext()) mRssAdapter = RssAdapter(requireContext())
@ -578,39 +579,39 @@ internal class Feeds : Fragment() , CommadCallabck {
} }
private fun createWidget(appWidgetId: Int, height: Int?) { private fun createWidget(appWidgetId: Int, height: Int?) {
// if (appWidgetId == -1) return if (appWidgetId == -1) return
//
// val appWidgetInfo = appWidgetManager!!.getAppWidgetInfo(appWidgetId) val appWidgetInfo = appWidgetManager!!.getAppWidgetInfo(appWidgetId)
// val params: LayoutParams? val params: ConstraintLayout.LayoutParams?
//
// when (height) { when (height) {
// null -> { null -> {
// params = ConstraintLayout.LayoutParams(LayoutParams.MATCH_PARENT, appWidgetInfo.minHeight) params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, appWidgetInfo.minHeight)
// val updatedIds = splitWidgetIds.plus("$appWidgetId") val updatedIds = splitWidgetIds.plus("$appWidgetId")
// val updatedHeights = splitWidgetHeights.plus("${appWidgetInfo.minHeight}") val updatedHeights = splitWidgetHeights.plus("${appWidgetInfo.minHeight}")
// saveWidgetData(updatedIds, updatedHeights) saveWidgetData(updatedIds, updatedHeights)
// } }
// else -> params = ConstraintLayout.LayoutParams(LayoutParams.MATCH_PARENT, height) else -> params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, height)
// } }
//
// (appWidgetHost?.createView(lActivity!!.applicationContext, appWidgetId, appWidgetInfo) as WidgetHostView) (appWidgetHost?.createView(lActivity!!.applicationContext, appWidgetId, appWidgetInfo) as WidgetHostView)
// .apply { .apply {
// setAppWidget(appWidgetId, appWidgetInfo) setAppWidget(appWidgetId, appWidgetInfo)
// }.let { }.let {
// binding.widgetContainer.addView(it, params) binding.widgetContainer.addView(it, params)
// widgetMenu(it) widgetMenu(it)
// } }
} }
private fun updateWidgets() { private fun updateWidgets() {
// if (splitWidgetIds.size > 0) { if (splitWidgetIds.size > 0) {
// viewLifecycleOwner.lifecycleScope.launch { viewLifecycleOwner.lifecycleScope.launch {
// binding.widgetContainer.removeAllViews() binding.widgetContainer.removeAllViews()
// splitWidgetIds.indices.forEach { i: Int -> splitWidgetIds.indices.forEach { i: Int ->
// createWidget(splitWidgetIds[i]!!.int(), splitWidgetHeights[i]!!.int()) createWidget(splitWidgetIds[i]!!.int(), splitWidgetHeights[i]!!.int())
// } }
// } }
// } }
} }
private fun widgetMenu(hostView: WidgetHostView) { private fun widgetMenu(hostView: WidgetHostView) {

View File

@ -33,8 +33,8 @@ import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.databinding.ListItemWithBinding import rasel.lunar.launcher.databinding.ListItemWithBinding
import rasel.lunar.launcher.model.RssDataInterface import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.RssDataType import rasel.lunar.launcher.model.RssDataType
import rasel.lunar.launcher.model.RssItem import rasel.lunar.launcher.model.JGuru
import rasel.lunar.launcher.todos.RssItemDiffUtil import rasel.lunar.launcher.home.adapters.RssItemDiffUtil
import java.net.URLEncoder import java.net.URLEncoder
import java.nio.charset.Charset import java.nio.charset.Charset
import java.text.SimpleDateFormat import java.text.SimpleDateFormat
@ -95,7 +95,7 @@ internal class RssAdapter<T : RssDataInterface>(private val context: Context) :
} }
holder.view.root.setOnLongClickListener { holder.view.root.setOnLongClickListener {
if(item is RssItem) { if(item is JGuru) {
openOpera( openOpera(
"https://cili.site/search?q=${ "https://cili.site/search?q=${
URLEncoder.encode( URLEncoder.encode(

View File

@ -84,10 +84,10 @@ import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.RssDataType import rasel.lunar.launcher.model.RssDataType
import rasel.lunar.launcher.qaccess.QuickAccess import rasel.lunar.launcher.qaccess.QuickAccess
import rasel.lunar.launcher.settings.SettingsActivity import rasel.lunar.launcher.settings.SettingsActivity
import rasel.lunar.launcher.todos.MissedCallsAdapter import rasel.lunar.launcher.home.adapters.RecentCallsAdapter
import rasel.lunar.launcher.todos.NotificationItemAdapter import rasel.lunar.launcher.home.adapters.NotificationItemAdapter
import rasel.lunar.launcher.todos.RssItemAdapter import rasel.lunar.launcher.home.adapters.RssItemAdapter
import rasel.lunar.launcher.todos.SmsLogsAdapter import rasel.lunar.launcher.home.adapters.SmsLogsAdapter
import rasel.lunar.launcher.utils.BLog import rasel.lunar.launcher.utils.BLog
import rasel.lunar.launcher.utils.BitmapConverter import rasel.lunar.launcher.utils.BitmapConverter
import rasel.lunar.launcher.utils.JamoUtils import rasel.lunar.launcher.utils.JamoUtils
@ -164,7 +164,7 @@ internal class LauncherHome : Fragment() {
fragManager = lActivity!!.supportFragmentManager fragManager = lActivity!!.supportFragmentManager
settingsPrefs = requireContext().getSharedPreferences(PREFS_SETTINGS, 0) settingsPrefs = requireContext().getSharedPreferences(PREFS_SETTINGS, 0)
batteryReceiver = BatteryReceiver(binding.batteryProgress) batteryReceiver = BatteryReceiver(binding.batteryProgress)
mMissedCallsAdapter = MissedCallsAdapter(callList, requireContext()) mRecentCallsAdapter = RecentCallsAdapter(callList, requireContext())
mSmsLogsAdapter = SmsLogsAdapter(smsList, requireContext()) mSmsLogsAdapter = SmsLogsAdapter(smsList, requireContext())
mNotiAdapter = NotificationItemAdapter(requireContext()) mNotiAdapter = NotificationItemAdapter(requireContext())
mRssAdapter = RssItemAdapter(requireContext()) mRssAdapter = RssItemAdapter(requireContext())
@ -182,7 +182,7 @@ internal class LauncherHome : Fragment() {
binding.smsList.layoutManager = GridLayoutManager(requireContext(),2) binding.smsList.layoutManager = GridLayoutManager(requireContext(),2)
binding.infoList.layoutManager = LinearLayoutManager(requireContext()) binding.infoList.layoutManager = LinearLayoutManager(requireContext())
binding.mainList.adapter = mMissedCallsAdapter binding.mainList.adapter = mRecentCallsAdapter
binding.smsList.adapter = mSmsLogsAdapter binding.smsList.adapter = mSmsLogsAdapter
binding.infoList.adapter = mRssAdapter binding.infoList.adapter = mRssAdapter
binding.notiList.adapter = mNotiAdapter binding.notiList.adapter = mNotiAdapter
@ -452,7 +452,7 @@ internal class LauncherHome : Fragment() {
var infosJob : Job? = null var infosJob : Job? = null
var noticeJob : Job? = null var noticeJob : Job? = null
lateinit var mMissedCallsAdapter : MissedCallsAdapter lateinit var mRecentCallsAdapter : RecentCallsAdapter
lateinit var mSmsLogsAdapter : SmsLogsAdapter lateinit var mSmsLogsAdapter : SmsLogsAdapter
lateinit var mRssAdapter : RssItemAdapter lateinit var mRssAdapter : RssItemAdapter
lateinit var mNotiAdapter : NotificationItemAdapter lateinit var mNotiAdapter : NotificationItemAdapter
@ -638,7 +638,7 @@ internal class LauncherHome : Fragment() {
callList.addAll(copyFromRealm(result)) callList.addAll(copyFromRealm(result))
binding.missedCalls.text = "최근 통화 [${callList.size}]" binding.missedCalls.text = "최근 통화 [${callList.size}]"
binding.mainList.visibility = View.VISIBLE binding.mainList.visibility = View.VISIBLE
mMissedCallsAdapter.updateData(callList) mRecentCallsAdapter.updateData(callList)
binding.recentSms.isSelected = false binding.recentSms.isSelected = false
binding.otherCheck.isSelected = false binding.otherCheck.isSelected = false
binding.notice.isSelected = false binding.notice.isSelected = false

View File

@ -1,4 +1,4 @@
package rasel.lunar.launcher.todos package rasel.lunar.launcher.home.adapters
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package rasel.lunar.launcher.todos package rasel.lunar.launcher.home.adapters
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package rasel.lunar.launcher.todos package rasel.lunar.launcher.home.adapters
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
@ -35,15 +35,15 @@ import rasel.lunar.launcher.utils.getContactId
import rasel.lunar.launcher.workers.RecentCall import rasel.lunar.launcher.workers.RecentCall
internal class MissedCallsAdapter( internal class RecentCallsAdapter(
private val callList: ArrayList<RecentCall>, private val callList: ArrayList<RecentCall>,
private val context: Context) : RecyclerView.Adapter<MissedCallsAdapter.MissedCallsHolder>() { private val context: Context) : RecyclerView.Adapter<RecentCallsAdapter.RecentCallsHolder>() {
private val currentFragment = lActivity!!.supportFragmentManager.findFragmentById(R.id.mainFragmentsContainer) private val currentFragment = lActivity!!.supportFragmentManager.findFragmentById(R.id.mainFragmentsContainer)
override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int): MissedCallsHolder { override fun onCreateViewHolder(viewGroup: ViewGroup, i: Int): RecentCallsHolder {
val binding = CalllogItemBinding.inflate(LayoutInflater.from(viewGroup.context), viewGroup, false) val binding = CalllogItemBinding.inflate(LayoutInflater.from(viewGroup.context), viewGroup, false)
return MissedCallsHolder(binding) return RecentCallsHolder(binding)
} }
override fun getItemCount(): Int { override fun getItemCount(): Int {
@ -52,7 +52,7 @@ internal class MissedCallsAdapter(
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
override fun onBindViewHolder(holder: MissedCallsHolder, position: Int) { override fun onBindViewHolder(holder: RecentCallsHolder, position: Int) {
val todo = callList[position] val todo = callList[position]
holder.view.name.text = if(todo.name.equals("unknown")) todo.number else { todo.name} holder.view.name.text = if(todo.name.equals("unknown")) todo.number else { todo.name}
@ -90,7 +90,7 @@ internal class MissedCallsAdapter(
} }
inner class MissedCallsHolder(var view: CalllogItemBinding) : RecyclerView.ViewHolder(view.root) inner class RecentCallsHolder(var view: CalllogItemBinding) : RecyclerView.ViewHolder(view.root)
/* update dialog */ /* update dialog */
private fun updateDialog(position: Int) { private fun updateDialog(position: Int) {
@ -130,7 +130,7 @@ internal class MissedCallsAdapter(
} }
fun updateData(newList: ArrayList<RecentCall>) { fun updateData(newList: ArrayList<RecentCall>) {
val diffUtilResult = DiffUtil.calculateDiff(MissedCallDiffUtil(callList, newList)) val diffUtilResult = DiffUtil.calculateDiff(RecentCallDiffUtil(callList, newList))
diffUtilResult.dispatchUpdatesTo(this) diffUtilResult.dispatchUpdatesTo(this)
// callList.clear() // callList.clear()
// callList.addAll(newList) // callList.addAll(newList)
@ -138,7 +138,7 @@ internal class MissedCallsAdapter(
} }
internal class MissedCallDiffUtil( internal class RecentCallDiffUtil(
private val oldList: List<RecentCall>, private val newList: List<RecentCall> private val oldList: List<RecentCall>, private val newList: List<RecentCall>
) : DiffUtil.Callback() { ) : DiffUtil.Callback() {

View File

@ -1,13 +1,12 @@
package rasel.lunar.launcher.todos package rasel.lunar.launcher.home.adapters
import android.util.Xml import android.util.Xml
import com.google.gson.Gson import com.google.gson.Gson
import org.xmlpull.v1.XmlPullParser import org.xmlpull.v1.XmlPullParser
import org.xmlpull.v1.XmlPullParserException import org.xmlpull.v1.XmlPullParserException
import rasel.lunar.launcher.model.RssDataInterface import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.RssDataType import rasel.lunar.launcher.model.NewsData
import rasel.lunar.launcher.model.others.Reddit import rasel.lunar.launcher.model.others.Reddit
import rasel.lunar.launcher.utils.JamoUtils
import rasel.lunar.launcher.utils.beforeDay import rasel.lunar.launcher.utils.beforeDay
import java.io.IOException import java.io.IOException
import java.io.InputStream import java.io.InputStream
@ -74,7 +73,7 @@ object RssFeedsParser {
} }
@Throws(XmlPullParserException::class, IOException::class) @Throws(XmlPullParserException::class, IOException::class)
private fun readFeed(parser: XmlPullParser): List<RssFeed> { private fun readFeed(parser: XmlPullParser): List<NewsData> {
parser.require(XmlPullParser.START_TAG, null, "rss") parser.require(XmlPullParser.START_TAG, null, "rss")
var title: String? = null var title: String? = null
@ -82,7 +81,7 @@ object RssFeedsParser {
var date = 0L var date = 0L
var desc : String? = null var desc : String? = null
var source : String? = null var source : String? = null
val items: MutableList<RssFeed> = ArrayList() val items: MutableList<NewsData> = ArrayList()
while (parser.next() != XmlPullParser.END_DOCUMENT) { while (parser.next() != XmlPullParser.END_DOCUMENT) {
if (parser.eventType != XmlPullParser.START_TAG) { if (parser.eventType != XmlPullParser.START_TAG) {
@ -107,7 +106,7 @@ object RssFeedsParser {
} }
if (date > limitDateTime && title != null && link != null) { if (date > limitDateTime && title != null && link != null) {
val item = RssFeed(title, link) val item = NewsData(title, link)
item.pubDate = date item.pubDate = date
item.source = source item.source = source
item.description = desc item.description = desc
@ -174,44 +173,3 @@ object RssFeedsParser {
} }
} }
class RssFeed : RssDataInterface {
var title : String? = ""
var link : String? = ""
var guid : String? = ""
var description : String? = ""
var pubDate : Long = 0L
var source : String? = ""
constructor(title: String?,link: String?) {
this.link = link
this.title = title
}
override fun title(): String {
return title ?: ""
}
override fun thumbnailUrl(): String {
return source ?: ""
}
override fun originPage(): String {
return link ?: ""
}
override fun description(): String {
return description ?: ""
}
override fun pubDate(): Long {
return pubDate
}
override fun category(): RssDataType {
return RssDataType.NewsFeed
}
override fun getCho(): String? {
return JamoUtils.split(title()).joinToString("")
}
}

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package rasel.lunar.launcher.todos package rasel.lunar.launcher.home.adapters
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package rasel.lunar.launcher.todos package rasel.lunar.launcher.home.adapters
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context
@ -28,10 +28,10 @@ import com.google.gson.Gson
import rasel.lunar.launcher.LauncherActivity.Companion.lActivity import rasel.lunar.launcher.LauncherActivity.Companion.lActivity
import rasel.lunar.launcher.R import rasel.lunar.launcher.R
import rasel.lunar.launcher.databinding.ListItemBinding import rasel.lunar.launcher.databinding.ListItemBinding
import rasel.lunar.launcher.model.RssTagItem import rasel.lunar.launcher.model.jGuruTag
internal class RssTagAdapter( internal class RssTagAdapter(
private val smsList: ArrayList<RssTagItem>, private val smsList: ArrayList<jGuruTag>,
private val context: Context) : RecyclerView.Adapter<RssTagAdapter.RssTag>() { private val context: Context) : RecyclerView.Adapter<RssTagAdapter.RssTag>() {
private val currentFragment = lActivity!!.supportFragmentManager.findFragmentById(R.id.mainFragmentsContainer) private val currentFragment = lActivity!!.supportFragmentManager.findFragmentById(R.id.mainFragmentsContainer)
@ -64,7 +64,7 @@ internal class RssTagAdapter(
inner class RssTag(var view: ListItemBinding) : RecyclerView.ViewHolder(view.root) inner class RssTag(var view: ListItemBinding) : RecyclerView.ViewHolder(view.root)
fun updateData(newList: List<RssTagItem>) { fun updateData(newList: List<jGuruTag>) {
val diffUtilResult = DiffUtil.calculateDiff(RssTagDiffUtil(smsList, newList)) val diffUtilResult = DiffUtil.calculateDiff(RssTagDiffUtil(smsList, newList))
diffUtilResult.dispatchUpdatesTo(this) diffUtilResult.dispatchUpdatesTo(this)
// smsList.clear() // smsList.clear()
@ -111,7 +111,7 @@ internal class RssTagAdapter(
} }
internal class RssTagDiffUtil( internal class RssTagDiffUtil(
private val oldList: List<RssTagItem>, private val newList: List<RssTagItem> private val oldList: List<jGuruTag>, private val newList: List<jGuruTag>
) : DiffUtil.Callback() { ) : DiffUtil.Callback() {
override fun getOldListSize(): Int = oldList.size override fun getOldListSize(): Int = oldList.size

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
package rasel.lunar.launcher.todos package rasel.lunar.launcher.home.adapters
import android.annotation.SuppressLint import android.annotation.SuppressLint
import android.content.Context import android.content.Context

View File

@ -42,7 +42,7 @@ class MissD : RssDataInterface {
} }
} }
class MostItem : RssItem , RssDataInterface { class MostItem : JGuru , RssDataInterface {
constructor() : super() constructor() : super()
@ -74,7 +74,7 @@ class MostItem : RssItem , RssDataInterface {
return JamoUtils.split(title!!).joinToString("") return JamoUtils.split(title!!).joinToString("")
} }
} }
open class RssItem : RssDataInterface { open class JGuru : RssDataInterface {
var model : String = "" var model : String = ""
var title : String = "" var title : String = ""
var pageLink : String = "" var pageLink : String = ""
@ -131,7 +131,7 @@ open class RssItem : RssDataInterface {
} }
} }
class RssTagItem : RssDataInterface { class jGuruTag : RssDataInterface {
var link : String = "" var link : String = ""
var tagTitle = "" var tagTitle = ""
var count = 0 var count = 0

View File

@ -0,0 +1,45 @@
package rasel.lunar.launcher.model
import rasel.lunar.launcher.utils.JamoUtils
class NewsData : RssDataInterface {
var title : String? = ""
var link : String? = ""
var guid : String? = ""
var description : String? = ""
var pubDate : Long = 0L
var source : String? = ""
constructor(title: String?,link: String?) {
this.link = link
this.title = title
}
override fun title(): String {
return title ?: ""
}
override fun thumbnailUrl(): String {
return source ?: ""
}
override fun originPage(): String {
return link ?: ""
}
override fun description(): String {
return description ?: ""
}
override fun pubDate(): Long {
return pubDate
}
override fun category(): RssDataType {
return RssDataType.NewsFeed
}
override fun getCho(): String? {
return JamoUtils.split(title()).joinToString("")
}
}

View File

@ -2,8 +2,6 @@ package rasel.lunar.launcher.model.others
import rasel.lunar.launcher.model.RssDataInterface import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.RssDataType import rasel.lunar.launcher.model.RssDataType
import rasel.lunar.launcher.todos.Image
import rasel.lunar.launcher.todos.Source
import rasel.lunar.launcher.utils.JamoUtils import rasel.lunar.launcher.utils.JamoUtils

View File

@ -1,107 +0,0 @@
///*
// * 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 rasel.lunar.launcher.todos
//
//import android.database.sqlite.SQLiteOpenHelper
//import android.database.sqlite.SQLiteDatabase
//import android.content.ContentValues
//import android.annotation.SuppressLint
//import android.content.Context
//import android.database.DatabaseUtils
//import rasel.lunar.launcher.helpers.Constants.Companion.TODO_COLUMN_CREATED
//import rasel.lunar.launcher.helpers.Constants.Companion.TODO_COLUMN_ID
//import rasel.lunar.launcher.helpers.Constants.Companion.TODO_COLUMN_NAME
//import rasel.lunar.launcher.helpers.Constants.Companion.TODO_DATABASE_NAME
//import rasel.lunar.launcher.helpers.Constants.Companion.TODO_DATABASE_VERSION
//import rasel.lunar.launcher.helpers.Constants.Companion.TODO_TABLE_NAME
//import java.util.ArrayList
//
//
//internal class DatabaseHandler(context: Context?) :
// SQLiteOpenHelper(context, TODO_DATABASE_NAME, null, TODO_DATABASE_VERSION) {
//
// /* create database */
// override fun onCreate(database: SQLiteDatabase) {
// val createTodoTable = "CREATE TABLE " + TODO_TABLE_NAME + " (" +
// TODO_COLUMN_ID + " integer PRIMARY KEY AUTOINCREMENT," +
// TODO_COLUMN_CREATED + " datetime DEFAULT CURRENT_TIMESTAMP," +
// TODO_COLUMN_NAME + " varchar)"
// database.execSQL(createTodoTable)
// }
//
// override fun onUpgrade(sqLiteDatabase: SQLiteDatabase, i: Int, i1: Int) {}
//
// /* add new to-do entry */
// fun addTodo(todo: Todo) {
// val database = writableDatabase
// val contentValues = ContentValues()
// contentValues.put(TODO_COLUMN_NAME, todo.name)
// database.insert(TODO_TABLE_NAME, null, contentValues)
// }
//
// /* update or edit existing to-do */
// fun updateTodo(todo: Todo) {
// val database = writableDatabase
// val contentValues = ContentValues()
// contentValues.put(TODO_COLUMN_NAME, todo.name)
// database.update(
// TODO_TABLE_NAME,
// contentValues,
// "$TODO_COLUMN_ID=?",
// arrayOf(todo.id.toString())
// )
// }
//
// /* delete a single to-do */
// fun deleteTodo(todoId: Long) {
// writableDatabase.delete(TODO_TABLE_NAME,
// "$TODO_COLUMN_ID=?", arrayOf(todoId.toString()))
// }
//
// /* delete all existing todos at once */
// fun deleteAll() {
// writableDatabase.delete(TODO_TABLE_NAME, null, null)
// }
//
// @get:SuppressLint("Range")
// val todos: ArrayList<Todo>
// get() {
// val todoList = ArrayList<Todo>()
//// val queryResult =
//// readableDatabase.rawQuery("SELECT * from $TODO_TABLE_NAME", null)
////
//// if (queryResult.moveToFirst()) {
//// do {
//// val todo = Todo()
//// todo.id = queryResult.getLong(queryResult.getColumnIndex(TODO_COLUMN_ID))
//// todo.name = queryResult.getString(queryResult.getColumnIndex(TODO_COLUMN_NAME))
//// todoList.add(todo)
//// } while (queryResult.moveToNext())
//// }
////
//// queryResult.close()
// return todoList
// }
//
// /* check if any item exists in the database */
// val isTodoExists: Boolean get() {
// return DatabaseUtils.queryNumEntries(readableDatabase, TODO_TABLE_NAME, 1.toString()) > 0
// }
//
//}

File diff suppressed because it is too large Load Diff

View File

@ -17,10 +17,7 @@ class FmKoreaGetter : BaseGetter {
override fun realWork(): Result { override fun realWork(): Result {
val now = Date() val now = Date()
try { try {
val fmkoreaUrls = arrayListOf("https://www.fmkorea.com", val fmkoreaUrls = arrayListOf("https://www.fmkorea.com")
"https://www.fmkorea.com/index.php?mid=best&page=2",
"https://www.fmkorea.com/index.php?mid=best&page=3"
)
fmkoreaUrls.forEach { Jsoup.connect(it).userAgent(USAGT).get().let { fmkorea -> fmkoreaUrls.forEach { Jsoup.connect(it).userAgent(USAGT).get().let { fmkorea ->
// BLog.LOGE("fmkorea >>> ${fmkorea.title()}") // BLog.LOGE("fmkorea >>> ${fmkorea.title()}")
fmkorea.getElementsByTag("li").forEach { fmkorea_li -> fmkorea.getElementsByTag("li").forEach { fmkorea_li ->

View File

@ -4,7 +4,7 @@ import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import androidx.work.WorkerParameters import androidx.work.WorkerParameters
import rasel.lunar.launcher.model.getRssData import rasel.lunar.launcher.model.getRssData
import rasel.lunar.launcher.todos.RssFeedsParser import rasel.lunar.launcher.home.adapters.RssFeedsParser
import rasel.lunar.launcher.utils.RssList import rasel.lunar.launcher.utils.RssList
class NewsFeedsGetter : BaseGetter { class NewsFeedsGetter : BaseGetter {

View File

@ -5,7 +5,7 @@ import android.content.Context
import androidx.work.WorkerParameters import androidx.work.WorkerParameters
import rasel.lunar.launcher.model.RssData import rasel.lunar.launcher.model.RssData
import rasel.lunar.launcher.model.getRssData import rasel.lunar.launcher.model.getRssData
import rasel.lunar.launcher.todos.RssFeedsParser import rasel.lunar.launcher.home.adapters.RssFeedsParser
import rasel.lunar.launcher.utils.RssList.feedJsons import rasel.lunar.launcher.utils.RssList.feedJsons
class RedditGetter : BaseGetter { class RedditGetter : BaseGetter {

View File

@ -10,7 +10,7 @@ import org.jsoup.nodes.Document
import rasel.lunar.launcher.model.RssData import rasel.lunar.launcher.model.RssData
import rasel.lunar.launcher.model.RssDataInterface import rasel.lunar.launcher.model.RssDataInterface
import rasel.lunar.launcher.model.getRssData import rasel.lunar.launcher.model.getRssData
import rasel.lunar.launcher.todos.Root import rasel.lunar.launcher.model.others.Youtube
import rasel.lunar.launcher.utils.RssList import rasel.lunar.launcher.utils.RssList
class YoutubeGetter : BaseGetter { class YoutubeGetter : BaseGetter {
@ -26,7 +26,6 @@ class YoutubeGetter : BaseGetter {
for (url in rssUrls) { for (url in rssUrls) {
temp.addAll(ytChannel(Jsoup.connect(url).userAgent(USAGT).get())) temp.addAll(ytChannel(Jsoup.connect(url).userAgent(USAGT).get()))
} }
return Result.success().apply { return Result.success().apply {
WorkersDb.insertBulkData(temp) WorkersDb.insertBulkData(temp)
} }
@ -40,8 +39,10 @@ class YoutubeGetter : BaseGetter {
var tempJSONObject : JSONObject? = null var tempJSONObject : JSONObject? = null
JSONObject(ytInitialData).apply{ JSONObject(ytInitialData).apply{
tempJSONObject = this tempJSONObject = this
val root = Gson().fromJson(tempJSONObject.toString(), Root::class.java) val root = Gson().fromJson(tempJSONObject.toString(), Youtube::class.java)
(if (root?.contents?.singleColumnBrowseResultsRenderer?.tabs?.size ?: 0 > 0) { (if ((root?.contents?.singleColumnBrowseResultsRenderer?.tabs?.size
?: 0) > 0
) {
root?.contents?.singleColumnBrowseResultsRenderer?.tabs?.forEach { root?.contents?.singleColumnBrowseResultsRenderer?.tabs?.forEach {
it.tabRenderer?.content?.sectionListRenderer?.contents?.forEach { it.tabRenderer?.content?.sectionListRenderer?.contents?.forEach {
it.shelfRenderer?.content?.verticalListRenderer?.items?.forEach { it.shelfRenderer?.content?.verticalListRenderer?.items?.forEach {

View File

@ -3,7 +3,7 @@
<item android:state_pressed="true"> <item android:state_pressed="true">
<shape> <shape>
<corners <corners
android:radius="8dp" /> android:radius="15dp" />
<solid <solid
android:color="?attr/scrimBackground" /> android:color="?attr/scrimBackground" />
<stroke <stroke
@ -15,7 +15,7 @@
<item android:state_pressed="false"> <item android:state_pressed="false">
<shape> <shape>
<corners <corners
android:radius="8dp" /> android:radius="15dp" />
<solid <solid
android:color="@android:color/transparent" /> android:color="@android:color/transparent" />
<stroke <stroke

View File

@ -5,5 +5,5 @@
<corners android:radius="15dp"/> <corners android:radius="15dp"/>
<solid android:color="#44000000"/> <solid android:color="#44000000"/>
<stroke android:width="2dp" android:dashWidth="2dp" android:color="#33FFFFFF"/> <stroke android:width="1dp" android:color="#33FFFFFF"/>
</shape> </shape>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="800dp"
android:height="800dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,23A11,11 0,1 0,1 12,11.013 11.013,0 0,0 12,23ZM12,3a9,9 0,1 1,-9 9A9.01,9.01 0,0 1,12 3ZM14,12L8,16L8,8ZM17,16L15,16L15,8h2Z"
android:fillColor="#FFFFFF"/>
</vector>

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="800dp"
android:height="800dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:pathData="M12,1A11,11 0,1 0,23 12,11.013 11.013,0 0,0 12,1ZM12,21a9,9 0,1 1,9 -9A9.011,9.011 0,0 1,12 21ZM10,8l6,4 -6,4Z"
android:fillColor="#FFFFFF"/>
</vector>

View File

@ -3,7 +3,7 @@
<item android:state_pressed="true"> <item android:state_pressed="true">
<shape> <shape>
<corners <corners
android:radius="12dp" /> android:radius="15dp" />
<solid <solid
android:color="@android:color/transparent" /> android:color="@android:color/transparent" />
<stroke <stroke
@ -14,7 +14,7 @@
<item android:state_pressed="false"> <item android:state_pressed="false">
<shape> <shape>
<corners <corners
android:radius="12dp" /> android:radius="15dp" />
<solid <solid
android:color="?attr/scrimBackground" /> android:color="?attr/scrimBackground" />
</shape> </shape>

View File

@ -3,5 +3,5 @@
android:shape="rectangle"> android:shape="rectangle">
<corners android:radius="15dp"/> <corners android:radius="15dp"/>
<solid android:color="#22CCCCCC"/> <solid android:color="#22CCCCCC"/>
<stroke android:color="@color/sms_board" android:width="2dp"/> <stroke android:color="@color/sms_board" android:width="1dp"/>
</shape> </shape>

View File

@ -4,6 +4,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@drawable/sms_bg" android:background="@drawable/sms_bg"
android:layout_margin="5dp" android:layout_margin="5dp"
android:padding="15dp"
xmlns:app="http://schemas.android.com/apk/res-auto"> xmlns:app="http://schemas.android.com/apk/res-auto">
@ -11,7 +12,6 @@
android:id="@+id/name" android:id="@+id/name"
android:layout_width="@dimen/zero" android:layout_width="@dimen/zero"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="@dimen/twelve"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/> app:layout_constraintEnd_toEndOf="parent"/>
@ -20,7 +20,6 @@
android:id="@+id/date" android:id="@+id/date"
android:layout_width="@dimen/zero" android:layout_width="@dimen/zero"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="@dimen/twelve"
app:layout_constraintTop_toBottomOf="@id/name" app:layout_constraintTop_toBottomOf="@id/name"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/> app:layout_constraintEnd_toEndOf="parent"/>
@ -29,7 +28,6 @@
android:id="@+id/type" android:id="@+id/type"
android:layout_width="@dimen/zero" android:layout_width="@dimen/zero"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="@dimen/twelve"
app:layout_constraintTop_toBottomOf="@id/date" app:layout_constraintTop_toBottomOf="@id/date"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/> app:layout_constraintEnd_toEndOf="parent"/>

View File

@ -37,11 +37,12 @@
<ImageView <ImageView
android:id="@+id/next_play" android:id="@+id/next_play"
android:src="@android:drawable/ic_media_play" android:src="@drawable/play_song"
app:layout_constraintRight_toRightOf="@id/time" app:layout_constraintRight_toRightOf="@id/time"
app:layout_constraintTop_toTopOf="@id/time" app:layout_constraintTop_toTopOf="@id/time"
app:layout_constraintBottom_toBottomOf="@id/time" app:layout_constraintBottom_toBottomOf="@id/time"
android:layout_width="40dp" android:layout_width="40dp"
android:layout_margin="5dp"
android:layout_height="40dp"/> android:layout_height="40dp"/>
<rasel.lunar.launcher.view.CircleImageView <rasel.lunar.launcher.view.CircleImageView
@ -119,7 +120,7 @@
<ImageView <ImageView
android:id="@+id/next_btn" android:id="@+id/next_btn"
android:src="@android:drawable/ic_media_next" android:src="@drawable/next_song"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
android:layout_width="40dp" android:layout_width="40dp"