Skip to content

Commit dbf64da

Browse files
committed
see 12/13 log
1 parent 1aef86e commit dbf64da

File tree

27 files changed

+96
-89
lines changed

27 files changed

+96
-89
lines changed

launcher/app/src/main/java/com/blankj/launcher/app/UtilsApp.java

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import android.graphics.Bitmap;
66
import android.graphics.Canvas;
77
import android.view.View;
8+
import android.view.ViewGroup;
89
import android.view.WindowManager;
910
import android.widget.ImageView;
1011

@@ -15,6 +16,7 @@
1516
import com.blankj.utilcode.util.BusUtils;
1617
import com.blankj.utilcode.util.ImageUtils;
1718
import com.blankj.utilcode.util.LogUtils;
19+
import com.blankj.utilcode.util.ScreenUtils;
1820
import com.blankj.utilcode.util.Utils;
1921

2022
/**
@@ -45,35 +47,26 @@ public void onCreate() {
4547
AppUtils.registerAppStatusChangedListener(this, new Utils.OnAppStatusChangedListener() {
4648
@Override
4749
public void onForeground() {
50+
// Activity topActivity = ActivityUtils.getTopActivity();
51+
// if (topActivity == null) return;
52+
// ViewGroup decorView = (ViewGroup) topActivity.getWindow().getDecorView();
53+
// View blur = decorView.findViewWithTag("blur");
54+
// if (blur == null) return;
55+
// decorView.removeView(blur);
4856

4957
LogUtils.i();
5058
}
5159

5260
@Override
5361
public void onBackground() {
54-
Activity topActivity = ActivityUtils.getTopActivity();
55-
if (topActivity == null) return;
56-
View decorView = topActivity.getWindow().getDecorView();
57-
Bitmap bitmapForView = getBitmapForView(decorView);
58-
Bitmap bitmap = ImageUtils.fastBlur(bitmapForView, 0.125f, 2, true);
59-
60-
61-
WindowManager windowManager = topActivity.getWindowManager();
62-
WindowManager.LayoutParams mParams = new WindowManager.LayoutParams();
63-
64-
mParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
65-
mParams.height = WindowManager.LayoutParams.MATCH_PARENT;
66-
mParams.width = WindowManager.LayoutParams.MATCH_PARENT;
67-
ImageView view = new ImageView(topActivity);
68-
view.setImageBitmap(bitmap);
69-
windowManager.addView(view, mParams);
62+
63+
7064
LogUtils.i();
7165
}
7266
});
7367
}
7468

7569

76-
7770
private Bitmap getBitmapForView(View src) {
7871
Bitmap bitmap = Bitmap.createBitmap(
7972
src.getWidth(),
@@ -88,7 +81,7 @@ private Bitmap getBitmapForView(View src) {
8881
}
8982

9083
@BusUtils.Subscribe(name = "showDialog")
91-
public static void showDialog(){
84+
public static void showDialog() {
9285
DialogHelper.showOpenAppSettingDialog();
9386
}
9487
}

launcher/pkg/src/main/java/com/blankj/launcher/pkg/MainActivity.kt

Lines changed: 57 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
package com.blankj.launcher.pkg
22

33
import android.graphics.Color
4+
import android.opengl.Visibility
45
import android.os.Bundle
56
import android.support.v7.app.ActionBarDrawerToggle
67
import android.view.View
8+
import android.view.ViewGroup
9+
import android.view.WindowManager
10+
import android.widget.ImageView
711
import com.blankj.base.BaseDrawerActivity
812
import com.blankj.launcher.R
913
import com.blankj.utilcode.util.ActivityUtils
1014
import com.blankj.utilcode.util.BarUtils
1115
import com.blankj.utilcode.util.BusUtils
16+
import com.blankj.utilcode.util.ImageUtils
1217
import kotlinx.android.synthetic.main.activity_main.*
1318

1419

@@ -30,6 +35,8 @@ class MainActivity : BaseDrawerActivity() {
3035
return R.layout.activity_main
3136
}
3237

38+
private var view: ImageView? = null
39+
3340
override fun initView(savedInstanceState: Bundle?, contentView: View) {
3441
launcherMainCtl.setExpandedTitleColor(Color.TRANSPARENT)
3542
setSupportActionBar(launcherMainToolbar)
@@ -49,10 +56,27 @@ class MainActivity : BaseDrawerActivity() {
4956
}
5057

5158
launcherMainSubUtilBtn.setOnClickListener {
52-
BusUtils.post<Any>("SubUtilActivity#start", this)
59+
BusUtils.post<Any>("showDialog")
60+
// BusUtils.post<Any>("SubUtilActivity#start", this)
5361
}
5462

55-
BusUtils.post<Any>("showDialog")
63+
64+
contentView.post(Runnable {
65+
val topActivity = ActivityUtils.getTopActivity() ?: return@Runnable
66+
val decorView = topActivity.window.decorView as ViewGroup
67+
val bitmapForView = ImageUtils.view2Bitmap(decorView)
68+
69+
val bitmap = ImageUtils.fastBlur(bitmapForView, 0.125f, 2f, true, true)
70+
71+
view = ImageView(topActivity)
72+
view?.setImageBitmap(bitmap)
73+
view?.tag = "blur"
74+
decorView.addView(view, ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
75+
view?.visibility = View.GONE
76+
})
77+
78+
getWindow().setFlags(WindowManager.LayoutParams.FLAG_BLUR_BEHIND, WindowManager.LayoutParams.FLAG_BLUR_BEHIND);
79+
5680
}
5781

5882
override fun doBusiness() {
@@ -66,4 +90,35 @@ class MainActivity : BaseDrawerActivity() {
6690
override fun onBackPressed() {
6791
ActivityUtils.startHomeActivity()
6892
}
93+
94+
override fun onResume() {
95+
view?.visibility = View.GONE
96+
super.onResume()
97+
}
98+
99+
override fun onPause() {
100+
view?.visibility = View.VISIBLE
101+
// val topActivity = ActivityUtils.getTopActivity() ?: return
102+
// val decorView = topActivity.window.decorView as ViewGroup
103+
// val bitmapForView = ImageUtils.view2Bitmap(decorView)
104+
//
105+
// val bitmap = ImageUtils.fastBlur(bitmapForView, 0.125f, 2f, true, true)
106+
//
107+
// val view = ImageView(topActivity)
108+
// view.setImageBitmap(bitmap)
109+
// view.tag = "blur"
110+
// decorView.addView(view, ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT))
111+
// val windowManager = topActivity.windowManager
112+
// val mParams = WindowManager.LayoutParams()
113+
//
114+
// mParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_PANEL
115+
// mParams.height = WindowManager.LayoutParams.MATCH_PARENT
116+
// mParams.width = WindowManager.LayoutParams.MATCH_PARENT
117+
//
118+
// val view = ImageView(topActivity)
119+
// view.setImageBitmap(bitmap)
120+
// view.tag = "blur"
121+
// windowManager.addView(view, mParams)
122+
super.onPause()
123+
}
69124
}

lib/base/build.gradle

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

55
dependencies {
66
implementation fileTree(include: ['*.jar'], dir: 'libs')
7-
api project(':lib-resource')
87
api project(':utilcode-lib')
98
api project(':subutil-lib')
109

lib/resource/src/main/res-base/menu/main_drawer.xml renamed to lib/base/src/main/res/menu/main_drawer.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<item
44
android:id="@+id/action_git_hub"
55
android:icon="@drawable/main_menu_github"
6-
android:title="@string/git_hub" />
6+
android:title="GitHub" />
77

88
<item
99
android:id="@+id/action_blog"
1010
android:icon="@drawable/main_menu_blog"
11-
android:title="@string/blog" />
11+
android:title="Blog" />
1212
</menu>

lib/resource/src/main/res-base/values-v27/styles.xml renamed to lib/base/src/main/res/values-v27/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<resources>
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
4+
<style name="AppTheme" parent="Theme.AppCompat.NoActionBar">
55
<!-- Customize your theme here. -->
66
<item name="colorPrimary">@color/colorPrimary</item>
77
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,19 @@
1+
<?xml version="1.0" encoding="utf-8"?>
12
<resources>
23
<string name="github">https://github.com/Blankj/AndroidUtilCode</string>
34
<string name="blog">https://blankj.com</string>
5+
6+
<string name="core_util">Core Util</string>
7+
<string name="sub_util">Sub Util</string>
8+
9+
<string name="author">Blankj</string>
10+
<string name="demo_of_android_util_code">Demo of AndroidUtilCode</string>
11+
12+
<string name="navigation_drawer_open">navigation_drawer_open</string>
13+
<string name="navigation_drawer_close">navigation_drawer_close</string>
14+
15+
<string name="permission_rationale_message">You have rejected us to apply for authorization, please agree to authorization, otherwise the function can\'t be used normally!</string>
16+
<string name="permission_denied_forever_message">We need some of the permissions you rejected or the system failed to apply failed, please manually set to the page authorize, otherwise the function can\'t be used normally!</string>
17+
18+
<string name="crash_restart_tip">The application crashes, does it need to be restarted?</string>
419
</resources>

lib/resource/src/main/res-base/values/styles.xml renamed to lib/base/src/main/res/values/styles.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<resources>
22

33
<!-- Base application theme. -->
4-
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
4+
<style name="AppTheme" parent="Theme.AppCompat.DayNight">
55
<!-- Customize your theme here. -->
66
<item name="colorPrimary">@color/colorPrimary</item>
77
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>

lib/resource/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/resource/build.gradle

Lines changed: 0 additions & 11 deletions
This file was deleted.

lib/resource/proguard-rules.pro

Lines changed: 0 additions & 21 deletions
This file was deleted.

lib/resource/src/main/AndroidManifest.xml

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/resource/src/main/res-base/values/strings.xml

Lines changed: 0 additions & 19 deletions
This file was deleted.

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

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1170,16 +1170,11 @@ public static Bitmap fastBlur(final Bitmap src,
11701170
} else {
11711171
scaleBitmap = stackBlur(scaleBitmap, (int) radius, recycle);
11721172
}
1173-
if (scale == 1) {
1173+
if (scale == 1 || isReturnScale) {
11741174
if (recycle && !src.isRecycled()) src.recycle();
11751175
return scaleBitmap;
11761176
}
1177-
Bitmap ret;
1178-
if (isReturnScale) {
1179-
ret = scaleBitmap;
1180-
} else {
1181-
ret = Bitmap.createScaledBitmap(scaleBitmap, width, height, true);
1182-
}
1177+
Bitmap ret = Bitmap.createScaledBitmap(scaleBitmap, width, height, true);
11831178
if (!scaleBitmap.isRecycled()) scaleBitmap.recycle();
11841179
if (recycle && !src.isRecycled()) src.recycle();
11851180
return ret;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
import android.content.res.Configuration;
88
import android.content.res.Resources;
99
import android.graphics.Bitmap;
10+
import android.graphics.Canvas;
1011
import android.graphics.Point;
1112
import android.os.Build;
1213
import android.provider.Settings;

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,10 +203,7 @@ public void onActivityResumed(Activity activity) {
203203
}
204204

205205
@Override
206-
public void onActivityPaused(Activity activity) {/**/}
207-
208-
@Override
209-
public void onActivityStopped(Activity activity) {
206+
public void onActivityPaused(Activity activity) {/**/
210207
if (activity.isChangingConfigurations()) {
211208
--mConfigCount;
212209
} else {
@@ -217,6 +214,11 @@ public void onActivityStopped(Activity activity) {
217214
}
218215
}
219216

217+
@Override
218+
public void onActivityStopped(Activity activity) {
219+
220+
}
221+
220222
@Override
221223
public void onActivitySaveInstanceState(Activity activity, Bundle outState) {/**/}
222224

0 commit comments

Comments
 (0)