Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = ActivityCameraxBinding.inflate(getLayoutInflater());
setContentView(binding.getRoot());
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}

previewView = binding.previewView;

Expand All @@ -57,6 +60,12 @@ protected void onCreate(Bundle savedInstanceState) {
binding.backButton.setOnClickListener(view -> finish());
}

@Override
public boolean onSupportNavigateUp() {
getOnBackPressedDispatcher().onBackPressed();
return true;
}

private void startCamera() {
cameraProviderFuture = ProcessCameraProvider.getInstance(this);
cameraProviderFuture.addListener(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ class DetachAttachTabsActivity : AppCompatActivity(R.layout.activity_detach_atta
detach(tabB)
}
}
supportActionBar?.setDisplayHomeAsUpEnabled(true)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NoActionBar hides up affordance

Medium Severity

DetachAttachTabsActivity enables the ActionBar up affordance, but the manifest assigns @style/AppTheme.Main (NoActionBar), so supportActionBar is null and no on-screen back arrow appears despite the PRโ€™s AppCompat pattern.

Fix in Cursorย Fix in Web

Reviewed by Cursor Bugbot for commit 4d8253d. Configure here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's probably valid -- maybe we could adjust the layout so the buttons show up under the action bar as opposed to using NoActionBar theme

}

override fun onSupportNavigateUp(): Boolean {
onBackPressedDispatcher.onBackPressed()
return true
}

private fun showTab(index: Int) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,18 @@ import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.LinearProgressIndicator
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.ProvideTextStyle
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableIntState
import androidx.compose.runtime.mutableIntStateOf
Expand All @@ -44,29 +51,42 @@ class FrameDataForSpansActivity : ComponentActivity() {
private val model = ViewModel()
private var txn: ITransaction? = null

@OptIn(ExperimentalMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MaterialTheme {
Surface {
val infiniteTransition = rememberInfiniteTransition(label = "infiniteTransition")
val progress =
infiniteTransition.animateFloat(
label = "progress",
initialValue = 0f,
targetValue = 1f,
animationSpec =
infiniteRepeatable(animation = tween(1000), repeatMode = RepeatMode.Reverse),
Scaffold(
topBar = {
TopAppBar(
title = { Text("Frame Data for Spans") },
navigationIcon = {
IconButton(onClick = { onBackPressedDispatcher.onBackPressed() }) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
}
},
)
Column(modifier = Modifier.padding(24.dp)) {
Text(text = "Frame Data for Spans", style = MaterialTheme.typography.headlineMedium)
LinearProgressIndicator(progress = progress.value, modifier = Modifier.fillMaxWidth())
Spacer(modifier = Modifier.size(24.dp))
Text(text = "Tap to trigger a new frame render")
FrameControls(model)
Spacer(modifier = Modifier.size(24.dp))
Text(text = "Span Control")
SpanControls(model)
}
) { innerPadding ->
Surface(modifier = Modifier.padding(innerPadding)) {
val infiniteTransition = rememberInfiniteTransition(label = "infiniteTransition")
val progress =
infiniteTransition.animateFloat(
label = "progress",
initialValue = 0f,
targetValue = 1f,
animationSpec =
infiniteRepeatable(animation = tween(1000), repeatMode = RepeatMode.Reverse),
)
Column(modifier = Modifier.padding(24.dp)) {
LinearProgressIndicator(progress = progress.value, modifier = Modifier.fillMaxWidth())
Spacer(modifier = Modifier.size(24.dp))
Text(text = "Tap to trigger a new frame render")
FrameControls(model)
Spacer(modifier = Modifier.size(24.dp))
Text(text = "Span Control")
SpanControls(model)
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ class GesturesActivity : AppCompatActivity() {
binding.scrollingCrash.setOnClickListener { throw RuntimeException("Uncaught Exception") }

setContentView(binding.root)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}

override fun onSupportNavigateUp(): Boolean {
onBackPressedDispatcher.onBackPressed()
return true
}

override fun onResume() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,10 +499,7 @@ fun TracingScreen() {
item {
SentryTraced("open_second_activity") {
OutlinedButton(
onClick = {
activity.finish()
activity.startActivity(Intent(activity, SecondActivity::class.java))
},
onClick = { activity.startActivity(Intent(activity, SecondActivity::class.java)) },
modifier = Modifier,
) {
Text("Open Second Activity", maxLines = 2, overflow = TextOverflow.Ellipsis)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ class PermissionsActivity : AppCompatActivity() {
}

setContentView(binding.root)
supportActionBar?.setDisplayHomeAsUpEnabled(true)
Sentry.reportFullyDisplayed()
}

override fun onSupportNavigateUp(): Boolean {
onBackPressedDispatcher.onBackPressed()
return true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,17 @@ import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.rememberScrollState
import androidx.compose.foundation.shape.RoundedCornerShape
import androidx.compose.foundation.verticalScroll
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TopAppBar
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
Expand Down Expand Up @@ -65,6 +72,7 @@ import kotlin.math.roundToInt
import kotlin.math.sin

class ReplayAnimationsActivity : ComponentActivity() {
@OptIn(ExperimentalMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

Expand All @@ -77,7 +85,24 @@ class ReplayAnimationsActivity : ComponentActivity() {
else
lightColorScheme(primary = primaryColor, secondary = accentColor, tertiary = primaryColor)

MaterialTheme(colorScheme = colorScheme) { ReplayAnimationsScreen(onClose = { finish() }) }
MaterialTheme(colorScheme = colorScheme) {
Scaffold(
topBar = {
TopAppBar(
title = { Text("Replay Animations") },
navigationIcon = {
IconButton(onClick = { onBackPressedDispatcher.onBackPressed() }) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
}
},
)
}
) { innerPadding ->
Box(modifier = Modifier.padding(innerPadding)) {
ReplayAnimationsScreen(onClose = { finish() })
}
}
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package io.sentry.samples.android

import android.content.Intent
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
Expand All @@ -26,18 +25,22 @@ class SecondActivity : AppCompatActivity() {

binding.doRequest.setOnClickListener { updateRepos() }

binding.backMain.setOnClickListener {
finish()
startActivity(Intent(this, MainActivity::class.java))
}
binding.backMain.setOnClickListener { finish() }

// do some stuff

setContentView(binding.root)

supportActionBar?.setDisplayHomeAsUpEnabled(true)

span?.finish(SpanStatus.OK)
}

override fun onSupportNavigateUp(): Boolean {
onBackPressedDispatcher.onBackPressed()
return true
}

private fun showText(visible: Boolean = true, text: String = "") {
binding.text.text = if (visible) text else ""
binding.text.visibility = if (visible) View.VISIBLE else View.GONE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@ class ThirdActivityFragment : AppCompatActivity(R.layout.activity_third_fragment
add<ThirdFragment>(R.id.fragment_container_view, args = bundle)
}
}
supportActionBar?.setDisplayHomeAsUpEnabled(true)
}

override fun onSupportNavigateUp(): Boolean {
onBackPressedDispatcher.onBackPressed()
return true
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ public class TriggerHttpRequestActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_trigger_http_request);
if (getSupportActionBar() != null) {
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
}

dateFormat = new SimpleDateFormat("HH:mm:ss.SSS", Locale.getDefault());

Expand All @@ -60,6 +63,12 @@ protected void onCreate(Bundle savedInstanceState) {
setupClickListeners();
}

@Override
public boolean onSupportNavigateUp() {
getOnBackPressedDispatcher().onBackPressed();
return true;
}

private void initializeViews() {
urlInput = findViewById(R.id.url_input);
requestDisplay = findViewById(R.id.request_display);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,28 @@ import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Arrangement
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
import androidx.compose.foundation.layout.size
import androidx.compose.foundation.layout.wrapContentHeight
import androidx.compose.foundation.layout.wrapContentWidth
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.automirrored.filled.ArrowBack
import androidx.compose.material3.AlertDialogDefaults
import androidx.compose.material3.BasicAlertDialog
import androidx.compose.material3.Button
import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.Icon
import androidx.compose.material3.IconButton
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Scaffold
import androidx.compose.material3.Surface
import androidx.compose.material3.Text
import androidx.compose.material3.TextField
import androidx.compose.material3.TopAppBar
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.getValue
Expand Down Expand Up @@ -60,12 +67,28 @@ import kotlinx.coroutines.launch

class ComposeActivity : ComponentActivity() {

@OptIn(ExperimentalMaterial3Api::class)
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)

setContent {
val navController = rememberNavController().withSentryObservableEffect()
SampleNavigation(navController)
MaterialTheme {
Scaffold(
topBar = {
TopAppBar(
title = { Text("Compose") },
navigationIcon = {
IconButton(onClick = { onBackPressedDispatcher.onBackPressed() }) {
Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = "Back")
}
},
)
}
) { innerPadding ->
Box(modifier = Modifier.padding(innerPadding)) { SampleNavigation(navController) }
}
}
}
}
}
Expand Down
Loading
Loading