Moved Default Call Volume setting under Audio settings
This commit is contained in:
@ -5,6 +5,7 @@ import android.util.TypedValue
|
||||
import android.view.Gravity
|
||||
import android.view.Menu
|
||||
import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.*
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.core.content.ContextCompat
|
||||
@ -19,6 +20,7 @@ class AudioActivity : AppCompatActivity() {
|
||||
|
||||
private var save = false
|
||||
private var reload = false
|
||||
private var callVolume = BaresipService.callVolume
|
||||
private var oldAudioModules = mutableMapOf<String, Boolean>()
|
||||
private var oldOpusBitrate = ""
|
||||
private var oldOpusPacketLoss = ""
|
||||
@ -34,6 +36,35 @@ class AudioActivity : AppCompatActivity() {
|
||||
supportActionBar?.setDisplayHomeAsUpEnabled(true)
|
||||
Utils.addActivity("audio")
|
||||
|
||||
val callVolSpinner = binding.VolumeSpinner
|
||||
val volKeys = arrayListOf("None", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
|
||||
val volVals = arrayListOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||
val curVal = callVolume
|
||||
val curKey = volKeys[curVal]
|
||||
volKeys.removeAt(curVal)
|
||||
volVals.removeAt(curVal)
|
||||
volKeys.add(0, curKey)
|
||||
volVals.add(0, curVal)
|
||||
val callVolAdapter = ArrayAdapter(
|
||||
this, android.R.layout.simple_spinner_item,
|
||||
volKeys
|
||||
)
|
||||
callVolAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||
callVolSpinner.adapter = callVolAdapter
|
||||
callVolSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||
override fun onItemSelected(
|
||||
parent: AdapterView<*>,
|
||||
view: View?,
|
||||
position: Int,
|
||||
id: Long
|
||||
) {
|
||||
callVolume = volVals[volKeys.indexOf(parent.selectedItem.toString())]
|
||||
}
|
||||
|
||||
override fun onNothingSelected(parent: AdapterView<*>) {
|
||||
}
|
||||
}
|
||||
|
||||
val audioModulesList = binding.AudioModulesList
|
||||
var id = 1000
|
||||
for (module in audioModules) {
|
||||
@ -105,6 +136,12 @@ class AudioActivity : AppCompatActivity() {
|
||||
|
||||
R.id.checkIcon -> {
|
||||
|
||||
if (BaresipService.callVolume != callVolume) {
|
||||
BaresipService.callVolume = callVolume
|
||||
Config.replaceVariable("call_volume", callVolume.toString())
|
||||
save = true
|
||||
}
|
||||
|
||||
var id = 1001
|
||||
for (module in audioModules) {
|
||||
val box = findViewById<CheckBox>(id++)
|
||||
@ -200,6 +237,10 @@ class AudioActivity : AppCompatActivity() {
|
||||
}
|
||||
|
||||
private fun bindTitles() {
|
||||
binding.VolumeTitle.setOnClickListener {
|
||||
Utils.alertView(this, getString(R.string.default_call_volume),
|
||||
getString(R.string.default_call_volume_help))
|
||||
}
|
||||
binding.AudioModulesTitle.setOnClickListener {
|
||||
Utils.alertView(this, getString(R.string.audio_modules_title),
|
||||
getString(R.string.audio_modules_help))
|
||||
|
||||
@ -53,7 +53,6 @@ class ConfigActivity : AppCompatActivity() {
|
||||
private var oldVerifyServer = ""
|
||||
private var oldCAFile = false
|
||||
private var oldLogLevel = ""
|
||||
private var callVolume = BaresipService.callVolume
|
||||
private var oldDisplayTheme = -1
|
||||
private var save = false
|
||||
private var restart = false
|
||||
@ -282,35 +281,6 @@ class ConfigActivity : AppCompatActivity() {
|
||||
}
|
||||
}
|
||||
|
||||
val callVolSpinner = binding.VolumeSpinner
|
||||
val volKeys = arrayListOf("None", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10")
|
||||
val volVals = arrayListOf(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
|
||||
val curVal = callVolume
|
||||
val curKey = volKeys[curVal]
|
||||
volKeys.removeAt(curVal)
|
||||
volVals.removeAt(curVal)
|
||||
volKeys.add(0, curKey)
|
||||
volVals.add(0, curVal)
|
||||
val callVolAdapter = ArrayAdapter(
|
||||
this, android.R.layout.simple_spinner_item,
|
||||
volKeys
|
||||
)
|
||||
callVolAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item)
|
||||
callVolSpinner.adapter = callVolAdapter
|
||||
callVolSpinner.onItemSelectedListener = object : AdapterView.OnItemSelectedListener {
|
||||
override fun onItemSelected(
|
||||
parent: AdapterView<*>,
|
||||
view: View?,
|
||||
position: Int,
|
||||
id: Long
|
||||
) {
|
||||
callVolume = volVals[volKeys.indexOf(parent.selectedItem.toString())]
|
||||
}
|
||||
|
||||
override fun onNothingSelected(parent: AdapterView<*>) {
|
||||
}
|
||||
}
|
||||
|
||||
darkTheme = binding.DarkTheme
|
||||
oldDisplayTheme = Preferences(applicationContext).displayTheme
|
||||
darkTheme.isChecked = oldDisplayTheme == AppCompatDelegate.MODE_NIGHT_YES
|
||||
@ -445,12 +415,6 @@ class ConfigActivity : AppCompatActivity() {
|
||||
restart = true
|
||||
}
|
||||
|
||||
if (BaresipService.callVolume != callVolume) {
|
||||
BaresipService.callVolume = callVolume
|
||||
Config.replaceVariable("call_volume", callVolume.toString())
|
||||
save = true
|
||||
}
|
||||
|
||||
val newDisplayTheme = if (darkTheme.isChecked)
|
||||
AppCompatDelegate.MODE_NIGHT_YES
|
||||
else
|
||||
@ -541,10 +505,6 @@ class ConfigActivity : AppCompatActivity() {
|
||||
binding.AudioTitle .setOnClickListener {
|
||||
startActivity(Intent(this, AudioActivity::class.java))
|
||||
}
|
||||
binding.VolumeTitle.setOnClickListener {
|
||||
Utils.alertView(this, getString(R.string.default_call_volume),
|
||||
getString(R.string.default_call_volume_help))
|
||||
}
|
||||
binding.DarkThemeTitle.setOnClickListener {
|
||||
Utils.alertView(this, getString(R.string.dark_theme),
|
||||
getString(R.string.dark_theme_help))
|
||||
|
||||
@ -15,6 +15,31 @@
|
||||
android:paddingTop="16dp"
|
||||
android:focusableInTouchMode="true" >
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:orientation="horizontal" >
|
||||
<TextView
|
||||
android:id="@+id/VolumeTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toStartOf="@id/VolumeSpinner"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/default_call_volume" >
|
||||
</TextView>
|
||||
<Spinner
|
||||
android:id="@+id/VolumeSpinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="end" >
|
||||
</Spinner>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
@ -193,31 +193,6 @@
|
||||
android:text="@string/audio" >
|
||||
</TextView>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="12dp"
|
||||
android:orientation="horizontal" >
|
||||
<TextView
|
||||
android:id="@+id/VolumeTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_toStartOf="@id/VolumeSpinner"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/default_call_volume" >
|
||||
</TextView>
|
||||
<Spinner
|
||||
android:id="@+id/VolumeSpinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="end" >
|
||||
</Spinner>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
|
||||
Reference in New Issue
Block a user