Skip to content

Commit 493896b

Browse files
author
zhujiang2
committed
Optimized immersive status bar.
1 parent 4d779c1 commit 493896b

File tree

13 files changed

+57
-45
lines changed

13 files changed

+57
-45
lines changed

.idea/misc.xml

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/java/com/zj/play/main/login/LoginActivity.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
3535
override fun initView() {
3636
binding.loginButton.setOnClickListener(this)
3737
binding.loginTvRegister.setOnClickListener(this)
38-
viewModel.state.observe(this, {
38+
viewModel.state.observe(this) {
3939
when (it) {
4040
Logging -> {
4141
toProgressVisible(true)
@@ -49,7 +49,7 @@ class LoginActivity : BaseActivity(), View.OnClickListener {
4949
toProgressVisible(false)
5050
}
5151
}
52-
})
52+
}
5353
}
5454

5555
override fun onClick(v: View) {

app/src/main/java/com/zj/play/official/OfficialAccountsFragment.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import android.view.View
55
import android.view.ViewGroup
66
import androidx.fragment.app.Fragment
77
import androidx.fragment.app.viewModels
8+
import com.blankj.utilcode.util.BarUtils
89
import com.google.android.material.tabs.TabLayoutMediator
910
import com.zj.core.view.custom.FragmentAdapter
1011
import com.zj.play.databinding.FragmentOfficialAccountsBinding
@@ -37,6 +38,7 @@ class OfficialAccountsFragment : BaseTabFragment() {
3738
TabLayoutMediator(officialTabLayout, officialViewPager2) { tab, position ->
3839
tab.text = adapter.title(position)
3940
}.attach()
41+
officialTabLayout.setPadding(0, BarUtils.getStatusBarHeight(), 0, 0)
4042
}
4143
}
4244

app/src/main/java/com/zj/play/project/ProjectFragment.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.view.View
66
import android.view.ViewGroup
77
import androidx.fragment.app.Fragment
88
import androidx.fragment.app.viewModels
9+
import com.blankj.utilcode.util.BarUtils.getStatusBarHeight
910
import com.google.android.material.tabs.TabLayoutMediator
1011
import com.zj.core.view.custom.FragmentAdapter
1112
import com.zj.play.databinding.FragmentProjectBinding
@@ -37,6 +38,7 @@ class ProjectFragment : BaseTabFragment() {
3738
TabLayoutMediator(projectTabLayout, projectViewPager2) { tab, position ->
3839
tab.text = adapter.title(position)
3940
}.attach()
41+
projectTabLayout.setPadding(0, getStatusBarHeight(), 0, 0)
4042
}
4143
}
4244

app/src/main/res/layout-land/activity_login.xml

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
android:layout_height="@dimen/dp_70"
1313
android:layout_gravity="center"
1414
android:layout_marginTop="@dimen/dp_30"
15-
android:src="@drawable/logo_reverse" />
15+
android:src="@drawable/logo_reverse"
16+
tools:ignore="ContentDescription" />
1617

1718
<FrameLayout
1819
android:id="@+id/loginLayoutBottom"
@@ -46,7 +47,7 @@
4647
android:gravity="center_horizontal"
4748
android:text="@string/app_name"
4849
android:textColor="@color/white"
49-
android:textSize="@dimen/dp_24" />
50+
android:textSize="@dimen/sp_24" />
5051

5152
<EditText
5253
android:id="@+id/loginUserNumberEdit"
@@ -57,12 +58,14 @@
5758
android:layout_marginTop="@dimen/dp_15"
5859
android:background="@drawable/bg_edittext"
5960
android:hint="@string/enter_name"
61+
android:importantForAutofill="no"
6062
android:lines="1"
6163
android:paddingHorizontal="@dimen/dp_5"
6264
android:singleLine="true"
6365
android:textColor="@color/text_color_black"
6466
android:textColorHint="@color/plain"
65-
android:textSize="@dimen/dp_14" />
67+
android:textSize="@dimen/sp_14"
68+
tools:ignore="TextFields" />
6669

6770
<EditText
6871
android:id="@+id/loginPassNumberEdit"
@@ -73,22 +76,24 @@
7376
android:layout_marginTop="@dimen/dp_10"
7477
android:background="@drawable/bg_edittext"
7578
android:hint="@string/enter_password"
79+
android:importantForAutofill="no"
7680
android:lines="1"
7781
android:paddingHorizontal="@dimen/dp_5"
7882
android:singleLine="true"
7983
android:textColor="@color/text_color_black"
8084
android:textColorHint="@color/plain"
81-
android:textSize="@dimen/dp_14" />
85+
android:textSize="@dimen/sp_14"
86+
tools:ignore="TextFields" />
8287

8388
<TextView
8489
android:id="@+id/loginTvRegister"
8590
android:layout_width="wrap_content"
8691
android:layout_height="wrap_content"
87-
android:layout_gravity="right"
92+
android:layout_gravity="end"
8893
android:layout_marginTop="@dimen/dp_5"
8994
android:text="@string/register_account"
9095
android:textColor="@color/text_click_color"
91-
android:textSize="@dimen/dp_14" />
96+
android:textSize="@dimen/sp_14" />
9297

9398
<Button
9499
android:id="@+id/loginButton"
@@ -101,7 +106,7 @@
101106
android:background="@drawable/btn_login_bg"
102107
android:text="@string/login"
103108
android:textColor="@color/text_color"
104-
android:textSize="@dimen/dp_14" />
109+
android:textSize="@dimen/sp_14" />
105110

106111
</LinearLayout>
107112

app/src/main/res/layout-land/fragment_official_accounts.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@
55
android:layout_height="match_parent"
66
android:orientation="vertical">
77

8-
<View
9-
android:layout_width="match_parent"
10-
android:layout_height="@dimen/dp_10"
11-
android:background="@color/colorPrimary" />
12-
138
<com.google.android.material.tabs.TabLayout
149
android:id="@+id/officialTabLayout"
1510
android:layout_width="match_parent"
16-
android:layout_height="@dimen/dp_45"
11+
android:layout_height="@dimen/dp_60"
1712
android:background="@color/colorPrimary"
1813
app:tabGravity="fill"
1914
app:tabIndicatorColor="@color/white"

app/src/main/res/layout-land/fragment_project.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@
55
android:layout_height="match_parent"
66
android:orientation="vertical">
77

8-
<View
9-
android:layout_width="match_parent"
10-
android:layout_height="@dimen/dp_10"
11-
android:background="@color/colorPrimary" />
12-
138
<com.google.android.material.tabs.TabLayout
149
android:id="@+id/projectTabLayout"
1510
android:layout_width="match_parent"
16-
android:layout_height="@dimen/dp_45"
11+
android:layout_height="@dimen/dp_60"
1712
android:background="@color/colorPrimary"
1813
app:tabGravity="fill"
1914
app:tabIndicatorColor="@color/white"

app/src/main/res/layout/activity_login.xml

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111
android:layout_width="@dimen/dp_70"
1212
android:layout_height="@dimen/dp_70"
1313
android:layout_gravity="center"
14-
android:layout_marginTop="@dimen/dp_150"
15-
android:src="@drawable/logo_reverse" />
14+
android:layout_marginTop="@dimen/dp_120"
15+
android:src="@drawable/logo_reverse"
16+
tools:ignore="ContentDescription" />
1617

1718
<FrameLayout
1819
android:id="@+id/loginLayoutBottom"
@@ -35,7 +36,7 @@
3536
android:id="@+id/loginInputElements"
3637
android:layout_width="match_parent"
3738
android:layout_height="wrap_content"
38-
android:layout_gravity="center_vertical"
39+
android:layout_gravity="center"
3940
android:orientation="vertical"
4041
tools:ignore="UselessParent">
4142

@@ -45,7 +46,7 @@
4546
android:gravity="center_horizontal"
4647
android:text="@string/app_name"
4748
android:textColor="@color/white"
48-
android:textSize="@dimen/dp_24" />
49+
android:textSize="@dimen/sp_24" />
4950

5051
<EditText
5152
android:id="@+id/loginUserNumberEdit"
@@ -55,12 +56,14 @@
5556
android:layout_marginTop="@dimen/dp_25"
5657
android:background="@drawable/bg_edittext"
5758
android:hint="@string/enter_name"
59+
android:importantForAutofill="no"
5860
android:lines="1"
5961
android:paddingHorizontal="@dimen/dp_5"
6062
android:singleLine="true"
6163
android:textColor="@color/text_color"
6264
android:textColorHint="@color/plain"
63-
android:textSize="@dimen/dp_14" />
65+
android:textSize="@dimen/sp_14"
66+
tools:ignore="TextFields" />
6467

6568
<EditText
6669
android:id="@+id/loginPassNumberEdit"
@@ -70,23 +73,25 @@
7073
android:layout_marginTop="@dimen/dp_10"
7174
android:background="@drawable/bg_edittext"
7275
android:hint="@string/enter_password"
76+
android:importantForAutofill="no"
7377
android:lines="1"
7478
android:paddingHorizontal="@dimen/dp_5"
7579
android:singleLine="true"
7680
android:textColor="@color/text_color"
7781
android:textColorHint="@color/plain"
78-
android:textSize="@dimen/dp_14" />
82+
android:textSize="@dimen/sp_14"
83+
tools:ignore="TextFields" />
7984

8085
<TextView
8186
android:id="@+id/loginTvRegister"
8287
android:layout_width="wrap_content"
8388
android:layout_height="wrap_content"
84-
android:layout_gravity="right"
89+
android:layout_gravity="end"
8590
android:layout_marginHorizontal="@dimen/dp_35"
8691
android:layout_marginTop="@dimen/dp_10"
8792
android:text="@string/register_account"
8893
android:textColor="@color/text_click_color"
89-
android:textSize="@dimen/dp_14" />
94+
android:textSize="@dimen/sp_14" />
9095

9196
<Button
9297
android:id="@+id/loginButton"
@@ -98,7 +103,7 @@
98103
android:background="@drawable/btn_login_bg"
99104
android:text="@string/login"
100105
android:textColor="@color/text_color"
101-
android:textSize="@dimen/dp_14" />
106+
android:textSize="@dimen/sp_14" />
102107

103108
</LinearLayout>
104109

app/src/main/res/layout/activity_search.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<FrameLayout
1010
android:layout_width="match_parent"
11-
android:layout_height="@dimen/dp_70"
11+
android:layout_height="@dimen/dp_75"
1212
android:background="@color/colorPrimary"
1313
android:fitsSystemWindows="true"
1414
android:orientation="vertical">

app/src/main/res/layout/fragment_official_accounts.xml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,10 @@
55
android:layout_height="match_parent"
66
android:orientation="vertical">
77

8-
<View
9-
android:layout_width="match_parent"
10-
android:layout_height="@dimen/dp_20"
11-
android:background="@color/colorPrimary" />
12-
138
<com.google.android.material.tabs.TabLayout
149
android:id="@+id/officialTabLayout"
1510
android:layout_width="match_parent"
16-
android:layout_height="@dimen/dp_50"
11+
android:layout_height="@dimen/dp_75"
1712
android:background="@color/colorPrimary"
1813
app:tabGravity="fill"
1914
app:tabIndicatorColor="@color/white"

0 commit comments

Comments
 (0)