Skip to content

Commit cc7a785

Browse files
committed
see 01/29 log
1 parent 85bc44d commit cc7a785

File tree

8 files changed

+111
-1
lines changed

8 files changed

+111
-1
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
66

7-
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES"/>
7+
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
88

99
<!--bar-->
1010
<uses-permission android:name="android.permission.EXPAND_STATUS_BAR" />
@@ -142,6 +142,9 @@
142142
<activity
143143
android:name=".feature.core.process.ProcessActivity"
144144
android:launchMode="singleTop" />
145+
<activity
146+
android:name=".feature.core.reflect.ReflectActivity"
147+
android:launchMode="singleTop" />
145148
<activity
146149
android:name=".feature.core.screen.ScreenActivity"
147150
android:launchMode="singleTop" />

app/src/main/java/com/blankj/androidutilcode/feature/core/CoreUtilActivity.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
import com.blankj.androidutilcode.feature.core.permission.PermissionActivity;
2121
import com.blankj.androidutilcode.feature.core.phone.PhoneActivity;
2222
import com.blankj.androidutilcode.feature.core.process.ProcessActivity;
23+
import com.blankj.androidutilcode.feature.core.reflect.ReflectActivity;
2324
import com.blankj.androidutilcode.feature.core.screen.ScreenActivity;
2425
import com.blankj.androidutilcode.feature.core.sdcard.SDCardActivity;
2526
import com.blankj.androidutilcode.feature.core.snackbar.SnackbarActivity;
@@ -127,6 +128,10 @@ public void processClick(View view) {
127128
ProcessActivity.start(this);
128129
}
129130

131+
public void reflectClick(View view) {
132+
ReflectActivity.start(this);
133+
}
134+
130135
public void screenClick(View view) {
131136
ScreenActivity.start(this);
132137
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
package com.blankj.androidutilcode.feature.core.reflect;
2+
3+
import android.content.Context;
4+
import android.content.Intent;
5+
import android.os.Bundle;
6+
import android.view.View;
7+
import android.widget.TextView;
8+
9+
import com.blankj.androidutilcode.R;
10+
import com.blankj.androidutilcode.base.BaseBackActivity;
11+
import com.blankj.utilcode.util.ReflectUtils;
12+
import com.blankj.utilcode.util.SpanUtils;
13+
14+
/**
15+
* <pre>
16+
* author: Blankj
17+
* blog : http://blankj.com
18+
* time : 2018/01/29
19+
* desc :
20+
* </pre>
21+
*/
22+
public class ReflectActivity extends BaseBackActivity {
23+
24+
public static void start(Context context) {
25+
Intent starter = new Intent(context, ReflectActivity.class);
26+
context.startActivity(starter);
27+
}
28+
29+
@Override
30+
public void initData(Bundle bundle) {
31+
32+
}
33+
34+
@Override
35+
public int bindLayout() {
36+
return R.layout.activity_reflect;
37+
}
38+
39+
@Override
40+
public void initView(Bundle savedInstanceState, View view) {
41+
getToolBar().setTitle(getString(R.string.demo_reflect));
42+
43+
TextView tvAboutReflect = findViewById(R.id.tv_about_reflect);
44+
45+
tvAboutReflect.setText(new SpanUtils()
46+
.appendLine("before reflect: " + ReflectUtils.reflect(TestPrivateStaticFinal.class).field("I1").get())
47+
.append("after reflect: " + ReflectUtils.reflect(TestPrivateStaticFinal.class).field("I1", 2).field("I1").get())
48+
.create());
49+
}
50+
51+
@Override
52+
public void doBusiness() {
53+
54+
}
55+
56+
@Override
57+
public void onWidgetClick(View view) {
58+
59+
}
60+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
package com.blankj.androidutilcode.feature.core.reflect;
2+
3+
/**
4+
* <pre>
5+
* author: Blankj
6+
* blog : http://blankj.com
7+
* time : 2018/01/12
8+
* desc :
9+
* </pre>
10+
*/
11+
public class TestPrivateStaticFinal {
12+
private static final int I1 = 1;
13+
14+
public static int getI1() {
15+
return I1;
16+
}
17+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout
3+
xmlns:android="http://schemas.android.com/apk/res/android"
4+
android:layout_width="match_parent"
5+
android:layout_height="wrap_content"
6+
android:gravity="center_horizontal"
7+
android:orientation="vertical"
8+
android:padding="@dimen/spacing_16">
9+
10+
<TextView
11+
android:id="@+id/tv_about_reflect"
12+
style="@style/TextStyle"
13+
android:layout_width="match_parent"
14+
android:layout_height="wrap_content" />
15+
16+
</LinearLayout>

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,13 @@
106106
android:onClick="processClick"
107107
android:text="@string/demo_process" />
108108

109+
<Button
110+
style="@style/WideBtnStyle"
111+
android:layout_width="match_parent"
112+
android:layout_height="wrap_content"
113+
android:onClick="reflectClick"
114+
android:text="@string/demo_reflect" />
115+
109116
<Button
110117
style="@style/WideBtnStyle"
111118
android:layout_width="match_parent"

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
<string name="demo_permission">PermissionUtils Demo</string>
1515
<string name="demo_phone">PhoneUtils Demo</string>
1616
<string name="demo_process">ProcessUtils Demo</string>
17+
<string name="demo_reflect">ReflectUtils Demo</string>
1718
<string name="demo_screen">ScreenUtils Demo</string>
1819
<string name="demo_sdcard">SDCardUtils Demo</string>
1920
<string name="demo_snackbar">Snackbar Demo</string>

utilcode/src/test/java/com/blankj/utilcode/util/FileUtilsTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ public void getDirLength() throws Exception {
171171
@Test
172172
public void getFileLength() throws Exception {
173173
System.out.println(FileUtils.getFileLength(PATH_FILE + "UTF8.txt"));
174+
System.out.println(FileUtils.getFileLength("https://raw.githubusercontent.com/Blankj/AndroidUtilCode/85bc44d1c8adb31027870ea4cb7a931700c80cad/LICENSE"));
174175
}
175176

176177
@Test

0 commit comments

Comments
 (0)