Skip to content

Commit f6029de

Browse files
committed
资源和颜色抽取为可覆盖的配置
1 parent 9c45230 commit f6029de

File tree

12 files changed

+30
-34
lines changed

12 files changed

+30
-34
lines changed

app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@ apply plugin: 'kotlin-android'
55
apply plugin: 'kotlin-android-extensions'
66

77
android {
8-
compileSdkVersion 30
8+
compileSdkVersion 31
99
defaultConfig {
1010
applicationId "com.lxj.demo1"
1111
minSdkVersion 19
12-
targetSdkVersion 28
12+
targetSdkVersion 31
1313
versionCode 1
1414
versionName "1.0"
1515
}

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@
99
android:roundIcon="@mipmap/ic_launcher_round"
1010
android:supportsRtl="true"
1111
android:theme="@style/AppTheme">
12-
<activity android:name="com.lxj.demo1.MainActivity" >
12+
<activity android:name="com.lxj.demo1.MainActivity"
13+
android:exported="true">
1314
<intent-filter>
1415
<action android:name="android.intent.action.MAIN" />
1516

1617
<category android:name="android.intent.category.LAUNCHER" />
1718
</intent-filter>
1819
</activity>
1920

20-
<activity android:name="com.lxj.demo1.InFragmentDemo"/>
21+
<activity android:name="com.lxj.demo1.InFragmentDemo"
22+
android:exported="true"/>
2123
</application>
2224

2325
</manifest>

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
22

33
buildscript {
4-
ext.kotlin_version = '1.3.41'
4+
ext.kotlin_version = '1.5.0'
55
repositories {
66
google()
77
mavenCentral()
88
}
99
dependencies {
10-
classpath 'com.android.tools.build:gradle:3.5.3'
10+
classpath 'com.android.tools.build:gradle:4.2.0'
1111
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
1212
// NOTE: Do not place your application dependencies here; they belong
1313
// in the individual module build.gradle files

gradle/wrapper/gradle-wrapper.jar

-88 Bytes
Binary file not shown.
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
#Wed Dec 18 19:13:30 CST 2019
12
distributionBase=GRADLE_USER_HOME
23
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip

statelayout-library/build.gradle

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ apply plugin: 'com.android.library'
22
apply plugin: 'kotlin-android'
33

44
android {
5-
compileSdkVersion 28
5+
compileSdkVersion 31
66

77
defaultConfig {
88
minSdkVersion 19
9-
targetSdkVersion 28
9+
targetSdkVersion 31
1010
versionCode 1
1111
versionName "1.0"
1212
}
@@ -24,13 +24,3 @@ dependencies {
2424
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
2525
implementation 'androidx.appcompat:appcompat:1.3.1'
2626
}
27-
28-
//publish {
29-
// userOrg = 'li-xiaojun'
30-
// groupId = 'com.lxj'
31-
// artifactId = 'statelayout'
32-
// publishVersion = '1.2.2'
33-
// repoName = 'jrepo'
34-
// desc = 'Simple way to change your layout state, like loading, _statelayout_empty, _statelayout_error. Strong customizitaion, written by Kotlin!'
35-
// website = 'https://github.com/li-xiaojun/StateLayout'
36-
//}

statelayout-library/src/main/java/com/lxj/statelayout/StateLayout.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,10 +171,10 @@ class StateLayout @JvmOverloads constructor(context: Context, attributeSet: Attr
171171

172172
private fun switch(v: View?) {
173173
if (switchTask != null) {
174-
mHandler.removeCallbacks(switchTask)
174+
mHandler.removeCallbacks(switchTask!!)
175175
}
176176
switchTask = SwitchTask(v)
177-
mHandler.post(switchTask)
177+
mHandler.post(switchTask!!)
178178
}
179179

180180
private fun retry() {

statelayout-library/src/main/res/layout/_loading_layout_empty.xml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,14 @@
33
xmlns:android="http://schemas.android.com/apk/res/android"
44
android:layout_width="match_parent"
55
android:layout_height="match_parent"
6-
android:paddingBottom="30dp"
76
android:gravity="center"
87
android:orientation="vertical">
98

109
<ImageView
1110
android:id="@+id/ivNoDataIcon"
1211
android:src="@drawable/_statelayout_empty"
13-
android:layout_width="64dp"
14-
android:layout_height="64dp"
12+
android:layout_width="60dp"
13+
android:layout_height="60dp"
1514
android:layout_gravity="center"/>
1615

1716
<TextView
@@ -20,7 +19,7 @@
2019
android:layout_width="wrap_content"
2120
android:layout_height="wrap_content"
2221
android:layout_gravity="center"
23-
android:textColor="#444"
24-
android:textSize="15sp"
25-
android:text="@string/nodata"/>
22+
android:textColor="@color/_statelayout_hint_color"
23+
android:textSize="14sp"
24+
android:text="@string/_statelayout_nodata"/>
2625
</LinearLayout>

statelayout-library/src/main/res/layout/_loading_layout_error.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@
1818
android:layout_gravity="center"
1919
android:paddingLeft="14dp"
2020
android:paddingRight="14dp"
21-
android:textSize="12sp"
21+
android:textSize="14sp"
2222
android:layout_marginTop="15dp"
23-
android:text="@string/load_failed_try_again"
24-
android:textColor="#444"/>
23+
android:text="@string/_statelayout_load_failed"
24+
android:textColor="@color/_statelayout_hint_color"/>
2525

2626
</LinearLayout>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<string name="load_failed_try_again">Load failed, try again</string>
4-
<string name="nodata">No Data</string>
3+
<string name="_statelayout_load_failed">Click to retry</string>
4+
<string name="_statelayout_nodata">No Data</string>
55
</resources>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<resources>
3+
<color name="_statelayout_hint_color">#656565</color>
4+
</resources>
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
3-
<string name="load_failed_try_again">加载失败,点击重试</string>
4-
<string name="nodata">暂无数据</string>
3+
<string name="_statelayout_load_failed">点击重试</string>
4+
<string name="_statelayout_nodata">暂无数据</string>
55
</resources>

0 commit comments

Comments
 (0)