[app] Fix back press behavior (#1552)
This commit is contained in:
parent
d23123e39a
commit
5ee5297fb6
|
|
@ -22,6 +22,7 @@ package org.lsposed.manager.ui.activity;
|
|||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
|
|
@ -30,6 +31,7 @@ import android.view.MotionEvent;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.core.os.BuildCompat;
|
||||
import androidx.navigation.NavController;
|
||||
import androidx.navigation.NavOptions;
|
||||
import androidx.navigation.Navigation;
|
||||
import androidx.navigation.fragment.NavHostFragment;
|
||||
import androidx.navigation.ui.NavigationUI;
|
||||
|
|
@ -38,7 +40,6 @@ import com.google.android.material.navigation.NavigationBarView;
|
|||
|
||||
import org.lsposed.manager.App;
|
||||
import org.lsposed.manager.ConfigManager;
|
||||
import org.lsposed.manager.NavGraphDirections;
|
||||
import org.lsposed.manager.R;
|
||||
import org.lsposed.manager.databinding.ActivityMainBinding;
|
||||
import org.lsposed.manager.repo.RepoLoader;
|
||||
|
|
@ -78,7 +79,6 @@ public class MainActivity extends BaseActivity implements RepoLoader.RepoListene
|
|||
}
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
|
||||
binding = ActivityMainBinding.inflate(getLayoutInflater());
|
||||
setContentView(binding.getRoot());
|
||||
|
||||
|
|
@ -95,7 +95,6 @@ public class MainActivity extends BaseActivity implements RepoLoader.RepoListene
|
|||
NavController navController = navHostFragment.getNavController();
|
||||
var nav = (NavigationBarView) binding.nav;
|
||||
NavigationUI.setupWithNavController(nav, navController);
|
||||
nav.findViewById(R.id.modules_fragment);
|
||||
|
||||
handleIntent(getIntent());
|
||||
}
|
||||
|
|
@ -115,35 +114,36 @@ public class MainActivity extends BaseActivity implements RepoLoader.RepoListene
|
|||
return;
|
||||
}
|
||||
NavController navController = navHostFragment.getNavController();
|
||||
var nav = (NavigationBarView) binding.nav;
|
||||
if (intent.getAction() != null && intent.getAction().equals("android.intent.action.APPLICATION_PREFERENCES")) {
|
||||
navController.navigate(R.id.settings_fragment);
|
||||
nav.setSelectedItemId(R.id.settings_fragment);
|
||||
} else if (ConfigManager.isBinderAlive()) {
|
||||
if (!TextUtils.isEmpty(intent.getDataString())) {
|
||||
switch (intent.getDataString()) {
|
||||
case "modules":
|
||||
navController.navigate(R.id.modules_fragment);
|
||||
nav.setSelectedItemId(R.id.modules_nav);
|
||||
break;
|
||||
case "logs":
|
||||
navController.navigate(R.id.logs_fragment);
|
||||
nav.setSelectedItemId(R.id.logs_fragment);
|
||||
break;
|
||||
case "repo":
|
||||
if (ConfigManager.isMagiskInstalled()) {
|
||||
navController.navigate(R.id.repo_fragment);
|
||||
nav.setSelectedItemId(R.id.repo_nav);
|
||||
}
|
||||
break;
|
||||
case "settings":
|
||||
nav.setSelectedItemId(R.id.settings_fragment);
|
||||
break;
|
||||
default:
|
||||
var data = intent.getData();
|
||||
if (data.getScheme().equals("module")) {
|
||||
if (data != null && data.getScheme().equals("module")) {
|
||||
navController.navigate(
|
||||
NavGraphDirections.actionAppListFragment(
|
||||
data.getHost(),
|
||||
data.getPort())
|
||||
);
|
||||
new Uri.Builder().scheme("lsposed").authority("module").appendQueryParameter("modulePackageName", data.getHost()).appendQueryParameter("moduleUserId", String.valueOf(data.getPort())).build(),
|
||||
new NavOptions.Builder().setEnterAnim(R.anim.fragment_enter).setExitAnim(R.anim.fragment_exit).setPopEnterAnim(R.anim.fragment_enter_pop).setPopExitAnim(R.anim.fragment_exit_pop).setLaunchSingleTop(true).setPopUpTo(navController.getGraph().getStartDestinationId(), false, true).build());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ public class AppListFragment extends BaseFragment {
|
|||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
if (module == null) {
|
||||
getNavController().navigate(R.id.action_app_list_fragment_to_modules_fragment);
|
||||
getNavController().navigate(AppListFragmentDirections.actionAppListFragmentToModulesFragment());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -178,7 +178,7 @@ public class AppListFragment extends BaseFragment {
|
|||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
scopeAdapter.unregisterAdapterDataObserver(observer);
|
||||
if (scopeAdapter != null) scopeAdapter.unregisterAdapterDataObserver(observer);
|
||||
binding = null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ import androidx.constraintlayout.widget.ConstraintLayout;
|
|||
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.navigation.NavOptions;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
|
@ -321,7 +322,10 @@ public class ModulesFragment extends BaseFragment implements ModuleUtil.ModuleLi
|
|||
.show();
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_repo) {
|
||||
getNavController().navigate(ModulesFragmentDirections.actionModulesFragmentToRepoItemFragment(selectedModule.packageName, selectedModule.getAppName()));
|
||||
var navController = getNavController();
|
||||
navController.navigate(
|
||||
new Uri.Builder().scheme("lsposed").authority("repo").appendQueryParameter("modulePackageName", selectedModule.packageName).build(),
|
||||
new NavOptions.Builder().setEnterAnim(R.anim.fragment_enter).setExitAnim(R.anim.fragment_exit).setPopEnterAnim(R.anim.fragment_enter_pop).setPopExitAnim(R.anim.fragment_exit_pop).setLaunchSingleTop(true).setPopUpTo(getNavController().getGraph().getStartDestinationId(), false, true).build());
|
||||
return true;
|
||||
} else if (itemId == R.id.menu_compile_speed) {
|
||||
CompileDialogFragment.speed(getChildFragmentManager(), selectedModule.pkg.applicationInfo);
|
||||
|
|
|
|||
|
|
@ -312,7 +312,7 @@ public class RepoFragment extends BaseFragment implements RepoLoader.RepoListene
|
|||
|
||||
holder.itemView.setOnClickListener(v -> {
|
||||
searchView.clearFocus();
|
||||
getNavController().navigate(RepoFragmentDirections.actionRepoFragmentToRepoItemFragment(module.getName(), module.getDescription()));
|
||||
getNavController().navigate(RepoFragmentDirections.actionRepoFragmentToRepoItemFragment(module.getName()));
|
||||
});
|
||||
holder.itemView.setTooltipText(module.getDescription());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@
|
|||
android:tint="?attr/colorControlNormal"
|
||||
android:autoMirrored="true">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:fillColor="@color/ic_launcher_foreground"
|
||||
android:pathData="M19,3h-4.18C14.4,1.84 13.3,1 12,1c-1.3,0 -2.4,0.84 -2.82,2L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM12,3c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM14,17L7,17v-2h7v2zM17,13L7,13v-2h10v2zM17,9L7,9L7,7h10v2z"/>
|
||||
</vector>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@
|
|||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:fillColor="@color/ic_launcher_foreground"
|
||||
android:pathData="M20.5,11H19V7c0,-1.1 -0.9,-2 -2,-2h-4V3.5C13,2.12 11.88,1 10.5,1S8,2.12 8,3.5V5H4c-1.1,0 -1.99,0.9 -1.99,2v3.8H3.5c1.49,0 2.7,1.21 2.7,2.7s-1.21,2.7 -2.7,2.7H2V20c0,1.1 0.9,2 2,2h3.8v-1.5c0,-1.49 1.21,-2.7 2.7,-2.7 1.49,0 2.7,1.21 2.7,2.7V22H17c1.1,0 2,-0.9 2,-2v-4h1.5c1.38,0 2.5,-1.12 2.5,-2.5S21.88,11 20.5,11z"/>
|
||||
</vector>
|
||||
|
|
|
|||
|
|
@ -5,6 +5,6 @@
|
|||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:fillColor="@color/ic_launcher_foreground"
|
||||
android:pathData="M19,9h-4V3H9v6H5l7,7 7,-7zM5,18v2h14v-2H5z"/>
|
||||
</vector>
|
||||
|
|
|
|||
|
|
@ -1,11 +0,0 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24"
|
||||
android:viewportHeight="24"
|
||||
android:tint="?attr/colorControlNormal"
|
||||
android:autoMirrored="true">
|
||||
<path
|
||||
android:fillColor="@color/material_blue_500"
|
||||
android:pathData="M19,3h-4.18C14.4,1.84 13.3,1 12,1s-2.4,0.84 -2.82,2L5,3c-1.1,0 -2,0.9 -2,2v14c0,1.1 0.9,2 2,2h14c1.1,0 2,-0.9 2,-2L21,5c0,-1.1 -0.9,-2 -2,-2zM12,3c0.55,0 1,0.45 1,1s-0.45,1 -1,1 -1,-0.45 -1,-1 0.45,-1 1,-1zM13,17L8,17c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h5c0.55,0 1,0.45 1,1s-0.45,1 -1,1zM16,13L8,13c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h8c0.55,0 1,0.45 1,1s-0.45,1 -1,1zM16,9L8,9c-0.55,0 -1,-0.45 -1,-1s0.45,-1 1,-1h8c0.55,0 1,0.45 1,1s-0.45,1 -1,1z" />
|
||||
</vector>
|
||||
|
|
@ -19,11 +19,11 @@
|
|||
-->
|
||||
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/material_grey_100" />
|
||||
<background android:drawable="@color/ic_launcher_background" />
|
||||
<foreground>
|
||||
<!-- 44dp icon scaled to 52dp in 72dp, padding = (1-52/44*24/72)/2 -->
|
||||
<inset
|
||||
android:drawable="@drawable/ic_round_assignment_24"
|
||||
android:drawable="@drawable/ic_baseline_assignment_24"
|
||||
android:inset="30.303%" />
|
||||
</foreground>
|
||||
</adaptive-icon>
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
-->
|
||||
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/material_grey_100" />
|
||||
<background android:drawable="@color/ic_launcher_background" />
|
||||
<foreground>
|
||||
<!-- 44dp icon scaled to 52dp in 72dp, padding = (1-52/44*24/72)/2 -->
|
||||
<inset
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@
|
|||
-->
|
||||
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/material_grey_100" />
|
||||
<background android:drawable="@color/ic_launcher_background" />
|
||||
<foreground>
|
||||
<!-- 44dp icon scaled to 52dp in 72dp, padding = (1-52/44*24/72)/2 -->
|
||||
<inset
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ 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) 2022 LSPosed Contributors
|
||||
-->
|
||||
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@color/ic_launcher_background" />
|
||||
<foreground>
|
||||
<!-- 44dp icon scaled to 52dp in 72dp, padding = (1-52/44*24/72)/2 -->
|
||||
<inset
|
||||
android:drawable="@drawable/ic_baseline_settings_24"
|
||||
android:inset="30.303%" />
|
||||
</foreground>
|
||||
</adaptive-icon>
|
||||
|
|
@ -38,7 +38,7 @@
|
|||
app:layout_constraintLeft_toRightOf="@id/nav"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navGraph="@navigation/nav_graph" />
|
||||
app:navGraph="@navigation/main_nav" />
|
||||
|
||||
<com.google.android.material.navigationrail.NavigationRailView
|
||||
android:id="@+id/nav"
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@
|
|||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navGraph="@navigation/nav_graph" />
|
||||
app:navGraph="@navigation/main_nav" />
|
||||
|
||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
android:id="@+id/nav"
|
||||
|
|
|
|||
|
|
@ -18,32 +18,27 @@
|
|||
-->
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/repo_fragment"
|
||||
android:id="@+id/repo_nav"
|
||||
android:icon="@drawable/ic_get_app_checkable"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/module_repo" />
|
||||
|
||||
<item
|
||||
android:id="@+id/modules_fragment"
|
||||
android:id="@+id/modules_nav"
|
||||
android:icon="@drawable/ic_extension_checkable"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/Modules" />
|
||||
|
||||
<item
|
||||
android:id="@+id/main_fragment"
|
||||
android:icon="@drawable/ic_home_checkable"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/overview" />
|
||||
|
||||
<item
|
||||
android:id="@+id/logs_fragment"
|
||||
android:icon="@drawable/ic_assignment_checkable"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/Logs" />
|
||||
|
||||
<item
|
||||
android:id="@+id/settings_fragment"
|
||||
android:icon="@drawable/ic_settings_checkable"
|
||||
android:menuCategory="container"
|
||||
android:title="@string/Settings" />
|
||||
</menu>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,39 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ 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
|
||||
-->
|
||||
|
||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/nav_graph"
|
||||
app:startDestination="@id/main_fragment">
|
||||
<fragment
|
||||
android:id="@+id/main_fragment"
|
||||
android:name="org.lsposed.manager.ui.fragment.HomeFragment"
|
||||
android:label="main" />
|
||||
<fragment
|
||||
android:id="@+id/logs_fragment"
|
||||
android:name="org.lsposed.manager.ui.fragment.LogsFragment"
|
||||
android:label="logs" />
|
||||
<fragment
|
||||
android:id="@+id/settings_fragment"
|
||||
android:name="org.lsposed.manager.ui.fragment.SettingsFragment"
|
||||
android:label="settings" />
|
||||
|
||||
<include app:graph="@navigation/modules_nav" />
|
||||
<include app:graph="@navigation/repo_nav" />
|
||||
</navigation>
|
||||
|
|
@ -0,0 +1,59 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ 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
|
||||
-->
|
||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/modules_nav"
|
||||
app:startDestination="@id/modules_fragment">
|
||||
<fragment
|
||||
android:id="@+id/modules_fragment"
|
||||
android:name="org.lsposed.manager.ui.fragment.ModulesFragment"
|
||||
android:label="modules">
|
||||
<action
|
||||
android:id="@+id/action_modules_fragment_to_app_list_fragment"
|
||||
app:destination="@id/app_list_fragment"
|
||||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/app_list_fragment"
|
||||
android:name="org.lsposed.manager.ui.fragment.AppListFragment"
|
||||
android:label="app_list">
|
||||
<argument
|
||||
android:name="modulePackageName"
|
||||
app:argType="string" />
|
||||
|
||||
<argument
|
||||
android:name="moduleUserId"
|
||||
app:argType="integer" />
|
||||
<deepLink
|
||||
android:id="@+id/repo_item_deeplink"
|
||||
app:uri="lsposed://module?modulePackageName={modulePackageName}&moduleUserId={moduleUserId}" />
|
||||
</fragment>
|
||||
<action
|
||||
android:id="@+id/action_app_list_fragment_to_modules_fragment"
|
||||
app:destination="@id/modules_fragment"
|
||||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop"
|
||||
app:popUpTo="@id/main_fragment"
|
||||
app:popUpToInclusive="true" />
|
||||
</navigation>
|
||||
|
|
@ -1,117 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ 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
|
||||
-->
|
||||
|
||||
<navigation xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/nav_graph"
|
||||
app:startDestination="@id/main_fragment">
|
||||
<fragment
|
||||
android:id="@+id/main_fragment"
|
||||
android:name="org.lsposed.manager.ui.fragment.HomeFragment"
|
||||
android:label="main"/>
|
||||
<fragment
|
||||
android:id="@+id/logs_fragment"
|
||||
android:name="org.lsposed.manager.ui.fragment.LogsFragment"
|
||||
android:label="logs" />
|
||||
<fragment
|
||||
android:id="@+id/modules_fragment"
|
||||
android:name="org.lsposed.manager.ui.fragment.ModulesFragment"
|
||||
android:label="modules">
|
||||
<action
|
||||
android:id="@+id/action_modules_fragment_to_app_list_fragment"
|
||||
app:destination="@id/app_list_fragment"
|
||||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop" />
|
||||
<action
|
||||
android:id="@+id/action_modules_fragment_to_repo_item_fragment"
|
||||
app:destination="@id/repo_item_fragment"
|
||||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/settings_fragment"
|
||||
android:name="org.lsposed.manager.ui.fragment.SettingsFragment"
|
||||
android:label="settings" />
|
||||
<fragment
|
||||
android:id="@+id/app_list_fragment"
|
||||
android:name="org.lsposed.manager.ui.fragment.AppListFragment"
|
||||
android:label="app_list">
|
||||
<argument
|
||||
android:name="modulePackageName"
|
||||
app:argType="string" />
|
||||
|
||||
<argument
|
||||
android:name="moduleUserId"
|
||||
app:argType="integer" />
|
||||
<action
|
||||
android:id="@+id/action_app_list_fragment_to_modules_fragment"
|
||||
app:destination="@id/modules_fragment"
|
||||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop"
|
||||
app:popUpTo="@id/main_fragment"
|
||||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/repo_fragment"
|
||||
android:name="org.lsposed.manager.ui.fragment.RepoFragment"
|
||||
android:label="repo">
|
||||
<action
|
||||
android:id="@+id/action_repo_fragment_to_repo_item_fragment"
|
||||
app:destination="@id/repo_item_fragment"
|
||||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/repo_item_fragment"
|
||||
android:name="org.lsposed.manager.ui.fragment.RepoItemFragment"
|
||||
android:label="repo_item">
|
||||
<argument
|
||||
android:name="modulePackageName"
|
||||
app:argType="string" />
|
||||
|
||||
<argument
|
||||
android:name="moduleName"
|
||||
app:argType="string" />
|
||||
|
||||
<action
|
||||
android:id="@+id/action_repo_item_fragment_to_repo_fragment"
|
||||
app:destination="@id/repo_fragment"
|
||||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop"
|
||||
app:popUpTo="@id/main_fragment"
|
||||
app:popUpToInclusive="true" />
|
||||
</fragment>
|
||||
<action
|
||||
android:id="@+id/action_app_list_fragment"
|
||||
app:destination="@id/app_list_fragment"
|
||||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop" />
|
||||
</navigation>
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
~ 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
|
||||
-->
|
||||
<navigation android:id="@+id/repo_nav"
|
||||
app:startDestination="@id/repo_fragment"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<fragment
|
||||
android:id="@+id/repo_fragment"
|
||||
android:label="repo"
|
||||
android:name="org.lsposed.manager.ui.fragment.RepoFragment">
|
||||
<action
|
||||
android:id="@+id/action_repo_fragment_to_repo_item_fragment"
|
||||
app:destination="@id/repo_item_fragment"
|
||||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop" />
|
||||
</fragment>
|
||||
<fragment
|
||||
android:id="@+id/repo_item_fragment"
|
||||
android:name="org.lsposed.manager.ui.fragment.RepoItemFragment"
|
||||
android:label="repo_item">
|
||||
<argument
|
||||
android:name="modulePackageName"
|
||||
app:argType="string" />
|
||||
|
||||
<action
|
||||
android:id="@+id/action_repo_item_fragment_to_repo_fragment"
|
||||
app:destination="@id/repo_fragment"
|
||||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop"
|
||||
app:popUpTo="@id/main_fragment"
|
||||
app:popUpToInclusive="true" />
|
||||
<deepLink
|
||||
android:id="@+id/repo_item_deeplink"
|
||||
app:uri="lsposed://repo?modulePackageName={modulePackageName}" />
|
||||
</fragment>
|
||||
</navigation>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_foreground">@android:color/system_accent1_800</color>
|
||||
<color name="ic_launcher_background">@android:color/system_accent1_200</color>
|
||||
</resources>
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="ic_launcher_foreground">@android:color/system_accent1_0</color>
|
||||
<color name="ic_launcher_background">@android:color/system_accent1_600</color>
|
||||
</resources>
|
||||
|
|
@ -28,8 +28,8 @@
|
|||
android:shortcutShortLabel="@string/Modules">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetClass="org.lsposed.manager.ui.activity.MainActivity"
|
||||
android:data="modules"
|
||||
android:targetClass="org.lsposed.manager.ui.activity.MainActivity"
|
||||
android:targetPackage="org.lsposed.manager" />
|
||||
</shortcut>
|
||||
<shortcut
|
||||
|
|
@ -40,8 +40,8 @@
|
|||
android:shortcutShortLabel="@string/Logs">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetClass="org.lsposed.manager.ui.activity.MainActivity"
|
||||
android:data="logs"
|
||||
android:targetClass="org.lsposed.manager.ui.activity.MainActivity"
|
||||
android:targetPackage="org.lsposed.manager" />
|
||||
</shortcut>
|
||||
<shortcut
|
||||
|
|
@ -52,8 +52,20 @@
|
|||
android:shortcutShortLabel="@string/module_repo">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:targetClass="org.lsposed.manager.ui.activity.MainActivity"
|
||||
android:data="repo"
|
||||
android:targetClass="org.lsposed.manager.ui.activity.MainActivity"
|
||||
android:targetPackage="org.lsposed.manager" />
|
||||
</shortcut>
|
||||
<shortcut
|
||||
android:enabled="true"
|
||||
android:icon="@drawable/shortcut_ic_settings"
|
||||
android:shortcutId="settings"
|
||||
android:shortcutLongLabel="@string/Settings"
|
||||
android:shortcutShortLabel="@string/Settings">
|
||||
<intent
|
||||
android:action="android.intent.action.MAIN"
|
||||
android:data="settings"
|
||||
android:targetClass="org.lsposed.manager.ui.activity.MainActivity"
|
||||
android:targetPackage="org.lsposed.manager" />
|
||||
</shortcut>
|
||||
</shortcuts>
|
||||
|
|
|
|||
|
|
@ -207,7 +207,7 @@ public class LSPManagerService extends ILSPManagerService.Stub {
|
|||
public static PendingIntent getNotificationIntent(String modulePackageName, int moduleUserId) {
|
||||
try {
|
||||
var intent = (Intent) getManagerIntent().clone();
|
||||
intent.setData(Uri.parse("module://" + modulePackageName + ":" + moduleUserId));
|
||||
intent.setData(new Uri.Builder().scheme("module").encodedAuthority(modulePackageName + ":" + moduleUserId).build());
|
||||
return PendingIntent.getActivity(new FakeContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT | PendingIntent.FLAG_IMMUTABLE);
|
||||
} catch (Throwable e) {
|
||||
Log.e(TAG, "get notification intent", e);
|
||||
|
|
@ -311,7 +311,7 @@ public class LSPManagerService extends ILSPManagerService.Stub {
|
|||
for (var shortcutInfo : sm.getPinnedShortcuts()) {
|
||||
if (SHORTCUT_ID.equals(shortcutInfo.getId()) && shortcutInfo.isPinned()) {
|
||||
var shortcutIntent = sm.createShortcutResultIntent(shortcutInfo);
|
||||
var request = (LauncherApps.PinItemRequest)shortcutIntent.getParcelableExtra(LauncherApps.EXTRA_PIN_ITEM_REQUEST);
|
||||
var request = (LauncherApps.PinItemRequest) shortcutIntent.getParcelableExtra(LauncherApps.EXTRA_PIN_ITEM_REQUEST);
|
||||
var requestInfo = request.getShortcutInfo();
|
||||
// https://cs.android.com/android/platform/superproject/+/android-8.1.0_r1:frameworks/base/services/core/java/com/android/server/pm/ShortcutRequestPinProcessor.java;drc=4ad6b57700bef4c484021f49e018117046562e6b;l=337
|
||||
if (requestInfo.isPinned()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue