├── app ├── .gitignore ├── src │ └── main │ │ ├── res │ │ ├── values │ │ │ ├── strings.xml │ │ │ ├── styles.xml │ │ │ └── color.xml │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ └── layout │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── kotlin │ │ └── moe │ │ └── feng │ │ └── material │ │ └── statusbar │ │ └── demo │ │ └── MainActivity.kt ├── proguard-rules.pro └── build.gradle ├── demo-java ├── .gitignore ├── src │ ├── main │ │ ├── res │ │ │ ├── values │ │ │ │ ├── strings.xml │ │ │ │ ├── styles.xml │ │ │ │ └── color.xml │ │ │ ├── mipmap-hdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ │ └── ic_launcher.png │ │ │ └── layout │ │ │ │ └── activity_main.xml │ │ ├── AndroidManifest.xml │ │ └── java │ │ │ └── moe │ │ │ └── feng │ │ │ └── material │ │ │ └── statusbar │ │ │ └── demo │ │ │ └── MainActivity.java │ └── androidTest │ │ └── java │ │ └── moe │ │ └── feng │ │ └── material │ │ └── statusbar │ │ └── ApplicationTest.java ├── build.gradle └── proguard-rules.pro ├── library-java ├── .gitignore ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ ├── values │ │ │ ├── attrs.xml │ │ │ └── styles.xml │ │ ├── values-v19 │ │ │ └── styles.xml │ │ └── values-v21 │ │ │ └── styles.xml │ │ └── java │ │ └── moe │ │ └── feng │ │ └── material │ │ └── statusbar │ │ ├── StatusBarCompat.java │ │ ├── TranslucentSBActivity.java │ │ ├── util │ │ └── ViewHelper.java │ │ ├── StatusBarHeaderView.java │ │ └── AppBarLayout.java ├── build.gradle └── proguard-rules.pro ├── library-kotlin ├── .gitignore ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ ├── res │ │ ├── values │ │ │ ├── attrs.xml │ │ │ └── styles.xml │ │ ├── values-v19 │ │ │ └── styles.xml │ │ └── values-v21 │ │ │ └── styles.xml │ │ └── kotlin │ │ └── moe │ │ └── feng │ │ └── material │ │ └── statusbar │ │ ├── StatusBarCompat.kt │ │ ├── TranslucentSBActivity.kt │ │ ├── util │ │ └── ViewHelper.kt │ │ ├── StatusBarHeaderView.kt │ │ └── AppBarLayout.kt ├── proguard-rules.pro └── build.gradle ├── settings.gradle ├── art ├── Screenshot0.png ├── Screenshot1.png ├── Screenshot2.png └── Screenshot3.png ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── .gitignore ├── gradle.properties ├── gradlew.bat ├── README.md ├── gradlew └── LICENSE /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /demo-java/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library-java/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /library-kotlin/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /settings.gradle: -------------------------------------------------------------------------------- 1 | include ':library-kotlin', ':app', ':library-java', ':demo-java' 2 | -------------------------------------------------------------------------------- /art/Screenshot0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fython/MaterialStatusBarCompat/HEAD/art/Screenshot0.png -------------------------------------------------------------------------------- /art/Screenshot1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fython/MaterialStatusBarCompat/HEAD/art/Screenshot1.png -------------------------------------------------------------------------------- /art/Screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fython/MaterialStatusBarCompat/HEAD/art/Screenshot2.png -------------------------------------------------------------------------------- /art/Screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fython/MaterialStatusBarCompat/HEAD/art/Screenshot3.png -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | StatusBarCompat 3 | 4 | -------------------------------------------------------------------------------- /demo-java/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | StatusBarCompat 3 | 4 | -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fython/MaterialStatusBarCompat/HEAD/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | .DS_Store 4 | /captures 5 | 6 | *.iml 7 | *.apk 8 | /.idea 9 | /*/build 10 | /build -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fython/MaterialStatusBarCompat/HEAD/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fython/MaterialStatusBarCompat/HEAD/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fython/MaterialStatusBarCompat/HEAD/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /library-java/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /library-kotlin/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /demo-java/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fython/MaterialStatusBarCompat/HEAD/demo-java/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo-java/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fython/MaterialStatusBarCompat/HEAD/demo-java/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /demo-java/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fython/MaterialStatusBarCompat/HEAD/demo-java/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Tue Jul 14 17:30:42 CST 2015 2 | distributionBase=GRADLE_USER_HOME 3 | distributionPath=wrapper/dists 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 7 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /demo-java/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /app/src/main/res/values/color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #2196F3 5 | #1976D2 6 | 7 | #673AB7 8 | #512DA8 9 | 10 | -------------------------------------------------------------------------------- /demo-java/src/main/res/values/color.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | #2196F3 5 | #1976D2 6 | 7 | #673AB7 8 | #512DA8 9 | 10 | -------------------------------------------------------------------------------- /demo-java/src/androidTest/java/moe/feng/material/statusbar/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package moe.feng.material.statusbar; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /library-kotlin/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /library-java/src/main/res/values/attrs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /library-java/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion "22.0.1" 6 | 7 | defaultConfig { 8 | minSdkVersion 15 9 | targetSdkVersion 22 10 | versionCode 1 11 | versionName "1.0" 12 | } 13 | buildTypes { 14 | release { 15 | minifyEnabled false 16 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 17 | } 18 | } 19 | } 20 | 21 | dependencies { 22 | compile fileTree(dir: 'libs', include: ['*.jar']) 23 | compile 'com.android.support:appcompat-v7:22.2.0' 24 | } 25 | -------------------------------------------------------------------------------- /demo-java/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 22 5 | buildToolsVersion "22.0.1" 6 | 7 | defaultConfig { 8 | applicationId "moe.feng.material.statusbar.demo" 9 | minSdkVersion 15 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | compile fileTree(dir: 'libs', include: ['*.jar']) 24 | compile project(':library-java') 25 | compile 'com.android.support:appcompat-v7:22.2.0' 26 | } 27 | -------------------------------------------------------------------------------- /library-kotlin/src/main/res/values-v19/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in G:\adt\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /library-java/src/main/res/values-v19/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /library-kotlin/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in G:\adt\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /demo-java/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in G:\adt\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /library-java/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in G:\adt\sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /library-kotlin/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /library-java/src/main/res/values-v21/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 11 | 12 | 16 | 17 | -------------------------------------------------------------------------------- /library-java/src/main/java/moe/feng/material/statusbar/StatusBarCompat.java: -------------------------------------------------------------------------------- 1 | package moe.feng.material.statusbar; 2 | 3 | import android.app.Activity; 4 | import android.graphics.Color; 5 | import android.os.Build; 6 | import android.view.View; 7 | 8 | import moe.feng.material.statusbar.util.ViewHelper; 9 | 10 | public class StatusBarCompat { 11 | 12 | public static void setUpActivity(Activity activity) { 13 | if (Build.VERSION.SDK_INT >= 19 && !ViewHelper.isChrome()) { 14 | activity.getWindow().getDecorView() 15 | .setSystemUiVisibility( 16 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 17 | ); 18 | } 19 | 20 | if (Build.VERSION.SDK_INT >= 21) { 21 | activity.getWindow().setStatusBarColor(Color.TRANSPARENT); 22 | } 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /demo-java/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /library-kotlin/src/main/kotlin/moe/feng/material/statusbar/StatusBarCompat.kt: -------------------------------------------------------------------------------- 1 | package moe.feng.material.statusbar 2 | 3 | import android.app.Activity 4 | import android.graphics.Color 5 | import android.os.Build 6 | import android.view.View 7 | import moe.feng.material.statusbar.util.ViewHelper 8 | 9 | public class StatusBarCompat { 10 | 11 | public fun setUpActivity(activity: Activity) { 12 | if (Build.VERSION.SDK_INT >= 19 && !ViewHelper().isChrome()) { 13 | activity.getWindow().getDecorView() 14 | .setSystemUiVisibility( 15 | View.SYSTEM_UI_FLAG_LAYOUT_STABLE or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 16 | ); 17 | } 18 | 19 | if (Build.VERSION.SDK_INT >= 21) { 20 | activity.getWindow().setStatusBarColor(Color.TRANSPARENT); 21 | } 22 | } 23 | 24 | } 25 | -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | ## Project-wide Gradle settings. 2 | # 3 | # For more details on how to configure your build environment visit 4 | # http://www.gradle.org/docs/current/userguide/build_environment.html 5 | # 6 | # Specifies the JVM arguments used for the daemon process. 7 | # The setting is particularly useful for tweaking memory settings. 8 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 9 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 10 | # 11 | # When configured, Gradle will run in incubating parallel mode. 12 | # This option should only be used with decoupled projects. More details, visit 13 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 14 | # org.gradle.parallel=true 15 | #Tue Jul 14 18:25:31 CST 2015 16 | systemProp.http.proxyHost=127.0.0.1 17 | systemProp.http.proxyPort=1080 18 | -------------------------------------------------------------------------------- /library-kotlin/src/main/kotlin/moe/feng/material/statusbar/TranslucentSBActivity.kt: -------------------------------------------------------------------------------- 1 | package moe.feng.material.statusbar 2 | 3 | import android.os.Bundle 4 | import android.support.v7.app.AppCompatActivity 5 | 6 | open public class TranslucentSBActivity: AppCompatActivity() { 7 | 8 | var needSetTranslucent = true; var isCreated = false; 9 | 10 | override protected fun onCreate(savedInstanceState: Bundle?) { 11 | super.onCreate(savedInstanceState) 12 | if (needSetTranslucent) StatusBarCompat().setUpActivity(this) 13 | isCreated = true 14 | } 15 | 16 | public fun setStatusBarTranslucent(needSetTranslucent: Boolean) { 17 | if (isCreated) { 18 | throw ShouldSetBeforeActivityCreatedException() 19 | } else { 20 | this.needSetTranslucent = needSetTranslucent; 21 | } 22 | } 23 | 24 | public class ShouldSetBeforeActivityCreatedException : Exception() {} 25 | 26 | } -------------------------------------------------------------------------------- /library-java/src/main/java/moe/feng/material/statusbar/TranslucentSBActivity.java: -------------------------------------------------------------------------------- 1 | package moe.feng.material.statusbar; 2 | 3 | import android.os.Bundle; 4 | import android.support.v7.app.AppCompatActivity; 5 | 6 | public class TranslucentSBActivity extends AppCompatActivity { 7 | 8 | boolean needSetTranslucent = true, isCreated = false; 9 | 10 | @Override 11 | protected void onCreate(Bundle savedInstanceState) { 12 | super.onCreate(savedInstanceState); 13 | if (needSetTranslucent) { 14 | StatusBarCompat.setUpActivity(this); 15 | } 16 | isCreated = true; 17 | } 18 | 19 | public void setStatusBarTranslucent(boolean should) throws ShouldSetBeforeActivityCreatedException { 20 | if (isCreated) { 21 | throw new ShouldSetBeforeActivityCreatedException(); 22 | } else { 23 | this.needSetTranslucent = should; 24 | } 25 | } 26 | 27 | public class ShouldSetBeforeActivityCreatedException extends Exception {} 28 | 29 | } 30 | -------------------------------------------------------------------------------- /library-kotlin/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.library' 2 | apply plugin: 'kotlin-android' 3 | 4 | android { 5 | compileSdkVersion 22 6 | buildToolsVersion "22.0.1" 7 | 8 | defaultConfig { 9 | minSdkVersion 15 10 | targetSdkVersion 22 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | sourceSets { 21 | main.java.srcDirs += 'src/main/kotlin' 22 | } 23 | } 24 | 25 | dependencies { 26 | compile fileTree(dir: 'libs', include: ['*.jar']) 27 | compile 'com.android.support:appcompat-v7:22.2.0' 28 | compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 29 | } 30 | buildscript { 31 | ext.kotlin_version = '0.12.613' 32 | repositories { 33 | mavenCentral() 34 | } 35 | dependencies { 36 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 37 | } 38 | } 39 | repositories { 40 | mavenCentral() 41 | } 42 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | apply plugin: 'kotlin-android' 3 | 4 | android { 5 | compileSdkVersion 22 6 | buildToolsVersion "22.0.1" 7 | 8 | defaultConfig { 9 | applicationId "moe.feng.material.statusbar.demo" 10 | minSdkVersion 15 11 | targetSdkVersion 22 12 | versionCode 1 13 | versionName "1.0" 14 | } 15 | buildTypes { 16 | release { 17 | minifyEnabled false 18 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 19 | } 20 | } 21 | sourceSets { 22 | main.java.srcDirs += 'src/main/kotlin' 23 | } 24 | } 25 | 26 | dependencies { 27 | compile fileTree(dir: 'libs', include: ['*.jar']) 28 | compile project(':library-kotlin') 29 | compile 'com.android.support:appcompat-v7:22.2.0' 30 | compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 31 | } 32 | buildscript { 33 | ext.kotlin_version = '0.12.613' 34 | repositories { 35 | mavenCentral() 36 | } 37 | dependencies { 38 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" 39 | } 40 | } 41 | repositories { 42 | mavenCentral() 43 | } 44 | -------------------------------------------------------------------------------- /app/src/main/kotlin/moe/feng/material/statusbar/demo/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package moe.feng.material.statusbar.demo 2 | 3 | import android.os.Bundle 4 | import android.support.v7.app.AppCompatActivity 5 | import android.support.v7.widget.Toolbar 6 | 7 | import moe.feng.material.statusbar.AppBarLayout 8 | import moe.feng.material.statusbar.TranslucentSBActivity 9 | 10 | public class MainActivity : TranslucentSBActivity() { 11 | 12 | var mAppBarLayout : AppBarLayout? = null 13 | 14 | override public fun onCreate(savedInstanceState: Bundle?) { 15 | super.onCreate(savedInstanceState) 16 | setContentView(R.layout.activity_main) 17 | 18 | mAppBarLayout = findViewById(R.id.appbar_layout) as AppBarLayout 19 | setSupportActionBar(findViewById(R.id.toolbar) as Toolbar) 20 | 21 | findViewById(R.id.button_blue).setOnClickListener({ 22 | mAppBarLayout?.setColorResources(R.color.blue_500, R.color.blue_700) 23 | }) 24 | 25 | findViewById(R.id.button_deep_purple).setOnClickListener({ 26 | mAppBarLayout?.setColorResources(R.color.deep_purple_500, R.color.deep_purple_700) 27 | }) 28 | } 29 | 30 | } -------------------------------------------------------------------------------- /library-kotlin/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 13 | 14 | 18 | 19 | 23 | 24 | 8 | 9 | 13 | 14 | 18 | 19 | 23 | 24 |