1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2026-04-04 22:11:23 +00:00

Complete the debug screen migration to Compose with Nav3

- Completed the UI and logic for pending items of Debug screen using Jetpack Compose.
- Implemented a new navigation system for settings using the navigation3
  lib as it is now stable.
- Reuses the `ScaffoldWithToolbar` composable and removed the previous
  `Toolbar` composable to avoid redundancy in code.
- Refactored the `SettingsViewModel` to use a `BooleanPreference` helper
  class to reuse and reducing boilerplate for state management.
- Created a shared `TextBase` composable to remove duplicated UI logic
  between `SwitchPreference` and `TextPreference`.
- Move the build-variant-dependent logic for LeakCanary and reused it in
  Compose and Fragment, this logic is used for ensuring the leak canary
  fields are only enabled in debug variants.
- Fixed a layout bug in `SwitchPreference` where long summary text could
  misalign the switch component and also adjusted the paddings for consistency.
This commit is contained in:
Hatake Kakashri
2025-11-15 11:23:08 +05:30
committed by Ida Delphine
parent 5fafccba33
commit de344100db
18 changed files with 784 additions and 210 deletions

View File

@@ -1,20 +0,0 @@
package org.schabi.newpipe.settings;
import android.content.Intent;
import leakcanary.LeakCanary;
/**
* Build variant dependent (BVD) leak canary API implementation for the debug settings fragment.
* This class is loaded via reflection by
* {@link DebugSettingsFragment.DebugSettingsBVDLeakCanaryAPI}.
*/
@SuppressWarnings("unused") // Class is used but loaded via reflection
public class DebugSettingsBVDLeakCanary
implements DebugSettingsFragment.DebugSettingsBVDLeakCanaryAPI {
@Override
public Intent getNewLeakDisplayActivityIntent() {
return LeakCanary.INSTANCE.newLeakDisplayActivityIntent();
}
}

View File

@@ -0,0 +1,23 @@
/*
* SPDX-FileCopyrightText: 2025-2026 NewPipe e.V. <https://newpipe-ev.de>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package org.schabi.newpipe.settings
import android.content.Intent
import leakcanary.LeakCanary.newLeakDisplayActivityIntent
/**
* Build variant dependent (BVD) leak canary API implementation for the debug settings fragment.
* This class is loaded via reflection by
* [DebugSettingsBVDLeakCanaryAPI].
*/
@Suppress("unused") // Class is used but loaded via reflection
class DebugSettingsBVDLeakCanary :
DebugSettingsBVDLeakCanaryAPI {
override fun getNewLeakDisplayActivityIntent(): Intent {
return newLeakDisplayActivityIntent()
}
}