Skip to content

Commit

Permalink
[feature|optimize|fix]支持手动输入弹幕链接进行播放;全屏播放界面显示当前时间;修复部分界面显示问题和主题无法换肤的问…
Browse files Browse the repository at this point in the history
…题例如MaterialDialog;优化换肤模块逻辑结构;修复首页Banner指示器有时不能及时换肤的问题
  • Loading branch information
SkyD666 committed Nov 15, 2021
1 parent a5fb899 commit 69736d7
Show file tree
Hide file tree
Showing 95 changed files with 1,445 additions and 1,478 deletions.
2 changes: 2 additions & 0 deletions .idea/dictionaries/Sky_D.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 53 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions .idea/runConfigurations.xml

This file was deleted.

1 change: 1 addition & 0 deletions andresguard.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ def whiteList = [
// skin
"R.drawable.*_skin*",
"R.color.*_skin*",
"R.style.*.skin*",
// for your icon
"R.mipmap.ic_launcher",
"R.mipmap.ic_launcher_round",
Expand Down
3 changes: 2 additions & 1 deletion app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ android {
exclude 'org/eclipse/jetty/**'
exclude 'org/fourthline/cling/**'
exclude 'okhttp3/internal/**'
exclude 'com/badlogic/**'
}

buildFeatures {
Expand Down Expand Up @@ -166,8 +167,8 @@ dependencies {
implementation deps.smart.refresh_layout_kernel
implementation deps.smart.refresh_header_material
implementation deps.smart.refresh_footer_ball
implementation deps.ctiao.DanmakuFlameMaster
implementation deps.coil_kt.coil
implementation deps.kuaishou.akdanmaku
implementation project(':skin')
implementation project(':skin_blue')
implementation project(':skin_dark')
Expand Down
14 changes: 14 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ public static final int *;
*** get*();
void set*(***);
public <init>(android.content.Context);
public <init>(android.content.Context, java.lang.Boolean);
public <init>(android.content.Context, android.util.AttributeSet);
public <init>(android.content.Context, android.util.AttributeSet, int);
}
Expand Down Expand Up @@ -162,6 +163,19 @@ public static final int *;
#-keep class org.seamless.statemachine.** {;}
#-keepclassmembers class * implements org.fourthline.cling.support.avtransport.impl.state.AbstractState {;}

#-------------------------AkDanmaku v1.0.3
-dontwarn com.badlogic.gdx.backends.android.AndroidFragmentApplication
-dontwarn com.badlogic.gdx.utils.GdxBuild
-dontwarn com.badlogic.gdx.jnigen.BuildTarget*
-dontwarn com.badlogic.gdx.graphics.g2d.freetype.FreetypeBuild
-keep class com.kuaishou.akdanmaku.ecs.system.ActionSystem { *; }
-keep class com.kuaishou.akdanmaku.ecs.system.DanmakuSystem { *; }
-keep class com.kuaishou.akdanmaku.ecs.system.DataSystem { *; }
-keep class com.kuaishou.akdanmaku.ecs.system.RenderSystem { *; }
-keep class com.kuaishou.akdanmaku.ecs.system.layout.LayoutSystem { *; }
# Required if using Gdx-Controllers extension
-keep class com.badlogic.gdx.controllers.android.AndroidControllers

#-------------------------
-keep public class * extends android.app.Activity
-keep public class * extends android.app.AppCompatActivity
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
android:requestLegacyExternalStorage="true"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.樱花动漫"
android:theme="@style/Theme.Anime.skin"
android:usesCleartextTraffic="true">
<activity android:name=".view.activity.NoticeActivity" />
<activity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package com.skyd.imomoe.bean
package com.skyd.imomoe.bean.danmaku

import com.google.gson.annotations.SerializedName
import java.io.Serializable

class SendDanmuBean(
class AnimeSendDanmakuBean(
@SerializedName("author")
var author: String,
@SerializedName("color")
Expand All @@ -20,4 +20,4 @@ class SendDanmuBean(
var time: Double,
@SerializedName("type")
var type: String
) : Serializable
) : SendDanmakuBean
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package com.skyd.imomoe.bean
package com.skyd.imomoe.bean.danmaku

import com.google.gson.annotations.SerializedName
import com.skyd.imomoe.bean.BaseBean

class SendDanmuResultBean(
class AnimeSendDanmakuResultBean(
override var type: String,
override var actionUrl: String,
@SerializedName("code")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package com.skyd.imomoe.bean.danmaku

import java.io.Serializable

interface SendDanmakuBean : Serializable
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import com.skyd.imomoe.bean.PageNumberBean
* 获取分类界面数据的接口
*/
interface IClassifyModel : IBase {
@Deprecated("This method will cause a memory leak!!!")
fun setActivity(activity: Activity)

fun clearActivity()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import com.skyd.imomoe.bean.PlayBean
* 获取播放界面数据的接口
*/
interface IPlayModel : IBase {
@Deprecated("This method will cause a memory leak!!!")
fun setActivity(activity: Activity)

fun clearActivity()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ object ParseHtmlUtil {
"a" -> {
url = liChildren[j].attr("href")
cover = liChildren[j].select("img").attr("src")
title = liChildren[j].select("p").first().ownText()
title = liChildren[j].select("p").first()!!.ownText()
describe = liChildren[j].select("p").select("span").text()
}
"em" -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.skyd.imomoe.net.service

import com.skyd.imomoe.bean.SendDanmuResultBean
import com.skyd.imomoe.bean.danmaku.AnimeSendDanmakuResultBean
import com.skyd.imomoe.config.Api
import okhttp3.RequestBody
import retrofit2.Call
Expand All @@ -9,12 +9,12 @@ import retrofit2.http.Headers
import retrofit2.http.POST
import retrofit2.http.Query

interface DanmuService {
interface DanmakuService {
@Headers(value = ["Content-Type: application/json", "Accept: application/json"])
@POST(Api.DANMU_URL)
fun sendDanmu(
fun sendDanmaku(
@Query("ac") ac: String,
@Query("key") key: String,
@Body json: RequestBody
): Call<SendDanmuResultBean>
): Call<AnimeSendDanmakuResultBean>
}
13 changes: 13 additions & 0 deletions app/src/main/java/com/skyd/imomoe/util/IOUtil.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package com.skyd.imomoe.util

import java.io.InputStream

fun InputStream.string(): String {
val out = StringBuffer()
val b = ByteArray(4096)
var n: Int
while (this.read(b).also { n = it } != -1) {
out.append(String(b, 0, n))
}
return out.toString()
}
2 changes: 1 addition & 1 deletion app/src/main/java/com/skyd/imomoe/util/RvAdapter.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import com.skyd.imomoe.bean.GetDataEnum
* @param deltaDataSet 新数据集
* @param dataSet 构造adapter时传入的list
*/
fun <T> RecyclerView.Adapter<RecyclerView.ViewHolder>.smartNotifyDataSetChanged(
fun <T, VH : RecyclerView.ViewHolder> RecyclerView.Adapter<VH>.smartNotifyDataSetChanged(
type: GetDataEnum,
deltaDataSet: MutableList<T>,
dataSet: MutableList<T>
Expand Down
24 changes: 11 additions & 13 deletions app/src/main/java/com/skyd/imomoe/util/Util.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.skyd.imomoe.util

import android.annotation.SuppressLint
import android.app.Activity
import android.content.*
import android.content.Intent.FLAG_ACTIVITY_NEW_TASK
Expand Down Expand Up @@ -613,20 +614,17 @@ object Util {
decodeUrl.startsWith(Const.ActionUrl.ANIME_SKIP_BY_WEBSITE) -> { // 根据网址跳转
var website = decodeUrl.replaceFirst(Const.ActionUrl.ANIME_SKIP_BY_WEBSITE, "")
if (website.isBlank() || website == "/") {
MaterialDialog(activity).show {
input(hintRes = R.string.input_a_website) { dialog, text ->
try {
var url = text.toString()
if (!url.matches(Regex("^.+://.*"))) url = "http://$url"
process(activity, URL(url).file)
} catch (e: Exception) {
App.context.resources.getString(R.string.website_format_error)
.showToast()
e.printStackTrace()
}
MaterialDialog(activity).input(hintRes = R.string.input_a_website) { dialog, text ->
try {
var url = text.toString()
if (!url.matches(Regex("^.+://.*"))) url = "http://$url"
process(activity, URL(url).file)
} catch (e: Exception) {
App.context.resources.getString(R.string.website_format_error)
.showToast()
e.printStackTrace()
}
positiveButton(R.string.ok)
}
}.positiveButton(R.string.ok).show()
} else {
try {
if (!website.matches(Regex("^.+://.*"))) website = "http://$website"
Expand Down
9 changes: 9 additions & 0 deletions app/src/main/java/com/skyd/imomoe/util/View.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ package com.skyd.imomoe.util
import android.view.View
import android.view.animation.AlphaAnimation

fun View.enable() {
if (isEnabled) return
isEnabled = true
}

fun View.disable() {
if (!isEnabled) return
isEnabled = false
}

fun View.gone(animate: Boolean = false, dur: Long = 500L) {
if (visibility == View.GONE) return
Expand Down
9 changes: 6 additions & 3 deletions app/src/main/java/com/skyd/imomoe/util/html/SnifferVideo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ object SnifferVideo {
return when (type) {
0 -> {
Jsoup.parse(html).select("body")[0].select("[class=player]")[0]
.getElementById("playbox").select("iframe")[0]
.getElementById("playbox")!!.select("iframe")[0]
.attr("src")
}
1 -> {
Expand Down Expand Up @@ -63,7 +63,7 @@ object SnifferVideo {
}
}
Jsoup.parse(html)
.select("body")[0].getElementById("player")
.select("body")[0].getElementById("player")!!
.select("[class=leleplayer-video-wrap]")
.select("video").attr("src")
}
Expand Down Expand Up @@ -191,7 +191,10 @@ object SnifferVideo {
put(REFEREER_URL, this@SnifferVideo.referer)
put(
DANMU_URL,
"https:$serverApi/barrage/api?ac=dm&key=$serverKey&id=$videoId"
"$serverApi/barrage/api?ac=dm&key=$serverKey&id=$videoId".run {
if (this.startsWith("http")) this
else "https:" + this
}
)
callback(html, this)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.skyd.imomoe.util.skin.attrs

import android.view.View
import androidx.core.content.ContextCompat
import com.skyd.imomoe.view.component.bannerview.indicator.DotIndicator
import com.skyd.skin.core.SkinResourceProcessor
import com.skyd.skin.core.attrs.SkinAttr


class BannerIndicatorDotSelectedColorAttr : SkinAttr() {
override fun applySkin(view: View) {
if (attrResourceRefId != -1 && view is DotIndicator) {
val skinResProcessor = SkinResourceProcessor.instance
if (skinResProcessor.usingDefaultSkin() && skinResProcessor.usingInnerAppSkin()) {
view.mSelectedColor = ContextCompat.getColor(view.context, attrResourceRefId)
} else {
view.mSelectedColor = skinResProcessor.getColor(attrResourceRefId)
}
}
}

override fun tag(): String = "bannerIndicatorDotSelectedColorAttr"
}
Loading

0 comments on commit 69736d7

Please sign in to comment.