Skip to content

Commit a994dbd

Browse files
author
ChenRui
committed
夜间模式适配
1 parent c43cef2 commit a994dbd

22 files changed

+48
-20
lines changed

Diff for: app/src/main/java/com/rae/cnblogs/RaeImageLoader.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public static void displayHeaderImage(String url, ImageView view) {
1616
Context context = view.getContext();
1717
GlideApp.with(context)
1818
.load(url)
19-
.placeholder(R.drawable.ic_default_user_avatar)
19+
.placeholder(R.drawable.bg_user_avatar)
2020
.into(view);
2121
}
2222

Diff for: app/src/main/java/com/rae/cnblogs/dialog/impl/AppDialog.java

+10
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22

33
import android.app.Dialog;
44
import android.content.Context;
5+
import android.os.Build;
56
import android.view.View;
67

8+
import com.rae.cnblogs.ThemeCompat;
79
import com.rae.cnblogs.dialog.IAppDialog;
810
import com.rae.cnblogs.dialog.IAppDialogClickListener;
911

@@ -33,6 +35,14 @@ public AppDialog(Context context, int themeResId) {
3335
protected void initDialog() {
3436
setOnCancelListener((IAppDialogClickListener) null);
3537
setOnEnSureListener(null);
38+
39+
// 夜间模式不显示遮罩层
40+
if (ThemeCompat.isNight() && getWindow() != null) {
41+
getWindow().setDimAmount(0);
42+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) {
43+
getWindow().setElevation(0);
44+
}
45+
}
3646
}
3747

3848
@Override

Diff for: app/src/main/java/com/rae/cnblogs/dialog/impl/ShareDialog.java

+2
Original file line numberDiff line numberDiff line change
@@ -296,6 +296,8 @@ protected void onNightClick() {
296296
private void showNightText() {
297297
if (ThemeCompat.isNight()) {
298298
mNightView.setText(R.string.day_mode);
299+
300+
299301
} else {
300302
mNightView.setText(R.string.night_mode);
301303
}

Diff for: app/src/main/java/com/rae/cnblogs/fragment/BaseFragment.java

+14-4
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,18 @@
1111
import com.rae.cnblogs.sdk.config.CnblogSdkConfig;
1212

1313
import butterknife.ButterKnife;
14+
import butterknife.Unbinder;
15+
1416

15-
/**
16-
* Created by ChenRui on 2016/12/1 23:51.
17-
*/
1817
public abstract class BaseFragment extends Fragment {
1918

19+
private Unbinder mUnbinder;
20+
2021
@Nullable
2122
@Override
2223
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
2324
View view = inflater.inflate(getLayoutId(), container, false);
24-
ButterKnife.bind(this, view);
25+
mUnbinder = ButterKnife.bind(this, view);
2526
onCreateView(view);
2627
return view;
2728
}
@@ -33,6 +34,15 @@ public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
3334
onLoadData();
3435
}
3536

37+
@Override
38+
public void onDestroy() {
39+
super.onDestroy();
40+
if (mUnbinder != null) {
41+
mUnbinder.unbind();
42+
mUnbinder = null;
43+
}
44+
}
45+
3646
protected void onCreateView(View view) {
3747
}
3848

Diff for: app/src/main/res/color/text_color_tab_selector.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3-
<item android:color="@color/colorPrimary" android:state_selected="true"/>
4-
<item android:color="@color/colorPrimary" android:state_pressed="true"/>
5-
<item android:color="@color/ph3"/>
3+
<item android:color="@color/ph1" android:state_selected="true"/>
4+
<item android:color="@color/ph1" android:state_pressed="true"/>
5+
<item android:color="@color/ph4"/>
66
</selector>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3+
<item android:color="#3ba7ee" android:state_selected="true"/>
4+
<item android:color="#3ba7ee" android:state_pressed="true"/>
5+
<item android:color="@color/ph4"/>
6+
</selector>

Diff for: app/src/main/res/drawable-xxhdpi/tab_home_h.png

724 Bytes
Loading
15.7 KB
Loading

Diff for: app/src/main/res/drawable-xxhdpi/tab_library_h.png

1.53 KB
Loading
16.7 KB
Loading

Diff for: app/src/main/res/drawable-xxhdpi/tab_mine_h.png

1.67 KB
Loading
18 KB
Loading

Diff for: app/src/main/res/drawable-xxhdpi/tab_news_h.png

2.08 KB
Loading
18 KB
Loading

Diff for: app/src/main/res/drawable-xxhdpi/tab_news_n.png

1.74 KB
Loading
1.6 KB
Loading

Diff for: app/src/main/res/drawable/bg_write_comment_night.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<selector xmlns:android="http://schemas.android.com/apk/res/android">
33
<item>
44
<shape>
5-
<solid android:color="@color/nightColorPrimary"/>
5+
<solid android:color="#292a2e"/>
66
<corners android:radius="30dp"/>
77
</shape>
88
</item>

Diff for: app/src/main/res/drawable/tab_home_night.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3-
<item android:drawable="@drawable/tab_home_h" android:state_selected="true"/>
4-
<item android:drawable="@drawable/tab_home_h" android:state_pressed="true"/>
3+
<item android:drawable="@drawable/tab_home_h_night" android:state_selected="true"/>
4+
<item android:drawable="@drawable/tab_home_h_night" android:state_pressed="true"/>
55
<item android:drawable="@drawable/tab_home_n_night"/>
66
</selector>

Diff for: app/src/main/res/drawable/tab_library_night.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3-
<item android:drawable="@drawable/tab_library_h" android:state_selected="true"/>
4-
<item android:drawable="@drawable/tab_library_h" android:state_pressed="true"/>
3+
<item android:drawable="@drawable/tab_library_h_night" android:state_selected="true"/>
4+
<item android:drawable="@drawable/tab_library_h_night" android:state_pressed="true"/>
55
<item android:drawable="@drawable/tab_library_n_night"/>
66
</selector>

Diff for: app/src/main/res/drawable/tab_mine_night.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3-
<item android:drawable="@drawable/tab_mine_h" android:state_selected="true"/>
4-
<item android:drawable="@drawable/tab_mine_h" android:state_pressed="true"/>
3+
<item android:drawable="@drawable/tab_mine_h_night" android:state_selected="true"/>
4+
<item android:drawable="@drawable/tab_mine_h_night" android:state_pressed="true"/>
55
<item android:drawable="@drawable/tab_mine_n_night"/>
66
</selector>

Diff for: app/src/main/res/drawable/tab_news_night.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<selector xmlns:android="http://schemas.android.com/apk/res/android">
3-
<item android:drawable="@drawable/tab_news_h" android:state_selected="true"/>
4-
<item android:drawable="@drawable/tab_news_h" android:state_pressed="true"/>
3+
<item android:drawable="@drawable/tab_news_h_night" android:state_selected="true"/>
4+
<item android:drawable="@drawable/tab_news_h_night" android:state_pressed="true"/>
55
<item android:drawable="@drawable/tab_news_n_night"/>
66
</selector>

Diff for: app/src/main/res/layout/activity_post_moment.xml

+3-3
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,21 @@
5959
android:layout_height="wrap_content"
6060
android:paddingLeft="12dp"
6161
android:paddingRight="12dp">
62-
62+
<!-- android:textCursorDrawable="@drawable/text_cursor"-->
6363
<EditText
6464
android:id="@+id/et_content"
6565
android:layout_width="match_parent"
6666
android:layout_height="wrap_content"
6767
android:background="@android:color/transparent"
6868
android:gravity="start|top"
6969
android:hint="这一刻的想法..."
70-
android:lineSpacingMultiplier="1.5"
70+
android:lineSpacingMultiplier="1.2"
7171
android:maxLength="300"
7272
android:minHeight="130dp"
7373
android:paddingBottom="12dp"
7474
android:paddingTop="12dp"
7575
android:textColorHint="@color/ph3"
76-
android:textCursorDrawable="@drawable/text_cursor"
76+
7777
android:textSize="16sp"/>
7878

7979

0 commit comments

Comments
 (0)