.....
This commit is contained in:
parent
68839e1e73
commit
c8bd83689e
@ -94,8 +94,8 @@ 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.RssItem
|
||||
import rasel.lunar.launcher.model.RssTagItem
|
||||
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
|
||||
@ -146,9 +146,9 @@ internal class LauncherActivity : AppCompatActivity() {
|
||||
val COMIC_WORK_TAG = "ComicGetter"
|
||||
val COMIC2_WORK_TAG = "ComicGetter2"
|
||||
val REDDIT_WORK_TAG = "RedditGetter"
|
||||
val shortTimePeriod = 200L
|
||||
val longTimePeriod = 600L
|
||||
val midTimePeriod = 300L
|
||||
val shortTimePeriod = 20L
|
||||
val longTimePeriod = 60L
|
||||
val midTimePeriod = 30L
|
||||
var isOpendFold = false
|
||||
val qDayPeriod = 60L * 8L
|
||||
|
||||
@ -165,7 +165,7 @@ internal class LauncherActivity : AppCompatActivity() {
|
||||
.addTag(SMS_WORK_TAG)
|
||||
.build())
|
||||
}, 1, TimeUnit.SECONDS)
|
||||
var delay = 1L
|
||||
var delay = 3L
|
||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
||||
mWorkManager?.cancelAllWorkByTag(ContactInfoGetter.TAG)
|
||||
mWorkManager?.enqueueUniquePeriodicWork(
|
||||
@ -183,7 +183,6 @@ internal class LauncherActivity : AppCompatActivity() {
|
||||
.addTag(AppInfoGetter.TAG)
|
||||
.build())
|
||||
}, delay, TimeUnit.SECONDS)
|
||||
|
||||
delay = delay + 3L
|
||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
||||
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 ""
|
||||
if (pageLink.length > 0 && imgg.length > 0 && title.length > 0 && model.length > 0) {
|
||||
temp.add(
|
||||
RssItem(
|
||||
JGuru(
|
||||
model = model,
|
||||
title = title,
|
||||
pageLink = pageLink,
|
||||
@ -893,7 +892,7 @@ internal class LauncherActivity : AppCompatActivity() {
|
||||
|
||||
minDate = Math.min(minDate,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 {
|
||||
var itemC = 0
|
||||
WorkersDb.insertBulkInteface(temp)
|
||||
@ -911,7 +910,7 @@ internal class LauncherActivity : AppCompatActivity() {
|
||||
it.children().forEach {
|
||||
if (it.tag().name.contains("li")) {
|
||||
listTags.add(
|
||||
RssTagItem(
|
||||
jGuruTag(
|
||||
tagTitle = it.getElementsByTag("a").get(0).text(),
|
||||
link = it.getElementsByTag("a").get(0).attr("href")
|
||||
)
|
||||
|
||||
@ -40,6 +40,7 @@ import android.widget.EditText
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.widget.PopupMenu
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.fragment.app.Fragment
|
||||
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.RssDataInterface
|
||||
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.getRssData
|
||||
import rasel.lunar.launcher.utils.BLog
|
||||
@ -96,7 +97,7 @@ internal class Feeds : Fragment() , CommadCallabck {
|
||||
private lateinit var binding: FeedsBinding
|
||||
private val requestCodeString = "requestCode"
|
||||
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 {
|
||||
binding = FeedsBinding.inflate(inflater, container, false)
|
||||
mRssAdapter = RssAdapter(requireContext())
|
||||
@ -578,39 +579,39 @@ internal class Feeds : Fragment() , CommadCallabck {
|
||||
}
|
||||
|
||||
private fun createWidget(appWidgetId: Int, height: Int?) {
|
||||
// if (appWidgetId == -1) return
|
||||
//
|
||||
// val appWidgetInfo = appWidgetManager!!.getAppWidgetInfo(appWidgetId)
|
||||
// val params: LayoutParams?
|
||||
//
|
||||
// when (height) {
|
||||
// null -> {
|
||||
// params = ConstraintLayout.LayoutParams(LayoutParams.MATCH_PARENT, appWidgetInfo.minHeight)
|
||||
// val updatedIds = splitWidgetIds.plus("$appWidgetId")
|
||||
// val updatedHeights = splitWidgetHeights.plus("${appWidgetInfo.minHeight}")
|
||||
// saveWidgetData(updatedIds, updatedHeights)
|
||||
// }
|
||||
// else -> params = ConstraintLayout.LayoutParams(LayoutParams.MATCH_PARENT, height)
|
||||
// }
|
||||
//
|
||||
// (appWidgetHost?.createView(lActivity!!.applicationContext, appWidgetId, appWidgetInfo) as WidgetHostView)
|
||||
// .apply {
|
||||
// setAppWidget(appWidgetId, appWidgetInfo)
|
||||
// }.let {
|
||||
// binding.widgetContainer.addView(it, params)
|
||||
// widgetMenu(it)
|
||||
// }
|
||||
if (appWidgetId == -1) return
|
||||
|
||||
val appWidgetInfo = appWidgetManager!!.getAppWidgetInfo(appWidgetId)
|
||||
val params: ConstraintLayout.LayoutParams?
|
||||
|
||||
when (height) {
|
||||
null -> {
|
||||
params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, appWidgetInfo.minHeight)
|
||||
val updatedIds = splitWidgetIds.plus("$appWidgetId")
|
||||
val updatedHeights = splitWidgetHeights.plus("${appWidgetInfo.minHeight}")
|
||||
saveWidgetData(updatedIds, updatedHeights)
|
||||
}
|
||||
else -> params = ConstraintLayout.LayoutParams(ConstraintLayout.LayoutParams.MATCH_PARENT, height)
|
||||
}
|
||||
|
||||
(appWidgetHost?.createView(lActivity!!.applicationContext, appWidgetId, appWidgetInfo) as WidgetHostView)
|
||||
.apply {
|
||||
setAppWidget(appWidgetId, appWidgetInfo)
|
||||
}.let {
|
||||
binding.widgetContainer.addView(it, params)
|
||||
widgetMenu(it)
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateWidgets() {
|
||||
// if (splitWidgetIds.size > 0) {
|
||||
// viewLifecycleOwner.lifecycleScope.launch {
|
||||
// binding.widgetContainer.removeAllViews()
|
||||
// splitWidgetIds.indices.forEach { i: Int ->
|
||||
// createWidget(splitWidgetIds[i]!!.int(), splitWidgetHeights[i]!!.int())
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (splitWidgetIds.size > 0) {
|
||||
viewLifecycleOwner.lifecycleScope.launch {
|
||||
binding.widgetContainer.removeAllViews()
|
||||
splitWidgetIds.indices.forEach { i: Int ->
|
||||
createWidget(splitWidgetIds[i]!!.int(), splitWidgetHeights[i]!!.int())
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun widgetMenu(hostView: WidgetHostView) {
|
||||
|
||||
@ -33,8 +33,8 @@ 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.RssItem
|
||||
import rasel.lunar.launcher.todos.RssItemDiffUtil
|
||||
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
|
||||
@ -95,7 +95,7 @@ internal class RssAdapter<T : RssDataInterface>(private val context: Context) :
|
||||
}
|
||||
|
||||
holder.view.root.setOnLongClickListener {
|
||||
if(item is RssItem) {
|
||||
if(item is JGuru) {
|
||||
openOpera(
|
||||
"https://cili.site/search?q=${
|
||||
URLEncoder.encode(
|
||||
|
||||
@ -84,10 +84,10 @@ import rasel.lunar.launcher.model.RssDataInterface
|
||||
import rasel.lunar.launcher.model.RssDataType
|
||||
import rasel.lunar.launcher.qaccess.QuickAccess
|
||||
import rasel.lunar.launcher.settings.SettingsActivity
|
||||
import rasel.lunar.launcher.todos.MissedCallsAdapter
|
||||
import rasel.lunar.launcher.todos.NotificationItemAdapter
|
||||
import rasel.lunar.launcher.todos.RssItemAdapter
|
||||
import rasel.lunar.launcher.todos.SmsLogsAdapter
|
||||
import rasel.lunar.launcher.home.adapters.RecentCallsAdapter
|
||||
import rasel.lunar.launcher.home.adapters.NotificationItemAdapter
|
||||
import rasel.lunar.launcher.home.adapters.RssItemAdapter
|
||||
import rasel.lunar.launcher.home.adapters.SmsLogsAdapter
|
||||
import rasel.lunar.launcher.utils.BLog
|
||||
import rasel.lunar.launcher.utils.BitmapConverter
|
||||
import rasel.lunar.launcher.utils.JamoUtils
|
||||
@ -164,7 +164,7 @@ internal class LauncherHome : Fragment() {
|
||||
fragManager = lActivity!!.supportFragmentManager
|
||||
settingsPrefs = requireContext().getSharedPreferences(PREFS_SETTINGS, 0)
|
||||
batteryReceiver = BatteryReceiver(binding.batteryProgress)
|
||||
mMissedCallsAdapter = MissedCallsAdapter(callList, requireContext())
|
||||
mRecentCallsAdapter = RecentCallsAdapter(callList, requireContext())
|
||||
mSmsLogsAdapter = SmsLogsAdapter(smsList, requireContext())
|
||||
mNotiAdapter = NotificationItemAdapter(requireContext())
|
||||
mRssAdapter = RssItemAdapter(requireContext())
|
||||
@ -182,7 +182,7 @@ internal class LauncherHome : Fragment() {
|
||||
binding.smsList.layoutManager = GridLayoutManager(requireContext(),2)
|
||||
binding.infoList.layoutManager = LinearLayoutManager(requireContext())
|
||||
|
||||
binding.mainList.adapter = mMissedCallsAdapter
|
||||
binding.mainList.adapter = mRecentCallsAdapter
|
||||
binding.smsList.adapter = mSmsLogsAdapter
|
||||
binding.infoList.adapter = mRssAdapter
|
||||
binding.notiList.adapter = mNotiAdapter
|
||||
@ -452,7 +452,7 @@ internal class LauncherHome : Fragment() {
|
||||
var infosJob : Job? = null
|
||||
var noticeJob : Job? = null
|
||||
|
||||
lateinit var mMissedCallsAdapter : MissedCallsAdapter
|
||||
lateinit var mRecentCallsAdapter : RecentCallsAdapter
|
||||
lateinit var mSmsLogsAdapter : SmsLogsAdapter
|
||||
lateinit var mRssAdapter : RssItemAdapter
|
||||
lateinit var mNotiAdapter : NotificationItemAdapter
|
||||
@ -638,7 +638,7 @@ internal class LauncherHome : Fragment() {
|
||||
callList.addAll(copyFromRealm(result))
|
||||
binding.missedCalls.text = "최근 통화 [${callList.size}]"
|
||||
binding.mainList.visibility = View.VISIBLE
|
||||
mMissedCallsAdapter.updateData(callList)
|
||||
mRecentCallsAdapter.updateData(callList)
|
||||
binding.recentSms.isSelected = false
|
||||
binding.otherCheck.isSelected = false
|
||||
binding.notice.isSelected = false
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package rasel.lunar.launcher.todos
|
||||
package rasel.lunar.launcher.home.adapters
|
||||
|
||||
import android.content.Context
|
||||
import android.util.AttributeSet
|
||||
@ -16,7 +16,7 @@
|
||||
* 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.content.Context
|
||||
@ -16,7 +16,7 @@
|
||||
* 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.content.Context
|
||||
@ -35,15 +35,15 @@ import rasel.lunar.launcher.utils.getContactId
|
||||
import rasel.lunar.launcher.workers.RecentCall
|
||||
|
||||
|
||||
internal class MissedCallsAdapter(
|
||||
internal class RecentCallsAdapter(
|
||||
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)
|
||||
|
||||
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)
|
||||
return MissedCallsHolder(binding)
|
||||
return RecentCallsHolder(binding)
|
||||
}
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
@ -52,7 +52,7 @@ internal class MissedCallsAdapter(
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onBindViewHolder(holder: MissedCallsHolder, position: Int) {
|
||||
override fun onBindViewHolder(holder: RecentCallsHolder, position: Int) {
|
||||
val todo = callList[position]
|
||||
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 */
|
||||
private fun updateDialog(position: Int) {
|
||||
@ -130,7 +130,7 @@ internal class MissedCallsAdapter(
|
||||
}
|
||||
|
||||
fun updateData(newList: ArrayList<RecentCall>) {
|
||||
val diffUtilResult = DiffUtil.calculateDiff(MissedCallDiffUtil(callList, newList))
|
||||
val diffUtilResult = DiffUtil.calculateDiff(RecentCallDiffUtil(callList, newList))
|
||||
diffUtilResult.dispatchUpdatesTo(this)
|
||||
// callList.clear()
|
||||
// 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>
|
||||
) : DiffUtil.Callback() {
|
||||
|
||||
@ -1,13 +1,12 @@
|
||||
package rasel.lunar.launcher.todos
|
||||
package rasel.lunar.launcher.home.adapters
|
||||
|
||||
import android.util.Xml
|
||||
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.RssDataType
|
||||
import rasel.lunar.launcher.model.NewsData
|
||||
import rasel.lunar.launcher.model.others.Reddit
|
||||
import rasel.lunar.launcher.utils.JamoUtils
|
||||
import rasel.lunar.launcher.utils.beforeDay
|
||||
import java.io.IOException
|
||||
import java.io.InputStream
|
||||
@ -74,7 +73,7 @@ object RssFeedsParser {
|
||||
}
|
||||
|
||||
@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")
|
||||
var title: String? = null
|
||||
@ -82,7 +81,7 @@ object RssFeedsParser {
|
||||
var date = 0L
|
||||
var desc : String? = null
|
||||
var source : String? = null
|
||||
val items: MutableList<RssFeed> = ArrayList()
|
||||
val items: MutableList<NewsData> = ArrayList()
|
||||
|
||||
while (parser.next() != XmlPullParser.END_DOCUMENT) {
|
||||
if (parser.eventType != XmlPullParser.START_TAG) {
|
||||
@ -107,7 +106,7 @@ object RssFeedsParser {
|
||||
}
|
||||
|
||||
if (date > limitDateTime && title != null && link != null) {
|
||||
val item = RssFeed(title, link)
|
||||
val item = NewsData(title, link)
|
||||
item.pubDate = date
|
||||
item.source = source
|
||||
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("")
|
||||
}
|
||||
}
|
||||
@ -16,7 +16,7 @@
|
||||
* 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.content.Context
|
||||
@ -16,7 +16,7 @@
|
||||
* 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.content.Context
|
||||
@ -28,10 +28,10 @@ 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.RssTagItem
|
||||
import rasel.lunar.launcher.model.jGuruTag
|
||||
|
||||
internal class RssTagAdapter(
|
||||
private val smsList: ArrayList<RssTagItem>,
|
||||
private val smsList: ArrayList<jGuruTag>,
|
||||
private val context: Context) : RecyclerView.Adapter<RssTagAdapter.RssTag>() {
|
||||
|
||||
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)
|
||||
|
||||
fun updateData(newList: List<RssTagItem>) {
|
||||
fun updateData(newList: List<jGuruTag>) {
|
||||
val diffUtilResult = DiffUtil.calculateDiff(RssTagDiffUtil(smsList, newList))
|
||||
diffUtilResult.dispatchUpdatesTo(this)
|
||||
// smsList.clear()
|
||||
@ -111,7 +111,7 @@ internal class RssTagAdapter(
|
||||
}
|
||||
|
||||
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() {
|
||||
|
||||
override fun getOldListSize(): Int = oldList.size
|
||||
@ -16,7 +16,7 @@
|
||||
* 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.content.Context
|
||||
@ -42,7 +42,7 @@ class MissD : RssDataInterface {
|
||||
}
|
||||
}
|
||||
|
||||
class MostItem : RssItem , RssDataInterface {
|
||||
class MostItem : JGuru , RssDataInterface {
|
||||
|
||||
constructor() : super()
|
||||
|
||||
@ -74,7 +74,7 @@ class MostItem : RssItem , RssDataInterface {
|
||||
return JamoUtils.split(title!!).joinToString("")
|
||||
}
|
||||
}
|
||||
open class RssItem : RssDataInterface {
|
||||
open class JGuru : RssDataInterface {
|
||||
var model : String = ""
|
||||
var title : String = ""
|
||||
var pageLink : String = ""
|
||||
@ -131,7 +131,7 @@ open class RssItem : RssDataInterface {
|
||||
}
|
||||
}
|
||||
|
||||
class RssTagItem : RssDataInterface {
|
||||
class jGuruTag : RssDataInterface {
|
||||
var link : String = ""
|
||||
var tagTitle = ""
|
||||
var count = 0
|
||||
|
||||
45
app/src/main/kotlin/rasel/lunar/launcher/model/NewsData.kt
Normal file
45
app/src/main/kotlin/rasel/lunar/launcher/model/NewsData.kt
Normal 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("")
|
||||
}
|
||||
}
|
||||
@ -2,8 +2,6 @@ package rasel.lunar.launcher.model.others
|
||||
|
||||
import rasel.lunar.launcher.model.RssDataInterface
|
||||
import rasel.lunar.launcher.model.RssDataType
|
||||
import rasel.lunar.launcher.todos.Image
|
||||
import rasel.lunar.launcher.todos.Source
|
||||
import rasel.lunar.launcher.utils.JamoUtils
|
||||
|
||||
|
||||
|
||||
@ -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
@ -17,10 +17,7 @@ class FmKoreaGetter : BaseGetter {
|
||||
override fun realWork(): Result {
|
||||
val now = Date()
|
||||
try {
|
||||
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"
|
||||
)
|
||||
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 ->
|
||||
|
||||
@ -4,7 +4,7 @@ import android.annotation.SuppressLint
|
||||
import android.content.Context
|
||||
import androidx.work.WorkerParameters
|
||||
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
|
||||
|
||||
class NewsFeedsGetter : BaseGetter {
|
||||
|
||||
@ -5,7 +5,7 @@ import android.content.Context
|
||||
import androidx.work.WorkerParameters
|
||||
import rasel.lunar.launcher.model.RssData
|
||||
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
|
||||
|
||||
class RedditGetter : BaseGetter {
|
||||
|
||||
@ -10,7 +10,7 @@ import org.jsoup.nodes.Document
|
||||
import rasel.lunar.launcher.model.RssData
|
||||
import rasel.lunar.launcher.model.RssDataInterface
|
||||
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
|
||||
|
||||
class YoutubeGetter : BaseGetter {
|
||||
@ -26,7 +26,6 @@ class YoutubeGetter : BaseGetter {
|
||||
for (url in rssUrls) {
|
||||
temp.addAll(ytChannel(Jsoup.connect(url).userAgent(USAGT).get()))
|
||||
}
|
||||
|
||||
return Result.success().apply {
|
||||
WorkersDb.insertBulkData(temp)
|
||||
}
|
||||
@ -40,8 +39,10 @@ class YoutubeGetter : BaseGetter {
|
||||
var tempJSONObject : JSONObject? = null
|
||||
JSONObject(ytInitialData).apply{
|
||||
tempJSONObject = this
|
||||
val root = Gson().fromJson(tempJSONObject.toString(), Root::class.java)
|
||||
(if (root?.contents?.singleColumnBrowseResultsRenderer?.tabs?.size ?: 0 > 0) {
|
||||
val root = Gson().fromJson(tempJSONObject.toString(), Youtube::class.java)
|
||||
(if ((root?.contents?.singleColumnBrowseResultsRenderer?.tabs?.size
|
||||
?: 0) > 0
|
||||
) {
|
||||
root?.contents?.singleColumnBrowseResultsRenderer?.tabs?.forEach {
|
||||
it.tabRenderer?.content?.sectionListRenderer?.contents?.forEach {
|
||||
it.shelfRenderer?.content?.verticalListRenderer?.items?.forEach {
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<corners
|
||||
android:radius="8dp" />
|
||||
android:radius="15dp" />
|
||||
<solid
|
||||
android:color="?attr/scrimBackground" />
|
||||
<stroke
|
||||
@ -15,7 +15,7 @@
|
||||
<item android:state_pressed="false">
|
||||
<shape>
|
||||
<corners
|
||||
android:radius="8dp" />
|
||||
android:radius="15dp" />
|
||||
<solid
|
||||
android:color="@android:color/transparent" />
|
||||
<stroke
|
||||
|
||||
@ -5,5 +5,5 @@
|
||||
<corners android:radius="15dp"/>
|
||||
<solid android:color="#44000000"/>
|
||||
|
||||
<stroke android:width="2dp" android:dashWidth="2dp" android:color="#33FFFFFF"/>
|
||||
<stroke android:width="1dp" android:color="#33FFFFFF"/>
|
||||
</shape>
|
||||
9
app/src/main/res/drawable/next_song.xml
Normal file
9
app/src/main/res/drawable/next_song.xml
Normal 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>
|
||||
9
app/src/main/res/drawable/play_song.xml
Normal file
9
app/src/main/res/drawable/play_song.xml
Normal 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>
|
||||
@ -3,7 +3,7 @@
|
||||
<item android:state_pressed="true">
|
||||
<shape>
|
||||
<corners
|
||||
android:radius="12dp" />
|
||||
android:radius="15dp" />
|
||||
<solid
|
||||
android:color="@android:color/transparent" />
|
||||
<stroke
|
||||
@ -14,7 +14,7 @@
|
||||
<item android:state_pressed="false">
|
||||
<shape>
|
||||
<corners
|
||||
android:radius="12dp" />
|
||||
android:radius="15dp" />
|
||||
<solid
|
||||
android:color="?attr/scrimBackground" />
|
||||
</shape>
|
||||
|
||||
@ -3,5 +3,5 @@
|
||||
android:shape="rectangle">
|
||||
<corners android:radius="15dp"/>
|
||||
<solid android:color="#22CCCCCC"/>
|
||||
<stroke android:color="@color/sms_board" android:width="2dp"/>
|
||||
<stroke android:color="@color/sms_board" android:width="1dp"/>
|
||||
</shape>
|
||||
@ -4,6 +4,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/sms_bg"
|
||||
android:layout_margin="5dp"
|
||||
android:padding="15dp"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
|
||||
@ -11,7 +12,6 @@
|
||||
android:id="@+id/name"
|
||||
android:layout_width="@dimen/zero"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/twelve"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
@ -20,7 +20,6 @@
|
||||
android:id="@+id/date"
|
||||
android:layout_width="@dimen/zero"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/twelve"
|
||||
app:layout_constraintTop_toBottomOf="@id/name"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
@ -29,7 +28,6 @@
|
||||
android:id="@+id/type"
|
||||
android:layout_width="@dimen/zero"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="@dimen/twelve"
|
||||
app:layout_constraintTop_toBottomOf="@id/date"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
@ -37,11 +37,12 @@
|
||||
|
||||
<ImageView
|
||||
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_constraintTop_toTopOf="@id/time"
|
||||
app:layout_constraintBottom_toBottomOf="@id/time"
|
||||
android:layout_width="40dp"
|
||||
android:layout_margin="5dp"
|
||||
android:layout_height="40dp"/>
|
||||
|
||||
<rasel.lunar.launcher.view.CircleImageView
|
||||
@ -119,7 +120,7 @@
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/next_btn"
|
||||
android:src="@android:drawable/ic_media_next"
|
||||
android:src="@drawable/next_song"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:layout_width="40dp"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user