Skip to content

Commit

Permalink
Use PreferenceFragment instead of MoreFragment in bottom navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
SIKV committed Jun 18, 2024
1 parent 7717634 commit 1e88255
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 81 deletions.

This file was deleted.

27 changes: 0 additions & 27 deletions app/src/main/res/layout/fragment_more.xml

This file was deleted.

2 changes: 1 addition & 1 deletion app/src/main/res/navigation/navigation.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

<fragment
android:id="@+id/more"
android:name="com.github.sikv.photos.ui.fragment.MoreFragment"
android:name="com.github.sikv.photos.preferences.PreferenceFragment"
android:label="@string/more" />

<fragment
Expand Down
1 change: 1 addition & 0 deletions feature/preferences/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ android {

dependencies {
implementation project(':common-ui')
implementation project(':compose-ui')
implementation project(':navigation')
implementation project(':theme-manager')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@ import android.view.View
import android.view.ViewGroup
import androidx.compose.runtime.collectAsState
import androidx.compose.ui.platform.ComposeView
import androidx.fragment.app.Fragment
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.github.sikv.photos.common.ui.BaseFragment
import com.github.sikv.photos.navigation.route.FeedbackRoute
import com.google.accompanist.themeadapter.material3.Mdc3Theme
import com.google.android.gms.oss.licenses.OssLicensesMenuActivity
import dagger.hilt.android.AndroidEntryPoint
import javax.inject.Inject

@AndroidEntryPoint
class PreferenceFragment : BaseFragment() {
class PreferenceFragment : Fragment() {

@Inject
lateinit var feedbackRoute: FeedbackRoute
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,30 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.dimensionResource
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import com.github.sikv.photos.compose.ui.Scaffold

@Composable
internal fun PreferenceScreen(
preferences: List<PreferenceItem>,
onPreferencePress: (PreferenceAction) -> Unit
) {
Column {
preferences.iterator().forEach { item ->
when (item) {
is PreferenceItem.Item -> PreferenceItem(
item = item,
onPress = { onPreferencePress(item.action) }
)
is PreferenceItem.Divider -> Divider(
modifier = Modifier
.padding(dimensionResource(id = R.dimen.paddingOne))
)
Scaffold(
title = { Text(text = stringResource(id = R.string.more)) }
) {
Column {
preferences.iterator().forEach { item ->
when (item) {
is PreferenceItem.Item -> PreferenceItem(
item = item,
onPress = { onPreferencePress(item.action) }
)

is PreferenceItem.Divider -> Divider(
modifier = Modifier
.padding(dimensionResource(id = R.dimen.paddingOne))
)
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions feature/preferences/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="more">More</string>
<string name="theme">Theme</string>
<string name="send_feedback">Send Feedback</string>
<string name="open_source_licences">Open Source Licences</string>
Expand Down

0 comments on commit 1e88255

Please sign in to comment.