Skip to content

Commit c1212c7

Browse files
committed
Merge branch 'cc-2.0'
2 parents 1457b6b + 46d19d6 commit c1212c7

File tree

146 files changed

+1596
-694
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

146 files changed

+1596
-694
lines changed

app/build.gradle

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
import java.util.regex.Pattern
22

3-
apply plugin: 'com.android.application'
3+
4+
ext.mainApp = true //如果此module为主app module,一直以application方式编译,则启用这一行
5+
//ext.alwaysLib = true //如果此module为基础库,一直以library方式编译,则启用这一行
6+
apply from: rootProject.file("cc-settings-2-app.gradle")
7+
//注意:最好放在build.gradle中代码的第一行
8+
9+
410
apply plugin: 'kotlin-android'
511
apply plugin: 'kotlin-android-extensions'
612
apply plugin: 'kotlin-kapt'//kapt3插件
@@ -9,7 +15,9 @@ android {
915
compileSdkVersion versions.compileSdk
1016
buildToolsVersion versions.buildTools
1117
defaultConfig {
12-
applicationId "me.jbusdriver"
18+
if (project.ext.runAsApp) {
19+
applicationId "me.jbusdriver"
20+
}
1321
minSdkVersion 16
1422
targetSdkVersion versions.targetSdk
1523
versionCode 1
@@ -107,7 +115,7 @@ def VersionName() {
107115
cmd = 'git rev-list --all --count'
108116
def code = cmd.execute().text.trim().toInteger()
109117

110-
def versionName = verName + "build" + code
118+
def versionName = verName + "build" + code
111119
logger.quiet(cmd + " >>>> versionName = " + versionName)
112120
return versionName
113121
}
@@ -124,7 +132,6 @@ dependencies {
124132
exclude group: 'com.android.support'
125133
}
126134

127-
implementation project(':base_lib')
128135

129136
// implementation(name: 'bugly_crashreport_upgrade-1.3.5', ext: 'aar')
130137
// 远程依赖集成方式(推荐)
@@ -138,6 +145,9 @@ dependencies {
138145

139146

140147
implementation "com.android.support:multidex:1.0.3" // 多dex配置
148+
149+
//components
150+
addComponent "component_magnet"
141151
}
142152

143153
configurations.all { config ->

app/src/main/AndroidManifest.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3-
package="jbusdriver.me.jbusdriver">
3+
xmlns:tools="http://schemas.android.com/tools"
4+
package="me.jbusdriver">
45

56
<uses-permission android:name="android.permission.INTERNET" />
67
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
78
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
89
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
910
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
1011
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
11-
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
12+
<uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
13+
tools:ignore="ProtectedPermissions" />
1214
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
1315

1416
<application
@@ -49,9 +51,6 @@
4951
<activity
5052
android:name="me.jbusdriver.ui.activity.SearchResultActivity"
5153
android:launchMode="singleTop" />
52-
<activity
53-
android:name="me.jbusdriver.ui.activity.MagnetPagerListActivity"
54-
android:launchMode="singleTop" />
5554
<activity android:name="me.jbusdriver.ui.activity.SettingActivity" />
5655

5756
<service
@@ -61,7 +60,7 @@
6160
android:name="me.jbusdriver.ui.task.TrimLikeService"
6261
android:exported="false" />
6362

64-
<activity android:name="me.jbusdriver.ui.activity.HotRecommendActivity" />
63+
<!-- <activity android:name="me.jbusdriver.ui.activity.HotRecommendActivity" />-->
6564
</application>
6665

6766
</manifest>

app/src/main/java/me/jbusdriver/common/AppContext.kt

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package me.jbusdriver.common
22

33
import android.os.Environment
4+
import com.billy.cc.core.component.CC
45
import com.orhanobut.logger.AndroidLogAdapter
56
import com.orhanobut.logger.Logger
67
import com.orhanobut.logger.PrettyFormatStrategy
@@ -9,7 +10,7 @@ import com.tencent.tinker.loader.app.TinkerApplication
910
import com.tencent.tinker.loader.shareutil.ShareConstants
1011
import com.umeng.analytics.MobclickAgent
1112
import io.reactivex.plugins.RxJavaPlugins
12-
import jbusdriver.me.jbusdriver.BuildConfig
13+
import me.jbusdriver.BuildConfig
1314
import me.jbusdriver.base.JBusManager
1415
import me.jbusdriver.base.arrayMapof
1516
import me.jbusdriver.debug.stetho.initializeStetho
@@ -37,6 +38,8 @@ class AppContext : TinkerApplication(ShareConstants.TINKER_ENABLE_ALL, "me.jbusd
3738
if (BuildConfig.DEBUG) {
3839
LeakCanary.install(this)
3940

41+
initializeStetho(this) //chrome://inspect/#devices
42+
4043
val formatStrategy = PrettyFormatStrategy.newBuilder()
4144
.showThreadInfo(true) // (Optional) Whether to show thread info or not. Default true
4245
.methodCount(2) // (Optional) How many method line to show. Default 2
@@ -53,7 +56,10 @@ class AppContext : TinkerApplication(ShareConstants.TINKER_ENABLE_ALL, "me.jbusd
5356
).exists()
5457
})
5558

56-
initializeStetho(this) //chrome://inspect/#devices
59+
60+
CC.enableVerboseLog(true)
61+
CC.enableDebug(true)
62+
CC.enableRemoteCC(true)
5763
}
5864

5965
MobclickAgent.setDebugMode(BuildConfig.DEBUG)

app/src/main/java/me/jbusdriver/db/AppDBOPenHelper.kt

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import android.arch.persistence.db.SupportSQLiteDatabase
44
import android.arch.persistence.db.SupportSQLiteOpenHelper
55
import android.database.sqlite.SQLiteDatabase
66
import me.jbusdriver.base.KLog
7-
import me.jbusdriver.db.bean.AllFirstParentDBCategoryGroup
7+
import me.jbusdriver.commen.bean.db.CategoryTable
8+
import me.jbusdriver.commen.bean.db.AllFirstParentDBCategoryGroup
89

910

1011
//region history
@@ -26,16 +27,6 @@ object HistoryTable {
2627
}
2728
//endregion
2829

29-
//region collect category
30-
object CategoryTable {
31-
const val TABLE_NAME = "t_category"
32-
const val COLUMN_ID = "id"
33-
const val COLUMN_P_ID = "pid"
34-
const val COLUMN_NAME = "name"
35-
const val COLUMN_TREE = "tree"
36-
const val COLUMN_ORDER = "orderIndex"
37-
}
38-
3930
private const val CREATE_COLLECT_CATEGORY_SQL = "CREATE TABLE ${CategoryTable.TABLE_NAME} ( " +
4031
" ${CategoryTable.COLUMN_ID} INTEGER PRIMARY KEY AUTOINCREMENT," +
4132
" ${CategoryTable.COLUMN_P_ID} INTEGER NOT NULL DEFAULT -1," +
@@ -106,7 +97,7 @@ class CollectDBCallBack : SupportSQLiteOpenHelper.Callback(COLLECT_DB_VERSION) {
10697
db?.execSQL(CREATE_COLLECT_CATEGORY_SQL)
10798
AllFirstParentDBCategoryGroup.forEach {
10899
db?.insert(CategoryTable.TABLE_NAME, SQLiteDatabase.CONFLICT_NONE, it.value.cv())
109-
db?.update(CategoryTable.TABLE_NAME, SQLiteDatabase.CONFLICT_NONE, it.value.cv(),CategoryTable.COLUMN_ID + " = ${it.value.id!!} ",null)
100+
db?.update(CategoryTable.TABLE_NAME, SQLiteDatabase.CONFLICT_NONE, it.value.cv(), CategoryTable.COLUMN_ID + " = ${it.value.id!!} ",null)
110101
}
111102
// AllFirstParentDBCategoryGroup.forEach {
112103
// try {

app/src/main/java/me/jbusdriver/db/DB.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import java.io.File
1717
object DB {
1818
private val provideSqlBrite: SqlBrite by lazy {
1919
SqlBrite.Builder().apply {
20-
if (jbusdriver.me.jbusdriver.BuildConfig.DEBUG) {
20+
if (me.jbusdriver.BuildConfig.DEBUG) {
2121
this.logger { message -> KLog.t("DataBase").i(message) }
2222
}
2323
}.build()
@@ -27,7 +27,7 @@ object DB {
2727
val configuration = SupportSQLiteOpenHelper.Configuration.builder(JBus)
2828
.name(JBUS_DB_NAME).callback(JBusDBOpenCallBack()).build()
2929
provideSqlBrite.wrapDatabaseHelper(FrameworkSQLiteOpenHelperFactory().create(configuration), Schedulers.io()).apply {
30-
setLoggingEnabled(jbusdriver.me.jbusdriver.BuildConfig.DEBUG)
30+
setLoggingEnabled(me.jbusdriver.BuildConfig.DEBUG)
3131
}
3232
}
3333

@@ -37,7 +37,7 @@ object DB {
3737
override val dir: String = JBus.packageName + File.separator + "collect"
3838
}).name(COLLECT_DB_NAME).callback(CollectDBCallBack()).build()
3939
provideSqlBrite.wrapDatabaseHelper(FrameworkSQLiteOpenHelperFactory().create(configuration), Schedulers.io()).apply {
40-
setLoggingEnabled(jbusdriver.me.jbusdriver.BuildConfig.DEBUG)
40+
setLoggingEnabled(me.jbusdriver.BuildConfig.DEBUG)
4141
}
4242
}
4343

app/src/main/java/me/jbusdriver/db/bean/DBBean.kt

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,19 @@
11
package me.jbusdriver.db.bean
22

3-
import android.content.ContentValues
43
import android.content.Context
54
import me.jbusdriver.base.*
5+
import me.jbusdriver.base.mvp.bean.PageInfo
6+
import me.jbusdriver.commen.bean.ICollectCategory
7+
import me.jbusdriver.commen.bean.ILink
68
import me.jbusdriver.common.JBus
79
import me.jbusdriver.common.isEndWithXyzHost
8-
import me.jbusdriver.db.CategoryTable
910
import me.jbusdriver.http.JAVBusService
1011
import me.jbusdriver.mvp.bean.*
1112
import me.jbusdriver.ui.activity.MovieDetailActivity
1213
import me.jbusdriver.ui.activity.MovieListActivity
1314
import java.util.*
1415

1516

16-
data class Category(val name: String, val pid: Int = -1, val tree: String, var order: Int = 0) {
17-
var id: Int? = null
18-
19-
@delegate:Transient
20-
val depth: Int by lazy { tree.split("/").filter { it.isNotBlank() }.size }
21-
22-
fun cv(update: Boolean = false): ContentValues = ContentValues().also {
23-
if (id != null || update) it.put(CategoryTable.COLUMN_ID, id)
24-
it.put(CategoryTable.COLUMN_NAME, name)
25-
it.put(CategoryTable.COLUMN_P_ID, pid)
26-
it.put(CategoryTable.COLUMN_TREE, tree)
27-
it.put(CategoryTable.COLUMN_ORDER, order)
28-
}
29-
30-
override fun equals(other: Any?) =
31-
other?.let { (it as? Category)?.id == this.id } ?: false
32-
33-
fun equalAll(other: Category?) = other?.let { it.id == this.id && it.name == this.name && it.pid == this.pid && it.tree == this.tree }
34-
?: false
35-
}
36-
37-
/**
38-
* 预留 [3..9]的分类
39-
*/
40-
val MovieCategory = Category("默认电影分类", -1, "1/", Int.MAX_VALUE).apply { id = 1 }
41-
val ActressCategory = Category("默认演员分类", -1, "2/", Int.MAX_VALUE).apply { id = 2 }
42-
val LinkCategory = Category("默认链接分类", -1, "10/", Int.MAX_VALUE).apply { id = 10 }
43-
val AllFirstParentDBCategoryGroup by lazy { arrayMapof(1 to MovieCategory, 2 to ActressCategory, 10 to LinkCategory) }
44-
45-
4617
data class LinkItem(val type: Int, val createTime: Date, val key: String, val jsonStr: String, var categoryId: Int = -1) {
4718
var id: Int? = null
4819
fun getLinkValue(): ILink = doGet(type, jsonStr).also {
@@ -104,11 +75,6 @@ private fun doGet(type: Int, jsonStr: String) = when (type) {
10475
}
10576

10677

107-
interface ICollectCategory {
108-
var categoryId: Int
109-
}
110-
111-
11278
data class DBPage(val currentPage: Int, val totalPage: Int, val pageSize: Int = 20)
11379

11480
val DBPage.toPageInfo

app/src/main/java/me/jbusdriver/db/dao/CategoryDao.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import com.squareup.sqlbrite3.BriteDatabase
66
import me.jbusdriver.base.KLog
77
import me.jbusdriver.base.getIntByColumn
88
import me.jbusdriver.base.getStringByColumn
9-
import me.jbusdriver.db.CategoryTable
10-
import me.jbusdriver.db.bean.Category
9+
import me.jbusdriver.commen.bean.db.CategoryTable
10+
import me.jbusdriver.commen.bean.db.Category
1111
import java.util.concurrent.TimeUnit
1212

1313
/**

app/src/main/java/me/jbusdriver/db/service/Service.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ import io.reactivex.Flowable
55
import io.reactivex.Observable
66
import me.jbusdriver.base.KLog
77
import me.jbusdriver.db.DB
8-
import me.jbusdriver.db.bean.Category
8+
import me.jbusdriver.commen.bean.db.Category
99
import me.jbusdriver.db.bean.DBPage
1010
import me.jbusdriver.db.bean.History
1111
import me.jbusdriver.db.bean.LinkItem
1212
import me.jbusdriver.mvp.bean.ActressInfo
13-
import me.jbusdriver.mvp.bean.ILink
13+
import me.jbusdriver.commen.bean.ILink
1414
import me.jbusdriver.mvp.bean.Movie
1515
import me.jbusdriver.mvp.bean.convertDBItem
1616
import me.jbusdriver.ui.data.AppConfiguration

app/src/main/java/me/jbusdriver/mvp/Contract.kt

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
11
package me.jbusdriver.mvp
22

33
import me.jbusdriver.base.mvp.BaseView
4+
import me.jbusdriver.base.mvp.bean.PageInfo
45
import me.jbusdriver.base.mvp.presenter.BasePresenter
5-
import me.jbusdriver.mvp.bean.*
6+
import me.jbusdriver.commen.bean.ILink
7+
import me.jbusdriver.mvp.bean.ActressInfo
8+
import me.jbusdriver.mvp.bean.Genre
9+
import me.jbusdriver.mvp.bean.Movie
610
import me.jbusdriver.mvp.presenter.BaseCollectPresenter
711
import me.jbusdriver.ui.data.enums.DataSourceType
812

@@ -95,16 +99,8 @@ interface HistoryContract {
9599
}
96100
}
97101

98-
interface MagnetPagerContract {
99-
interface MagnetPagerView : BaseView
100-
interface MagnetPagerPresenter : BasePresenter<MagnetPagerView>, BasePresenter.LazyLoaderPresenter
101-
}
102102

103103

104-
interface MagnetListContract {
105-
interface MagnetListView : BaseView.BaseListWithRefreshView
106-
interface MagnetListPresenter : BasePresenter.BaseRefreshLoadMorePresenter<MagnetListView>, BasePresenter.LazyLoaderPresenter
107-
}
108104

109105
interface HotRecommendContract {
110106
interface HotRecommendView : BaseView.BaseListWithRefreshView

app/src/main/java/me/jbusdriver/mvp/bean/Bean.kt

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ package me.jbusdriver.mvp.bean
22

33
import me.jbusdriver.base.toJsonString
44
import me.jbusdriver.base.urlPath
5-
import me.jbusdriver.db.bean.AllFirstParentDBCategoryGroup
6-
import me.jbusdriver.db.bean.ICollectCategory
7-
import me.jbusdriver.db.bean.LinkCategory
5+
import me.jbusdriver.commen.bean.ICollectCategory
6+
import me.jbusdriver.commen.bean.ILink
7+
import me.jbusdriver.commen.bean.db.AllFirstParentDBCategoryGroup
8+
import me.jbusdriver.commen.bean.db.LinkCategory
89
import me.jbusdriver.db.bean.LinkItem
910
import me.jbusdriver.http.JAVBusService
1011
import me.jbusdriver.ui.data.enums.SearchType
11-
import java.io.Serializable
1212
import java.util.*
1313

1414
/**
@@ -19,10 +19,6 @@ const val Expand_Type_Head = 0
1919
const val Expand_Type_Item = 1
2020

2121

22-
interface ILink : ICollectCategory, Serializable {
23-
val link: String
24-
}
25-
2622
val ILink.des: String
2723
inline get() = when (this) {
2824
is Header -> "$name $value"
@@ -70,12 +66,6 @@ data class PageLink(val page: Int, val title: String /*XX类型*/, override val
7066
override var categoryId: Int = LinkCategory.id ?: 10
7167
}
7268

73-
data class PageInfo(val activePage: Int = 0, val nextPage: Int = 0,
74-
val referPages: List<Int> = listOf())
75-
76-
val PageInfo.hasNext
77-
inline get() = activePage < nextPage
78-
7969

8070
data class SearchLink(val type: SearchType, var query: String) : ILink {
8171
@Transient

0 commit comments

Comments
 (0)