Skip to content

Commit

Permalink
style: ktlint auto correct style for http module
Browse files Browse the repository at this point in the history
  • Loading branch information
web-flow authored Feb 27, 2023
1 parent f00aa25 commit 6368441
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import com.google.mlkit.vision.common.InputImage
import net.lifeupapp.lifeup.http.databinding.ActivityBarcodeScanningBinding
import java.util.concurrent.Executors


class BarcodeScanningActivity : AppCompatActivity() {

private val TAG = "BarcodeScanningActivity"
Expand Down Expand Up @@ -73,7 +72,6 @@ class BarcodeScanningActivity : AppCompatActivity() {
}
}
.addOnFailureListener { Log.d(TAG, "Error: ${it.message}") }

}
}

Expand Down Expand Up @@ -156,7 +154,8 @@ class BarcodeScanningActivity : AppCompatActivity() {
setResult(RESULT_OK, intent)
finish()
}, 150)
})
}
)
// bind camera to lifecycle
camera = cameraProvider.bindToLifecycle(
this as LifecycleOwner,
Expand Down Expand Up @@ -187,4 +186,4 @@ class BarcodeScanningActivity : AppCompatActivity() {
scaleX = overlay.width.toFloat() / imageWidth.toFloat()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ class QRCodeAnalyser(private val listener: (Barcode, Int, Int) -> Unit) : ImageA
.addOnSuccessListener { barCodes ->
if (barCodes.size > 0) {
listener.invoke(barCodes[0], imageProxy.width, imageProxy.height)
//接收到结果后,就关闭解析
// 接收到结果后,就关闭解析
detector.close()
}
}
.addOnFailureListener { Log.d(TAG, "Error: ${it.message}") }
.addOnCompleteListener { imageProxy.close() }

}

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import android.view.View
import androidx.core.content.ContextCompat
import net.lifeupapp.lifeup.http.R


class ScanOverlay(context: Context, attrs: AttributeSet?) : View(context, attrs) {

private var paint = Paint(Paint.ANTI_ALIAS_FLAG)
Expand Down Expand Up @@ -52,7 +51,6 @@ class ScanOverlay(context: Context, attrs: AttributeSet?) : View(context, attrs)
paint
)
}

}

private fun getAnimator(): ObjectAnimator {
Expand All @@ -64,7 +62,7 @@ class ScanOverlay(context: Context, attrs: AttributeSet?) : View(context, attrs)
1f
)
animator?.duration = 5000
animator?.repeatCount = -1 //-1 means infinite loop
animator?.repeatCount = -1 // -1 means infinite loop
}
return animator!!
}
Expand All @@ -75,6 +73,4 @@ class ScanOverlay(context: Context, attrs: AttributeSet?) : View(context, attrs)
getAnimator().cancel()
invalidate()
}


}
}
4 changes: 1 addition & 3 deletions http/src/main/java/net/lifeupapp/lifeup/http/qrcode/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import android.content.res.Configuration
import android.content.res.Resources
import android.util.TypedValue


fun Float.toPx(): Int {
val resources = Resources.getSystem()
return TypedValue.applyDimension(
Expand All @@ -15,8 +14,7 @@ fun Float.toPx(): Int {
).toInt()
}


fun isPortraitMode(context: Context): Boolean {
val mConfiguration: Configuration = context.resources.configuration
return mConfiguration.orientation == Configuration.ORIENTATION_PORTRAIT
}
}

0 comments on commit 6368441

Please sign in to comment.