- added "Reset to Factory Default" config option
This commit is contained in:
@ -20,6 +20,7 @@ class ConfigActivity : AppCompatActivity() {
|
||||
internal lateinit var opusBitRate: EditText
|
||||
internal lateinit var iceLite: CheckBox
|
||||
internal lateinit var debug: CheckBox
|
||||
internal lateinit var reset: CheckBox
|
||||
|
||||
private var oldAutoStart = ""
|
||||
private var oldPreferIPv6 = ""
|
||||
@ -79,6 +80,9 @@ class ConfigActivity : AppCompatActivity() {
|
||||
oldLogLevel = dbCv[0]
|
||||
debug.isChecked = oldLogLevel == "0"
|
||||
|
||||
reset = findViewById(R.id.Reset) as CheckBox
|
||||
reset.isChecked = false
|
||||
|
||||
}
|
||||
|
||||
override fun onCreateOptionsMenu(menu: Menu): Boolean {
|
||||
@ -156,6 +160,13 @@ class ConfigActivity : AppCompatActivity() {
|
||||
save = true
|
||||
}
|
||||
|
||||
if (reset.isChecked) {
|
||||
Utils.copyAssetToFile(applicationContext, "config",
|
||||
applicationContext.filesDir.absolutePath + "/config")
|
||||
save = false
|
||||
restart = true
|
||||
}
|
||||
|
||||
if (save) {
|
||||
var newConfig = ""
|
||||
for (line in config.split("\n")) {
|
||||
@ -204,6 +215,9 @@ class ConfigActivity : AppCompatActivity() {
|
||||
findViewById(R.id.DebugTitle) as TextView-> {
|
||||
Utils.alertView(this, "Debug", getString(R.string.debug))
|
||||
}
|
||||
findViewById(R.id.ResetTitle) as TextView-> {
|
||||
Utils.alertView(this, "Reset", getString(R.string.reset))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -168,6 +168,32 @@
|
||||
</CheckBox>
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal" >
|
||||
<TextView
|
||||
android:id="@+id/ResetTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:textSize="18sp"
|
||||
android:textColor="@android:color/black"
|
||||
android:onClick="onClick"
|
||||
android:text="Reset to Factory Default" >
|
||||
</TextView>
|
||||
<CheckBox
|
||||
android:id="@+id/Reset"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_gravity="end"
|
||||
android:checked="false" >
|
||||
</CheckBox>
|
||||
</RelativeLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
@ -63,4 +63,5 @@
|
||||
Valid value are 6000-510000. Factory default is 28000.</string>
|
||||
<string name="iceLite">If checked, ICE Lite Mode is used.</string>
|
||||
<string name="debug">If checked, debug and info level log messages are available in logcat.</string>
|
||||
<string name="reset">If checked, configuration is reset to factory default.</string>
|
||||
</resources>
|
||||
Reference in New Issue
Block a user