Skip to content

Commit

Permalink
fix sonar issues
Browse files Browse the repository at this point in the history
  • Loading branch information
xuduo committed Dec 11, 2023
1 parent 1bf1cb1 commit 4fb3378
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 22 deletions.
5 changes: 0 additions & 5 deletions app/src/main/java/com/xd/testrecorder/main/MainScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,19 @@ import androidx.compose.material.Text
import androidx.compose.material.rememberScaffoldState
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.semantics.contentDescription
import androidx.compose.ui.semantics.semantics
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
import androidx.hilt.navigation.compose.hiltViewModel
import com.xd.common.nav.LocalNavController
import com.xd.common.widget.AppBar
import com.xd.testrecorder.MainDestinations
import com.xd.testrecorder.R
import com.xd.testrecorder.accessibility.TouchAccessibilityViewModel

@Composable
fun MainScreen(
modifier: Modifier = Modifier,
scaffoldState: ScaffoldState = rememberScaffoldState(),
touchAccessibilityViewModel: TouchAccessibilityViewModel = hiltViewModel(),
) {
Scaffold(
scaffoldState = scaffoldState,
Expand All @@ -54,7 +50,6 @@ fun MainScreen(
modifier = modifier.fillMaxSize()
)
{
val context = LocalContext.current
val nav = LocalNavController.current
Column {
Modifier.padding(it)
Expand Down
2 changes: 0 additions & 2 deletions common/src/main/java/com/xd/common/widget/ComposeUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import androidx.annotation.StringRes
import androidx.compose.animation.core.LinearEasing
import androidx.compose.animation.core.RepeatMode
import androidx.compose.animation.core.animateFloat
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.core.infiniteRepeatable
import androidx.compose.animation.core.rememberInfiniteTransition
import androidx.compose.animation.core.tween
Expand All @@ -27,7 +26,6 @@ import androidx.compose.material.pullrefresh.PullRefreshIndicator
import androidx.compose.material.pullrefresh.pullRefresh
import androidx.compose.material.pullrefresh.rememberPullRefreshState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.getValue
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,13 @@ sealed class ActionCodeConverter {
lateinit var options: CodeConverterOptions

fun toCode(action: Action): String {
var code = ""
if (action.viewContentDescription.isNotEmpty()) {
code = "clickContentDescription(\"${action.viewContentDescription}\")"
return if (action.viewContentDescription.isNotEmpty()) {
"clickContentDescription(\"${action.viewContentDescription}\")"
} else if (action.viewText.isNotEmpty()) {
code = "clickText(\"${action.viewText}\")"
} else{
code = "// no ContentDescription or Text detected"
"clickText(\"${action.viewText}\")"
} else {
"// no ContentDescription or Text detected"
}
return code
}

abstract fun getFun(name: String): String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import androidx.room.Entity
import androidx.room.ForeignKey
import androidx.room.PrimaryKey
import java.io.ByteArrayOutputStream
import java.nio.ByteBuffer

@Entity(
tableName = "action_images",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import android.content.Intent
import android.gesture.GestureOverlayView
import android.graphics.PixelFormat
import android.graphics.Rect
import android.os.Build
import android.os.IBinder
import android.view.Gravity
import android.view.MotionEvent
Expand Down Expand Up @@ -100,7 +99,7 @@ class OverlayService : Service() {

// Set OnTouchListener

overlayView.setOnTouchListener { view, event ->
overlayView.setOnTouchListener { _, event ->
// Handle touch events here
logger.d("OnTouchListener $event")
if (isPassThrough()) {
Expand All @@ -125,8 +124,8 @@ class OverlayService : Service() {
// Update your WindowManager LayoutParams

params.gravity = Gravity.TOP or Gravity.START
params.x = 0;
params.y = 0;
params.x = 0
params.y = 0
params.flags = flagsCapture

overlayView.addOnAttachStateChangeListener(object : View.OnAttachStateChangeListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.launch
import java.time.Instant
import java.time.ZoneId
import java.time.format.DateTimeFormatter

//@AndroidEntryPoint
class RecorderService : Service() {
Expand Down

0 comments on commit 4fb3378

Please sign in to comment.