### 注意:請將lib_common下manifest中喜馬拉雅key替換爲自己的,不然會提示訪問超過限制.
https://github.com/TanZhiL/Zhumulangma
本項目僅提供學習參考,不可作爲商用.
更新日誌:
珠穆朗瑪FM 1.0 2019-10.09
- 友盟分享
珠穆朗瑪FM 1.0 2019-09.25
- 佈局優化,避免過渡繪製
- 完善狀態管理,提升用戶體驗
珠穆朗瑪FM 1.0 2019-09.20
- 聲音批量下載
- 語音搜索
- 專輯訂閱
- 聲音喜歡
- 優化啓動速度
- 加入模擬廣告頁
- 集成Bugly異常上報,全量更新,熱更新
珠穆朗瑪FM 1.0 2019-09.13
- 第一次發佈
功能演示
主要功能(包括不僅限於):
- 專輯展示
- 聲音展示及播放
- 電臺展示及播放
- 主播展示
- 聲音下載
- 歷史播放展示及播放
待完善(包括不僅限於):
- 用戶登陸
- 優化UI
- 優化性能
- 修復bug
- 更多
快速體驗
掃描二維碼下載:
如果二維碼圖片不可見,點我下載體驗
項目架構
本項目採用retrofit+rxjava2+rxandroid+arouter+mvvm+fragmentation實現單activity多fragme組件化架構
- app:負責管理各個業務組件,和打包apk,沒有具體的業務功能;
- lib_common:屬於功能組件,支撐業務組件的基礎,提供多數業務組件需要的功能;
- module_main:屬於業務組件,指定APP啓動頁面、主界面;
- module_home:首頁展示,包括熱門,分類,精品,主播,電臺,展示及播放等;
- module_listen:我聽,包括訂閱,喜歡,播放歷史,下載等;
- module_discover:發現,包括後續擴展功能等;
- module_user:用戶管理模塊;
組件化實現:
珠穆朗瑪FM客戶端使用阿里ARouter作爲路由,實現組件與組件的通信跳轉
集成模式和組件模式轉換
Module的屬性是在每個組件的 build.gradle 文件中配置的,當我們在組件模式開發時,業務組件應處於application屬性,這時的業務組件就是一個 Android App,可以獨立開發和調試;而當我們轉換到集成模式開發時,業務組件應該處於 library 屬性,這樣才能被我們的“app殼工程”所依賴,組成一個具有完整功能的APP
先打開工程的根目錄下找到gradle.properties 文件,然後將 isModule 改爲你需要的開發模式(true/false), 然後點擊 “Sync Project” 按鈕同步項目
isModule=false
if (isModule.toBoolean()) {
apply plugin: 'com.android.application'
} else {
apply plugin: 'com.android.library'
}
組件之間AndroidManifest合併問題
我們可以爲組件開發模式下的業務組件再創建一個 AndroidManifest.xml,然後根據isModule指定AndroidManifest.xml的文件路徑,讓業務組件在集成模式和組件模式下使用不同的AndroidManifest.xml,這樣表單衝突的問題就可以規避了
已module_main組件爲例配置如下:
sourceSets {
main {
if (isModule.toBoolean()) {
manifest.srcFile 'src/main/module/AndroidManifest.xml'
} else {
manifest.srcFile 'src/main/AndroidManifest.xml'
}
}
}
組件模式下的Application
在每個組件的debug目錄下創建一個Application並在module下的AndroidManifest.xml進行配置
配圖:
集成開發模式下的Application
主要用到的開源庫
- 快速切面編程開源庫 https://github.com/TanZhiL/OkAspectj
- 喜馬拉雅SDK http://open.ximalaya.com/
- fragmentation https://github.com/YoKeyword/Fragmentation
- okhttp https://github.com/square/okhttp
- retrofit https://github.com/square/retrofit
- rxpermissions 權限 https://github.com/tbruyelle/RxPermissions
- BaseRecyclerViewAdapterHelper https://github.com/CymChad/BaseRecyclerViewAdapterHelper
- loadsir 狀態管理 https://github.com/KingJA/LoadSir
- lottie動畫 https://github.com/airbnb/lottie-android
- SmartRefreshLayout https://github.com/scwang90/SmartRefreshLayout
- MagicIndicator https://github.com/hackware1993/MagicIndicator
致謝
- 感謝所有開源庫的大佬
- mvvm借鑑 https://github.com/geduo83/FlyTour
- 原型平臺 https://www.xiaopiu.com/
問題反饋
歡迎加星,打call https://github.com/TanZhiL/Zhumulangma
- email:[email protected]
關於作者
譚志龍
開源項目
- 快速切面編程開源庫 https://github.com/TanZhiL/OkAspectj
- 高仿喜馬拉雅聽Android客戶端 https://github.com/TanZhiL/Zhumulangma
License
Copyright (C) tanzhilong Zhumualangma Framework Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.