move AppBar component to component package on root level

+ add string
+ remove unused resources

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This commit is contained in:
Marcel Hibbe 2025-03-03 17:39:44 +01:00
parent c2177f689b
commit 2b0a38240c
No known key found for this signature in database
GPG Key ID: C793F8B59F43CE7B
4 changed files with 12 additions and 31 deletions

View File

@ -1,11 +1,11 @@
/*
* Nextcloud Talk - Android Client
*
* SPDX-FileCopyrightText: 2025 Marcel Hibbe <dev@mhibbe.de>
* SPDX-FileCopyrightText: 2025 Your Name <your@email.com>
* SPDX-License-Identifier: GPL-3.0-or-later
*/
package com.nextcloud.talk.diagnose
package com.nextcloud.talk.components
import androidx.activity.compose.LocalOnBackPressedDispatcherOwner
import androidx.compose.foundation.background
@ -33,7 +33,7 @@ import com.nextcloud.talk.R
@OptIn(ExperimentalMaterial3Api::class)
@Composable
fun AppBar(title: String, menuItems: List<Pair<String, () -> Unit>>?) {
fun StandardAppBar(title: String, menuItems: List<Pair<String, () -> Unit>>?) {
val backDispatcher = LocalOnBackPressedDispatcherOwner.current?.onBackPressedDispatcher
var expanded by remember { mutableStateOf(false) }
@ -53,13 +53,16 @@ fun AppBar(title: String, menuItems: List<Pair<String, () -> Unit>>?) {
actions = {
Box {
IconButton(onClick = { expanded = true }) {
Icon(Icons.Default.MoreVert, contentDescription = "More Options")
Icon(
imageVector = Icons.Default.MoreVert,
contentDescription = stringResource(R.string.nc_common_more_options)
)
}
DropdownMenu(
expanded = expanded,
onDismissRequest = { expanded = false },
Modifier.background(colorResource(id = R.color.bg_default))
modifier = Modifier.background(color = colorResource(id = R.color.bg_default))
) {
menuItems?.forEach { (label, action) ->
DropdownMenuItem(
@ -79,5 +82,5 @@ fun AppBar(title: String, menuItems: List<Pair<String, () -> Unit>>?) {
@Preview(showBackground = true)
@Composable
fun AppBarPreview() {
AppBar("title", null)
StandardAppBar("title", null)
}

View File

@ -35,6 +35,7 @@ import com.nextcloud.talk.activities.BaseActivity
import com.nextcloud.talk.api.NcApi
import com.nextcloud.talk.application.NextcloudTalkApplication
import com.nextcloud.talk.arbitrarystorage.ArbitraryStorageManager
import com.nextcloud.talk.components.StandardAppBar
import com.nextcloud.talk.components.SetStatusBarColor
import com.nextcloud.talk.users.UserManager
import com.nextcloud.talk.utils.BrandingUtils
@ -100,7 +101,7 @@ class DiagnoseActivity : BaseActivity() {
) {
Scaffold(
topBar = {
AppBar(
StandardAppBar(
title = stringResource(R.string.nc_settings_diagnose_title),
menuItems
)

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Nextcloud Talk - Android Client
~
~ SPDX-FileCopyrightText: 2024 Marcel Hibbe <dev@mhibbe.de>
~ SPDX-License-Identifier: GPL-3.0-or-later
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:id="@+id/copy"
android:title="@string/nc_common_copy" />
<item
android:id="@+id/share"
android:title="@string/share" />
<item
android:id="@+id/send_mail"
android:title="@string/send_email" />
<item
android:id="@+id/create_issue"
android:title="@string/create_issue" />
</menu>

View File

@ -35,6 +35,7 @@ How to translate with transifex:
<string name="nc_common_disabled">Disabled</string>
<string name="nc_common_copy">Copy</string>
<string name="nc_common_copy_success">Copied to clipboard</string>
<string name="nc_common_more_options">More options</string>
<!-- Bottom Navigation -->
<string name="nc_settings">Settings</string>
@ -66,7 +67,6 @@ How to translate with transifex:
<string name="nc_nextcloud_talk_app_not_installed">%1$s not available (not installed or restricted by admin)</string>
<string name="nc_display_name_not_stored">Could not store display name, aborting</string>
<string name="nc_never">Never joined</string>
<string name="nc_search">Search</string>
<string name="nc_certificate_dialog_title">Check out the certificate</string>
@ -305,7 +305,6 @@ How to translate with transifex:
<string name="nc_call_button_content_description_audio_output">Change audio output</string>
<string name="nc_call_button_content_description_camera">Toggle camera</string>
<string name="nc_call_button_content_description_microphone">Toggle microphone</string>
<string name="nc_call_button_content_description_advanced">Advanced call options</string>
<string name="nc_call_button_content_description_hangup">Hang up</string>
<string name="nc_call_button_content_description_answer_voice_only">Answer as voice call only</string>
<string name="nc_call_button_content_description_answer_video_call">Answer as video call</string>
@ -439,7 +438,6 @@ How to translate with transifex:
<string name="nc_remote_audio_off">Remote audio off</string>
<string name="nc_add_attachment">Add attachment</string>
<string name="emoji_category_recent">Recent</string>
<string name="emoji_backspace">Backspace</string>
<plurals name="see_similar_system_messages">
<item quantity="one">See %d similar message</item>
<item quantity="other">See %d similar messages</item>