리모컨 네트워크 설정 처리 적용
setProperty로 네트워크 상태, account 상태 설정 처리
This commit is contained in:
parent
3bb1079674
commit
96aefe8738
@ -163,6 +163,13 @@
|
||||
android:label="@string/about_title_plus"
|
||||
android:parentActivityName=".MainActivity"></activity>
|
||||
|
||||
<activity
|
||||
android:name=".NetworkSettingActivity"
|
||||
android:windowSoftInputMode="adjustResize|stateVisible"
|
||||
android:label="@string/chat">
|
||||
|
||||
</activity>
|
||||
|
||||
<service
|
||||
android:name=".BaresipService"
|
||||
android:enabled="true"
|
||||
|
@ -170,7 +170,21 @@ class BaresipService: Service() {
|
||||
allNetworks.add(network)
|
||||
|
||||
val netInfo = Utils.getEthernetInfo(applicationContext)
|
||||
Utils.propertySet("sys.ritosip.ipv4.address", netInfo.get("ip")!!)
|
||||
if(netInfo.get("ip") != null) {
|
||||
deviceIpAddress = netInfo.get("ip")!!
|
||||
}
|
||||
Utils.propertySet("sys.ritosip.ipv4.address", deviceIpAddress)
|
||||
if(netInfo.get("netmask") != null) {
|
||||
Utils.propertySet("sys.ritosip.ipv4.netmask", netInfo.get("netmask")!!)
|
||||
}
|
||||
if(netInfo.get("gateway") != null) {
|
||||
Utils.propertySet("sys.ritosip.ipv4.gateway", netInfo.get("gateway")!!)
|
||||
}
|
||||
if(netInfo.get("dns") != null) {
|
||||
Utils.propertySet("sys.ritosip.ipv4.dns", netInfo.get("dns")!!)
|
||||
}
|
||||
|
||||
Utils.checkNetworkIpType()
|
||||
|
||||
val newIntent = Intent()
|
||||
newIntent.setClassName("kr.co.rito.ritosip", "com.tutpro.baresip.plus.MainActivity")
|
||||
@ -178,8 +192,9 @@ class BaresipService: Service() {
|
||||
Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP or
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
newIntent.putExtra("action", "network available")
|
||||
newIntent.putExtra("address", netInfo.get("ip"))
|
||||
deviceIpAddress = netInfo.get("ip")!!
|
||||
//newIntent.putExtra("address", netInfo.get("ip"))
|
||||
newIntent.putExtra("address", deviceIpAddress)
|
||||
|
||||
startActivity(newIntent)
|
||||
}
|
||||
|
||||
@ -790,6 +805,7 @@ class BaresipService: Service() {
|
||||
var callExist = false
|
||||
if(uas.size > 0) {
|
||||
val ua = uas[0]
|
||||
val account = ua.account
|
||||
val call = ua.currentCall()
|
||||
var sipaddr = ua.account.aor
|
||||
sipaddr = sipaddr.removePrefix("sip:")
|
||||
@ -804,6 +820,24 @@ class BaresipService: Service() {
|
||||
Utils.propertySet("sys.ritosip.sip.status", "unregistered")
|
||||
}
|
||||
|
||||
if(account != null) {
|
||||
Utils.propertySet("sys.ritosip.account.display_name", account.nickName)
|
||||
Utils.propertySet("sys.ritosip.account.account_name", account.authUser)
|
||||
Utils.propertySet("sys.ritosip.account.server_address", account.host())
|
||||
Utils.propertySet("sys.ritosip.account.prefer_transport", preferTransport)
|
||||
if(account.mediaEnc.startsWith("srtp", ignoreCase = true)) {
|
||||
Utils.propertySet(
|
||||
"sys.ritosip.account.media_encryption",
|
||||
"srtp"
|
||||
)
|
||||
} else {
|
||||
Utils.propertySet(
|
||||
"sys.ritosip.account.media_encryption",
|
||||
"none"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
if (call != null) {
|
||||
callExist = true
|
||||
var audioMute = "unmute"
|
||||
@ -2446,6 +2480,7 @@ class BaresipService: Service() {
|
||||
var callAnswerMode = "auto"
|
||||
var audioInputDevice = "usb"
|
||||
var useDisplaySplitMode = false
|
||||
var totalDurationSeconds = 0
|
||||
var displaySplitMode = DISPLAY_SPLIT_MODE_원거리_최대_근거리_우하단
|
||||
var farViewDisplayId = 1
|
||||
var nearViewDisplayId = 2
|
||||
|
@ -13,6 +13,7 @@ import android.content.Intent.ACTION_DIAL
|
||||
import android.content.Intent.ACTION_VIEW
|
||||
import android.content.pm.PackageManager
|
||||
import android.content.res.Configuration
|
||||
import android.graphics.Rect
|
||||
import android.hardware.display.DisplayManager
|
||||
import android.media.AudioManager
|
||||
import android.media.MediaActionSound
|
||||
@ -21,6 +22,7 @@ import android.os.*
|
||||
import android.os.StrictMode.VmPolicy
|
||||
import android.provider.DocumentsContract
|
||||
import android.provider.MediaStore
|
||||
import android.provider.MediaStore.Audio.Radio
|
||||
import android.text.InputType
|
||||
import android.text.TextWatcher
|
||||
import android.util.TypedValue
|
||||
@ -53,6 +55,7 @@ import java.text.SimpleDateFormat
|
||||
import java.time.LocalDateTime
|
||||
import java.time.format.DateTimeFormatter
|
||||
import java.util.*
|
||||
import kotlin.collections.HashMap
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
|
||||
@ -132,6 +135,10 @@ class MainActivity : AppCompatActivity() {
|
||||
private lateinit var dialogImgBtn1: AppCompatButton
|
||||
private lateinit var dialogImgBtn2: AppCompatButton
|
||||
|
||||
private lateinit var callStartButton: AppCompatButton
|
||||
private lateinit var callHistoryButton: AppCompatButton
|
||||
private lateinit var settingButton: AppCompatButton
|
||||
|
||||
private var callHandler: Handler = Handler(Looper.getMainLooper())
|
||||
private var callRunnable: Runnable? = null
|
||||
private var downloadsInputUri: Uri? = null
|
||||
@ -157,6 +164,185 @@ class MainActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
private fun setDpadNavigation(
|
||||
view: View,
|
||||
upView: View? = null,
|
||||
downView: View? = null
|
||||
) {
|
||||
view.setOnKeyListener { _, keyCode, event ->
|
||||
if (event.action == KeyEvent.ACTION_DOWN) {
|
||||
when (keyCode) {
|
||||
KeyEvent.KEYCODE_DPAD_UP -> {
|
||||
upView?.requestFocus()
|
||||
true
|
||||
}
|
||||
KeyEvent.KEYCODE_DPAD_DOWN -> {
|
||||
downView?.requestFocus()
|
||||
true
|
||||
}
|
||||
else -> false
|
||||
}
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lateinit var navUpList : HashMap<View, View>
|
||||
lateinit var navDownList : HashMap<View, View>
|
||||
|
||||
override fun dispatchKeyEvent(event: KeyEvent): Boolean {
|
||||
if(!isKeyboardVisible) {
|
||||
val currentFocusView = currentFocus
|
||||
if(event.action == KeyEvent.ACTION_UP) {
|
||||
println("pokaRITO pokachip z. " + event)
|
||||
if(event.keyCode == KeyEvent.KEYCODE_DPAD_UP) {
|
||||
if(navUpList.contains(currentFocusView)) {
|
||||
val view = navUpList.get(currentFocusView)!!
|
||||
if(view.isVisible) {
|
||||
view.requestFocus()
|
||||
return false
|
||||
} else {
|
||||
if(currentFocusView == binding.btnApply) {
|
||||
binding.radioDhcp.requestFocus()
|
||||
return false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(event.keyCode == KeyEvent.KEYCODE_DPAD_DOWN) {
|
||||
println("pokaRITO pokachip k. " + currentFocusView)
|
||||
if(binding.radioStatic.isFocused) {
|
||||
println("pokaRITO pokachip radioStatic focused")
|
||||
}
|
||||
if(navDownList.contains(currentFocusView)) {
|
||||
println("pokaRITO pokachip zz. " + currentFocusView)
|
||||
val view = navDownList.get(currentFocusView)!!
|
||||
if(view.isVisible) {
|
||||
println("pokaRITO pokachip zzz. " + view)
|
||||
view.requestFocus()
|
||||
return false
|
||||
}
|
||||
} else if(currentFocusView is RadioButton) {
|
||||
println("pokaRITO pokachip rr. " + currentFocusView)
|
||||
}
|
||||
|
||||
} else if(event.keyCode == KeyEvent.KEYCODE_ENTER) {
|
||||
if(currentFocusView == binding.editIp ||
|
||||
currentFocusView == binding.editGateway ||
|
||||
currentFocusView == binding.editNetmask ||
|
||||
currentFocusView == binding.editDns) {
|
||||
if(imm.isActive) {
|
||||
imm.showSoftInput(currentFocusView, InputMethodManager.SHOW_IMPLICIT)
|
||||
imm.restartInput(currentFocusView)
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if(event.action == KeyEvent.ACTION_DOWN) {
|
||||
if(event.keyCode == KeyEvent.KEYCODE_DPAD_DOWN || event.keyCode == KeyEvent.KEYCODE_DPAD_UP) {
|
||||
var found = false
|
||||
if(navUpList.contains(currentFocusView) || navDownList.contains(currentFocusView)) {
|
||||
found = true
|
||||
}
|
||||
|
||||
if(found) {
|
||||
return true
|
||||
}
|
||||
} else if(event.keyCode == KeyEvent.KEYCODE_ENTER) {
|
||||
if(currentFocusView == binding.editIp ||
|
||||
currentFocusView == binding.editGateway ||
|
||||
currentFocusView == binding.editNetmask ||
|
||||
currentFocusView == binding.editDns) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if(event.keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
// val currentFocusView = currentFocus
|
||||
// if(currentFocusView != null) {
|
||||
// imm.hideSoftInputFromWindow(currentFocusView.windowToken, 0)
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
// if (event.action == KeyEvent.ACTION_UP && event.keyCode == KeyEvent.KEYCODE_BACK) {
|
||||
// val currentFocusView = currentFocus
|
||||
// println("pokaRITO pokachip 0")
|
||||
// if (currentFocusView is EditText) {
|
||||
// println("pokaRITO pokachip 1")
|
||||
// // 키보드가 내려간 후 300ms 뒤에 포커스를 재설정
|
||||
// Handler(Looper.getMainLooper()).postDelayed({
|
||||
// currentFocusView.requestFocus()
|
||||
// }, 300)
|
||||
// }
|
||||
// }
|
||||
return super.dispatchKeyEvent(event)
|
||||
}
|
||||
private var isKeyboardVisible = false
|
||||
|
||||
private fun setupKeyboardVisibilityListener() {
|
||||
val rootView = findViewById<View>(android.R.id.content)
|
||||
rootView.viewTreeObserver.addOnGlobalLayoutListener {
|
||||
val rect = Rect()
|
||||
rootView.getWindowVisibleDisplayFrame(rect)
|
||||
val screenHeight = rootView.rootView.height
|
||||
|
||||
val keypadHeight = screenHeight - rect.bottom
|
||||
|
||||
val visible = keypadHeight > screenHeight * 0.15 // 키보드 올라옴 판단 기준
|
||||
|
||||
if (isKeyboardVisible && !visible) {
|
||||
// 🔻 키보드가 막 내려간 순간!
|
||||
onKeyboardHidden()
|
||||
}
|
||||
|
||||
isKeyboardVisible = visible
|
||||
}
|
||||
}
|
||||
|
||||
private fun onKeyboardHidden() {
|
||||
println( "키보드가 내려갔습니다!")
|
||||
|
||||
// val currentFocusView = currentFocus
|
||||
// if(currentFocusView != null) {
|
||||
// println( "hideSoftInputFromWindow : " + currentFocusView)
|
||||
// imm.hideSoftInputFromWindow(currentFocusView.windowToken, 0)
|
||||
// imm.restartInput(currentFocusView)
|
||||
// currentFocusView.clearFocus()
|
||||
// currentFocusView.invalidate()
|
||||
// currentFocusView.requestFocus()
|
||||
// }
|
||||
// Handler(Looper.getMainLooper()).postDelayed({
|
||||
// findViewById<EditText>(R.id.editIp).requestFocus()
|
||||
// findViewById<EditText>(R.id.editDns).requestFocus()
|
||||
// }, 100) // 지연은 상황 따라 조정
|
||||
}
|
||||
|
||||
private fun updateFieldsVisibility() {
|
||||
val isStatic = binding.radioStatic.isChecked
|
||||
val visibility = if (isStatic) View.VISIBLE else View.GONE
|
||||
binding.editIp.visibility = visibility
|
||||
binding.editNetmask.visibility = visibility
|
||||
binding.editGateway.visibility = visibility
|
||||
binding.editDns.visibility = visibility
|
||||
}
|
||||
|
||||
fun showCustomToast(context: Context, message: String) {
|
||||
val inflater = LayoutInflater.from(context)
|
||||
val layout: View = inflater.inflate(R.layout.custom_toast, null)
|
||||
|
||||
val textView: TextView = layout.findViewById(R.id.toast_text)
|
||||
textView.text = message
|
||||
|
||||
val toast = Toast(context)
|
||||
toast.duration = Toast.LENGTH_LONG
|
||||
toast.view = layout
|
||||
toast.show()
|
||||
}
|
||||
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
|
||||
@ -204,6 +390,8 @@ class MainActivity : AppCompatActivity() {
|
||||
WindowInsetsCompat.CONSUMED
|
||||
}
|
||||
|
||||
setupKeyboardVisibilityListener()
|
||||
|
||||
// Must be done after view has been created
|
||||
this.setShowWhenLocked(true)
|
||||
this.setTurnScreenOn( true)
|
||||
@ -248,6 +436,25 @@ class MainActivity : AppCompatActivity() {
|
||||
|
||||
}
|
||||
dialogImgBtn2 = binding.dialogButtonImg2
|
||||
callStartButton = binding.callStartBtn
|
||||
callStartButton.setOnClickListener {
|
||||
callVideoButton.performClick()
|
||||
}
|
||||
//callHistoryButton = binding.callHistoryBtn
|
||||
settingButton = binding.settingBtn
|
||||
settingButton.setOnClickListener {
|
||||
// val i = Intent(this, NetworkSettingActivity::class.java)
|
||||
// i.flags = Intent.FLAG_ACTIVITY_NEW_TASK or
|
||||
// Intent.FLAG_ACTIVITY_SINGLE_TOP or Intent.FLAG_ACTIVITY_CLEAR_TOP
|
||||
// startActivity(i)
|
||||
|
||||
// binding.baseButtonLayout.visibility = View.INVISIBLE
|
||||
// binding.mainActivityLayout.visibility = View.INVISIBLE
|
||||
// binding.defaultLayout.visibility = View.INVISIBLE
|
||||
binding.networkSettingLayout.visibility = View.VISIBLE
|
||||
binding.radioDhcp.requestFocus()
|
||||
}
|
||||
|
||||
|
||||
BaresipService.supportedCameras = Utils.supportedCameras(applicationContext).isNotEmpty()
|
||||
|
||||
@ -256,6 +463,87 @@ class MainActivity : AppCompatActivity() {
|
||||
am = getSystemService(AUDIO_SERVICE) as AudioManager
|
||||
kgm = getSystemService(Context.KEYGUARD_SERVICE) as KeyguardManager
|
||||
|
||||
binding.editIp.setOnClickListener {
|
||||
imm.showSoftInput(it, InputMethodManager.SHOW_IMPLICIT)
|
||||
}
|
||||
binding.editNetmask.setOnClickListener {
|
||||
imm.showSoftInput(it, InputMethodManager.SHOW_IMPLICIT)
|
||||
}
|
||||
binding.editGateway.setOnClickListener {
|
||||
imm.showSoftInput(it, InputMethodManager.SHOW_IMPLICIT)
|
||||
}
|
||||
binding.editDns.setOnClickListener {
|
||||
imm.showSoftInput(it, InputMethodManager.SHOW_IMPLICIT)
|
||||
}
|
||||
navUpList = HashMap<View, View>()
|
||||
navDownList = HashMap<View, View>()
|
||||
|
||||
navUpList.put(binding.editIp, binding.radioStatic)
|
||||
navUpList.put(binding.editNetmask, binding.editIp)
|
||||
navUpList.put(binding.editGateway, binding.editNetmask)
|
||||
navUpList.put(binding.editDns, binding.editGateway)
|
||||
navUpList.put(binding.btnApply, binding.editDns)
|
||||
//navUpList.put(binding.btnApply, binding.radioDhcp)
|
||||
|
||||
navDownList.put(binding.radioStatic, binding.editIp)
|
||||
navDownList.put(binding.editIp, binding.editNetmask)
|
||||
navDownList.put(binding.editNetmask, binding.editGateway)
|
||||
navDownList.put(binding.editGateway, binding.editDns)
|
||||
navDownList.put(binding.editDns, binding.btnApply)
|
||||
navDownList.put(binding.radioDhcp, binding.btnApply)
|
||||
|
||||
// setDpadNavigation(binding.editIp, downView = binding.editNetmask)
|
||||
// setDpadNavigation(binding.editNetmask, upView = binding.editIp, downView = binding.editGateway)
|
||||
// setDpadNavigation(binding.editGateway, upView = binding.editNetmask, downView = binding.editDns)
|
||||
// setDpadNavigation(binding.editDns, upView = binding.editGateway, downView = binding.btnApply)
|
||||
// setDpadNavigation(binding.radioStatic, downView = binding.editIp)
|
||||
|
||||
binding.btnApply.setOnClickListener { _ ->
|
||||
if(binding.radioDhcp.isChecked) {
|
||||
val params: HashMap<String, String> = HashMap<String, String>()
|
||||
params.put("IPV4TYPE", "DHCP")
|
||||
params.put("DEVTYPE", "ETHERNET")
|
||||
Utils.sendRequestToFactory(applicationContext, "Ipv4", params)
|
||||
// Toast.makeText(
|
||||
// applicationContext,
|
||||
// "DHCP 적용되었습니다.",
|
||||
// Toast.LENGTH_SHORT
|
||||
// ).show()
|
||||
showCustomToast(applicationContext, "DHCP 적용되었습니다.")
|
||||
binding.networkSettingLayout.visibility = View.INVISIBLE
|
||||
} else {
|
||||
val params: HashMap<String, String> = HashMap<String, String>()
|
||||
params.put("IPV4TYPE", "STATIC")
|
||||
params.put("DEVTYPE", "ETHERNET")
|
||||
params.put("ADDRESS", binding.editIp.text.toString())
|
||||
params.put("NETMASK", binding.editNetmask.text.toString())
|
||||
params.put("GATEWAY", binding.editGateway.text.toString())
|
||||
params.put("DNS", binding.editDns.text.toString())
|
||||
Utils.sendRequestToFactory(applicationContext, "Ipv4", params)
|
||||
// Toast.makeText(
|
||||
// applicationContext,
|
||||
// "STATIC 적용되었습니다.",
|
||||
// Toast.LENGTH_SHORT
|
||||
// ).show()
|
||||
showCustomToast(applicationContext, "STATIC 적용되었습니다.")
|
||||
binding.networkSettingLayout.visibility = View.INVISIBLE
|
||||
}
|
||||
}
|
||||
|
||||
binding.btnCancel.setOnClickListener { _ ->
|
||||
binding.networkSettingLayout.visibility = View.INVISIBLE
|
||||
}
|
||||
|
||||
updateFieldsVisibility()
|
||||
|
||||
val radioGroup = findViewById<RadioGroup>(R.id.radioGroup)
|
||||
radioGroup.setOnCheckedChangeListener { _, checkedId ->
|
||||
val selected = findViewById<RadioButton>(checkedId)
|
||||
selected.requestFocus()
|
||||
updateFieldsVisibility()
|
||||
}
|
||||
|
||||
|
||||
serviceEventObserver = Observer {
|
||||
val event = it.getContentIfNotHandled()
|
||||
Log.d(TAG, "Observed event $event")
|
||||
|
@ -0,0 +1,70 @@
|
||||
package com.tutpro.baresip.plus
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
|
||||
class NetworkSettingActivity : AppCompatActivity() {
|
||||
|
||||
private lateinit var radioDhcp: RadioButton
|
||||
private lateinit var radioStatic: RadioButton
|
||||
private lateinit var editIp: EditText
|
||||
private lateinit var editNetmask: EditText
|
||||
private lateinit var editGateway: EditText
|
||||
private lateinit var editDns: EditText
|
||||
private lateinit var btnApply: Button
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_network_setting)
|
||||
|
||||
radioDhcp = findViewById(R.id.radioDhcp)
|
||||
radioStatic = findViewById(R.id.radioStatic)
|
||||
editIp = findViewById(R.id.editIp)
|
||||
editNetmask = findViewById(R.id.editNetmask)
|
||||
editGateway = findViewById(R.id.editGateway)
|
||||
editDns = findViewById(R.id.editDns)
|
||||
btnApply = findViewById(R.id.btnApply)
|
||||
|
||||
updateFieldsVisibility()
|
||||
|
||||
val radioGroup = findViewById<RadioGroup>(R.id.radioGroup)
|
||||
radioGroup.setOnCheckedChangeListener { _, _ ->
|
||||
updateFieldsVisibility()
|
||||
}
|
||||
|
||||
btnApply.setOnClickListener {
|
||||
applyNetworkSettings()
|
||||
}
|
||||
}
|
||||
|
||||
private fun updateFieldsVisibility() {
|
||||
val isStatic = radioStatic.isChecked
|
||||
val visibility = if (isStatic) View.VISIBLE else View.GONE
|
||||
editIp.visibility = visibility
|
||||
editNetmask.visibility = visibility
|
||||
editGateway.visibility = visibility
|
||||
editDns.visibility = visibility
|
||||
}
|
||||
|
||||
private fun applyNetworkSettings() {
|
||||
if (radioDhcp.isChecked) {
|
||||
Toast.makeText(this, "DHCP 설정 적용", Toast.LENGTH_SHORT).show()
|
||||
// TODO: DHCP 설정 로직 추가
|
||||
} else {
|
||||
val ip = editIp.text.toString()
|
||||
val netmask = editNetmask.text.toString()
|
||||
val gateway = editGateway.text.toString()
|
||||
val dns = editDns.text.toString()
|
||||
|
||||
if (ip.isBlank() || netmask.isBlank() || gateway.isBlank() || dns.isBlank()) {
|
||||
Toast.makeText(this, "모든 STATIC 필드를 입력해 주세요.", Toast.LENGTH_SHORT).show()
|
||||
return
|
||||
}
|
||||
|
||||
Toast.makeText(this, "STATIC 설정 적용:\n$ip / $netmask / $gateway / $dns", Toast.LENGTH_SHORT).show()
|
||||
// TODO: Static 설정 로직 추가
|
||||
}
|
||||
}
|
||||
}
|
@ -46,11 +46,20 @@ class UaSpinnerAdapter(cxt: Context, private val uas: ArrayList<UserAgent>) :
|
||||
ua.account.nickName + "(${ua.account.aor.split(":")[1]})"
|
||||
else
|
||||
ua.account.aor.split(":")[1]
|
||||
viewHolder.textView.textSize = 17f
|
||||
|
||||
//viewHolder.textView.textSize = 17f
|
||||
viewHolder.textView.textSize = 30f // modified by ritoseo - aorSpinner 글씨 크기 변경
|
||||
if (BaresipService.uas.size > 1 && ua.calls().isNotEmpty())
|
||||
viewHolder.textView.setTypeface(null, Typeface.BOLD)
|
||||
viewHolder.imageView.setImageResource(ua.status)
|
||||
|
||||
/* modified by ritoseo - aorSpinner 상태 아이콘 크기 변경 */
|
||||
val imgLayout = viewHolder.imageView.layoutParams
|
||||
imgLayout.width = 45
|
||||
imgLayout.height = 45
|
||||
viewHolder.imageView.layoutParams = imgLayout
|
||||
/* --------------------------------------------------- */
|
||||
|
||||
return rowView
|
||||
}
|
||||
|
||||
|
@ -14,12 +14,12 @@ import android.graphics.Bitmap.createScaledBitmap
|
||||
import android.graphics.BitmapFactory
|
||||
import android.graphics.Canvas
|
||||
import android.graphics.Color
|
||||
import android.media.AudioAttributes
|
||||
import android.hardware.camera2.CameraAccessException
|
||||
import android.hardware.camera2.CameraCharacteristics
|
||||
import android.hardware.camera2.CameraManager
|
||||
import android.hardware.camera2.CameraMetadata.LENS_FACING_BACK
|
||||
import android.hardware.camera2.CameraMetadata.LENS_FACING_FRONT
|
||||
import android.media.AudioAttributes
|
||||
import android.media.AudioDeviceInfo
|
||||
import android.media.AudioManager
|
||||
import android.media.MediaPlayer
|
||||
@ -30,7 +30,6 @@ import android.net.wifi.WifiManager
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
import android.os.Process
|
||||
import android.provider.DocumentsContract
|
||||
import android.provider.MediaStore
|
||||
import android.provider.OpenableColumns
|
||||
@ -1264,7 +1263,26 @@ object Utils {
|
||||
propertySet("sys.rito.audio.input.device", dev)
|
||||
//val process = Runtime.getRuntime().exec("ritosysc shell-order=killall audioserver")
|
||||
val process = Runtime.getRuntime().exec("ritosysc shell-order=killall android.hardware.audio.service")
|
||||
//val process = Runtime.getRuntime().exec("ritosysc shell-order=service call audio 11 i32 1 i32 3")
|
||||
process.waitFor()
|
||||
process.destroy()
|
||||
}
|
||||
|
||||
fun checkNetworkIpType() {
|
||||
val process = Runtime.getRuntime().exec("ritosysc shell-order=rm /mnt/obb/ip_static;grep STATIC /data/misc/ethernet/ipconfig.txt && touch /mnt/obb/ip_static")
|
||||
process.waitFor()
|
||||
process.destroy()
|
||||
|
||||
if(File("/mnt/obb/ip_static").exists()) {
|
||||
propertySet("sys.ritosip.ipv4.iptype", "static")
|
||||
} else {
|
||||
propertySet("sys.ritosip.ipv4.iptype", "dhcp")
|
||||
}
|
||||
}
|
||||
|
||||
fun save(dev : String) {
|
||||
propertySet("sys.rito.audio.input.device", dev)
|
||||
//val process = Runtime.getRuntime().exec("ritosysc shell-order=killall audioserver")
|
||||
val process = Runtime.getRuntime().exec("ritosysc shell-order=killall android.hardware.audio.service")
|
||||
process.waitFor()
|
||||
process.destroy()
|
||||
}
|
||||
@ -1313,6 +1331,14 @@ object Utils {
|
||||
return "plugout"
|
||||
}
|
||||
|
||||
fun fileContainsString(filePath: String, keyword: String): Boolean {
|
||||
val file = File(filePath)
|
||||
if (!file.exists()) return false
|
||||
|
||||
return file.useLines { lines ->
|
||||
lines.any { it.contains(keyword) }
|
||||
}
|
||||
}
|
||||
fun getEthernetInfo(context: Context): MutableMap<String, String> {
|
||||
val netInfo = mutableMapOf<String, String>()
|
||||
val cm = context.getSystemService(Context.CONNECTIVITY_SERVICE) as? ConnectivityManager
|
||||
@ -1351,12 +1377,20 @@ object Utils {
|
||||
netInfo["ip"] = ip
|
||||
|
||||
// Subnet Mask (Netmask)
|
||||
val prefixLength = it.linkAddresses[0].prefixLength
|
||||
it.linkAddresses.forEach {linkAddress ->
|
||||
if (linkAddress.address is Inet4Address) {
|
||||
val prefixLength = linkAddress.prefixLength
|
||||
val netmask = calculateNetmask(prefixLength)
|
||||
Log.w("Network", "Netmask: $netmask")
|
||||
Log.d("Network", "IPv4 netmask: $netmask")
|
||||
netInfo["netmask"] = netmask
|
||||
}
|
||||
}
|
||||
// val prefixLength = it.linkAddresses[0].prefixLength
|
||||
// val netmask = calculateNetmask(prefixLength)
|
||||
// Log.w("Network", "Netmask: $netmask, prefixLength : ${prefixLength}")
|
||||
//netInfo["netmask"] = netmask
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (e: SocketException) {
|
||||
@ -1379,6 +1413,19 @@ object Utils {
|
||||
).joinToString(".")
|
||||
}
|
||||
|
||||
fun sendRequestToFactory(context: Context, request: String, params: Map<String, String>) {
|
||||
val intent = Intent("kr.co.rito.factory.setting").apply {
|
||||
setPackage("kr.co.rito.factory")
|
||||
putExtra("TYPE", request)
|
||||
for ((key, value) in params) {
|
||||
putExtra(key, value)
|
||||
}
|
||||
}
|
||||
|
||||
context.sendBroadcast(intent)
|
||||
}
|
||||
|
||||
|
||||
external fun openSerial(strDev: String, baudrate: Int): Int // by ritoseo
|
||||
external fun readSerial(devHandle:Int, buffer: ByteArray, size: Int): Int // by ritoseo
|
||||
external fun writeSerial(devHandle:Int, buffer: ByteArray, size: Int): Int // by ritoseo
|
||||
|
5
app/src/main/res/drawable/calls_large.xml
Normal file
5
app/src/main/res/drawable/calls_large.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<vector android:height="144px" android:tint="@color/colorSecondary"
|
||||
android:viewportHeight="24.0" android:viewportWidth="24.0"
|
||||
android:width="144px" xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<path android:fillColor="#FF000000" android:pathData="M13,3c-4.97,0 -9,4.03 -9,9L1,12l3.89,3.89 0.07,0.14L9,12L6,12c0,-3.87 3.13,-7 7,-7s7,3.13 7,7 -3.13,7 -7,7c-1.93,0 -3.68,-0.79 -4.94,-2.06l-1.42,1.42C8.27,19.99 10.51,21 13,21c4.97,0 9,-4.03 9,-9s-4.03,-9 -9,-9zM12,8v5l4.28,2.54 0.72,-1.21 -3.5,-2.08L13.5,8L12,8z"/>
|
||||
</vector>
|
@ -26,6 +26,68 @@
|
||||
android:layout_marginBottom="0dp"
|
||||
android:background="#00000000">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/baseButtonLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/callStartBtn"
|
||||
android:layout_width="230px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="500px"
|
||||
android:layout_marginTop="450px"
|
||||
android:background="@drawable/bg_button_selector"
|
||||
android:drawableTop="@drawable/callbutton2"
|
||||
android:drawablePadding="25px"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:text="전화걸기"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="30sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<!-- <androidx.appcompat.widget.AppCompatButton-->
|
||||
<!-- android:id="@+id/callHistoryBtn"-->
|
||||
<!-- android:layout_width="230px"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:layout_marginLeft="850px"-->
|
||||
<!-- android:layout_marginTop="450px"-->
|
||||
<!-- android:background="@drawable/bg_button_selector"-->
|
||||
<!-- android:drawableTop="@drawable/calls_large"-->
|
||||
<!-- android:drawablePadding="25px"-->
|
||||
<!-- android:focusable="true"-->
|
||||
<!-- android:focusableInTouchMode="true"-->
|
||||
<!-- android:gravity="center"-->
|
||||
<!-- android:padding="16dp"-->
|
||||
<!-- android:text="최근통화"-->
|
||||
<!-- android:textColor="@color/colorWhite"-->
|
||||
<!-- android:textSize="30sp"-->
|
||||
<!-- android:textStyle="bold" />-->
|
||||
|
||||
<androidx.appcompat.widget.AppCompatButton
|
||||
android:id="@+id/settingBtn"
|
||||
android:layout_width="230px"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="1190px"
|
||||
android:layout_marginTop="450px"
|
||||
android:background="@drawable/bg_button_selector"
|
||||
android:drawableTop="@drawable/setting"
|
||||
android:drawablePadding="25px"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:text="설정"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="30sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/header_bar"
|
||||
android:layout_width="match_parent"
|
||||
@ -96,7 +158,7 @@
|
||||
<Spinner
|
||||
android:id="@+id/aorSpinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:layout_height="64dp"
|
||||
android:background="@color/cardview_shadow_start_color"
|
||||
android:clickable="false"
|
||||
android:gravity="center_vertical"
|
||||
@ -120,7 +182,7 @@
|
||||
android:paddingStart="3dp"
|
||||
android:paddingEnd="0dp"
|
||||
android:text="@string/outgoing_call_to_dots"
|
||||
android:textSize="20sp"></TextView>
|
||||
android:textSize="24sp"></TextView>
|
||||
|
||||
<Chronometer
|
||||
android:id="@+id/callTimer"
|
||||
@ -150,9 +212,9 @@
|
||||
android:enabled="false"
|
||||
android:hint="@string/callee"
|
||||
android:inputType="textEmailAddress"
|
||||
android:textColorHint="@color/colorSecondaryDark"
|
||||
android:textColor="#FF000000"
|
||||
android:textSize="34sp">
|
||||
android:textColorHint="@color/colorSecondaryDark"
|
||||
android:textSize="42sp">
|
||||
<!-- <requestFocus /> -->
|
||||
</AutoCompleteTextView>
|
||||
|
||||
@ -515,8 +577,7 @@
|
||||
android:id="@+id/dialogLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="invisible"
|
||||
tools:visibility="visible">
|
||||
android:visibility="invisible">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/dialogBase"
|
||||
@ -568,11 +629,11 @@
|
||||
android:layout_marginTop="250px"
|
||||
android:background="@drawable/bg_button_selector"
|
||||
android:drawableTop="@drawable/callbutton2"
|
||||
android:drawablePadding="25px"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:drawablePadding="25px"
|
||||
android:text="전화걸기"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="30sp"
|
||||
@ -586,11 +647,11 @@
|
||||
android:layout_marginTop="250px"
|
||||
android:background="@drawable/bg_button_selector"
|
||||
android:drawableTop="@drawable/setting"
|
||||
android:drawablePadding="25px"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:gravity="center"
|
||||
android:padding="16dp"
|
||||
android:drawablePadding="25px"
|
||||
android:text="설정"
|
||||
android:textColor="@color/colorWhite"
|
||||
android:textSize="30sp"
|
||||
@ -599,4 +660,119 @@
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/networkSettingLayout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/custom_border"
|
||||
android:visibility="invisible">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textView"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="16dp"
|
||||
android:text="네트워크 설정"
|
||||
android:textSize="34sp"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radioGroup"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingBottom="16dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radioDhcp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:paddingRight="15dp"
|
||||
android:text="DHCP"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/radioStatic"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:paddingRight="15dp"
|
||||
android:text="STATIC"
|
||||
android:textSize="24sp" />
|
||||
</RadioGroup>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editIp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="IP Address"
|
||||
android:inputType="phone"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editNetmask"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Netmask"
|
||||
android:inputType="text"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editGateway"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="Gateway"
|
||||
android:inputType="text"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editDns"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:hint="DNS"
|
||||
android:inputType="text"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnApply"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:paddingHorizontal="20dp"
|
||||
android:paddingVertical="10dp"
|
||||
android:text="적용하기"
|
||||
android:textSize="24sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnCancel"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:paddingHorizontal="20dp"
|
||||
android:paddingVertical="10dp"
|
||||
android:text="취소하기"
|
||||
android:textSize="24sp" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
</RelativeLayout>
|
||||
|
71
app/src/main/res/layout/activity_network_setting.xml
Normal file
71
app/src/main/res/layout/activity_network_setting.xml
Normal file
@ -0,0 +1,71 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:focusable="true"
|
||||
android:focusableInTouchMode="true"
|
||||
android:descendantFocusability="afterDescendants">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radioGroup"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
<RadioButton
|
||||
android:id="@+id/radioDhcp"
|
||||
android:text="DHCP"
|
||||
android:checked="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
<RadioButton
|
||||
android:id="@+id/radioStatic"
|
||||
android:text="STATIC"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"/>
|
||||
</RadioGroup>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editIp"
|
||||
android:hint="IP Address"
|
||||
android:focusable="true"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:nextFocusDown="@+id/editNetmask"
|
||||
android:nextFocusUp="@+id/radioStatic"
|
||||
android:inputType="text"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editNetmask"
|
||||
android:hint="Netmask"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="text"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editGateway"
|
||||
android:hint="Gateway"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="text"/>
|
||||
|
||||
<EditText
|
||||
android:id="@+id/editDns"
|
||||
android:hint="DNS"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="text"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnApply"
|
||||
android:text="Apply Settings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"/>
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
Loading…
x
Reference in New Issue
Block a user