[app] blurrrr

This commit is contained in:
tehcneko 2021-02-27 20:59:16 +08:00
parent d3d15a6b2e
commit 3bb40a5990
7 changed files with 102 additions and 6 deletions

View File

@ -1,3 +1,22 @@
/*
* This file is part of LSPosed.
*
* LSPosed is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LSPosed is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2021 LSPosed Contributors
*/
package io.github.lsposed.manager.receivers;
import android.content.pm.PackageInfo;

View File

@ -27,7 +27,6 @@ import android.text.method.LinkMovementMethod;
import android.view.LayoutInflater;
import android.view.View;
import androidx.appcompat.app.AlertDialog;
import androidx.core.text.HtmlCompat;
import com.bumptech.glide.Glide;
@ -41,6 +40,7 @@ import io.github.lsposed.manager.databinding.ActivityMainBinding;
import io.github.lsposed.manager.databinding.DialogAboutBinding;
import io.github.lsposed.manager.ui.activity.base.BaseActivity;
import io.github.lsposed.manager.ui.fragment.StatusDialogBuilder;
import io.github.lsposed.manager.util.BlurBehindDialogBuilder;
import io.github.lsposed.manager.util.GlideHelper;
import io.github.lsposed.manager.util.ModuleUtil;
import io.github.lsposed.manager.util.NavUtil;
@ -80,7 +80,7 @@ public class MainActivity extends BaseActivity {
R.string.about_view_source_code,
"<b><a href=\"https://github.com/LSPosed/LSPosed\">GitHub</a></b>",
"<b><a href=\"https://t.me/LSPosed\">Telegram</a></b>"), HtmlCompat.FROM_HTML_MODE_LEGACY));
new AlertDialog.Builder(this)
new BlurBehindDialogBuilder(this)
.setView(binding.getRoot())
.show();
});

View File

@ -27,7 +27,6 @@ import android.view.LayoutInflater;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
import androidx.core.text.HtmlCompat;
import java.io.BufferedReader;
@ -40,9 +39,10 @@ import io.github.lsposed.manager.BuildConfig;
import io.github.lsposed.manager.ConfigManager;
import io.github.lsposed.manager.R;
import io.github.lsposed.manager.databinding.StatusInstallerBinding;
import io.github.lsposed.manager.util.BlurBehindDialogBuilder;
@SuppressLint("StaticFieldLeak")
public class StatusDialogBuilder extends AlertDialog.Builder {
public class StatusDialogBuilder extends BlurBehindDialogBuilder {
private static final String CPU_ABI;
private static final String CPU_ABI2;

View File

@ -0,0 +1,60 @@
/*
* This file is part of LSPosed.
*
* LSPosed is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LSPosed is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2021 LSPosed Contributors
*/
package io.github.lsposed.manager.util;
import android.content.Context;
import android.os.Build;
import android.view.SurfaceControl;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AlertDialog;
public class BlurBehindDialogBuilder extends AlertDialog.Builder {
public BlurBehindDialogBuilder(@NonNull Context context) {
super(context);
}
@NonNull
@Override
public AlertDialog create() {
AlertDialog dialog = super.create();
dialog.setOnShowListener(d -> setBackgroundBlurRadius(dialog.getWindow().getDecorView()));
return dialog;
}
private void setBackgroundBlurRadius(View view) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
try {
Object viewRootImpl = view.getClass().getMethod("getViewRootImpl").invoke(view);
if (viewRootImpl == null) {
return;
}
SurfaceControl surfaceControl = (SurfaceControl) viewRootImpl.getClass().getMethod("getSurfaceControl").invoke(viewRootImpl);
SurfaceControl.Transaction transaction = new SurfaceControl.Transaction();
transaction.getClass().getDeclaredMethod("setBackgroundBlurRadius", SurfaceControl.class, int.class).invoke(transaction, surfaceControl, 150);
transaction.apply();
} catch (Throwable t) {
t.printStackTrace();
}
}
}
}

View File

@ -1,3 +1,22 @@
/*
* This file is part of LSPosed.
*
* LSPosed is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* LSPosed is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2021 LSPosed Contributors
*/
package io.github.lsposed.manager.util.svg;
import android.graphics.Bitmap;

View File

@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2020 EdXposed Contributors
* Copyright (C) 2021 LSPosed Contributors
*/

View File

@ -14,7 +14,6 @@
* You should have received a copy of the GNU General Public License
* along with LSPosed. If not, see <https://www.gnu.org/licenses/>.
*
* Copyright (C) 2020 EdXposed Contributors
* Copyright (C) 2021 LSPosed Contributors
*/