Skip to content

Commit

Permalink
see 12/14 log
Browse files Browse the repository at this point in the history
  • Loading branch information
Blankj committed Dec 14, 2018
1 parent 812ca69 commit cce9449
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 45 deletions.
11 changes: 9 additions & 2 deletions config_app.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,16 @@ android {
}

buildTypes {
// debug {
// minifyEnabled true
// proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
// for (int i = 0; i < consumerProguardFiles.size(); i++) {
// println consumerProguardFiles[i].getAbsolutePath() + "<111"
// }
//// consumerProguardFiles[0] + ",111 " + consumerProguardFiles[1].getAbsolutePath()
// }
release {
minifyEnabled true
consumerProguardFiles 'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Expand Down Expand Up @@ -61,7 +68,7 @@ def configSigning(Project pro) {
properties.load(new FileInputStream(signPropertiesFile))
signingConfigs {
release {
storeFile file(properties['keystore'])
storeFile new File(signPropertiesFile.getParent(), properties['keystore'])
storePassword properties['storePassword']
keyAlias properties['keyAlias']
keyPassword properties['keyPassword']
Expand Down
2 changes: 1 addition & 1 deletion sign/keystore.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
keystore=sign/keystore.jks
keystore=keystore.jks
storePassword=utilcode
keyAlias=utilcode
keyPassword=utilcode
1 change: 1 addition & 0 deletions utilcode/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ apply {
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation project(':utilcode-pkg')
api dep.free_proguard
}
4 changes: 2 additions & 2 deletions utilcode/lib/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@
# public *;
#}

#-keep class com.blankj.utilcode.** { *; }
#-keepclassmembers class com.blankj.utilcode.** { *; }
-keep class com.blankj.utilcode.** { *; }
-keepclassmembers class com.blankj.utilcode.** { *; }
-dontwarn com.blankj.utilcode.**
15 changes: 10 additions & 5 deletions utilcode/lib/src/main/java/com/blankj/utilcode/util/Utils.java
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,9 @@ static class ActivityLifecycleImpl implements ActivityLifecycleCallbacks {

private OnActivityDestroyedListener mOnActivityDestroyedListener;

private int mForegroundCount = 0;
private int mConfigCount = 0;
private int mForegroundCount = 0;
private int mConfigCount = 0;
private boolean mIsBackground = false;

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

@Override
public void onActivityStarted(Activity activity) {
setTopActivity(activity);
if (mForegroundCount <= 0) {
postStatus(true);
if (!mIsBackground) {
setTopActivity(activity);
}
if (mConfigCount < 0) {
++mConfigCount;
Expand All @@ -200,6 +200,10 @@ public void onActivityStarted(Activity activity) {
@Override
public void onActivityResumed(Activity activity) {
setTopActivity(activity);
if (mIsBackground) {
mIsBackground = false;
postStatus(true);
}
}

@Override
Expand All @@ -214,6 +218,7 @@ public void onActivityStopped(Activity activity) {
} else {
--mForegroundCount;
if (mForegroundCount <= 0) {
mIsBackground = true;
postStatus(false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.ImageUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.Utils;

import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -44,7 +45,7 @@ public void initData(@Nullable Bundle bundle) {

@Override
public int bindLayout() {
this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
// this.getWindow().setType(WindowManager.LayoutParams.TYPE_KEYGUARD_DIALOG);
return R.layout.activity_blur;
}

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

@Override
public void doBusiness() {
// AppUtils.registerAppStatusChangedListener(this, new Utils.OnAppStatusChangedListener() {
// @Override
// public void onForeground() {
// BlurActivity.leave(false);
// }
//
// @Override
// public void onBackground() {
// BlurActivity.leave(true);
// }
// });
mContentView.postDelayed(new Runnable() {
AppUtils.registerAppStatusChangedListener(this, new Utils.OnAppStatusChangedListener() {
@Override
public void run() {
DialogHelper.showAdaptScreenDialog();
public void onForeground() {
LogUtils.e();
BlurActivity.leave(false);
}
}, 1000);

@Override
public void onBackground() {
LogUtils.e();
BlurActivity.leave(true);
}
});
}

@Override
Expand All @@ -91,24 +87,17 @@ protected void onResume() {
super.onResume();
}

@Override
public void onWindowFocusChanged(boolean hasFocus) {
if (hasFocus) {
leave(false);
LogUtils.e();
} else {
leave(true);
LogUtils.e();
}
super.onWindowFocusChanged(hasFocus);
}

@Override
protected void onUserLeaveHint() {
leave(true);
LogUtils.e();
super.onUserLeaveHint();
}
// @Override
// public void onWindowFocusChanged(boolean hasFocus) {
// if (hasFocus) {
// leave(false);
// LogUtils.e();
// } else {
// leave(true);
// LogUtils.e();
// }
// super.onWindowFocusChanged(hasFocus);
// }


public static void leave(boolean isBlur) {
Expand All @@ -129,7 +118,7 @@ public static void leave(boolean isBlur) {
view,
new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)
);
TransparentActivity.start();
// TransparentActivity.start();
}
} else {
if (!isBlur) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ public static void start() {
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
finish();
}
}

0 comments on commit cce9449

Please sign in to comment.