[app] Fix crash of RepoItemFrag when module not found (#806)
* [app] Fix crash of RepoItemFrag when module not found * Fix popup * Fix tablet
This commit is contained in:
parent
4b769db0d5
commit
14e084e1c9
|
|
@ -194,16 +194,17 @@ dependencies {
|
|||
implementation("androidx.activity:activity:1.2.3")
|
||||
implementation("androidx.browser:browser:1.3.0")
|
||||
implementation("androidx.constraintlayout:constraintlayout:2.0.4")
|
||||
implementation("androidx.core:core:1.5.0")
|
||||
implementation("androidx.core:core:1.6.0")
|
||||
implementation("androidx.fragment:fragment:1.3.5")
|
||||
implementation("androidx.navigation:navigation-fragment:$navVersion")
|
||||
implementation("androidx.navigation:navigation-ui:$navVersion")
|
||||
implementation("androidx.recyclerview:recyclerview:1.2.1")
|
||||
implementation("androidx.slidingpanelayout:slidingpanelayout:1.2.0-alpha03")
|
||||
implementation("androidx.swiperefreshlayout:swiperefreshlayout:1.1.0")
|
||||
implementation("com.caverock:androidsvg-aar:1.4")
|
||||
implementation("com.github.bumptech.glide:glide:$glideVersion")
|
||||
implementation("com.github.bumptech.glide:okhttp3-integration:$glideVersion")
|
||||
implementation("com.google.android.material:material:1.3.0")
|
||||
implementation("com.google.android.material:material:1.4.0")
|
||||
implementation("com.google.code.gson:gson:2.8.7")
|
||||
implementation("com.takisoft.preferencex:preferencex:1.1.0")
|
||||
implementation("com.takisoft.preferencex:preferencex-colorpicker:1.1.0")
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ public class RepoLoader {
|
|||
}
|
||||
|
||||
public OnlineModule getOnlineModule(String packageName) {
|
||||
return onlineModules.get(packageName);
|
||||
return packageName == null ? null : onlineModules.get(packageName);
|
||||
}
|
||||
|
||||
public Collection<OnlineModule> getOnlineModules() {
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ import android.os.Bundle;
|
|||
import android.text.TextUtils;
|
||||
import android.view.KeyEvent;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.navigation.NavController;
|
||||
|
|
@ -84,6 +85,15 @@ public class MainActivity extends BaseActivity {
|
|||
return;
|
||||
}
|
||||
NavController navController = navHostFragment.getNavController();
|
||||
if (binding.homeFragment != null) {
|
||||
navController.addOnDestinationChangedListener((controller, destination, arguments) -> {
|
||||
if (destination.getId() == R.id.main_fragment) {
|
||||
binding.navHostFragment.setVisibility(View.GONE);
|
||||
} else {
|
||||
binding.navHostFragment.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
if (intent.getAction() != null && intent.getAction().equals("android.intent.action.APPLICATION_PREFERENCES")) {
|
||||
navController.navigate(R.id.action_settings_fragment);
|
||||
} else if (intent.hasExtra("modulePackageName")) {
|
||||
|
|
|
|||
|
|
@ -35,17 +35,8 @@ public class BaseFragment extends Fragment {
|
|||
}
|
||||
|
||||
public NavController getNavController() {
|
||||
View view = getView();
|
||||
if (view == null) {
|
||||
return NavHostFragment.findNavController(this);
|
||||
}
|
||||
View tabletFragmentContainer = view.findViewById(R.id.tablet_nav_container);
|
||||
if (tabletFragmentContainer != null) {
|
||||
return Navigation.findNavController(tabletFragmentContainer);
|
||||
} else {
|
||||
return Navigation.findNavController(view);
|
||||
}
|
||||
}
|
||||
|
||||
public void setupToolbar(Toolbar toolbar, int title) {
|
||||
setupToolbar(toolbar, getString(title), -1);
|
||||
|
|
|
|||
|
|
@ -106,8 +106,9 @@ public class RepoItemFragment extends BaseFragment implements RepoLoader.Listene
|
|||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
|
||||
binding = FragmentPagerBinding.inflate(getLayoutInflater(), container, false);
|
||||
String modulePackageName = getArguments().getString("modulePackageName");
|
||||
String moduleName = getArguments().getString("moduleName");
|
||||
if (module == null) return binding.getRoot();
|
||||
String modulePackageName = module.getName();
|
||||
String moduleName = module.getDescription();
|
||||
binding.getRoot().bringChildToFront(binding.appBar);
|
||||
setupToolbar(binding.toolbar, moduleName, R.menu.menu_repo_item);
|
||||
binding.toolbar.setSubtitle(modulePackageName);
|
||||
|
|
@ -137,9 +138,10 @@ public class RepoItemFragment extends BaseFragment implements RepoLoader.Listene
|
|||
RepoLoader.getInstance().addListener(this);
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
String modulePackageName = getArguments().getString("modulePackageName");
|
||||
String modulePackageName = getArguments() == null ? null : getArguments().getString("modulePackageName");
|
||||
module = RepoLoader.getInstance().getOnlineModule(modulePackageName);
|
||||
|
||||
if (module == null)
|
||||
getNavController().navigate(R.id.action_repo_item_fragment_to_repo_fragment);
|
||||
}
|
||||
|
||||
private void renderGithubMarkdown(WebView view, String text) {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
|
||||
<androidx.slidingpanelayout.widget.SlidingPaneLayout
|
||||
android:id="@+id/snackbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:animateLayoutChanges="true" >
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/home_fragment"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:name="org.lsposed.manager.ui.fragment.HomeFragment"/>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/nav_host_fragment"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="3"
|
||||
app:defaultNavHost="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:navGraph="@navigation/nav_graph" />
|
||||
</androidx.slidingpanelayout.widget.SlidingPaneLayout>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
<!--
|
||||
~ 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
|
||||
-->
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:consumeSystemWindowsInsets="start|end"
|
||||
app:edgeToEdge="true"
|
||||
app:fitsSystemWindowsInsets="start|end">
|
||||
|
||||
<androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||
android:id="@+id/snackbar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1">
|
||||
|
||||
<include layout="@layout/fragment_home" />
|
||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
||||
|
||||
<androidx.fragment.app.FragmentContainerView
|
||||
android:id="@+id/tablet_nav_container"
|
||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
app:defaultNavHost="false"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintHorizontal_weight="1"
|
||||
app:layout_constraintStart_toEndOf="@+id/snackbar"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:navGraph="@navigation/sub_nav_graph" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
@ -125,6 +125,16 @@
|
|||
<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_settings_fragment"
|
||||
|
|
@ -132,28 +142,36 @@
|
|||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop" />
|
||||
app:popExitAnim="@anim/fragment_exit_pop"
|
||||
app:popUpTo="@id/settings_fragment"
|
||||
app:popUpToInclusive="true" />
|
||||
<action
|
||||
android:id="@+id/action_logs_fragment"
|
||||
app:destination="@id/logs_fragment"
|
||||
app:enterAnim="@anim/fragment_enter"
|
||||
app:exitAnim="@anim/fragment_exit"
|
||||
app:popEnterAnim="@anim/fragment_enter_pop"
|
||||
app:popExitAnim="@anim/fragment_exit_pop" />
|
||||
app:popExitAnim="@anim/fragment_exit_pop"
|
||||
app:popUpTo="@id/logs_fragment"
|
||||
app:popUpToInclusive="true" />
|
||||
<action
|
||||
android:id="@+id/action_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:popExitAnim="@anim/fragment_exit_pop"
|
||||
app:popUpTo="@id/repo_fragment"
|
||||
app:popUpToInclusive="true" />
|
||||
<action
|
||||
android:id="@+id/action_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:popExitAnim="@anim/fragment_exit_pop"
|
||||
app:popUpTo="@id/modules_fragment"
|
||||
app:popUpToInclusive="true" />
|
||||
<action
|
||||
android:id="@+id/action_app_list_fragment"
|
||||
app:destination="@id/app_list_fragment"
|
||||
|
|
|
|||
|
|
@ -1,115 +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_details"
|
||||
app:startDestination="@id/modules_fragment">
|
||||
<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" />
|
||||
</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" />
|
||||
</fragment>
|
||||
<action
|
||||
android:id="@+id/action_settings_fragment"
|
||||
app:destination="@id/settings_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_logs_fragment"
|
||||
app:destination="@id/logs_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_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" />
|
||||
<action
|
||||
android:id="@+id/action_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" />
|
||||
</navigation>
|
||||
|
|
@ -25,7 +25,7 @@ buildscript {
|
|||
mavenCentral()
|
||||
}
|
||||
dependencies {
|
||||
classpath("com.android.tools.build:gradle:7.0.0-beta04")
|
||||
classpath("com.android.tools.build:gradle:7.0.0-beta05")
|
||||
classpath("org.eclipse.jgit:org.eclipse.jgit:5.10.0.202012080955-r")
|
||||
classpath("androidx.navigation:navigation-safe-args-gradle-plugin:2.3.5")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,7 +60,7 @@ dependencies {
|
|||
implementation("dev.rikka.ndk:riru:${moduleMinRiruVersionName}")
|
||||
implementation("dev.rikka.ndk.thirdparty:cxx:1.1.0")
|
||||
implementation("io.github.vvb2060.ndk:dobby:1.2")
|
||||
implementation("com.android.tools.build:apksig:7.0.0-beta03")
|
||||
implementation("com.android.tools.build:apksig:7.0.0-beta05")
|
||||
implementation("org.apache.commons:commons-lang3:3.12.0")
|
||||
implementation("de.upb.cs.swt:axml:2.1.1")
|
||||
compileOnly(project(":hiddenapi-stubs"))
|
||||
|
|
|
|||
Loading…
Reference in New Issue