├── .gitignore ├── AlipayHome ├── .gitignore ├── .idea │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── misc.xml │ ├── modules.xml │ └── runConfigurations.xml ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── kyleduo │ │ │ └── alipayhome │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── kyleduo │ │ │ │ └── alipayhome │ │ │ │ ├── MainActivity.java │ │ │ │ └── widgets │ │ │ │ ├── APBarView.java │ │ │ │ ├── APHeaderView.java │ │ │ │ ├── APScrollingBehavior.java │ │ │ │ ├── APSnapView.java │ │ │ │ ├── CommonListDecoration.java │ │ │ │ └── support │ │ │ │ ├── ATHeaderBehavior.java │ │ │ │ ├── ATHeaderScrollingViewBehavior.java │ │ │ │ ├── ATMathUtils.java │ │ │ │ ├── ATViewOffsetBehavior.java │ │ │ │ └── ATViewOffsetHelper.java │ │ └── res │ │ │ ├── drawable-xxxhdpi │ │ │ ├── bar1.png │ │ │ ├── bar2.png │ │ │ ├── grid.png │ │ │ └── snap.png │ │ │ ├── drawable │ │ │ └── common_item_bg.xml │ │ │ ├── layout │ │ │ ├── activity_main.xml │ │ │ └── item_content.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── ids.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── kyleduo │ │ └── alipayhome │ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── DiggingTranslucentStatusBar ├── .gitignore ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── kyleduo │ │ │ └── digging │ │ │ └── translucentstatusbar │ │ │ └── ExampleInstrumentedTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── kyleduo │ │ │ │ └── digging │ │ │ │ └── translucentstatusbar │ │ │ │ ├── BaseActivity.java │ │ │ │ ├── Demo1Activity.java │ │ │ │ ├── Demo2Activity.java │ │ │ │ ├── Demo3Activity.java │ │ │ │ ├── Demo3BActivity.java │ │ │ │ ├── Demo3BFragment.java │ │ │ │ ├── Demo3Fragment.java │ │ │ │ ├── MainActivity.java │ │ │ │ ├── SecondActivity.java │ │ │ │ └── widgets │ │ │ │ ├── DummySupportToolbar.java │ │ │ │ ├── FitCollapsingToolbarLayout.java │ │ │ │ └── OnItemClickListener.java │ │ └── res │ │ │ ├── drawable-xxhdpi │ │ │ ├── drawer_header.jpg │ │ │ ├── ic_back.png │ │ │ ├── ic_burger.png │ │ │ └── temp.jpg │ │ │ ├── layout │ │ │ ├── act_demo1.xml │ │ │ ├── act_demo2.xml │ │ │ ├── act_demo3.xml │ │ │ ├── act_main.xml │ │ │ ├── act_second.xml │ │ │ ├── frgm_demo3.xml │ │ │ ├── frgm_demo3b.xml │ │ │ └── stub_kitkat_statusbar.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── values-sw360dp │ │ │ └── dimens.xml │ │ │ ├── values-sw400dp │ │ │ └── dimens.xml │ │ │ ├── values-v19 │ │ │ └── styles.xml │ │ │ ├── values-v21 │ │ │ └── styles.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── kyleduo │ │ └── digging │ │ └── translucentstatusbar │ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── ExchangeFragment ├── .gitignore ├── .idea │ ├── .name │ ├── compiler.xml │ ├── copyright │ │ └── profiles_settings.xml │ ├── encodings.xml │ ├── gradle.xml │ ├── misc.xml │ ├── modules.xml │ └── runConfigurations.xml ├── app │ ├── .gitignore │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ ├── androidTest │ │ └── java │ │ │ └── com │ │ │ └── kyleduo │ │ │ └── blogdemo │ │ │ └── exchangefragment │ │ │ └── ApplicationTest.java │ │ ├── main │ │ ├── AndroidManifest.xml │ │ ├── java │ │ │ └── com │ │ │ │ └── kyleduo │ │ │ │ └── blogdemo │ │ │ │ └── exchangefragment │ │ │ │ ├── ExchangedFragment.java │ │ │ │ ├── Holder1Fragment.java │ │ │ │ ├── Holder2Fragment.java │ │ │ │ ├── Holder3Fragment.java │ │ │ │ ├── Holder4Fragment.java │ │ │ │ ├── HolderFragment.java │ │ │ │ └── MainActivity.java │ │ └── res │ │ │ ├── drawable-xxxhdpi │ │ │ └── icon_holder.png │ │ │ ├── drawable │ │ │ ├── tab_selector.xml │ │ │ └── top_line_bg.xml │ │ │ ├── layout │ │ │ ├── activity_main.xml │ │ │ ├── fragment_holder.xml │ │ │ └── layout_tab.xml │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxxhdpi │ │ │ └── ic_launcher.png │ │ │ ├── values-w820dp │ │ │ └── dimens.xml │ │ │ └── values │ │ │ ├── colors.xml │ │ │ ├── dimens.xml │ │ │ ├── strings.xml │ │ │ └── styles.xml │ │ └── test │ │ └── java │ │ └── com │ │ └── kyleduo │ │ └── blogdemo │ │ └── exchangefragment │ │ └── ExampleUnitTest.java ├── build.gradle ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── LICENSE ├── PCHImportProblem ├── PCHImportProblem.xcodeproj │ ├── project.pbxproj │ ├── project.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcuserdata │ │ │ └── kyle.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcuserdata │ │ └── kyle.xcuserdatad │ │ └── xcschemes │ │ ├── PCHImportProblem.xcscheme │ │ ├── TestWatchOS (Notification).xcscheme │ │ ├── TestWatchOS.xcscheme │ │ └── xcschememanagement.plist ├── PCHImportProblem.xcworkspace │ ├── contents.xcworkspacedata │ └── xcuserdata │ │ └── kyle.xcuserdatad │ │ └── UserInterfaceState.xcuserstate ├── PCHImportProblem │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets │ │ └── AppIcon.appiconset │ │ │ └── Contents.json │ ├── Base.lproj │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── ImportFile.h │ ├── Info.plist │ ├── Mock.h │ ├── Mock.m │ ├── PrefixHeader.pch │ ├── SubTestJsonModel.h │ ├── SubTestJsonModel.m │ ├── TestJsonModel.h │ ├── TestJsonModel.m │ ├── ViewController.h │ ├── ViewController.m │ └── main.m ├── Podfile ├── Podfile.lock ├── Pods │ ├── Headers │ │ ├── Private │ │ │ └── JSONModel │ │ │ │ ├── JSONAPI.h │ │ │ │ ├── JSONHTTPClient.h │ │ │ │ ├── JSONKeyMapper.h │ │ │ │ ├── JSONModel+networking.h │ │ │ │ ├── JSONModel.h │ │ │ │ ├── JSONModelArray.h │ │ │ │ ├── JSONModelClassProperty.h │ │ │ │ ├── JSONModelError.h │ │ │ │ ├── JSONModelLib.h │ │ │ │ ├── JSONValueTransformer.h │ │ │ │ └── NSArray+JSONModel.h │ │ └── Public │ │ │ └── JSONModel │ │ │ ├── JSONAPI.h │ │ │ ├── JSONHTTPClient.h │ │ │ ├── JSONKeyMapper.h │ │ │ ├── JSONModel+networking.h │ │ │ ├── JSONModel.h │ │ │ ├── JSONModelArray.h │ │ │ ├── JSONModelClassProperty.h │ │ │ ├── JSONModelError.h │ │ │ ├── JSONModelLib.h │ │ │ ├── JSONValueTransformer.h │ │ │ └── NSArray+JSONModel.h │ ├── JSONModel │ │ ├── JSONModel │ │ │ ├── JSONModel │ │ │ │ ├── JSONModel.h │ │ │ │ ├── JSONModel.m │ │ │ │ ├── JSONModelArray.h │ │ │ │ ├── JSONModelArray.m │ │ │ │ ├── JSONModelClassProperty.h │ │ │ │ ├── JSONModelClassProperty.m │ │ │ │ ├── JSONModelError.h │ │ │ │ └── JSONModelError.m │ │ │ ├── JSONModelCategories │ │ │ │ ├── NSArray+JSONModel.h │ │ │ │ └── NSArray+JSONModel.m │ │ │ ├── JSONModelLib.h │ │ │ ├── JSONModelNetworking │ │ │ │ ├── JSONAPI.h │ │ │ │ ├── JSONAPI.m │ │ │ │ ├── JSONHTTPClient.h │ │ │ │ ├── JSONHTTPClient.m │ │ │ │ ├── JSONModel+networking.h │ │ │ │ └── JSONModel+networking.m │ │ │ └── JSONModelTransformations │ │ │ │ ├── JSONKeyMapper.h │ │ │ │ ├── JSONKeyMapper.m │ │ │ │ ├── JSONValueTransformer.h │ │ │ │ └── JSONValueTransformer.m │ │ ├── LICENSE_jsonmodel.txt │ │ └── README.md │ ├── Manifest.lock │ ├── Pods.xcodeproj │ │ ├── project.pbxproj │ │ └── xcuserdata │ │ │ └── kyle.xcuserdatad │ │ │ └── xcschemes │ │ │ ├── JSONModel.xcscheme │ │ │ ├── Pods-PCHImportProblem.xcscheme │ │ │ └── xcschememanagement.plist │ └── Target Support Files │ │ ├── JSONModel │ │ ├── JSONModel-dummy.m │ │ ├── JSONModel-prefix.pch │ │ └── JSONModel.xcconfig │ │ └── Pods-PCHImportProblem │ │ ├── Pods-PCHImportProblem-acknowledgements.markdown │ │ ├── Pods-PCHImportProblem-acknowledgements.plist │ │ ├── Pods-PCHImportProblem-dummy.m │ │ ├── Pods-PCHImportProblem-frameworks.sh │ │ ├── Pods-PCHImportProblem-resources.sh │ │ ├── Pods-PCHImportProblem.debug.xcconfig │ │ └── Pods-PCHImportProblem.release.xcconfig ├── TestWatchOS Extension │ ├── Assets.xcassets │ │ └── README__ignoredByTemplate__ │ ├── ExtensionDelegate.h │ ├── ExtensionDelegate.m │ ├── Info.plist │ ├── InterfaceController.h │ ├── InterfaceController.m │ ├── NotificationController.h │ ├── NotificationController.m │ ├── PrefixHeader.pch │ └── PushNotificationPayload.apns └── TestWatchOS │ ├── Assets.xcassets │ └── AppIcon.appiconset │ │ └── Contents.json │ ├── Base.lproj │ └── Interface.storyboard │ └── Info.plist ├── README.md └── preview ├── ExchangeFragment.gif └── alipay.png /.gitignore: -------------------------------------------------------------------------------- 1 | */gradle.properties 2 | 3 | # Built application files 4 | *.apk 5 | *.ap_ 6 | 7 | # Files for the Dalvik VM 8 | *.dex 9 | 10 | # Java class files 11 | *.class 12 | 13 | # Generated files 14 | bin/ 15 | gen/ 16 | 17 | # Gradle files 18 | .gradle/ 19 | build/ 20 | 21 | # Local configuration file (sdk path, etc) 22 | local.properties 23 | 24 | # Proguard folder generated by Eclipse 25 | proguard/ 26 | 27 | # Log Files 28 | *.log 29 | 30 | # Android Studio Navigation editor temp files 31 | .navigation/ 32 | 33 | # Android Studio captures folder 34 | captures/ 35 | -------------------------------------------------------------------------------- /AlipayHome/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | -------------------------------------------------------------------------------- /AlipayHome/.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /AlipayHome/.idea/copyright/profiles_settings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /AlipayHome/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /AlipayHome/.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 17 | 18 | -------------------------------------------------------------------------------- /AlipayHome/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 19 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 46 | -------------------------------------------------------------------------------- /AlipayHome/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /AlipayHome/.idea/runConfigurations.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | -------------------------------------------------------------------------------- /AlipayHome/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /AlipayHome/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.3" 6 | defaultConfig { 7 | applicationId "com.kyleduo.alipayhome" 8 | minSdkVersion 14 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | ext { 23 | supportVersion = '25.3.1' 24 | } 25 | 26 | dependencies { 27 | compile fileTree(dir: 'libs', include: ['*.jar']) 28 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 29 | exclude group: 'com.android.support', module: 'support-annotations' 30 | }) 31 | compile 'com.android.support.constraint:constraint-layout:1.0.2' 32 | testCompile 'junit:junit:4.12' 33 | 34 | 35 | compile "com.android.support:recyclerview-v7:$supportVersion" 36 | compile "com.android.support:appcompat-v7:$supportVersion" 37 | compile "com.android.support:design:$supportVersion" 38 | } 39 | -------------------------------------------------------------------------------- /AlipayHome/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 /Users/kyle/Documents/developer/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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /AlipayHome/app/src/androidTest/java/com/kyleduo/alipayhome/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.alipayhome; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.kyleduo.alipayhome", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/java/com/kyleduo/alipayhome/widgets/APBarView.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.alipayhome.widgets; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.AttrRes; 5 | import android.support.annotation.NonNull; 6 | import android.support.annotation.Nullable; 7 | import android.util.AttributeSet; 8 | import android.view.View; 9 | import android.view.ViewParent; 10 | import android.widget.FrameLayout; 11 | 12 | import com.kyleduo.alipayhome.widgets.support.ATMathUtils; 13 | import com.kyleduo.alipayhome.widgets.support.ATViewOffsetHelper; 14 | 15 | import java.lang.ref.WeakReference; 16 | 17 | /** 18 | * AndroidTech 19 | * Created by kyleduo on 2017/7/12. 20 | */ 21 | 22 | public class APBarView extends FrameLayout { 23 | 24 | private View mView1; 25 | private View mView2; 26 | 27 | private APHeaderView.OnOffsetChangeListener mOnOffsetChangeListener; 28 | 29 | private ATViewOffsetHelper mOffsetHelper; 30 | 31 | public APBarView(@NonNull Context context) { 32 | super(context); 33 | } 34 | 35 | public APBarView(@NonNull Context context, @Nullable AttributeSet attrs) { 36 | super(context, attrs); 37 | } 38 | 39 | public APBarView(@NonNull Context context, @Nullable AttributeSet attrs, @AttrRes int defStyleAttr) { 40 | super(context, attrs, defStyleAttr); 41 | } 42 | 43 | @Override 44 | protected void onFinishInflate() { 45 | super.onFinishInflate(); 46 | mView1 = getChildAt(0); 47 | mView2 = getChildAt(1); 48 | } 49 | 50 | @Override 51 | protected void onLayout(boolean changed, int left, int top, int right, int bottom) { 52 | super.onLayout(changed, left, top, right, bottom); 53 | if (mOffsetHelper != null) { 54 | mOffsetHelper.onViewLayout(); 55 | } 56 | } 57 | 58 | @Override 59 | protected void onAttachedToWindow() { 60 | super.onAttachedToWindow(); 61 | if (mOffsetHelper == null) { 62 | mOffsetHelper = new ATViewOffsetHelper(this); 63 | } 64 | ViewParent parent = getParent(); 65 | if (parent != null && parent instanceof APHeaderView) { 66 | APHeaderView header = (APHeaderView) parent; 67 | if (mOnOffsetChangeListener == null) { 68 | mOnOffsetChangeListener = new OffsetChangeListener(this); 69 | } 70 | header.addOnOffsetChangeListener(mOnOffsetChangeListener); 71 | } 72 | } 73 | 74 | @Override 75 | protected void onDetachedFromWindow() { 76 | super.onDetachedFromWindow(); 77 | ViewParent parent = getParent(); 78 | if (parent != null && parent instanceof APHeaderView) { 79 | APHeaderView header = (APHeaderView) parent; 80 | if (mOnOffsetChangeListener != null) { 81 | header.removeOnOffsetChangeListener(mOnOffsetChangeListener); 82 | } 83 | } 84 | } 85 | 86 | void offset(int offset) { 87 | mOffsetHelper.setTopAndBottomOffset(-offset); 88 | 89 | float ratio = 1 - Math.abs(offset) * 1.f / (getResources().getDisplayMetrics().density * 104); 90 | ratio = ATMathUtils.constrain(ratio, 0, 1); 91 | 92 | float alpha1 = 1 - Math.min(1, ratio / 0.5f); 93 | float alpha2 = Math.max((ratio - 0.5f) / 0.5f, 0); 94 | 95 | mView1.setAlpha(alpha1); 96 | mView2.setAlpha(alpha2); 97 | } 98 | 99 | private static class OffsetChangeListener implements APHeaderView.OnOffsetChangeListener { 100 | 101 | private WeakReference mSnapViewRef; 102 | 103 | public OffsetChangeListener(APBarView barView) { 104 | mSnapViewRef = new WeakReference<>(barView); 105 | } 106 | 107 | @Override 108 | public void onOffsetChanged(APHeaderView header, int currOffset) { 109 | APBarView barView = mSnapViewRef.get(); 110 | if (barView != null) { 111 | barView.offset(currOffset); 112 | } 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/java/com/kyleduo/alipayhome/widgets/APScrollingBehavior.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.alipayhome.widgets; 2 | 3 | import android.content.Context; 4 | import android.graphics.Rect; 5 | import android.support.design.widget.CoordinatorLayout; 6 | import android.support.v4.view.ViewCompat; 7 | import android.util.AttributeSet; 8 | import android.view.View; 9 | 10 | import com.kyleduo.alipayhome.widgets.support.ATHeaderScrollingViewBehavior; 11 | import com.kyleduo.alipayhome.widgets.support.ATViewOffsetHelper; 12 | 13 | import java.util.List; 14 | 15 | /** 16 | * 17 | * Created by kyleduo on 2017/7/12. 18 | */ 19 | 20 | public class APScrollingBehavior extends ATHeaderScrollingViewBehavior { 21 | 22 | ATViewOffsetHelper mOffsetHelper; 23 | 24 | public APScrollingBehavior() { 25 | } 26 | 27 | public APScrollingBehavior(Context context, AttributeSet attrs) { 28 | super(context, attrs); 29 | } 30 | 31 | @Override 32 | protected APHeaderView findFirstDependency(List views) { 33 | for (int i = 0, z = views.size(); i < z; i++) { 34 | View view = views.get(i); 35 | if (view instanceof APHeaderView) { 36 | return (APHeaderView) view; 37 | } 38 | } 39 | return null; 40 | } 41 | 42 | @Override 43 | public boolean layoutDependsOn(CoordinatorLayout parent, View child, View dependency) { 44 | return dependency instanceof APHeaderView; 45 | } 46 | 47 | @Override 48 | public boolean onDependentViewChanged(CoordinatorLayout parent, final View child, View dependency) { 49 | APHeaderView header = findFirstDependency(parent.getDependencies(child)); 50 | if (header != null) { 51 | CoordinatorLayout.LayoutParams lp = (CoordinatorLayout.LayoutParams) header.getLayoutParams(); 52 | CoordinatorLayout.Behavior behavior = lp.getBehavior(); 53 | if (behavior instanceof APHeaderView.Behavior) { 54 | APHeaderView.Behavior headerBehavior = (APHeaderView.Behavior) behavior; 55 | int offset = headerBehavior.getTopAndBottomOffset(); 56 | ViewCompat.offsetTopAndBottom(child, (dependency.getBottom() - child.getTop())); 57 | } 58 | } 59 | return super.onDependentViewChanged(parent, child, dependency); 60 | } 61 | 62 | @Override 63 | protected int getScrollRange(View v) { 64 | if (v instanceof APHeaderView) { 65 | return ((APHeaderView) v).getScrollRange(); 66 | } 67 | return super.getScrollRange(v); 68 | } 69 | 70 | @Override 71 | public boolean onRequestChildRectangleOnScreen(CoordinatorLayout coordinatorLayout, View child, Rect rectangle, boolean immediate) { 72 | final APHeaderView header = findFirstDependency(coordinatorLayout.getDependencies(child)); 73 | if (header != null) { 74 | // Offset the rect by the child's left/top 75 | rectangle.offset(child.getLeft(), child.getTop()); 76 | 77 | final Rect parentRect = mTempRect1; 78 | parentRect.set(0, 0, coordinatorLayout.getWidth(), coordinatorLayout.getHeight()); 79 | 80 | if (!parentRect.contains(rectangle)) { 81 | // If the rectangle can not be fully seen the visible bounds, collapse 82 | // the AppBarLayout 83 | header.setExpanded(false); 84 | return true; 85 | } 86 | } 87 | return false; 88 | } 89 | } 90 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/java/com/kyleduo/alipayhome/widgets/APSnapView.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.alipayhome.widgets; 2 | 3 | import android.content.Context; 4 | import android.util.AttributeSet; 5 | import android.view.View; 6 | import android.view.ViewParent; 7 | import android.widget.RelativeLayout; 8 | 9 | import com.kyleduo.alipayhome.widgets.support.ATMathUtils; 10 | import com.kyleduo.alipayhome.widgets.support.ATViewOffsetHelper; 11 | 12 | import java.lang.ref.WeakReference; 13 | 14 | /** 15 | * 16 | * Created by kyleduo on 2017/7/12. 17 | */ 18 | 19 | public class APSnapView extends RelativeLayout { 20 | 21 | private APHeaderView.OnOffsetChangeListener mOnOffsetChangeListener; 22 | 23 | private View mContent; 24 | private ATViewOffsetHelper mOffsetHelper; 25 | 26 | public APSnapView(Context context) { 27 | super(context); 28 | } 29 | 30 | public APSnapView(Context context, AttributeSet attrs) { 31 | super(context, attrs); 32 | } 33 | 34 | public APSnapView(Context context, AttributeSet attrs, int defStyleAttr) { 35 | super(context, attrs, defStyleAttr); 36 | } 37 | 38 | @Override 39 | protected void onFinishInflate() { 40 | super.onFinishInflate(); 41 | mContent = getChildAt(0); 42 | mOffsetHelper = new ATViewOffsetHelper(mContent); 43 | } 44 | 45 | @Override 46 | protected void onAttachedToWindow() { 47 | super.onAttachedToWindow(); 48 | ViewParent parent = getParent(); 49 | if (parent != null && parent instanceof APHeaderView) { 50 | APHeaderView header = (APHeaderView) parent; 51 | if (mOnOffsetChangeListener == null) { 52 | mOnOffsetChangeListener = new OffsetChangeListener(this); 53 | } 54 | header.addOnOffsetChangeListener(mOnOffsetChangeListener); 55 | } 56 | } 57 | 58 | @Override 59 | protected void onDetachedFromWindow() { 60 | super.onDetachedFromWindow(); 61 | ViewParent parent = getParent(); 62 | if (parent != null && parent instanceof APHeaderView) { 63 | APHeaderView header = (APHeaderView) parent; 64 | if (mOnOffsetChangeListener != null) { 65 | header.removeOnOffsetChangeListener(mOnOffsetChangeListener); 66 | } 67 | } 68 | } 69 | 70 | void offset(int offset) { 71 | final float ratio = 0.5f; 72 | float alpha = 1 - Math.abs(offset) * 1.f / (0.8f * getHeight()); 73 | alpha = ATMathUtils.constrain(alpha, 0, 1); 74 | if (offset < -getHeight()) { 75 | offset = -getHeight(); 76 | } else if (offset > 0) { 77 | offset = 0; 78 | } 79 | int value = (int) (-offset * ratio); 80 | mOffsetHelper.setTopAndBottomOffset(value); 81 | getChildAt(0).setAlpha(alpha); 82 | } 83 | 84 | private static class OffsetChangeListener implements APHeaderView.OnOffsetChangeListener { 85 | 86 | private WeakReference mSnapViewRef; 87 | 88 | public OffsetChangeListener(APSnapView snapView) { 89 | mSnapViewRef = new WeakReference<>(snapView); 90 | } 91 | 92 | @Override 93 | public void onOffsetChanged(APHeaderView header, int currOffset) { 94 | APSnapView snapView = mSnapViewRef.get(); 95 | if (snapView != null) { 96 | snapView.offset(currOffset); 97 | } 98 | } 99 | } 100 | } 101 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/java/com/kyleduo/alipayhome/widgets/CommonListDecoration.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.alipayhome.widgets; 2 | 3 | import android.graphics.Rect; 4 | import android.support.v7.widget.RecyclerView; 5 | import android.view.View; 6 | 7 | /** 8 | * 9 | * Created by kyleduo on 2017/6/30. 10 | */ 11 | 12 | public class CommonListDecoration extends RecyclerView.ItemDecoration { 13 | 14 | private int mSpaceV, mSpaceH; 15 | 16 | public CommonListDecoration() { 17 | } 18 | 19 | public CommonListDecoration(int spaceV, int spaceH) { 20 | mSpaceV = spaceV; 21 | mSpaceH = spaceH; 22 | } 23 | 24 | @Override 25 | public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { 26 | int position = parent.getChildLayoutPosition(view); 27 | RecyclerView.Adapter adapter = parent.getAdapter(); 28 | int itemCount = adapter == null ? 0 : adapter.getItemCount(); 29 | 30 | if (mSpaceH == 0 && mSpaceV == 0) { 31 | float density = parent.getContext().getResources().getDisplayMetrics().density; 32 | mSpaceH = (int) (density * 16); 33 | mSpaceV = (int) (density * 12); 34 | } 35 | //noinspection UnnecessaryLocalVariable 36 | int top = 0; 37 | int left = 0; 38 | int right = 0; 39 | int bottom = 0; 40 | 41 | if (position == 0) { 42 | top = mSpaceV; 43 | bottom = mSpaceV / 2; 44 | } else if (position == itemCount - 1) { 45 | top = mSpaceV / 2; 46 | bottom = mSpaceV; 47 | } else { 48 | top = mSpaceV / 2; 49 | bottom = mSpaceV / 2; 50 | } 51 | 52 | left = mSpaceH; 53 | right = mSpaceH; 54 | 55 | outRect.set(left, top, right, bottom); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/java/com/kyleduo/alipayhome/widgets/support/ATMathUtils.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.alipayhome.widgets.support; 2 | 3 | /** 4 | * AndroidTech 5 | * Created by kyleduo on 2017/7/11. 6 | */ 7 | 8 | public class ATMathUtils { 9 | 10 | public static int constrain(int amount, int low, int high) { 11 | int ret = amount < low ? low : amount; 12 | ret = ret > high ? high : ret; 13 | return ret; 14 | } 15 | 16 | public static float constrain(float amount, float low, float high) { 17 | float ret = amount < low ? low : amount; 18 | ret = ret > high ? high : ret; 19 | return ret; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/java/com/kyleduo/alipayhome/widgets/support/ATViewOffsetBehavior.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.alipayhome.widgets.support; 2 | 3 | import android.content.Context; 4 | import android.support.design.widget.CoordinatorLayout; 5 | import android.util.AttributeSet; 6 | import android.view.View; 7 | 8 | /** 9 | * AndroidTech 10 | * Created by kyleduo on 2017/7/11. 11 | */ 12 | 13 | public class ATViewOffsetBehavior extends CoordinatorLayout.Behavior { 14 | 15 | private ATViewOffsetHelper mViewOffsetHelper; 16 | 17 | private int mTempTopBottomOffset = 0; 18 | private int mTempLeftRightOffset = 0; 19 | 20 | public ATViewOffsetBehavior() {} 21 | 22 | public ATViewOffsetBehavior(Context context, AttributeSet attrs) { 23 | super(context, attrs); 24 | } 25 | 26 | @Override 27 | public boolean onLayoutChild(CoordinatorLayout parent, V child, int layoutDirection) { 28 | // First let lay the child out 29 | layoutChild(parent, child, layoutDirection); 30 | 31 | if (mViewOffsetHelper == null) { 32 | mViewOffsetHelper = new ATViewOffsetHelper(child); 33 | } 34 | mViewOffsetHelper.onViewLayout(); 35 | 36 | if (mTempTopBottomOffset != 0) { 37 | mViewOffsetHelper.setTopAndBottomOffset(mTempTopBottomOffset); 38 | mTempTopBottomOffset = 0; 39 | } 40 | if (mTempLeftRightOffset != 0) { 41 | mViewOffsetHelper.setLeftAndRightOffset(mTempLeftRightOffset); 42 | mTempLeftRightOffset = 0; 43 | } 44 | 45 | return true; 46 | } 47 | 48 | protected void layoutChild(CoordinatorLayout parent, V child, int layoutDirection) { 49 | // Let the parent lay it out by default 50 | parent.onLayoutChild(child, layoutDirection); 51 | } 52 | 53 | public boolean setTopAndBottomOffset(int offset) { 54 | if (mViewOffsetHelper != null) { 55 | return mViewOffsetHelper.setTopAndBottomOffset(offset); 56 | } else { 57 | mTempTopBottomOffset = offset; 58 | } 59 | return false; 60 | } 61 | 62 | public boolean setLeftAndRightOffset(int offset) { 63 | if (mViewOffsetHelper != null) { 64 | return mViewOffsetHelper.setLeftAndRightOffset(offset); 65 | } else { 66 | mTempLeftRightOffset = offset; 67 | } 68 | return false; 69 | } 70 | 71 | public int getTopAndBottomOffset() { 72 | return mViewOffsetHelper != null ? mViewOffsetHelper.getTopAndBottomOffset() : 0; 73 | } 74 | 75 | public int getLeftAndRightOffset() { 76 | return mViewOffsetHelper != null ? mViewOffsetHelper.getLeftAndRightOffset() : 0; 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/java/com/kyleduo/alipayhome/widgets/support/ATViewOffsetHelper.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.alipayhome.widgets.support; 2 | 3 | import android.support.v4.view.ViewCompat; 4 | import android.view.View; 5 | 6 | /** 7 | * AndroidTech 8 | * Created by kyleduo on 2017/7/11. 9 | */ 10 | 11 | public class ATViewOffsetHelper { 12 | 13 | private final View mView; 14 | 15 | private int mLayoutTop; 16 | private int mLayoutLeft; 17 | private int mOffsetTop; 18 | private int mOffsetLeft; 19 | 20 | public ATViewOffsetHelper(View view) { 21 | mView = view; 22 | } 23 | 24 | public void onViewLayout() { 25 | // Now grab the intended top 26 | mLayoutTop = mView.getTop(); 27 | mLayoutLeft = mView.getLeft(); 28 | 29 | // And offset it as needed 30 | updateOffsets(); 31 | } 32 | 33 | private void updateOffsets() { 34 | ViewCompat.offsetTopAndBottom(mView, mOffsetTop - (mView.getTop() - mLayoutTop)); 35 | ViewCompat.offsetLeftAndRight(mView, mOffsetLeft - (mView.getLeft() - mLayoutLeft)); 36 | } 37 | 38 | /** 39 | * Set the top and bottom offset for this {@link ATViewOffsetHelper}'s view. 40 | * 41 | * @param offset the offset in px. 42 | * @return true if the offset has changed 43 | */ 44 | public boolean setTopAndBottomOffset(int offset) { 45 | if (mOffsetTop != offset) { 46 | mOffsetTop = offset; 47 | updateOffsets(); 48 | return true; 49 | } 50 | return false; 51 | } 52 | 53 | /** 54 | * Set the left and right offset for this {@link ATViewOffsetHelper}'s view. 55 | * 56 | * @param offset the offset in px. 57 | * @return true if the offset has changed 58 | */ 59 | public boolean setLeftAndRightOffset(int offset) { 60 | if (mOffsetLeft != offset) { 61 | mOffsetLeft = offset; 62 | updateOffsets(); 63 | return true; 64 | } 65 | return false; 66 | } 67 | 68 | public int getTopAndBottomOffset() { 69 | return mOffsetTop; 70 | } 71 | 72 | public int getLeftAndRightOffset() { 73 | return mOffsetLeft; 74 | } 75 | 76 | public int getLayoutTop() { 77 | return mLayoutTop; 78 | } 79 | 80 | public int getLayoutLeft() { 81 | return mLayoutLeft; 82 | } 83 | } 84 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/drawable-xxxhdpi/bar1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/drawable-xxxhdpi/bar1.png -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/drawable-xxxhdpi/bar2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/drawable-xxxhdpi/bar2.png -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/drawable-xxxhdpi/grid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/drawable-xxxhdpi/grid.png -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/drawable-xxxhdpi/snap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/drawable-xxxhdpi/snap.png -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/drawable/common_item_bg.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 13 | 14 | 19 | 20 | 26 | 27 | 28 | 29 | 34 | 35 | 39 | 40 | 41 | 42 | 48 | 49 | 54 | 55 | 60 | 61 | 62 | 63 | 69 | 70 | 75 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/layout/item_content.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #3F51B5 4 | #303F9F 5 | #FF4081 6 | 7 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/values/ids.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | AlipayHome 3 | 4 | -------------------------------------------------------------------------------- /AlipayHome/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 10 | 11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /AlipayHome/app/src/test/java/com/kyleduo/alipayhome/ExampleUnitTest.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.alipayhome; 2 | 3 | import org.junit.Test; 4 | 5 | import static org.junit.Assert.*; 6 | 7 | /** 8 | * Example local unit test, which will execute on the development machine (host). 9 | * 10 | * @see Testing documentation 11 | */ 12 | public class ExampleUnitTest { 13 | @Test 14 | public void addition_isCorrect() throws Exception { 15 | assertEquals(4, 2 + 2); 16 | } 17 | } -------------------------------------------------------------------------------- /AlipayHome/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:2.3.3' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | jcenter() 18 | } 19 | } 20 | 21 | task clean(type: Delete) { 22 | delete rootProject.buildDir 23 | } 24 | -------------------------------------------------------------------------------- /AlipayHome/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/AlipayHome/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /AlipayHome/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | #Mon Jul 24 20:57:41 CST 2017 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-3.3-all.zip 7 | -------------------------------------------------------------------------------- /AlipayHome/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /AlipayHome/settings.gradle: -------------------------------------------------------------------------------- 1 | include ':app' 2 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | /.idea/workspace.xml 5 | /.idea/libraries 6 | .DS_Store 7 | /build 8 | /captures 9 | .externalNativeBuild 10 | /.idea/ 11 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 25 5 | buildToolsVersion "25.0.2" 6 | defaultConfig { 7 | applicationId "com.kyleduo.digging.translucentstatusbar" 8 | minSdkVersion 14 9 | targetSdkVersion 25 10 | versionCode 1 11 | versionName "1.0" 12 | testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | ext { 23 | supportVersion = '25.3.1' 24 | butterKnifeVersion = '8.5.1' 25 | } 26 | 27 | dependencies { 28 | compile fileTree(dir: 'libs', include: ['*.jar']) 29 | androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', { 30 | exclude group: 'com.android.support', module: 'support-annotations' 31 | }) 32 | 33 | compile "com.android.support:appcompat-v7:$supportVersion" 34 | compile "com.android.support:design:$supportVersion" 35 | 36 | compile 'com.android.support.constraint:constraint-layout:1.0.2' 37 | testCompile 'junit:junit:4.12' 38 | 39 | 40 | annotationProcessor "com.jakewharton:butterknife-compiler:$butterKnifeVersion" 41 | compile "com.jakewharton:butterknife:$butterKnifeVersion" 42 | } 43 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/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 /Users/kyle/Documents/developer/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 | 19 | # Uncomment this to preserve the line number information for 20 | # debugging stack traces. 21 | #-keepattributes SourceFile,LineNumberTable 22 | 23 | # If you keep the line number information, uncomment this to 24 | # hide the original source file name. 25 | #-renamesourcefileattribute SourceFile 26 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/androidTest/java/com/kyleduo/digging/translucentstatusbar/ExampleInstrumentedTest.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.digging.translucentstatusbar; 2 | 3 | import android.content.Context; 4 | import android.support.test.InstrumentationRegistry; 5 | import android.support.test.runner.AndroidJUnit4; 6 | 7 | import org.junit.Test; 8 | import org.junit.runner.RunWith; 9 | 10 | import static org.junit.Assert.*; 11 | 12 | /** 13 | * Instrumentation test, which will execute on an Android device. 14 | * 15 | * @see Testing documentation 16 | */ 17 | @RunWith(AndroidJUnit4.class) 18 | public class ExampleInstrumentedTest { 19 | @Test 20 | public void useAppContext() throws Exception { 21 | // Context of the app under test. 22 | Context appContext = InstrumentationRegistry.getTargetContext(); 23 | 24 | assertEquals("com.kyleduo.digging.translucentstatusbar", appContext.getPackageName()); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/BaseActivity.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.digging.translucentstatusbar; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.ActionBar; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.support.v7.widget.Toolbar; 8 | 9 | import butterknife.BindView; 10 | import butterknife.ButterKnife; 11 | 12 | /** 13 | * for DiggingTranslucentStatusBar 14 | * Created by kyleduo on 2017/5/5. 15 | */ 16 | 17 | public class BaseActivity extends AppCompatActivity { 18 | private static final int INVALID_RES_ID = 0; 19 | 20 | @BindView(R.id.tool_bar) 21 | Toolbar mToolbar; 22 | 23 | @Override 24 | protected void onCreate(@Nullable Bundle savedInstanceState) { 25 | super.onCreate(savedInstanceState); 26 | int resId = getLayoutResId(); 27 | if (resId == INVALID_RES_ID) { 28 | return; 29 | } 30 | setContentView(resId); 31 | ButterKnife.bind(this); 32 | 33 | setSupportActionBar(mToolbar); 34 | ActionBar actionBar = getSupportActionBar(); 35 | if (actionBar != null) { 36 | actionBar.setHomeButtonEnabled(true); 37 | actionBar.setDisplayHomeAsUpEnabled(true); 38 | //noinspection deprecation 39 | actionBar.setHomeAsUpIndicator(getResources().getDrawable(R.drawable.ic_back)); 40 | } 41 | 42 | } 43 | 44 | protected int getLayoutResId() { 45 | return INVALID_RES_ID; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/Demo1Activity.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.digging.translucentstatusbar; 2 | 3 | import android.view.MenuItem; 4 | 5 | /** 6 | * for DiggingTranslucentStatusBar 7 | * Created by kyleduo on 2017/5/5. 8 | */ 9 | 10 | public class Demo1Activity extends BaseActivity { 11 | 12 | @Override 13 | protected int getLayoutResId() { 14 | return R.layout.act_demo1; 15 | } 16 | 17 | @Override 18 | public boolean onOptionsItemSelected(MenuItem item) { 19 | if (item.getItemId() == android.R.id.home) { 20 | finish(); 21 | return true; 22 | } 23 | return super.onOptionsItemSelected(item); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/Demo2Activity.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.digging.translucentstatusbar; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.design.widget.AppBarLayout; 6 | import android.view.MenuItem; 7 | 8 | import butterknife.BindView; 9 | 10 | /** 11 | * for DiggingTranslucentStatusBar 12 | * Created by kyleduo on 2017/5/5. 13 | */ 14 | 15 | public class Demo2Activity extends BaseActivity { 16 | 17 | @BindView(R.id.main_appbar) 18 | AppBarLayout mAppBarLayout; 19 | 20 | 21 | @Override 22 | protected int getLayoutResId() { 23 | return R.layout.act_demo2; 24 | } 25 | 26 | @Override 27 | protected void onCreate(@Nullable Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | 30 | mAppBarLayout.addOnOffsetChangedListener(new AppBarLayout.OnOffsetChangedListener() { 31 | @Override 32 | public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) { 33 | if (verticalOffset <= -mToolbar.getHeight() && mToolbar.getTranslationY() == 0) { 34 | mToolbar.animate().translationY(dp2px(-16)).setDuration(100).start(); 35 | } else if (verticalOffset > -mToolbar.getHeight() + mToolbar.getTop() && mToolbar.getTranslationY() == dp2px(-16)) { 36 | mToolbar.animate().translationY(0).setDuration(100).start(); 37 | } 38 | } 39 | }); 40 | 41 | } 42 | 43 | private int dp2px(float dp) { 44 | return (int) (getResources().getDisplayMetrics().density * dp + 0.5); 45 | } 46 | 47 | @Override 48 | public boolean onOptionsItemSelected(MenuItem item) { 49 | if (item.getItemId() == android.R.id.home) { 50 | finish(); 51 | return true; 52 | } 53 | return super.onOptionsItemSelected(item); 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/Demo3Activity.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.digging.translucentstatusbar; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | 7 | /** 8 | * for DiggingTranslucentStatusBar 9 | * Created by kyleduo on 2017/5/11. 10 | */ 11 | 12 | public class Demo3Activity extends AppCompatActivity { 13 | 14 | @Override 15 | protected void onCreate(@Nullable Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.act_demo3); 18 | 19 | getSupportFragmentManager().beginTransaction() 20 | .add(R.id.demo3_fragment_container, new Demo3Fragment()) 21 | .commit(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/Demo3BActivity.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.digging.translucentstatusbar; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.AppCompatActivity; 6 | 7 | /** 8 | * for DiggingTranslucentStatusBar 9 | * Created by kyleduo on 2017/5/11. 10 | */ 11 | 12 | public class Demo3BActivity extends AppCompatActivity { 13 | 14 | @Override 15 | protected void onCreate(@Nullable Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.act_demo3); 18 | 19 | getSupportFragmentManager().beginTransaction() 20 | .add(R.id.demo3_fragment_container, new Demo3BFragment()) 21 | .commit(); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/Demo3BFragment.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.digging.translucentstatusbar; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.view.LayoutInflater; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | /** 11 | * for DiggingTranslucentStatusBar 12 | * Created by kyleduo on 2017/5/17. 13 | */ 14 | 15 | public class Demo3BFragment extends Fragment { 16 | @Nullable 17 | @Override 18 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 19 | return inflater.inflate(R.layout.frgm_demo3b, container, false); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/Demo3Fragment.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.digging.translucentstatusbar; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v4.app.Fragment; 6 | import android.support.v7.app.ActionBar; 7 | import android.support.v7.app.AppCompatActivity; 8 | import android.support.v7.widget.Toolbar; 9 | import android.view.LayoutInflater; 10 | import android.view.MenuItem; 11 | import android.view.View; 12 | import android.view.ViewGroup; 13 | 14 | /** 15 | * for DiggingTranslucentStatusBar 16 | * Created by kyleduo on 2017/5/11. 17 | */ 18 | 19 | public class Demo3Fragment extends Fragment { 20 | 21 | Toolbar mToolbar; 22 | 23 | @Nullable 24 | @Override 25 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 26 | View view = inflater.inflate(R.layout.frgm_demo3, container, false); 27 | mToolbar = (Toolbar) view.findViewById(R.id.tool_bar); 28 | return view; 29 | } 30 | 31 | @Override 32 | public void onActivityCreated(@Nullable Bundle savedInstanceState) { 33 | super.onActivityCreated(savedInstanceState); 34 | 35 | 36 | AppCompatActivity act = (AppCompatActivity) getActivity(); 37 | 38 | act.setSupportActionBar(mToolbar); 39 | ActionBar actionBar = act.getSupportActionBar(); 40 | if (actionBar != null) { 41 | actionBar.setHomeButtonEnabled(true); 42 | actionBar.setDisplayHomeAsUpEnabled(true); 43 | //noinspection deprecation 44 | actionBar.setHomeAsUpIndicator(getResources().getDrawable(R.drawable.ic_back)); 45 | } 46 | 47 | setHasOptionsMenu(true); 48 | } 49 | 50 | @Override 51 | public boolean onOptionsItemSelected(MenuItem item) { 52 | if (item.getItemId() == android.R.id.home) { 53 | getActivity().finish(); 54 | return true; 55 | } 56 | return super.onOptionsItemSelected(item); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/SecondActivity.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.digging.translucentstatusbar; 2 | 3 | import android.os.Bundle; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.app.ActionBar; 6 | import android.support.v7.app.AppCompatActivity; 7 | import android.support.v7.widget.Toolbar; 8 | import android.view.MenuItem; 9 | import android.view.View; 10 | 11 | import butterknife.BindView; 12 | import butterknife.ButterKnife; 13 | 14 | /** 15 | * for DiggingTranslucentStatusBar 16 | * Created by kyleduo on 2017/5/3. 17 | */ 18 | 19 | public class SecondActivity extends AppCompatActivity { 20 | 21 | @BindView(R.id.second_root) 22 | View mRootView; 23 | @BindView(R.id.second_toolbar) 24 | Toolbar mToolbar; 25 | 26 | @Override 27 | protected void onCreate(@Nullable Bundle savedInstanceState) { 28 | super.onCreate(savedInstanceState); 29 | setContentView(R.layout.act_second); 30 | ButterKnife.bind(this); 31 | 32 | setSupportActionBar(mToolbar); 33 | ActionBar actionBar = getSupportActionBar(); 34 | if (actionBar != null) { 35 | actionBar.setHomeButtonEnabled(true); 36 | actionBar.setDisplayHomeAsUpEnabled(true); 37 | //noinspection deprecation 38 | actionBar.setHomeAsUpIndicator(getResources().getDrawable(R.drawable.ic_back)); 39 | } 40 | } 41 | 42 | @Override 43 | public boolean onOptionsItemSelected(MenuItem item) { 44 | if (item.getItemId() == android.R.id.home) { 45 | finish(); 46 | return true; 47 | } 48 | return super.onOptionsItemSelected(item); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/widgets/DummySupportToolbar.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.digging.translucentstatusbar.widgets; 2 | 3 | import android.content.Context; 4 | import android.support.annotation.Nullable; 5 | import android.support.v7.widget.Toolbar; 6 | import android.util.AttributeSet; 7 | import android.view.View; 8 | import android.view.ViewGroup; 9 | 10 | /** 11 | * Created by kyleduo on 2017/5/3. 12 | */ 13 | 14 | public class DummySupportToolbar extends Toolbar { 15 | 16 | private View mDummyView; 17 | 18 | public DummySupportToolbar(Context context) { 19 | super(context); 20 | } 21 | 22 | public DummySupportToolbar(Context context, @Nullable AttributeSet attrs) { 23 | super(context, attrs); 24 | } 25 | 26 | public DummySupportToolbar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { 27 | super(context, attrs, defStyleAttr); 28 | } 29 | 30 | @Override 31 | public void addView(View child, int width, int height) { 32 | if (View.class.isInstance(child)) { 33 | mDummyView = child; 34 | if (height == ViewGroup.LayoutParams.MATCH_PARENT) { 35 | height = getSuggestedMinimumHeight(); 36 | } 37 | } 38 | super.addView(child, width, height); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/widgets/FitCollapsingToolbarLayout.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.digging.translucentstatusbar.widgets; 2 | 3 | import android.content.Context; 4 | import android.support.design.widget.CollapsingToolbarLayout; 5 | import android.support.v4.view.WindowInsetsCompat; 6 | import android.util.AttributeSet; 7 | 8 | import java.lang.reflect.Field; 9 | 10 | /** 11 | * Created by kyleduo on 2017/5/5. 12 | */ 13 | 14 | public class FitCollapsingToolbarLayout extends CollapsingToolbarLayout { 15 | 16 | Field mLastInsetsField; 17 | 18 | public FitCollapsingToolbarLayout(Context context) { 19 | this(context, null); 20 | } 21 | 22 | public FitCollapsingToolbarLayout(Context context, AttributeSet attrs) { 23 | this(context, attrs, 0); 24 | } 25 | 26 | public FitCollapsingToolbarLayout(Context context, AttributeSet attrs, int defStyleAttr) { 27 | super(context, attrs, defStyleAttr); 28 | 29 | try { 30 | mLastInsetsField = CollapsingToolbarLayout.class.getDeclaredField("mLastInsets"); 31 | mLastInsetsField.setAccessible(true); 32 | } catch (NoSuchFieldException e) { 33 | e.printStackTrace(); 34 | } 35 | } 36 | 37 | @Override 38 | protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { 39 | super.onMeasure(widthMeasureSpec, heightMeasureSpec); 40 | if (mLastInsetsField != null) { 41 | try { 42 | WindowInsetsCompat insetsCompat = (WindowInsetsCompat) mLastInsetsField.get(this); 43 | if (insetsCompat != null && insetsCompat.getSystemWindowInsetTop() > 0) { 44 | setMeasuredDimension(getMeasuredWidth(), getMeasuredHeight() + insetsCompat.getSystemWindowInsetTop()); 45 | } 46 | } catch (IllegalAccessException e) { 47 | e.printStackTrace(); 48 | } 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/java/com/kyleduo/digging/translucentstatusbar/widgets/OnItemClickListener.java: -------------------------------------------------------------------------------- 1 | package com.kyleduo.digging.translucentstatusbar.widgets; 2 | 3 | import android.support.v7.widget.RecyclerView; 4 | import android.view.View; 5 | 6 | /** 7 | * Created by kyleduo on 2017/4/27. 8 | */ 9 | 10 | public interface OnItemClickListener { 11 | void onItemClick(View view, RecyclerView.ViewHolder holder, int position); 12 | } 13 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/drawer_header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/drawer_header.jpg -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/ic_back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/ic_back.png -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/ic_burger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/ic_burger.png -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/temp.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kyleduo/ExamplesFromMyBlog/58fea7cfafe5d96867cfc34579a2947117fe9027/DiggingTranslucentStatusBar/app/src/main/res/drawable-xxhdpi/temp.jpg -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/res/layout/act_demo1.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 10 | 11 | 17 | 18 | 30 | 31 | 41 | 42 | 49 | 50 | 56 | 57 | 58 | 59 | 60 | 65 | 66 | 70 | 71 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/res/layout/act_demo2.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 17 | 18 | 30 | 31 | 38 | 39 | 45 | 46 | 47 | 54 | 55 | 56 | 57 | 62 | 63 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/res/layout/act_demo3.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/res/layout/act_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 10 | 14 | 15 | 21 | 22 | 34 | 35 | 45 | 46 | 53 | 54 | 60 | 61 | 62 | 63 | 64 | 69 | 70 | 71 | 72 | 73 | 81 | 82 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /DiggingTranslucentStatusBar/app/src/main/res/layout/act_second.xml: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 17 | 18 |