[app] Don't show parasitic recommend everytime
This commit is contained in:
parent
4ac9612f17
commit
6b3598dc93
|
|
@ -29,6 +29,7 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.annotation.Nullable;
|
||||||
import androidx.core.text.HtmlCompat;
|
import androidx.core.text.HtmlCompat;
|
||||||
|
|
||||||
import com.google.android.material.color.MaterialColors;
|
import com.google.android.material.color.MaterialColors;
|
||||||
|
|
@ -56,6 +57,29 @@ public class HomeFragment extends BaseFragment {
|
||||||
|
|
||||||
private FragmentHomeBinding binding;
|
private FragmentHomeBinding binding;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onCreate(@Nullable Bundle savedInstanceState) {
|
||||||
|
super.onCreate(savedInstanceState);
|
||||||
|
|
||||||
|
if (!App.isParasitic() && !App.getPreferences().getBoolean("never_show_shortcut", false)) {
|
||||||
|
new BlurBehindDialogBuilder(requireActivity())
|
||||||
|
.setTitle(R.string.parasitic_recommend)
|
||||||
|
.setMessage(R.string.parasitic_recommend_summary)
|
||||||
|
.setNegativeButton(R.string.never_show, (dialog, which) -> App.getPreferences().edit().putBoolean("never_show_shortcut", true).apply())
|
||||||
|
.setNeutralButton(R.string.create_shortcut, (dialog, which) -> {
|
||||||
|
try {
|
||||||
|
LSPManagerServiceHolder.getService().createShortcut();
|
||||||
|
} catch (Throwable e) {
|
||||||
|
if (binding != null) {
|
||||||
|
Snackbar.make(binding.snackbar, getString(R.string.failed_to_create_shortcut, e.getMessage()), Snackbar.LENGTH_LONG).show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.setPositiveButton(android.R.string.ok, null)
|
||||||
|
.show();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
||||||
binding = FragmentHomeBinding.inflate(inflater, container, false);
|
binding = FragmentHomeBinding.inflate(inflater, container, false);
|
||||||
|
|
@ -83,22 +107,6 @@ public class HomeFragment extends BaseFragment {
|
||||||
binding.settings.setOnClickListener(new StartFragmentListener(R.id.action_settings_fragment, false));
|
binding.settings.setOnClickListener(new StartFragmentListener(R.id.action_settings_fragment, false));
|
||||||
binding.issue.setOnClickListener(view -> NavUtil.startURL(activity, "https://github.com/LSPosed/LSPosed/issues"));
|
binding.issue.setOnClickListener(view -> NavUtil.startURL(activity, "https://github.com/LSPosed/LSPosed/issues"));
|
||||||
|
|
||||||
if (!App.isParasitic() && !App.getPreferences().getBoolean("never_show_shortcut", false)) {
|
|
||||||
new BlurBehindDialogBuilder(activity)
|
|
||||||
.setTitle(R.string.parasitic_recommend)
|
|
||||||
.setMessage(R.string.parasitic_recommend_summary)
|
|
||||||
.setNegativeButton(R.string.never_show, (dialog, which) -> App.getPreferences().edit().putBoolean("never_show_shortcut", true).apply())
|
|
||||||
.setNeutralButton(R.string.create_shortcut, (dialog, which) -> {
|
|
||||||
try {
|
|
||||||
LSPManagerServiceHolder.getService().createShortcut();
|
|
||||||
} catch (Throwable e) {
|
|
||||||
Snackbar.make(binding.snackbar, getString(R.string.failed_to_create_shortcut, e.getMessage()), Snackbar.LENGTH_LONG).show();
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setPositiveButton(android.R.string.ok, null)
|
|
||||||
.show();
|
|
||||||
}
|
|
||||||
|
|
||||||
updateStates(requireActivity(), ConfigManager.isBinderAlive(), App.needUpdate());
|
updateStates(requireActivity(), ConfigManager.isBinderAlive(), App.needUpdate());
|
||||||
return binding.getRoot();
|
return binding.getRoot();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue