├── .gitignore ├── LICENSE ├── README.md ├── app ├── .gitignore ├── build.gradle └── src │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── yanzhenjie │ │ └── sofia │ │ └── sample │ │ ├── OnItemClickListener.java │ │ └── ui │ │ ├── CommonActivity.java │ │ ├── DarkFontStatusActivity.java │ │ ├── DrawerLayoutActivity.java │ │ ├── GoodsDetailsActivity.java │ │ ├── MainActivity.java │ │ └── fragment │ │ ├── FragmentA.java │ │ ├── FragmentActivity.java │ │ └── FragmentB.java │ └── res │ ├── drawable-land-xxhdpi │ ├── navigation_image_a.jpg │ └── navigation_image_b.jpg │ ├── drawable-xxhdpi │ ├── draw_layout.jpg │ ├── header.jpg │ ├── navigation_image_a.jpg │ ├── navigation_image_b.jpg │ └── status_image.jpg │ ├── layout │ ├── activity_common.xml │ ├── activity_dark_font.xml │ ├── activity_drawer_layout.xml │ ├── activity_fragment.xml │ ├── activity_goods_details.xml │ ├── activity_main.xml │ ├── content.xml │ ├── fragment_a.xml │ ├── fragment_b.xml │ ├── header.xml │ ├── item.xml │ ├── toolbar_dark.xml │ └── toolbar_light.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 │ ├── array.xml │ ├── colors.xml │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── config.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── image ├── 1.gif ├── 2.gif ├── 3.gif ├── 4.gif ├── 5.gif └── 6.gif ├── settings.gradle └── sofia ├── .gitignore ├── build.gradle └── src └── main ├── AndroidManifest.xml ├── java └── com │ └── yanzhenjie │ └── sofia │ ├── Bar.java │ ├── FitWindowLayout.java │ ├── HostLayout.java │ ├── NavigationView.java │ ├── Sofia.java │ ├── StatusView.java │ └── Utils.java └── res ├── layout-land └── sofia_host_layout.xml ├── layout └── sofia_host_layout.xml └── values └── colors.xml /.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /local.properties 4 | .idea 5 | .DS_Store 6 | /build 7 | /captures 8 | .externalNativeBuild -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Apache License 2 | Version 2.0, January 2004 3 | http://www.apache.org/licenses/ 4 | 5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 6 | 7 | 1. Definitions. 8 | 9 | "License" shall mean the terms and conditions for use, reproduction, 10 | and distribution as defined by Sections 1 through 9 of this document. 11 | 12 | "Licensor" shall mean the copyright owner or entity authorized by 13 | the copyright owner that is granting the License. 14 | 15 | "Legal Entity" shall mean the union of the acting entity and all 16 | other entities that control, are controlled by, or are under common 17 | control with that entity. For the purposes of this definition, 18 | "control" means (i) the power, direct or indirect, to cause the 19 | direction or management of such entity, whether by contract or 20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 21 | outstanding shares, or (iii) beneficial ownership of such entity. 22 | 23 | "You" (or "Your") shall mean an individual or Legal Entity 24 | exercising permissions granted by this License. 25 | 26 | "Source" form shall mean the preferred form for making modifications, 27 | including but not limited to software source code, documentation 28 | source, and configuration files. 29 | 30 | "Object" form shall mean any form resulting from mechanical 31 | transformation or translation of a Source form, including but 32 | not limited to compiled object code, generated documentation, 33 | and conversions to other media types. 34 | 35 | "Work" shall mean the work of authorship, whether in Source or 36 | Object form, made available under the License, as indicated by a 37 | copyright notice that is included in or attached to the work 38 | (an example is provided in the Appendix below). 39 | 40 | "Derivative Works" shall mean any work, whether in Source or Object 41 | form, that is based on (or derived from) the Work and for which the 42 | editorial revisions, annotations, elaborations, or other modifications 43 | represent, as a whole, an original work of authorship. For the purposes 44 | of this License, Derivative Works shall not include works that remain 45 | separable from, or merely link (or bind by name) to the interfaces of, 46 | the Work and Derivative Works thereof. 47 | 48 | "Contribution" shall mean any work of authorship, including 49 | the original version of the Work and any modifications or additions 50 | to that Work or Derivative Works thereof, that is intentionally 51 | submitted to Licensor for inclusion in the Work by the copyright owner 52 | or by an individual or Legal Entity authorized to submit on behalf of 53 | the copyright owner. For the purposes of this definition, "submitted" 54 | means any form of electronic, verbal, or written communication sent 55 | to the Licensor or its representatives, including but not limited to 56 | communication on electronic mailing lists, source code control systems, 57 | and issue tracking systems that are managed by, or on behalf of, the 58 | Licensor for the purpose of discussing and improving the Work, but 59 | excluding communication that is conspicuously marked or otherwise 60 | designated in writing by the copyright owner as "Not a Contribution." 61 | 62 | "Contributor" shall mean Licensor and any individual or Legal Entity 63 | on behalf of whom a Contribution has been received by Licensor and 64 | subsequently incorporated within the Work. 65 | 66 | 2. Grant of Copyright License. Subject to the terms and conditions of 67 | this License, each Contributor hereby grants to You a perpetual, 68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 69 | copyright license to reproduce, prepare Derivative Works of, 70 | publicly display, publicly perform, sublicense, and distribute the 71 | Work and such Derivative Works in Source or Object form. 72 | 73 | 3. Grant of Patent License. Subject to the terms and conditions of 74 | this License, each Contributor hereby grants to You a perpetual, 75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 76 | (except as stated in this section) patent license to make, have made, 77 | use, offer to sell, sell, import, and otherwise transfer the Work, 78 | where such license applies only to those patent claims licensable 79 | by such Contributor that are necessarily infringed by their 80 | Contribution(s) alone or by combination of their Contribution(s) 81 | with the Work to which such Contribution(s) was submitted. If You 82 | institute patent litigation against any entity (including a 83 | cross-claim or counterclaim in a lawsuit) alleging that the Work 84 | or a Contribution incorporated within the Work constitutes direct 85 | or contributory patent infringement, then any patent licenses 86 | granted to You under this License for that Work shall terminate 87 | as of the date such litigation is filed. 88 | 89 | 4. Redistribution. You may reproduce and distribute copies of the 90 | Work or Derivative Works thereof in any medium, with or without 91 | modifications, and in Source or Object form, provided that You 92 | meet the following conditions: 93 | 94 | (a) You must give any other recipients of the Work or 95 | Derivative Works a copy of this License; and 96 | 97 | (b) You must cause any modified files to carry prominent notices 98 | stating that You changed the files; and 99 | 100 | (c) You must retain, in the Source form of any Derivative Works 101 | that You distribute, all copyright, patent, trademark, and 102 | attribution notices from the Source form of the Work, 103 | excluding those notices that do not pertain to any part of 104 | the Derivative Works; and 105 | 106 | (d) If the Work includes a "NOTICE" text file as part of its 107 | distribution, then any Derivative Works that You distribute must 108 | include a readable copy of the attribution notices contained 109 | within such NOTICE file, excluding those notices that do not 110 | pertain to any part of the Derivative Works, in at least one 111 | of the following places: within a NOTICE text file distributed 112 | as part of the Derivative Works; within the Source form or 113 | documentation, if provided along with the Derivative Works; or, 114 | within a display generated by the Derivative Works, if and 115 | wherever such third-party notices normally appear. The contents 116 | of the NOTICE file are for informational purposes only and 117 | do not modify the License. You may add Your own attribution 118 | notices within Derivative Works that You distribute, alongside 119 | or as an addendum to the NOTICE text from the Work, provided 120 | that such additional attribution notices cannot be construed 121 | as modifying the License. 122 | 123 | You may add Your own copyright statement to Your modifications and 124 | may provide additional or different license terms and conditions 125 | for use, reproduction, or distribution of Your modifications, or 126 | for any such Derivative Works as a whole, provided Your use, 127 | reproduction, and distribution of the Work otherwise complies with 128 | the conditions stated in this License. 129 | 130 | 5. Submission of Contributions. Unless You explicitly state otherwise, 131 | any Contribution intentionally submitted for inclusion in the Work 132 | by You to the Licensor shall be under the terms and conditions of 133 | this License, without any additional terms or conditions. 134 | Notwithstanding the above, nothing herein shall supersede or modify 135 | the terms of any separate license agreement you may have executed 136 | with Licensor regarding such Contributions. 137 | 138 | 6. Trademarks. This License does not grant permission to use the trade 139 | names, trademarks, service marks, or product names of the Licensor, 140 | except as required for reasonable and customary use in describing the 141 | origin of the Work and reproducing the content of the NOTICE file. 142 | 143 | 7. Disclaimer of Warranty. Unless required by applicable law or 144 | agreed to in writing, Licensor provides the Work (and each 145 | Contributor provides its Contributions) on an "AS IS" BASIS, 146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 147 | implied, including, without limitation, any warranties or conditions 148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 149 | PARTICULAR PURPOSE. You are solely responsible for determining the 150 | appropriateness of using or redistributing the Work and assume any 151 | risks associated with Your exercise of permissions under this License. 152 | 153 | 8. Limitation of Liability. In no event and under no legal theory, 154 | whether in tort (including negligence), contract, or otherwise, 155 | unless required by applicable law (such as deliberate and grossly 156 | negligent acts) or agreed to in writing, shall any Contributor be 157 | liable to You for damages, including any direct, indirect, special, 158 | incidental, or consequential damages of any character arising as a 159 | result of this License or out of the use or inability to use the 160 | Work (including but not limited to damages for loss of goodwill, 161 | work stoppage, computer failure or malfunction, or any and all 162 | other commercial damages or losses), even if such Contributor 163 | has been advised of the possibility of such damages. 164 | 165 | 9. Accepting Warranty or Additional Liability. While redistributing 166 | the Work or Derivative Works thereof, You may choose to offer, 167 | and charge a fee for, acceptance of support, warranty, indemnity, 168 | or other liability obligations and/or rights consistent with this 169 | License. However, in accepting such obligations, You may act only 170 | on Your own behalf and on Your sole responsibility, not on behalf 171 | of any other Contributor, and only if You agree to indemnify, 172 | defend, and hold each Contributor harmless for any liability 173 | incurred by, or claims asserted against, such Contributor by reason 174 | of your accepting any such warranty or additional liability. 175 | 176 | END OF TERMS AND CONDITIONS 177 | 178 | APPENDIX: How to apply the Apache License to your work. 179 | 180 | To apply the Apache License to your work, attach the following 181 | boilerplate notice, with the fields enclosed by brackets "{}" 182 | replaced with your own identifying information. (Don't include 183 | the brackets!) The text should be enclosed in the appropriate 184 | comment syntax for the file format. We also recommend that a 185 | file or class name and description of purpose be included on the 186 | same "printed page" as the copyright notice for easier 187 | identification within third-party archives. 188 | 189 | Copyright 2017 Yan Zhenjie 190 | 191 | Licensed under the Apache License, Version 2.0 (the "License"); 192 | you may not use this file except in compliance with the License. 193 | You may obtain a copy of the License at 194 | 195 | http://www.apache.org/licenses/LICENSE-2.0 196 | 197 | Unless required by applicable law or agreed to in writing, software 198 | distributed under the License is distributed on an "AS IS" BASIS, 199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 200 | See the License for the specific language governing permissions and 201 | limitations under the License. 202 | 203 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Sofia 2 | Android状态栏与导航栏一体化项目,实现沉浸式效果,状态栏和导航栏均支持设置颜色、渐变色、图片、透明度、内容入侵和状态栏深色字体;兼容竖屏、横屏,当屏幕旋转时会自动适配。 3 | 4 | Sofia一词源自于希腊语∑οφία,含义为智慧,译为中文应该可以叫做*索菲亚*,这也是我赋予这个项目的愿望。 5 | 6 | **QQ技术交流群:[46505645](https://jq.qq.com/?_wv=1027&k=5nJm5up)** 7 | 8 | ## 截图 9 | 10 | 11 | 12 | * 图一:状态栏和导航栏用图片作为背景。 13 | * 图二:状态栏和导航栏随着Content的滑动逐渐变色。 14 | * 图三:内容侵入状态栏,比如产品详情页。 15 | * 图四:状态栏底色白色,字体深色(大概是灰黑色)。 16 | * 图五:和DrawerLayout结合使用。 17 | * 图六:和Fragment结合使用。 18 | 19 | ## 下载 20 | 在Gradle中添加依赖: 21 | ```groovy 22 | implementation 'com.yanzhenjie:sofia:1.0.5' 23 | ``` 24 | 25 | 开发者也可以使用[其它版本](https://github.com/yanzhenjie/Sofia/releases)。 26 | 27 | ## Api 28 | 这里例如所有的Api,调用时结合具体的场景调用某几个方法即可,也可以一个都不调用,具体请参考Sample。 29 | 通用的用法是: 30 | ```java 31 | Sofia.with(Activity) 32 | ...; 33 | ``` 34 | 35 | 调用`with`方法后返回一个`Bar`接口,可以链式连续调用所有方法,方法列表如下: 36 | ```java 37 | // 状态栏深色字体。 38 | Bar statusBarDarkFont(); 39 | 40 | // 状态栏浅色字体。 41 | Bar statusBarLightFont(); 42 | 43 | // 状态栏背景色。 44 | Bar statusBarBackground(int statusBarColor); 45 | 46 | // 状态栏背景Drawable。 47 | Bar statusBarBackground(Drawable drawable); 48 | 49 | // 状态栏背景透明度。 50 | Bar statusBarBackgroundAlpha(int alpha); 51 | 52 | // 导航栏背景色。 53 | Bar navigationBarBackground(int navigationBarColor); 54 | 55 | // 导航栏背景Drawable。 56 | Bar navigationBarBackground(Drawable drawable); 57 | 58 | // 导航栏背景透明度。 59 | Bar navigationBarBackgroundAlpha(int alpha); 60 | 61 | // 内容入侵状态栏。 62 | Bar invasionStatusBar(); 63 | 64 | // 内容入侵导航栏。 65 | Bar invasionNavigationBar(); 66 | 67 | // 让某一个View考虑状态栏的高度,显示在适当的位置,接受ViewId。 68 | Bar fitsStatusBarView(int viewId); 69 | 70 | // 让某一个View考虑状态栏的高度,显示在适当的位置,接受View。 71 | Bar fitsStatusBarView(View view); 72 | 73 | // 让某一个View考虑导航栏的高度,显示在适当的位置,接受ViewId。 74 | Bar fitsNavigationBarView(View view); 75 | 76 | // 让某一个View考虑导航栏的高度,显示在适当的位置,接受View。 77 | Bar fitsNavigationBarView(View view); 78 | ``` 79 | 80 | `fitsStatusBarView()`一般用在产品详情页,假设需求如`图三`所示。在内容入侵状态栏后,我们的布局整体上移到状态栏,那么`Toolbar`的一部分也会显示在状态栏下方(层级),这个时候就需要`Toolbar`考虑系统状态栏的高度显示在适当的位置了;`fitsNavigationBarView()`同理,只是显示在屏幕的最底部(竖屏)或者最右侧(横屏)。 81 | 82 | **注意**:`Sofia.with(Activity)`调用后会返回一个`Bar`接口实例,开发者可以连续调用某几个方法。在页面滑动时如果需要再次改变SystemBar的颜色,那么开发者可以保存这个`Bar`实例为`Activity`的成员变量,也可以不保存,在重复改变时再次调用`Sofia.with(Activity)`,此时还是会返回上次返回给开发者的`Bar`接口实例。 83 | 84 | ## License 85 | ```text 86 | Copyright 2017 Yan Zhenjie 87 | 88 | Licensed under the Apache License, Version 2.0 (the "License"); 89 | you may not use this file except in compliance with the License. 90 | You may obtain a copy of the License at 91 | 92 | http://www.apache.org/licenses/LICENSE-2.0 93 | 94 | Unless required by applicable law or agreed to in writing, software 95 | distributed under the License is distributed on an "AS IS" BASIS, 96 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 97 | See the License for the specific language governing permissions and 98 | limitations under the License. 99 | ``` -------------------------------------------------------------------------------- /app/.gitignore: -------------------------------------------------------------------------------- 1 | /build 2 | -------------------------------------------------------------------------------- /app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: rootProject.ext.plugins.application 2 | 3 | android { 4 | compileSdkVersion rootProject.ext.android.compileSdkVersion 5 | buildToolsVersion rootProject.ext.android.buildToolsVersion 6 | 7 | defaultConfig { 8 | applicationId rootProject.ext.android.applicationId 9 | minSdkVersion rootProject.ext.android.minSdkVersion 10 | targetSdkVersion rootProject.ext.android.targetSdkVersion 11 | versionCode rootProject.ext.android.versionCode 12 | versionName rootProject.ext.android.versionName 13 | } 14 | } 15 | 16 | dependencies { 17 | implementation rootProject.ext.dependencies.appCompat 18 | implementation rootProject.ext.dependencies.design 19 | implementation rootProject.ext.dependencies.recyclerView 20 | implementation rootProject.ext.dependencies.sofia 21 | } -------------------------------------------------------------------------------- /app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 20 | 21 | 28 | 29 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 43 | 47 | 51 | 55 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /app/src/main/java/com/yanzhenjie/sofia/sample/OnItemClickListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.sofia.sample; 17 | 18 | import android.view.View; 19 | 20 | /** 21 | * Created by YanZhenjie on 2017/12/13. 22 | */ 23 | public interface OnItemClickListener { 24 | 25 | void onItemClick(View view, int position); 26 | } -------------------------------------------------------------------------------- /app/src/main/java/com/yanzhenjie/sofia/sample/ui/CommonActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.sofia.sample.ui; 17 | 18 | import android.os.Bundle; 19 | import android.support.annotation.Nullable; 20 | import android.support.v4.content.ContextCompat; 21 | import android.support.v4.graphics.drawable.DrawableCompat; 22 | import android.support.v4.widget.NestedScrollView; 23 | import android.support.v7.app.AppCompatActivity; 24 | import android.support.v7.widget.Toolbar; 25 | import android.view.View; 26 | 27 | import com.yanzhenjie.sofia.Sofia; 28 | import com.yanzhenjie.sofia.sample.R; 29 | 30 | /** 31 | *

32 | * Gradient status bar. 33 | *

34 | * Created by YanZhenjie on 2017/8/2. 35 | */ 36 | public class CommonActivity extends AppCompatActivity { 37 | 38 | private Toolbar mToolbar; 39 | private View mHeaderView; 40 | 41 | @Override 42 | protected void onCreate(@Nullable Bundle savedInstanceState) { 43 | super.onCreate(savedInstanceState); 44 | setContentView(R.layout.activity_common); 45 | 46 | mToolbar = findViewById(R.id.toolbar); 47 | setSupportActionBar(mToolbar); 48 | 49 | NestedScrollView nestedScrollView = findViewById(R.id.nested_scroll_view); 50 | mHeaderView = findViewById(R.id.header); 51 | 52 | final int startColor = ContextCompat.getColor(this, R.color.colorPrimary); 53 | final int endColor = ContextCompat.getColor(this, R.color.colorNavigation); 54 | 55 | nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() { 56 | @Override 57 | public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { 58 | int headerHeight = mHeaderView.getHeight(); 59 | int scrollDistance = Math.min(scrollY, headerHeight); 60 | float fraction = (float) scrollDistance / (float) headerHeight; 61 | 62 | setToolbarStatusBarAlpha(evaluate(fraction, startColor, endColor)); 63 | setNavigationViewColor(evaluate(fraction, endColor, startColor)); 64 | } 65 | }); 66 | 67 | Sofia.with(this) 68 | .statusBarBackground(ContextCompat.getColor(this, R.color.colorPrimary)) 69 | .navigationBarBackground(ContextCompat.getDrawable(this, R.color.colorNavigation)); 70 | } 71 | 72 | private void setToolbarStatusBarAlpha(int color) { 73 | DrawableCompat.setTint(mToolbar.getBackground().mutate(), color); 74 | Sofia.with(this) 75 | .statusBarBackground(color); 76 | } 77 | 78 | private void setNavigationViewColor(int color) { 79 | Sofia.with(this) 80 | .navigationBarBackground(color); 81 | } 82 | 83 | public int evaluate(float fraction, int startValue, int endValue) { 84 | int startA = (startValue >> 24) & 0xff; 85 | int startR = (startValue >> 16) & 0xff; 86 | int startG = (startValue >> 8) & 0xff; 87 | int startB = startValue & 0xff; 88 | 89 | int endA = (endValue >> 24) & 0xff; 90 | int endR = (endValue >> 16) & 0xff; 91 | int endG = (endValue >> 8) & 0xff; 92 | int endB = endValue & 0xff; 93 | 94 | return ((startA + (int) (fraction * (endA - startA))) << 24) | 95 | ((startR + (int) (fraction * (endR - startR))) << 16) | 96 | ((startG + (int) (fraction * (endG - startG))) << 8) | 97 | ((startB + (int) (fraction * (endB - startB)))); 98 | } 99 | } 100 | -------------------------------------------------------------------------------- /app/src/main/java/com/yanzhenjie/sofia/sample/ui/DarkFontStatusActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.sofia.sample.ui; 17 | 18 | import android.os.Bundle; 19 | import android.support.annotation.Nullable; 20 | import android.support.v4.content.ContextCompat; 21 | import android.support.v7.app.AppCompatActivity; 22 | import android.support.v7.widget.Toolbar; 23 | 24 | import com.yanzhenjie.sofia.Sofia; 25 | import com.yanzhenjie.sofia.sample.R; 26 | 27 | /** 28 | *

29 | * Dark font status bar. 30 | *

31 | * Created by YanZhenjie on 2017/8/2. 32 | */ 33 | public class DarkFontStatusActivity extends AppCompatActivity { 34 | 35 | @Override 36 | protected void onCreate(@Nullable Bundle savedInstanceState) { 37 | super.onCreate(savedInstanceState); 38 | setContentView(R.layout.activity_dark_font); 39 | 40 | Toolbar mToolbar = findViewById(R.id.toolbar); 41 | setSupportActionBar(mToolbar); 42 | 43 | Sofia.with(this) 44 | .statusBarDarkFont() 45 | .statusBarBackground(ContextCompat.getColor(this, R.color.white)) 46 | .navigationBarBackground(ContextCompat.getColor(this, R.color.colorNavigation)); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /app/src/main/java/com/yanzhenjie/sofia/sample/ui/DrawerLayoutActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.sofia.sample.ui; 17 | 18 | import android.graphics.Color; 19 | import android.os.Bundle; 20 | import android.support.annotation.Nullable; 21 | import android.support.v4.content.ContextCompat; 22 | import android.support.v4.widget.DrawerLayout; 23 | import android.support.v4.widget.NestedScrollView; 24 | import android.support.v7.app.ActionBar; 25 | import android.support.v7.app.ActionBarDrawerToggle; 26 | import android.support.v7.app.AppCompatActivity; 27 | import android.support.v7.widget.Toolbar; 28 | import android.view.View; 29 | 30 | import com.yanzhenjie.sofia.Sofia; 31 | import com.yanzhenjie.sofia.StatusView; 32 | import com.yanzhenjie.sofia.sample.R; 33 | 34 | /** 35 | * Created by YanZhenjie on 2017/12/13. 36 | */ 37 | public class DrawerLayoutActivity extends AppCompatActivity { 38 | 39 | private StatusView mStatusView; 40 | private Toolbar mToolbar; 41 | private View mHeaderView; 42 | 43 | @Override 44 | protected void onCreate(@Nullable Bundle savedInstanceState) { 45 | super.onCreate(savedInstanceState); 46 | setContentView(R.layout.activity_drawer_layout); 47 | 48 | mStatusView = findViewById(R.id.status_view); 49 | mToolbar = findViewById(R.id.toolbar); 50 | setSupportActionBar(mToolbar); 51 | ActionBar actionBar = getSupportActionBar(); 52 | assert actionBar != null; 53 | actionBar.setDisplayHomeAsUpEnabled(true); 54 | 55 | NestedScrollView nestedScrollView = findViewById(R.id.nested_scroll_view); 56 | mHeaderView = findViewById(R.id.header); 57 | 58 | DrawerLayout drawerLayout = findViewById(R.id.drawer_layout); 59 | ActionBarDrawerToggle drawerToggle = new ActionBarDrawerToggle(this, drawerLayout, mToolbar, R.string.app_name, R.string.app_name); 60 | drawerLayout.addDrawerListener(drawerToggle); 61 | drawerToggle.syncState(); 62 | 63 | nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() { 64 | @Override 65 | public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { 66 | int headerHeight = mHeaderView.getHeight(); 67 | int scrollDistance = Math.min(scrollY, headerHeight); 68 | int statusAlpha = (int) ((float) scrollDistance / (float) headerHeight * 255F); 69 | setAnyBarAlpha(statusAlpha); 70 | } 71 | }); 72 | 73 | // 这里不使用Sofia设置StatusBar颜色,用自己在布局中的,用Sofia设置会覆盖在DrawerLayout之上。 74 | Sofia.with(this) 75 | .navigationBarBackground(ContextCompat.getDrawable(this, R.color.colorNavigation)) 76 | .invasionStatusBar() 77 | .statusBarBackground(Color.TRANSPARENT); 78 | setAnyBarAlpha(0); 79 | } 80 | 81 | private void setAnyBarAlpha(int alpha) { 82 | mStatusView.getBackground().mutate().setAlpha(alpha); 83 | mToolbar.getBackground().mutate().setAlpha(alpha); 84 | } 85 | } -------------------------------------------------------------------------------- /app/src/main/java/com/yanzhenjie/sofia/sample/ui/GoodsDetailsActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.sofia.sample.ui; 17 | 18 | import android.os.Bundle; 19 | import android.support.annotation.Nullable; 20 | import android.support.v4.content.ContextCompat; 21 | import android.support.v4.widget.NestedScrollView; 22 | import android.support.v7.app.AppCompatActivity; 23 | import android.support.v7.widget.Toolbar; 24 | import android.view.View; 25 | 26 | import com.yanzhenjie.sofia.Sofia; 27 | import com.yanzhenjie.sofia.sample.R; 28 | 29 | /** 30 | * Content intrusion status bar. 31 | * Created by YanZhenjie on 2017/8/2. 32 | */ 33 | public class GoodsDetailsActivity extends AppCompatActivity { 34 | 35 | private Toolbar mToolbar; 36 | private View mHeaderView; 37 | 38 | @Override 39 | protected void onCreate(@Nullable Bundle savedInstanceState) { 40 | super.onCreate(savedInstanceState); 41 | setContentView(R.layout.activity_goods_details); 42 | 43 | mToolbar = findViewById(R.id.toolbar); 44 | setSupportActionBar(mToolbar); 45 | 46 | NestedScrollView nestedScrollView = findViewById(R.id.nested_scroll_view); 47 | mHeaderView = findViewById(R.id.header); 48 | 49 | nestedScrollView.setOnScrollChangeListener(new NestedScrollView.OnScrollChangeListener() { 50 | @Override 51 | public void onScrollChange(NestedScrollView v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) { 52 | int headerHeight = mHeaderView.getHeight(); 53 | int scrollDistance = Math.min(scrollY, headerHeight); 54 | int statusAlpha = (int) ((float) scrollDistance / (float) headerHeight * 255F); 55 | setAnyBarAlpha(statusAlpha); 56 | } 57 | }); 58 | 59 | Sofia.with(this) 60 | .statusBarBackground(ContextCompat.getColor(this, R.color.colorPrimary)) 61 | .navigationBarBackground(ContextCompat.getDrawable(this, R.color.colorNavigation)) 62 | .invasionStatusBar() 63 | .fitsStatusBarView(mToolbar); 64 | 65 | setAnyBarAlpha(0); 66 | } 67 | 68 | private void setAnyBarAlpha(int alpha) { 69 | mToolbar.getBackground().mutate().setAlpha(alpha); 70 | Sofia.with(this) 71 | .statusBarBackgroundAlpha(alpha); 72 | } 73 | 74 | } -------------------------------------------------------------------------------- /app/src/main/java/com/yanzhenjie/sofia/sample/ui/MainActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.sofia.sample.ui; 17 | 18 | import android.content.Intent; 19 | import android.os.Bundle; 20 | import android.support.v4.content.ContextCompat; 21 | import android.support.v7.app.AppCompatActivity; 22 | import android.support.v7.widget.LinearLayoutManager; 23 | import android.support.v7.widget.RecyclerView; 24 | import android.support.v7.widget.Toolbar; 25 | import android.view.LayoutInflater; 26 | import android.view.View; 27 | import android.view.ViewGroup; 28 | import android.widget.TextView; 29 | 30 | import com.yanzhenjie.sofia.Sofia; 31 | import com.yanzhenjie.sofia.sample.OnItemClickListener; 32 | import com.yanzhenjie.sofia.sample.R; 33 | import com.yanzhenjie.sofia.sample.ui.fragment.FragmentActivity; 34 | 35 | import java.util.Arrays; 36 | import java.util.List; 37 | 38 | /** 39 | * Entrance. 40 | * Created by YanZhenjie on 2017/8/2. 41 | */ 42 | public class MainActivity extends AppCompatActivity { 43 | 44 | @Override 45 | protected void onCreate(Bundle savedInstanceState) { 46 | super.onCreate(savedInstanceState); 47 | setContentView(R.layout.activity_main); 48 | Toolbar toolbar = findViewById(R.id.toolbar); 49 | setSupportActionBar(toolbar); 50 | 51 | RecyclerView recyclerView = findViewById(R.id.recycler_view); 52 | recyclerView.setLayoutManager(new LinearLayoutManager(this)); 53 | Adapter adapter = new Adapter(Arrays.asList(getResources().getStringArray(R.array.main_item))); 54 | recyclerView.setAdapter(adapter); 55 | 56 | adapter.setItemClickListener(new OnItemClickListener() { 57 | @Override 58 | public void onItemClick(View view, int position) { 59 | switch (position) { 60 | case 0: { 61 | startActivity(new Intent(MainActivity.this, CommonActivity.class)); 62 | break; 63 | } 64 | case 1: { 65 | startActivity(new Intent(MainActivity.this, GoodsDetailsActivity.class)); 66 | break; 67 | } 68 | case 2: { 69 | startActivity(new Intent(MainActivity.this, DarkFontStatusActivity.class)); 70 | break; 71 | } 72 | case 3: { 73 | startActivity(new Intent(MainActivity.this, DrawerLayoutActivity.class)); 74 | break; 75 | } 76 | case 4: { 77 | startActivity(new Intent(MainActivity.this, FragmentActivity.class)); 78 | break; 79 | } 80 | } 81 | } 82 | }); 83 | 84 | Sofia.with(this) 85 | .statusBarBackground(ContextCompat.getDrawable(this, R.drawable.status_image)) 86 | .navigationBarBackground(ContextCompat.getDrawable(this, R.drawable.navigation_image_a)); 87 | } 88 | 89 | private static class Adapter extends RecyclerView.Adapter { 90 | 91 | private List mStringList; 92 | private OnItemClickListener mItemClickListener; 93 | 94 | public Adapter(List stringList) { 95 | mStringList = stringList; 96 | } 97 | 98 | public void setItemClickListener(OnItemClickListener itemClickListener) { 99 | this.mItemClickListener = itemClickListener; 100 | } 101 | 102 | @Override 103 | public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) { 104 | ViewHolder viewHolder = new ViewHolder(LayoutInflater.from(parent.getContext()).inflate(R.layout.item, parent, false)); 105 | viewHolder.mItemClickListener = mItemClickListener; 106 | return viewHolder; 107 | } 108 | 109 | @Override 110 | public void onBindViewHolder(ViewHolder holder, int position) { 111 | holder.mTextView.setText(mStringList.get(position)); 112 | } 113 | 114 | @Override 115 | public int getItemCount() { 116 | return mStringList.size(); 117 | } 118 | 119 | } 120 | 121 | static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener { 122 | 123 | OnItemClickListener mItemClickListener; 124 | TextView mTextView; 125 | 126 | ViewHolder(View itemView) { 127 | super(itemView); 128 | mTextView = itemView.findViewById(R.id.tv_title); 129 | 130 | itemView.setOnClickListener(this); 131 | } 132 | 133 | @Override 134 | public void onClick(View v) { 135 | if (mItemClickListener != null) 136 | mItemClickListener.onItemClick(v, getAdapterPosition()); 137 | } 138 | } 139 | 140 | } 141 | -------------------------------------------------------------------------------- /app/src/main/java/com/yanzhenjie/sofia/sample/ui/fragment/FragmentA.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.sofia.sample.ui.fragment; 17 | 18 | import android.os.Bundle; 19 | import android.support.annotation.Nullable; 20 | import android.support.v4.app.Fragment; 21 | import android.support.v4.content.ContextCompat; 22 | import android.view.LayoutInflater; 23 | import android.view.View; 24 | import android.view.ViewGroup; 25 | import android.widget.TextView; 26 | 27 | import com.yanzhenjie.sofia.StatusView; 28 | import com.yanzhenjie.sofia.sample.R; 29 | 30 | /** 31 | * Created by YanZhenjie on 2017/12/13. 32 | */ 33 | public class FragmentA extends Fragment { 34 | 35 | @Nullable 36 | @Override 37 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 38 | return inflater.inflate(R.layout.fragment_a, container, false); 39 | } 40 | 41 | private StatusView mStatusView; 42 | private TextView mTvContent; 43 | 44 | @Override 45 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 46 | mStatusView = view.findViewById(R.id.status_view); 47 | mTvContent = view.findViewById(R.id.tv_content); 48 | } 49 | 50 | @Override 51 | public void onActivityCreated(@Nullable Bundle savedInstanceState) { 52 | super.onActivityCreated(savedInstanceState); 53 | mStatusView.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.fragment_a_status)); 54 | mTvContent.setText(getClass().getSimpleName()); 55 | } 56 | } -------------------------------------------------------------------------------- /app/src/main/java/com/yanzhenjie/sofia/sample/ui/fragment/FragmentActivity.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.sofia.sample.ui.fragment; 17 | 18 | import android.graphics.Color; 19 | import android.os.Bundle; 20 | import android.support.annotation.Nullable; 21 | import android.support.design.widget.TabLayout; 22 | import android.support.v4.app.Fragment; 23 | import android.support.v4.app.FragmentManager; 24 | import android.support.v4.app.FragmentPagerAdapter; 25 | import android.support.v4.content.ContextCompat; 26 | import android.support.v4.view.ViewPager; 27 | import android.support.v7.app.AppCompatActivity; 28 | 29 | import com.yanzhenjie.sofia.Sofia; 30 | import com.yanzhenjie.sofia.sample.R; 31 | 32 | import java.util.ArrayList; 33 | import java.util.List; 34 | 35 | /** 36 | * Created by YanZhenjie on 2017/12/13. 37 | */ 38 | public class FragmentActivity extends AppCompatActivity { 39 | 40 | @Override 41 | protected void onCreate(@Nullable Bundle savedInstanceState) { 42 | super.onCreate(savedInstanceState); 43 | setContentView(R.layout.activity_fragment); 44 | 45 | TabLayout tabLayout = findViewById(R.id.tab_layout); 46 | ViewPager viewPager = findViewById(R.id.view_pager); 47 | 48 | List fragmentList = new ArrayList<>(); 49 | fragmentList.add(new FragmentA()); 50 | fragmentList.add(new FragmentB()); 51 | 52 | Adapter adapter = new Adapter(getSupportFragmentManager(), fragmentList); 53 | viewPager.setAdapter(adapter); 54 | tabLayout.setupWithViewPager(viewPager); 55 | 56 | // 不实用Sofia设置Status颜色,因为不会随着Fragment的改变而变化,在Fragment中自行设置。 57 | Sofia.with(this) 58 | .invasionStatusBar() 59 | .statusBarBackground(Color.TRANSPARENT) 60 | .navigationBarBackground(ContextCompat.getDrawable(this, R.drawable.navigation_image_b)); 61 | } 62 | 63 | private static class Adapter extends FragmentPagerAdapter { 64 | 65 | private List mFragmentList; 66 | 67 | public Adapter(FragmentManager fm, List fragmentList) { 68 | super(fm); 69 | mFragmentList = fragmentList; 70 | } 71 | 72 | @Override 73 | public Fragment getItem(int position) { 74 | return mFragmentList.get(position); 75 | } 76 | 77 | @Override 78 | public int getCount() { 79 | return mFragmentList.size(); 80 | } 81 | 82 | @Override 83 | public CharSequence getPageTitle(int position) { 84 | return mFragmentList.get(position).getClass().getSimpleName(); 85 | } 86 | } 87 | 88 | } -------------------------------------------------------------------------------- /app/src/main/java/com/yanzhenjie/sofia/sample/ui/fragment/FragmentB.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2017 Yan Zhenjie 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.yanzhenjie.sofia.sample.ui.fragment; 17 | 18 | import android.os.Bundle; 19 | import android.support.annotation.Nullable; 20 | import android.support.v4.app.Fragment; 21 | import android.support.v4.content.ContextCompat; 22 | import android.view.LayoutInflater; 23 | import android.view.View; 24 | import android.view.ViewGroup; 25 | import android.widget.TextView; 26 | 27 | import com.yanzhenjie.sofia.StatusView; 28 | import com.yanzhenjie.sofia.sample.R; 29 | 30 | /** 31 | * Created by YanZhenjie on 2017/12/13. 32 | */ 33 | public class FragmentB extends Fragment { 34 | 35 | @Nullable 36 | @Override 37 | public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) { 38 | return inflater.inflate(R.layout.fragment_b, container, false); 39 | } 40 | 41 | private StatusView mStatusView; 42 | private TextView mTvContent; 43 | 44 | @Override 45 | public void onViewCreated(View view, @Nullable Bundle savedInstanceState) { 46 | mStatusView = view.findViewById(R.id.status_view); 47 | mTvContent = view.findViewById(R.id.tv_content); 48 | } 49 | 50 | @Override 51 | public void onActivityCreated(@Nullable Bundle savedInstanceState) { 52 | super.onActivityCreated(savedInstanceState); 53 | mStatusView.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.fragment_b_status)); 54 | mTvContent.setText(getClass().getSimpleName()); 55 | } 56 | } -------------------------------------------------------------------------------- /app/src/main/res/drawable-land-xxhdpi/navigation_image_a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/drawable-land-xxhdpi/navigation_image_a.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-land-xxhdpi/navigation_image_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/drawable-land-xxhdpi/navigation_image_b.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/draw_layout.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/drawable-xxhdpi/draw_layout.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/header.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/drawable-xxhdpi/header.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/navigation_image_a.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/drawable-xxhdpi/navigation_image_a.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/navigation_image_b.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/drawable-xxhdpi/navigation_image_b.jpg -------------------------------------------------------------------------------- /app/src/main/res/drawable-xxhdpi/status_image.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/drawable-xxhdpi/status_image.jpg -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_common.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 23 | 24 | 25 | 29 | 30 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_dark_font.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 23 | 24 | 25 | 26 | 30 | 31 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_drawer_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 23 | 27 | 28 | 32 | 33 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 49 | 50 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 66 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_fragment.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 23 | 24 | 36 | 37 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_goods_details.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 21 | 22 | 26 | 27 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 23 | 24 | 25 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/content.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 27 | 28 | 35 | 36 | 43 | 44 | 51 | 52 | 59 | 60 | 67 | 68 | 75 | 76 | 83 | 84 | 91 | 92 | 99 | 100 | 107 | 108 | 115 | 116 | 123 | 124 | 131 | 132 | 139 | 140 | 147 | 148 | 155 | 156 | 163 | 164 | 171 | 172 | 179 | 180 | 187 | 188 | 195 | 196 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_a.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 23 | 27 | 28 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/fragment_b.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 22 | 23 | 27 | 28 | 35 | 36 | -------------------------------------------------------------------------------- /app/src/main/res/layout/header.xml: -------------------------------------------------------------------------------- 1 | 16 | -------------------------------------------------------------------------------- /app/src/main/res/layout/item.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 23 | 24 | 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toolbar_dark.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/layout/toolbar_light.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yanzhenjie/Sofia/f4693e06cfd68a0519932b26a121fbcf1b95cb6e/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /app/src/main/res/values/array.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 20 | 普通状态栏渐变 21 | 内容侵入状态栏渐变 22 | 状态栏深色字体 23 | 结合DrawLayout 24 | 结合ViewPager + Fragment 25 | 26 | 27 | -------------------------------------------------------------------------------- /app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | #3F51B5 19 | #303F9F 20 | #FF4081 21 | #2B2B2B 22 | 23 | #FFFFFF 24 | #2B2B2B 25 | 26 | #90AB31 27 | #FF9000 28 | #9831AB 29 | #FF007E 30 | 31 | -------------------------------------------------------------------------------- /app/src/main/res/values/dimens.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 0dp 20 | 2dp 21 | 10dp 22 | 250dp 23 | 24 | 20sp 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | Sofia 19 | 20 | 渐变色状态栏 21 | 内容侵入状态栏渐变 22 | 状态栏深色字体 23 | 结合DrawLayout 24 | 结合ViewPager + Fragment 25 | 26 | -------------------------------------------------------------------------------- /app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 17 | 18 | 19 | 29 | 30 |