Skip to content

Commit 7b98b40

Browse files
authored
Merge pull request #13447 from TeamNewPipe/about-activity
remove AboutActivity
2 parents 9bd9a5c + 2ebb0dc commit 7b98b40

7 files changed

Lines changed: 29 additions & 38 deletions

File tree

app/src/main/AndroidManifest.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,6 @@
9595
android:exported="false"
9696
android:label="@string/settings" />
9797

98-
99-
<activity
100-
android:name=".about.AboutActivity"
101-
android:exported="false"
102-
android:label="@string/title_activity_about" />
103-
10498
<service
10599
android:name="androidx.work.impl.foreground.SystemForegroundService"
106100
android:foregroundServiceType="dataSync"

app/src/main/java/org/schabi/newpipe/ComposeActivity.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ class ComposeActivity : ComponentActivity() {
4949

5050
private fun resolveStartDestination(intent: Intent): NavKey {
5151
return when (intent.getStringExtra(EXTRA_SCREEN)) {
52+
SCREEN_ABOUT -> Screen.About
53+
5254
SCREEN_ERROR -> Screen.Error
5355

5456
SCREEN_SETTINGS -> Screen.Settings.Home
@@ -60,12 +62,21 @@ class ComposeActivity : ComponentActivity() {
6062
}
6163

6264
companion object {
65+
66+
const val SCREEN_ABOUT = "about"
67+
6368
const val EXTRA_SCREEN = "extra_screen"
6469
const val EXTRA_ERROR_INFO = "extra_error_info"
6570

6671
const val SCREEN_ERROR = "error"
6772
const val SCREEN_SETTINGS = "settings"
6873

74+
fun aboutIntent(context: Context): Intent {
75+
return Intent(context, ComposeActivity::class.java).apply {
76+
putExtra(EXTRA_SCREEN, SCREEN_ABOUT)
77+
}
78+
}
79+
6980
fun errorIntent(context: Context, errorInfo: ErrorInfo): Intent {
7081
return Intent(context, ComposeActivity::class.java).apply {
7182
putExtra(EXTRA_SCREEN, SCREEN_ERROR)

app/src/main/java/org/schabi/newpipe/about/AboutActivity.kt

Lines changed: 0 additions & 29 deletions
This file was deleted.

app/src/main/java/org/schabi/newpipe/navigation/NavDisplay.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import org.schabi.newpipe.ComposeActivity
2222
import org.schabi.newpipe.R
2323
import org.schabi.newpipe.error.ErrorInfo
2424
import org.schabi.newpipe.error.ErrorReportHelper
25+
import org.schabi.newpipe.ui.components.common.ScaffoldWithToolbar
26+
import org.schabi.newpipe.ui.screens.AboutScreen
2527
import org.schabi.newpipe.ui.screens.ErrorReportEvent
2628
import org.schabi.newpipe.ui.screens.ErrorReportScreen
2729
import org.schabi.newpipe.ui.screens.settings.debug.DebugScreen
@@ -55,6 +57,16 @@ fun NavDisplay(startDestination: NavKey) {
5557
rememberViewModelStoreNavEntryDecorator()
5658
),
5759
entryProvider = entryProvider {
60+
// About
61+
entry<Screen.About> {
62+
ScaffoldWithToolbar(
63+
title = stringResource(R.string.title_activity_about),
64+
onBackClick = ::onNavigateUp
65+
) { padding ->
66+
AboutScreen(padding)
67+
}
68+
}
69+
5870
// Error Report
5971
entry<Screen.Error> {
6072
val errorInfo = remember {

app/src/main/java/org/schabi/newpipe/navigation/Screen.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import kotlinx.serialization.Serializable
1111
@Serializable
1212
sealed interface Screen : NavKey {
1313

14+
@Serializable
15+
data object About : Screen
16+
1417
@Serializable
1518
data object Error : Screen
1619

app/src/main/java/org/schabi/newpipe/ui/screens/AboutScreen.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import androidx.compose.foundation.layout.padding
88
import androidx.compose.foundation.pager.HorizontalPager
99
import androidx.compose.foundation.pager.rememberPagerState
1010
import androidx.compose.material3.MaterialTheme
11+
import androidx.compose.material3.SecondaryTabRow
1112
import androidx.compose.material3.Surface
1213
import androidx.compose.material3.Tab
1314
import androidx.compose.material3.TabRow
@@ -44,7 +45,7 @@ fun AboutScreen(padding: PaddingValues) {
4445
tabIndex = pagerState.currentPage
4546
}
4647

47-
TabRow(
48+
SecondaryTabRow(
4849
selectedTabIndex = tabIndex,
4950
containerColor = MaterialTheme.colorScheme.primaryContainer
5051
) {

app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import org.schabi.newpipe.NewPipeDatabase;
3030
import org.schabi.newpipe.R;
3131
import org.schabi.newpipe.RouterActivity;
32-
import org.schabi.newpipe.about.AboutActivity;
3332
import org.schabi.newpipe.database.feed.model.FeedGroupEntity;
3433
import org.schabi.newpipe.download.DownloadActivity;
3534
import org.schabi.newpipe.error.ErrorUtil;
@@ -635,7 +634,7 @@ public static void openRouterActivity(final Context context, final String url) {
635634
}
636635

637636
public static void openAbout(final Context context) {
638-
final Intent intent = new Intent(context, AboutActivity.class);
637+
final Intent intent = ComposeActivity.Companion.aboutIntent(context);
639638
context.startActivity(intent);
640639
}
641640

0 commit comments

Comments
 (0)