Skip to content

Commit

Permalink
Merge pull request #7 from TsubakiDev/main
Browse files Browse the repository at this point in the history
multi optimizations
  • Loading branch information
SpaceXC authored Mar 10, 2024
2 parents 3e64561 + 68de2e1 commit 1ddad10
Show file tree
Hide file tree
Showing 70 changed files with 355 additions and 466 deletions.
File renamed without changes.
File renamed without changes.
26 changes: 26 additions & 0 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Android CI

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: gradle

- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew build
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,12 @@
- 你也可以自行clone该仓库并构建此项目。



## :hammer_and_wrench: 构建

1. 该项目依赖于[`Bilibili-Kotlin-SDK`](https://github.com/SpaceXC/Bilibili-Kotlin-SDK)~~clone此项目前,请先clone该项目~~

2. 使用 `git submodule update`,等待下载完成后就可以正常开发

3. 在Android Studio中删除位于`cn.spacexc.wearbili.remake.app.splash.ui.SplashScreen.kt`中有关更新检测以及内测资格检查的相关代码。
4. 开始构建或二次开发!
1. clone 本项目, 用你的 terminal 环境打开项目根目录
2. 输入 ```./gradlew build```
3. 在目录下的 ```build/libs/Re-WearBili - $versionName Ver.$releaseNumber Rel.$versionCode.apk``` 找到apk文件
4. 导入IDEA进行二次开发,或者将apk导入到你的手表使用

### :computer:我的构建环境:

Expand All @@ -47,7 +44,7 @@ Java version: openjdk version "17.0.8.1" 2023-08-24

## :book:行为准则

[行为准则](https://github.com/SpaceXC/Re-WearBili/blob/main/CodeOfConduct.md)
[行为准则](https://github.com/SpaceXC/Re-WearBili/blob/main/.github/files/CodeOfConduct.md)

## :page_facing_up:开源协议

Expand Down
2 changes: 2 additions & 0 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,8 @@ dependencies {
implementation(libs.androidx.constraintlayout)
implementation(libs.androidx.lifecycle.service)

implementation(libs.ktor.client.core)
implementation(libs.ktor.client.cio)

implementation(libs.hilt.android)
implementation(libs.hilt.work)
Expand Down
13 changes: 11 additions & 2 deletions app/common/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,22 @@ dependencies {
api(libs.material)
api(libs.androidx.ui.graphics)

api(project(":libs"))
api(libs.bilibili.sdk)
api(libs.hilt.android)

implementation(libs.androidx.datastore.preferences)
implementation(libs.androidx.datastore.core)

implementation(libs.ktor.client.android)
implementation(libs.ktor.client.core)
implementation(libs.ktor.client.cio)
implementation(libs.ktor.client.content.negotiation)
implementation(libs.ktor.client.logging)
implementation(libs.ktor.serialization.gson)
implementation(libs.ktor.serialization.kotlinx.protobuf)

implementation(libs.atomicfu)

api(libs.protobuf.javalite)
api(libs.protobuf.kotlin.lite)

Expand All @@ -56,5 +66,4 @@ dependencies {
implementation(libs.zxing.core)

kapt(libs.hilt.compiler)

}
2 changes: 1 addition & 1 deletion app/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#-renamesourcefileattribute SourceFile
# Please add these rules to your existing keep rules in order to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
-printmapping mapping.txt
# -printmapping mapping.txt

# Please add these rules to your existing keep rules in order to suppress warnings.
# This is generated automatically by the Android Gradle plugin.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,6 @@ class Application : android.app.Application(), Configuration.Provider {
.find { it.service.className == serviceClass.name } != null
}


override fun onTerminate() {
super.onTerminate()
}

init {
mApplication = this
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ fun Activity.BangumiInfoScreen(
top = 5.dp,
bottom = 5.dp
),
verticalAlignment = Alignment.CenterVertically
verticalAlignment = CenterVertically
) {
IconText(
text = "追番",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ const val PARAM_IMAGE_URLS = "imageUrls"
const val PARAM_SELECTED_INDEX = "selectedIndex"

class ImageViewerActivity : ComponentActivity() {
@OptIn(ExperimentalFoundationApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
val images = intent.getStringArrayExtra(PARAM_IMAGE_URLS) ?: emptyArray()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ class LinkProcessActivity : ComponentActivity() {

val state = MutableLiveData(0)

override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

}

fun processUrl() {
lifecycleScope.launch {
val uri = getUrl()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import cn.spacexc.wearbili.remake.common.ui.toLoadingState
class FollowingUsersActivity : ComponentActivity() {
private val viewModel by viewModels<FollowingUsersViewModel>()

@OptIn(ExperimentalFoundationApi::class, ExperimentalMaterialApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
viewModel.getFollowedUserTags()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ data class AdInfo(
val card_type: Int,
val client_ip: String,
val cm_mark: Int,
val creative_content: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.CreativeContent,
val creative_content: CreativeContent,
val creative_id: Long,
val creative_style: Int,
val creative_type: Int,
val extra: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.Extra,
val extra: Extra,
val index: Int,
val is_ad: Boolean,
val is_ad_loc: Boolean,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@ package cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app

data class Card(
val ad_tag: String,
val ad_tag_style: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.AdTagStyle,
val adver: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.Adver,
val ad_tag_style: AdTagStyle,
val adver: Adver,
val adver_account_id: Long,
val adver_logo: String,
val adver_mid: Long,
val adver_name: String,
val adver_page_url: String,
val callup_url: String,
val card_type: Int,
val covers: List<cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.Cover>,
val covers: List<Cover>,
val desc: String,
val duration: String,
val dynamic_text: String,
val extra_desc: String,
val extreme_team_icon: String,
val extreme_team_status: Boolean,
val feedback_panel: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.FeedbackPanel,
val feedback_panel: FeedbackPanel,
val fold_time: Int,
val goods_cur_price: String,
val goods_ori_price: String,
Expand All @@ -45,5 +45,5 @@ data class Card(
val under_player_interaction_style: Int,
val universal_app: String,
val use_multi_cover: Boolean,
val video: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.Video
val video: Video
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ data class Config(
val inline_sound: Int,
val is_back_to_homepage: Boolean,
val show_inline_danmaku: Int,
val toast: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.Toast,
val toast: Toast,
val trigger_loadmore_left_line_num: Int,
val visible_area: Int
)
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app

data class Data(
val config: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.Config,
val items: List<cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.Item>
val config: Config,
val items: List<Item>
)
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ data class Extra(
val appstore_priority: Int,
val appstore_url: String,
val bg_img: String,
val card: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.Card,
val card: Card,
val click_area: Int,
val click_urls: List<Any>,
val download_whitelist: List<Any>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app

data class FeedbackPanel(
val close_rec_tips: String,
val feedback_panel_detail: List<cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.FeedbackPanelDetail>,
val feedback_panel_detail: List<FeedbackPanelDetail>,
val open_rec_tips: String,
val panel_type_text: String,
val toast: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ data class FeedbackPanelDetail(
val jump_type: Int,
val jump_url: String,
val module_id: Long,
val secondary_panel: List<cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.SecondaryPanel>?,
val secondary_panel: List<SecondaryPanel>?,
val sub_text: String,
val text: String
)
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app

data class Item(
val ad_info: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.AdInfo?,
val args: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.Args,
val ad_info: AdInfo?,
val args: Args,
val can_play: Int,
val card_goto: String,
val bvid: String?,
Expand All @@ -17,19 +17,19 @@ data class Item(
val cover_right_content_description: String,
val cover_right_text: String,
val desc: String?,
val desc_button: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.DescButton?,
val desc_button: DescButton?,
val goto: String,
val cover_badge: String?,
val goto_icon: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.GotoIcon?,
val goto_icon: GotoIcon?,
val idx: Int,
val official_icon: Int?,
val `param`: String?,
val player_args: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.PlayerArgs?,
val player_args: PlayerArgs?,
val rcmd_reason: String?,
val rcmd_reason_style: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.RcmdReasonStyle?,
val rcmd_reason_style: RcmdReasonStyle?,
val talk_back: String?,
val three_point: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.ThreePoint,
val three_point_v2: List<cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.ThreePointV2>,
val three_point: ThreePoint,
val three_point_v2: List<ThreePointV2>,
val title: String,
val track_id: String,
val uri: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app

data class RecommendVideo(
val code: Int,
val `data`: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.Data,
val `data`: Data,
val message: String,
val ttl: Int
)
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app

data class ThreePoint(
val dislike_reasons: List<cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.DislikeReason>,
val feedbacks: List<cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.Feedback>?,
val dislike_reasons: List<DislikeReason>,
val feedbacks: List<Feedback>?,
val watch_later: Int?
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app

data class ThreePointV2(
val icon: String?,
val reasons: List<cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.app.Reason>?,
val reasons: List<Reason>?,
val subtitle: String?,
val title: String?,
val type: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ data class BusinessInfo(
@SerializedName("asg_id")
val asgid: Long,
@SerializedName("business_mark")
val businessMark: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.web.BusinessMark,
val businessMark: BusinessMark,
@SerializedName("card_type")
val cardType: Int,
@SerializedName("cm_mark")
Expand All @@ -35,7 +35,7 @@ data class BusinessInfo(
@SerializedName("id")
val id: Long,
@SerializedName("inline")
val `inline`: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.web.Inline,
val `inline`: Inline,
@SerializedName("intro")
val intro: String,
@SerializedName("is_ad")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ data class Data(
@SerializedName("business_card")
val businessCard: Any?,
@SerializedName("floor_info")
val floorInfo: List<cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.web.FloorInfo>,
val floorInfo: List<FloorInfo>,
@SerializedName("item")
val item: List<cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.web.Item>,
val item: List<Item>,
@SerializedName("mid")
val mid: Long,
@SerializedName("preload_expose_pct")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ data class WebRecommendVideo(
@SerializedName("code")
val code: Int,
@SerializedName("data")
val `data`: cn.spacexc.wearbili.remake.app.main.recommend.domain.remote.rcmd.web.Data,
val `data`: Data,
@SerializedName("message")
val message: String,
@SerializedName("ttl")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ class MainActivity : ComponentActivity() {
private val dynamicViewModel by viewModels<DynamicViewModel>()
private val profileViewModel by viewModels<ProfileViewModel>()

@OptIn(ExperimentalFoundationApi::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
//throw RuntimeException("这是一个用于测试异常的异常")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,14 @@ import kotlinx.coroutines.launch
* 给!爷!写!注!释!
*/

data class MenuItem @OptIn(ExperimentalFoundationApi::class) constructor(
data class MenuItem(
val text: String,
val icon: ImageVector? = null,
@DrawableRes val iconResId: Int = 0,
val customIcon: Boolean = false,
val onClick: suspend PagerState.(Context) -> Unit,
)

@OptIn(ExperimentalFoundationApi::class)
val menuItems = listOf(
MenuItem(
text = "主页",
Expand Down Expand Up @@ -145,7 +144,6 @@ val menuItems = listOf(
)


@OptIn(ExperimentalAnimationApi::class, ExperimentalFoundationApi::class)
@Composable
fun MainActivityScreen(
context: Activity,
Expand Down
Loading

0 comments on commit 1ddad10

Please sign in to comment.