Fixed the app restarting not working properly

* Using [``process-phoenix``](https://github.com/JakeWharton/ProcessPhoenix)
This commit is contained in:
litetex 2021-09-06 20:47:44 +02:00
parent 6a1d81fcf3
commit fda0a550fd
4 changed files with 19 additions and 3 deletions

View file

@ -58,6 +58,8 @@ import java.util.ArrayList;
import static org.schabi.newpipe.util.external_communication.ShareUtils.installApp;
import com.jakewharton.processphoenix.ProcessPhoenix;
public final class NavigationHelper {
public static final String MAIN_FRAGMENT_TAG = "main_fragment_tag";
public static final String SEARCH_FRAGMENT_TAG = "search_fragment_tag";
@ -607,8 +609,7 @@ public final class NavigationHelper {
*/
public static void restartApp(final Activity activity) {
NewPipeDatabase.close();
activity.finishAffinity();
final Intent intent = new Intent(activity, MainActivity.class);
activity.startActivity(intent);
ProcessPhoenix.triggerRebirth(activity.getApplicationContext());
}
}