Skip to content

Commit a9de7c5

Browse files
committed
see 07/31 log
1 parent 075b886 commit a9de7c5

40 files changed

+1096
-1832
lines changed

README-CN.md

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

4242
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
4343

44-
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.17.3-brightgreen.svg
44+
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.18.0-brightgreen.svg
4545
[auc]: https://github.com/Blankj/AndroidUtilCode
4646

4747
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ If this project helps you a lot and you want to support the project's developmen
4141

4242
[logo]: https://raw.githubusercontent.com/Blankj/AndroidUtilCode/master/art/logo.png
4343

44-
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.17.3-brightgreen.svg
44+
[aucsvg]: https://img.shields.io/badge/AndroidUtilCode-v1.18.0-brightgreen.svg
4545
[auc]: https://github.com/Blankj/AndroidUtilCode
4646

4747
[apisvg]: https://img.shields.io/badge/API-14+-brightgreen.svg

app/src/main/AndroidManifest.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@
147147
<activity
148148
android:name=".feature.core.screen.ScreenActivity"
149149
android:launchMode="singleTop" />
150+
<activity
151+
android:name=".feature.core.screen.ScreenAdaptActivity"
152+
android:launchMode="singleTop" />
150153
<activity
151154
android:name=".feature.core.sdcard.SDCardActivity"
152155
android:launchMode="singleTop" />

app/src/main/java/com/blankj/androidutilcode/feature/core/network/NetworkActivity.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class NetworkActivity extends BaseBackActivity {
2929
@Override
3030
public String doInBackground() {
3131
return "isAvailableByPing: " + NetworkUtils.isAvailableByPing()
32-
+ "\ngetDomainAddress: " + NetworkUtils.getDomainAddress("baidu.com");
32+
+ "\ngetBaiduDomainAddress: " + NetworkUtils.getDomainAddress("baidu.com");
3333
}
3434

3535
@Override
@@ -96,7 +96,13 @@ private void updateAboutNetwork() {
9696
.appendLine("isWifiAvailable: " + NetworkUtils.isWifiAvailable())
9797
.appendLine("getNetworkOperatorName: " + NetworkUtils.getNetworkOperatorName())
9898
.appendLine("getNetworkTypeName: " + NetworkUtils.getNetworkType())
99-
.append("getIPAddress: " + NetworkUtils.getIPAddress(true))
99+
.appendLine("getIPv4Address: " + NetworkUtils.getIPAddress(true))
100+
.appendLine("getIPv6Address: " + NetworkUtils.getIPAddress(false))
101+
.appendLine("getBroadcastIpAddress: " + NetworkUtils.getBroadcastIpAddress())
102+
.appendLine("getIpAddressByWifi: " + NetworkUtils.getIpAddressByWifi())
103+
.appendLine("getGatewayByWifi: " + NetworkUtils.getGatewayByWifi())
104+
.appendLine("getNetMaskByWifi: " + NetworkUtils.getNetMaskByWifi())
105+
.append("getServerAddressByWifi: " + NetworkUtils.getServerAddressByWifi())
100106
.create()
101107
);
102108
}

app/src/main/java/com/blankj/androidutilcode/feature/core/screen/ScreenActivity.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public void initView(Bundle savedInstanceState, View contentView) {
5050
findViewById(R.id.btn_set_portrait).setOnClickListener(this);
5151
findViewById(R.id.btn_screenshot).setOnClickListener(this);
5252
findViewById(R.id.btn_set_sleep_duration).setOnClickListener(this);
53+
findViewById(R.id.btn_test_adapt_screen).setOnClickListener(this);
5354

5455
updateAboutScreen();
5556
}
@@ -78,6 +79,9 @@ public void onWidgetClick(View view) {
7879
ScreenUtils.setSleepDuration(100000);
7980
updateAboutScreen();
8081
break;
82+
case R.id.btn_test_adapt_screen:
83+
ScreenAdaptActivity.start(this);
84+
break;
8185
}
8286
}
8387

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
package com.blankj.androidutilcode.feature.core.screen;
2+
3+
import android.content.Context;
4+
import android.content.Intent;
5+
import android.os.Bundle;
6+
import android.support.annotation.Nullable;
7+
import android.view.View;
8+
import android.view.ViewGroup;
9+
import android.widget.TextView;
10+
11+
import com.blankj.androidutilcode.R;
12+
import com.blankj.androidutilcode.base.BaseActivity;
13+
import com.blankj.utilcode.util.BarUtils;
14+
import com.blankj.utilcode.util.ScreenUtils;
15+
import com.blankj.utilcode.util.SizeUtils;
16+
17+
/**
18+
* <pre>
19+
* author: Blankj
20+
* blog : http://blankj.com
21+
* time : 2016/09/27
22+
* desc : demo about ScreenUtils
23+
* </pre>
24+
*/
25+
public class ScreenAdaptActivity extends BaseActivity {
26+
27+
private TextView tvUp;
28+
private TextView tvDown;
29+
30+
public static void start(Context context) {
31+
Intent starter = new Intent(context, ScreenAdaptActivity.class);
32+
context.startActivity(starter);
33+
}
34+
35+
@Override
36+
public void initData(@Nullable Bundle bundle) {
37+
if (ScreenUtils.isPortrait()) {
38+
ScreenUtils.adaptScreen4VerticalSlide(this, 360);
39+
} else {
40+
ScreenUtils.adaptScreen4HorizontalSlide(this, 360);
41+
}
42+
}
43+
44+
@Override
45+
public int bindLayout() {
46+
return R.layout.activity_screen_adapt;
47+
}
48+
49+
@Override
50+
public void initView(Bundle savedInstanceState, View contentView) {
51+
tvUp = findViewById(R.id.tv_up);
52+
tvDown = findViewById(R.id.tv_down);
53+
if (!ScreenUtils.isPortrait()) {
54+
updateLayout();
55+
}
56+
}
57+
58+
@Override
59+
public void doBusiness() {
60+
61+
}
62+
63+
@Override
64+
public void onWidgetClick(View view) {
65+
66+
}
67+
68+
public void toggleFullScreen(View view) {
69+
ScreenUtils.toggleFullScreen(this);
70+
updateLayout();
71+
}
72+
73+
private void updateLayout() {
74+
int statusBarHeight = BarUtils.getStatusBarHeight();
75+
int statusBarHeightInDp = SizeUtils.px2dp(this, statusBarHeight);
76+
ViewGroup.LayoutParams upLayoutParams = tvUp.getLayoutParams();
77+
ViewGroup.LayoutParams downLayoutParams = tvDown.getLayoutParams();
78+
if (ScreenUtils.isFullScreen(this)) {
79+
int height = 720 / 2 / 2;
80+
String s = height + "dp";
81+
upLayoutParams.height = SizeUtils.dp2px(this, height);
82+
tvUp.setLayoutParams(upLayoutParams);
83+
tvUp.setText(s);
84+
85+
downLayoutParams.height = SizeUtils.dp2px(this, height);
86+
tvDown.setLayoutParams(downLayoutParams);
87+
tvDown.setText(s);
88+
} else {
89+
int height = 720 / 2 / 2 - statusBarHeightInDp / 2;
90+
String s = height + "dp";
91+
upLayoutParams.height = SizeUtils.dp2px(this, height);
92+
tvUp.setLayoutParams(upLayoutParams);
93+
tvUp.setText(s);
94+
95+
downLayoutParams.height = SizeUtils.dp2px(this, height);
96+
tvDown.setLayoutParams(downLayoutParams);
97+
tvDown.setText(s);
98+
}
99+
}
100+
}

app/src/main/res/values/colors.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<resources>
33
<color name="colorPrimary">#34A48E</color>
4+
<color name="colorPrimaryHalfTrans">#8034A48E</color>
45
<color name="colorPrimaryDark">#245C50</color>
56
<color name="colorAccent">#FF73A3</color>
7+
<color name="colorAccentHalfTrans">#80245C50</color>
68

79
<color name="white">#FFFFFF</color>
810
<color name="light_black">#191919</color>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<HorizontalScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:background="@color/white">
6+
7+
<RelativeLayout
8+
android:layout_width="2000dp"
9+
android:layout_height="match_parent">
10+
11+
<TextView
12+
android:id="@+id/tv_fullscreen"
13+
android:layout_width="wrap_content"
14+
android:layout_height="match_parent"
15+
android:gravity="center"
16+
android:onClick="toggleFullScreen"
17+
android:text="Toggle Full Screen"
18+
android:textSize="@dimen/font_24" />
19+
20+
<TextView
21+
android:id="@+id/tv_up"
22+
android:layout_width="2000dp"
23+
android:layout_height="1dp"
24+
android:layout_alignParentTop="true"
25+
android:layout_toRightOf="@id/tv_fullscreen"
26+
android:background="@color/colorAccentHalfTrans"
27+
android:gravity="center_vertical"
28+
android:text="180dp"
29+
android:textSize="@dimen/font_40" />
30+
31+
<TextView
32+
android:id="@+id/tv_down"
33+
android:layout_width="2000dp"
34+
android:layout_height="1dp"
35+
android:layout_alignParentBottom="true"
36+
android:layout_toRightOf="@id/tv_fullscreen"
37+
android:background="@color/colorPrimaryHalfTrans"
38+
android:gravity="center_vertical"
39+
android:text="180dp"
40+
android:textSize="@dimen/font_40" />
41+
42+
43+
</RelativeLayout>
44+
</HorizontalScrollView>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:background="@color/white">
6+
7+
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
8+
android:layout_width="match_parent"
9+
android:layout_height="2000dp">
10+
11+
<TextView
12+
android:layout_width="180dp"
13+
android:layout_height="2000dp"
14+
android:layout_alignParentLeft="true"
15+
android:layout_below="@id/tv_fullscreen"
16+
android:background="@color/colorAccentHalfTrans"
17+
android:gravity="center_horizontal"
18+
android:text="180dp"
19+
android:textSize="@dimen/font_40" />
20+
21+
<TextView
22+
android:layout_width="180dp"
23+
android:layout_height="2000dp"
24+
android:layout_alignParentRight="true"
25+
android:layout_below="@id/tv_fullscreen"
26+
android:background="@color/colorPrimaryHalfTrans"
27+
android:gravity="center_horizontal"
28+
android:text="180dp"
29+
android:textSize="@dimen/font_40" />
30+
31+
</RelativeLayout>
32+
</ScrollView>

app/src/main/res_core/layout/activity_screen.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,12 @@
5959
android:layout_height="wrap_content"
6060
android:text="@string/screen_set_sleep_duration" />
6161

62+
<Button
63+
android:id="@+id/btn_test_adapt_screen"
64+
style="@style/WideBtnStyle"
65+
android:layout_width="match_parent"
66+
android:layout_height="wrap_content"
67+
android:text="@string/screen_test_adapt_screen" />
68+
6269
</LinearLayout>
6370
</ScrollView>

app/src/main/res_core/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@
219219
<string name="screen_set_portrait">Set Portrait</string>
220220
<string name="screen_screenshot">Screenshot</string>
221221
<string name="screen_set_sleep_duration">Set Sleep Duration</string>
222+
<string name="screen_test_adapt_screen">Test Adapt Screen</string>
222223

223224
<!--SnackBar 相关-->
224225
<string name="snackbar_show_short">Show Short Snackbar</string>

config.gradle

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ ext {
66
compileSdkVersion: 27,
77
minSdkVersion : 14,
88
targetSdkVersion : 27,
9-
versionCode : 1_017_004,
10-
versionName : '1.17.4'// E.g 1.9.72 => 1,009,072
9+
versionCode : 1_018_000,
10+
versionName : '1.18.0'// E.g 1.9.72 => 1,009,072
1111
]
1212

1313
versionConfig = [
@@ -146,7 +146,7 @@ def configLibAndroidDomain(Project pro) {
146146
def configAppDependencies(Project pro) {
147147
pro.dependencies {
148148
implementation fileTree(include: ['*.jar'], dir: 'libs')
149-
implementation project(':utilcode')
149+
// implementation project(':utilcode')
150150
implementation project(':subutil')
151151

152152
implementation depConfig.support.appcompat_v7
@@ -155,7 +155,7 @@ def configAppDependencies(Project pro) {
155155
// LeakCanary
156156
debugImplementation depConfig.leakcanary.android
157157
releaseImplementation depConfig.leakcanary.android_no_op
158-
// implementation 'com.blankj:utilcode:1.17.3'
158+
implementation 'com.blankj:utilcode:1.18.0'
159159
}
160160
}
161161

update_log.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
* 18/08/01 删除标记废弃的 CacheUtils, AppUtils#installApp, TimeUtils#getWeekIndex,发布 1.18.0
2+
* 18/07/30 替换 ScreenUtils#adaptPortraitScreen 和 ScreenUtils#adaptLandscapeScreen,为 ScreenUtils#adaptScreen4VerticalSlide 和 ScreenUtils#adaptScreen4HorizontalSlide
3+
* 18/07/28 修复 NetworkUtils#getIPAddress
14
* 18/07/16 新增 ScreenUtils#adaptPortraitScreen 和 ScreenUtils#adaptLandscapeScreen,发布 1.17.3
25
* 18/07/13 修复 IntentUtils 分享图片判断逻辑,CacheDiskUtils 可放入 byte[0]
36
* 18/06/29 修复 FragmentUtils 中 getFragmentManager 空指针错误,发布 1.17.2

0 commit comments

Comments
 (0)