Skip to content

Commit

Permalink
资源和颜色抽取为可覆盖的配置
Browse files Browse the repository at this point in the history
  • Loading branch information
junixapp committed Apr 28, 2022
1 parent 9c45230 commit f6029de
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 34 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'

android {
compileSdkVersion 30
compileSdkVersion 31
defaultConfig {
applicationId "com.lxj.demo1"
minSdkVersion 19
targetSdkVersion 28
targetSdkVersion 31
versionCode 1
versionName "1.0"
}
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,17 @@
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name="com.lxj.demo1.MainActivity" >
<activity android:name="com.lxj.demo1.MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<activity android:name="com.lxj.demo1.InFragmentDemo"/>
<activity android:name="com.lxj.demo1.InFragmentDemo"
android:exported="true"/>
</application>

</manifest>
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.3.41'
ext.kotlin_version = '1.5.0'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.5.3'
classpath 'com.android.tools.build:gradle:4.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#Wed Dec 18 19:13:30 CST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
14 changes: 2 additions & 12 deletions statelayout-library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 28
compileSdkVersion 31

defaultConfig {
minSdkVersion 19
targetSdkVersion 28
targetSdkVersion 31
versionCode 1
versionName "1.0"
}
Expand All @@ -24,13 +24,3 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation 'androidx.appcompat:appcompat:1.3.1'
}

//publish {
// userOrg = 'li-xiaojun'
// groupId = 'com.lxj'
// artifactId = 'statelayout'
// publishVersion = '1.2.2'
// repoName = 'jrepo'
// desc = 'Simple way to change your layout state, like loading, _statelayout_empty, _statelayout_error. Strong customizitaion, written by Kotlin!'
// website = 'https://github.com/li-xiaojun/StateLayout'
//}
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ class StateLayout @JvmOverloads constructor(context: Context, attributeSet: Attr

private fun switch(v: View?) {
if (switchTask != null) {
mHandler.removeCallbacks(switchTask)
mHandler.removeCallbacks(switchTask!!)
}
switchTask = SwitchTask(v)
mHandler.post(switchTask)
mHandler.post(switchTask!!)
}

private fun retry() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,14 @@
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="30dp"
android:gravity="center"
android:orientation="vertical">

<ImageView
android:id="@+id/ivNoDataIcon"
android:src="@drawable/_statelayout_empty"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_width="60dp"
android:layout_height="60dp"
android:layout_gravity="center"/>

<TextView
Expand All @@ -20,7 +19,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textColor="#444"
android:textSize="15sp"
android:text="@string/nodata"/>
android:textColor="@color/_statelayout_hint_color"
android:textSize="14sp"
android:text="@string/_statelayout_nodata"/>
</LinearLayout>
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
android:layout_gravity="center"
android:paddingLeft="14dp"
android:paddingRight="14dp"
android:textSize="12sp"
android:textSize="14sp"
android:layout_marginTop="15dp"
android:text="@string/load_failed_try_again"
android:textColor="#444"/>
android:text="@string/_statelayout_load_failed"
android:textColor="@color/_statelayout_hint_color"/>

</LinearLayout>
4 changes: 2 additions & 2 deletions statelayout-library/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="load_failed_try_again">Load failed, try again</string>
<string name="nodata">No Data</string>
<string name="_statelayout_load_failed">Click to retry</string>
<string name="_statelayout_nodata">No Data</string>
</resources>
4 changes: 4 additions & 0 deletions statelayout-library/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="_statelayout_hint_color">#656565</color>
</resources>
4 changes: 2 additions & 2 deletions statelayout-library/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="load_failed_try_again">加载失败,点击重试</string>
<string name="nodata">暂无数据</string>
<string name="_statelayout_load_failed">点击重试</string>
<string name="_statelayout_nodata">暂无数据</string>
</resources>

0 comments on commit f6029de

Please sign in to comment.