Skip to content

Commit cce9449

Browse files
committed
see 12/14 log
1 parent 812ca69 commit cce9449

File tree

7 files changed

+48
-45
lines changed

7 files changed

+48
-45
lines changed

config_app.gradle

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,16 @@ android {
2121
}
2222

2323
buildTypes {
24+
// debug {
25+
// minifyEnabled true
26+
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
27+
// for (int i = 0; i < consumerProguardFiles.size(); i++) {
28+
// println consumerProguardFiles[i].getAbsolutePath() + "<111"
29+
// }
30+
//// consumerProguardFiles[0] + ",111 " + consumerProguardFiles[1].getAbsolutePath()
31+
// }
2432
release {
2533
minifyEnabled true
26-
consumerProguardFiles 'proguard-rules.pro'
2734
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2835
}
2936
}
@@ -61,7 +68,7 @@ def configSigning(Project pro) {
6168
properties.load(new FileInputStream(signPropertiesFile))
6269
signingConfigs {
6370
release {
64-
storeFile file(properties['keystore'])
71+
storeFile new File(signPropertiesFile.getParent(), properties['keystore'])
6572
storePassword properties['storePassword']
6673
keyAlias properties['keyAlias']
6774
keyPassword properties['keyPassword']

sign/keystore.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
keystore=sign/keystore.jks
1+
keystore=keystore.jks
22
storePassword=utilcode
33
keyAlias=utilcode
44
keyPassword=utilcode

utilcode/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ apply {
55
dependencies {
66
implementation fileTree(dir: 'libs', include: ['*.jar'])
77
implementation project(':utilcode-pkg')
8+
api dep.free_proguard
89
}

utilcode/lib/proguard-rules.pro

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
# public *;
1717
#}
1818

19-
#-keep class com.blankj.utilcode.** { *; }
20-
#-keepclassmembers class com.blankj.utilcode.** { *; }
19+
-keep class com.blankj.utilcode.** { *; }
20+
-keepclassmembers class com.blankj.utilcode.** { *; }
2121
-dontwarn com.blankj.utilcode.**

utilcode/lib/src/main/java/com/blankj/utilcode/util/Utils.java

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,9 @@ static class ActivityLifecycleImpl implements ActivityLifecycleCallbacks {
160160

161161
private OnActivityDestroyedListener mOnActivityDestroyedListener;
162162

163-
private int mForegroundCount = 0;
164-
private int mConfigCount = 0;
163+
private int mForegroundCount = 0;
164+
private int mConfigCount = 0;
165+
private boolean mIsBackground = false;
165166

166167
OnActivityDestroyedListener getOnActivityDestroyedListener() {
167168
return mOnActivityDestroyedListener;
@@ -186,9 +187,8 @@ public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
186187

187188
@Override
188189
public void onActivityStarted(Activity activity) {
189-
setTopActivity(activity);
190-
if (mForegroundCount <= 0) {
191-
postStatus(true);
190+
if (!mIsBackground) {
191+
setTopActivity(activity);
192192
}
193193
if (mConfigCount < 0) {
194194
++mConfigCount;
@@ -200,6 +200,10 @@ public void onActivityStarted(Activity activity) {
200200
@Override
201201
public void onActivityResumed(Activity activity) {
202202
setTopActivity(activity);
203+
if (mIsBackground) {
204+
mIsBackground = false;
205+
postStatus(true);
206+
}
203207
}
204208

205209
@Override
@@ -214,6 +218,7 @@ public void onActivityStopped(Activity activity) {
214218
} else {
215219
--mForegroundCount;
216220
if (mForegroundCount <= 0) {
221+
mIsBackground = true;
217222
postStatus(false);
218223
}
219224
}

utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/feature/blur/BlurActivity.java

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import com.blankj.utilcode.util.AppUtils;
1818
import com.blankj.utilcode.util.ImageUtils;
1919
import com.blankj.utilcode.util.LogUtils;
20+
import com.blankj.utilcode.util.Utils;
2021

2122
import org.jetbrains.annotations.NotNull;
2223
import org.jetbrains.annotations.Nullable;
@@ -44,7 +45,7 @@ public void initData(@Nullable Bundle bundle) {
4445

4546
@Override
4647
public int bindLayout() {
47-
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
48+
// this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
4849
return R.layout.activity_blur;
4950
}
5051

@@ -55,24 +56,19 @@ public void initView(@Nullable Bundle savedInstanceState, @NotNull View contentV
5556

5657
@Override
5758
public void doBusiness() {
58-
// AppUtils.registerAppStatusChangedListener(this, new Utils.OnAppStatusChangedListener() {
59-
// @Override
60-
// public void onForeground() {
61-
// BlurActivity.leave(false);
62-
// }
63-
//
64-
// @Override
65-
// public void onBackground() {
66-
// BlurActivity.leave(true);
67-
// }
68-
// });
69-
mContentView.postDelayed(new Runnable() {
59+
AppUtils.registerAppStatusChangedListener(this, new Utils.OnAppStatusChangedListener() {
7060
@Override
71-
public void run() {
72-
DialogHelper.showAdaptScreenDialog();
61+
public void onForeground() {
62+
LogUtils.e();
63+
BlurActivity.leave(false);
7364
}
74-
}, 1000);
7565

66+
@Override
67+
public void onBackground() {
68+
LogUtils.e();
69+
BlurActivity.leave(true);
70+
}
71+
});
7672
}
7773

7874
@Override
@@ -91,24 +87,17 @@ protected void onResume() {
9187
super.onResume();
9288
}
9389

94-
@Override
95-
public void onWindowFocusChanged(boolean hasFocus) {
96-
if (hasFocus) {
97-
leave(false);
98-
LogUtils.e();
99-
} else {
100-
leave(true);
101-
LogUtils.e();
102-
}
103-
super.onWindowFocusChanged(hasFocus);
104-
}
105-
106-
@Override
107-
protected void onUserLeaveHint() {
108-
leave(true);
109-
LogUtils.e();
110-
super.onUserLeaveHint();
111-
}
90+
// @Override
91+
// public void onWindowFocusChanged(boolean hasFocus) {
92+
// if (hasFocus) {
93+
// leave(false);
94+
// LogUtils.e();
95+
// } else {
96+
// leave(true);
97+
// LogUtils.e();
98+
// }
99+
// super.onWindowFocusChanged(hasFocus);
100+
// }
112101

113102

114103
public static void leave(boolean isBlur) {
@@ -129,7 +118,7 @@ public static void leave(boolean isBlur) {
129118
view,
130119
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
131120
);
132-
TransparentActivity.start();
121+
// TransparentActivity.start();
133122
}
134123
} else {
135124
if (!isBlur) {

utilcode/pkg/src/main/java/com/blankj/utilcode/pkg/feature/blur/TransparentActivity.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ public static void start() {
2626
@Override
2727
protected void onCreate(@Nullable Bundle savedInstanceState) {
2828
super.onCreate(savedInstanceState);
29+
finish();
2930
}
3031
}

0 commit comments

Comments
 (0)