Skip to content

Commit

Permalink
cleanup old files, take care of versionning
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruddle committed Aug 22, 2023
1 parent f52305d commit 1fe3196
Show file tree
Hide file tree
Showing 11 changed files with 224 additions and 651 deletions.
10 changes: 2 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-kapt'
apply plugin: "androidx.navigation.safeargs"

apply plugin: 'kotlin-parcelize'

android {
Expand All @@ -27,8 +26,8 @@ android {
applicationId "com.samsung.android.scan3d"
minSdkVersion 28
targetSdkVersion 33
versionCode 1
versionName "1.0.0"
versionCode 4
versionName "0.0.4"
}

compileOptions {
Expand Down Expand Up @@ -86,11 +85,6 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.11.0'
kapt 'com.github.bumptech.glide:compiler:4.11.0'




implementation "io.ktor:ktor-server-core:2.3.3"
implementation "io.ktor:ktor-server-netty:2.3.3"

//implementation files("../libs/libjpeg-turbo-release.aar")
}
16 changes: 7 additions & 9 deletions app/src/main/java/com/samsung/android/scan3d/CameraActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,11 @@ import kotlinx.coroutines.channels.Channel
class CameraActivity : AppCompatActivity() {

private lateinit var activityCameraBinding: ActivityCameraBinding
var hasFor = false


private val receiver: BroadcastReceiver = object : BroadcastReceiver() {
override fun onReceive(context: Context, intent: Intent) {
finish()
// android.os.Process.killProcess(android.os.Process.myPid())
// android.os.Process.killProcess(android.os.Process.myPid())
}
}

Expand All @@ -54,14 +52,15 @@ class CameraActivity : AppCompatActivity() {
it.action = "start"
}
registerReceiver(receiver, IntentFilter("KILL"))
hasFor = true
}

override fun onPause() {
super.onPause()
sendCam {
it.action = "onPause"
}
}

fun sendCam(extra: (Intent) -> Unit) {
var intent = Intent(this, Cam::class.java)
extra(intent)
Expand All @@ -71,16 +70,15 @@ class CameraActivity : AppCompatActivity() {
startService(intent)
}
}

override fun onDestroy() {
super.onDestroy()
if (hasFor) {
sendCam {
it.action = "stop"
}
sendCam {
it.action = "stop"
}
unregisterReceiver(receiver)

}

override fun onResume() {
super.onResume()
sendCam {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,16 @@ import androidx.navigation.Navigation
import com.example.android.camera.utils.OrientationLiveData
import com.samsung.android.scan3d.CameraActivity
import com.samsung.android.scan3d.R
import com.samsung.android.scan3d.databinding.FragmentCamera2Binding
import com.samsung.android.scan3d.databinding.FragmentCameraBinding
import com.samsung.android.scan3d.serv.CamEngine
import com.samsung.android.scan3d.util.ClipboardUtil
import com.samsung.android.scan3d.util.IpUtil
import kotlinx.parcelize.Parcelize

class CameraFragment2 : Fragment() {
class CameraFragment : Fragment() {

/** Android ViewBinding */
private var _fragmentCameraBinding: FragmentCamera2Binding? = null
private var _fragmentCameraBinding: FragmentCameraBinding? = null

private val fragmentCameraBinding get() = _fragmentCameraBinding!!

Expand Down Expand Up @@ -75,7 +75,7 @@ class CameraFragment2 : Fragment() {
container: ViewGroup?,
savedInstanceState: Bundle?
): View {
_fragmentCameraBinding = FragmentCamera2Binding.inflate(inflater, container, false)
_fragmentCameraBinding = FragmentCameraBinding.inflate(inflater, container, false)

// Get the local ip address
val localIp = IpUtil.getLocalIpAddress()
Expand Down Expand Up @@ -328,7 +328,7 @@ class CameraFragment2 : Fragment() {
}

companion object {
private val TAG = CameraFragment2::class.java.simpleName
private val TAG = CameraFragment::class.java.simpleName

@Parcelize
data class ViewState(
Expand Down

This file was deleted.

10 changes: 5 additions & 5 deletions app/src/main/java/com/samsung/android/scan3d/serv/Cam.kt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import android.view.Surface
import androidx.core.app.NotificationCompat
import com.samsung.android.scan3d.CameraActivity
import com.samsung.android.scan3d.R
import com.samsung.android.scan3d.fragments.CameraFragment2
import com.samsung.android.scan3d.fragments.CameraFragment
import com.samsung.android.scan3d.http.HttpService
import kotlinx.coroutines.runBlocking

Expand Down Expand Up @@ -67,7 +67,7 @@ class Cam : Service() {
.setSmallIcon(R.drawable.ic_linked_camera).addAction(R.drawable.ic_close, "Kill",pendingIntentKill)
.setContentIntent(pendingIntent)

//.setFullScreenIntent(pendingIntent,true)


if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
// builer?.setForegroundServiceBehavior(Notification.FOREGROUND_SERVICE_IMMEDIATE)
Expand Down Expand Up @@ -101,12 +101,12 @@ class Cam : Service() {
"new_view_state" -> {

val old = engine?.viewState!!
val new : CameraFragment2.Companion.ViewState = intent.extras?.getParcelable("data")!!
val new : CameraFragment.Companion.ViewState = intent.extras?.getParcelable("data")!!
Log.i("CAM", "new_view_state: " + new)
Log.i("CAM", "from: " + old)
engine?.viewState = new
if (old != new) {
Log.i("CAM", "DIFFFFFFFFFFFFFFFFFFF")
Log.i("CAM", "diff")
engine?.restart()
}
}
Expand Down Expand Up @@ -140,7 +140,7 @@ class Cam : Service() {

override fun onDestroy() {
super.onDestroy()
Log.i("CAM", "OnDezstoy")
Log.i("CAM", "OnDestroy")
kill()
}

Expand Down
Loading

0 comments on commit 1fe3196

Please sign in to comment.