Skip to content

Commit 12ce81c

Browse files
committed
feat: Refine Android header UI
1 parent 0eae4a1 commit 12ce81c

File tree

1 file changed

+43
-34
lines changed

1 file changed

+43
-34
lines changed

android/app/src/main/java/com/example/gutenbergkit/EditorActivity.kt

Lines changed: 43 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import android.content.pm.ApplicationInfo
66
import androidx.activity.ComponentActivity
77
import androidx.activity.compose.setContent
88
import androidx.activity.enableEdgeToEdge
9+
import androidx.compose.foundation.layout.Box
910
import androidx.compose.foundation.layout.fillMaxSize
1011
import androidx.compose.foundation.layout.padding
1112
import androidx.compose.material.icons.Icons
@@ -20,6 +21,7 @@ import androidx.compose.material3.Icon
2021
import androidx.compose.material3.IconButton
2122
import androidx.compose.material3.Scaffold
2223
import androidx.compose.material3.Text
24+
import androidx.compose.material3.TextButton
2325
import androidx.compose.material3.TopAppBar
2426
import androidx.compose.runtime.Composable
2527
import androidx.compose.runtime.getValue
@@ -95,41 +97,48 @@ fun EditorScreen(
9597
contentDescription = "Redo"
9698
)
9799
}
98-
IconButton(onClick = { showMenu = true }) {
99-
Icon(
100-
imageVector = Icons.Default.MoreVert,
101-
contentDescription = "More options"
102-
)
100+
TextButton(onClick = { }, enabled = false) {
101+
Text("PUBLISH")
103102
}
104-
DropdownMenu(
105-
expanded = showMenu,
106-
onDismissRequest = { showMenu = false }
107-
) {
108-
DropdownMenuItem(
109-
text = { Text("Save") },
110-
onClick = { },
111-
enabled = false
112-
)
113-
DropdownMenuItem(
114-
text = { Text("Preview") },
115-
onClick = { },
116-
enabled = false
117-
)
118-
DropdownMenuItem(
119-
text = { Text("Code Editor") },
120-
onClick = { },
121-
enabled = false
122-
)
123-
DropdownMenuItem(
124-
text = { Text("Post Settings") },
125-
onClick = { },
126-
enabled = false
127-
)
128-
DropdownMenuItem(
129-
text = { Text("Help") },
130-
onClick = { },
131-
enabled = false
132-
)
103+
104+
// Overflow menu button and dropdown in Box for proper anchoring
105+
Box {
106+
IconButton(onClick = { showMenu = true }) {
107+
Icon(
108+
imageVector = Icons.Default.MoreVert,
109+
contentDescription = "More options"
110+
)
111+
}
112+
DropdownMenu(
113+
expanded = showMenu,
114+
onDismissRequest = { showMenu = false }
115+
) {
116+
DropdownMenuItem(
117+
text = { Text("Save") },
118+
onClick = { },
119+
enabled = false
120+
)
121+
DropdownMenuItem(
122+
text = { Text("Preview") },
123+
onClick = { },
124+
enabled = false
125+
)
126+
DropdownMenuItem(
127+
text = { Text("Code editor") },
128+
onClick = { },
129+
enabled = false
130+
)
131+
DropdownMenuItem(
132+
text = { Text("Post settings") },
133+
onClick = { },
134+
enabled = false
135+
)
136+
DropdownMenuItem(
137+
text = { Text("Help") },
138+
onClick = { },
139+
enabled = false
140+
)
141+
}
133142
}
134143
}
135144
)

0 commit comments

Comments
 (0)