alert string update

This commit is contained in:
Omer Schloss 2021-06-22 16:09:54 +03:00
parent c5d2d762b4
commit e01c0c1145
3 changed files with 19 additions and 6 deletions

View File

@ -4,6 +4,7 @@ import android.os.Bundle
import android.view.View import android.view.View
import android.widget.Button import android.widget.Button
import android.widget.EditText import android.widget.EditText
import android.widget.Toast
import androidx.appcompat.app.AlertDialog import androidx.appcompat.app.AlertDialog
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import com.example.flightgearcontrollerapp.R import com.example.flightgearcontrollerapp.R
@ -27,11 +28,19 @@ class MainActivity : AppCompatActivity() {
if (!isConnected) { if (!isConnected) {
val editTextIP = findViewById<EditText>(ip_address) val editTextIP = findViewById<EditText>(ip_address)
val editTextPort = findViewById<EditText>(port_address) val editTextPort = findViewById<EditText>(port_address)
if (editTextIP.text.toString() ==""){
Toast.makeText(applicationContext, "Please write IP address", Toast.LENGTH_SHORT).show()
return
}
if (editTextPort.text.toString()==""){
Toast.makeText(applicationContext, "Please write port address", Toast.LENGTH_SHORT).show()
return
}
val builder = AlertDialog.Builder(this) val builder = AlertDialog.Builder(this)
builder.setTitle(getString(R.string.alert_dialog_flightgear_connection)) builder.setTitle(getString(R.string.alert_dialog_flightgear_connection))
builder.setMessage(getString(R.string.alert_instruction)) builder.setMessage(getString(R.string.alert_instruction))
builder.setPositiveButton(getString(R.string.ok_btn)){ dialog, _ -> builder.setPositiveButton(getString(R.string.ok_btn)){ dialog, _ ->
if ((editTextIP.text.toString() !="")&&(editTextPort.text.toString()!="")&&(vmConnection.connectToFG(editTextIP.text.toString(),editTextPort.text.toString()))) { if (vmConnection.connectToFG(editTextIP.text.toString(),editTextPort.text.toString())) {
btnConnection.setText(R.string.disconnect) btnConnection.setText(R.string.disconnect)
isConnected = true isConnected = true
} else { } else {

View File

@ -138,13 +138,13 @@
<com.jackandphantom.joystickview.JoyStickView <com.jackandphantom.joystickview.JoyStickView
android:id="@+id/widget_joystick" android:id="@+id/widget_joystick"
android:layout_width="360sp" android:layout_width="match_parent"
android:layout_height="360sp" android:layout_height="match_parent"
android:layout_alignParentEnd="true" android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginEnd="0dp" android:layout_marginEnd="0dp"
android:layout_marginBottom="-3dp" android:layout_marginBottom="0dp"
app:innerCircleColor="#f6FFFFFF" app:innerCircleColor="#f6FFFFFF"
app:innerCircleImage="@drawable/ic_baseline_airplanemode_active_24" app:innerCircleImage="@drawable/ic_baseline_airplanemode_active_24"
app:outerCircleBorderColor="#fff" app:outerCircleBorderColor="#fff"
@ -155,6 +155,7 @@
</RelativeLayout> </RelativeLayout>
<GridLayout <GridLayout
android:layout_width="100sp" android:layout_width="100sp"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/white_40"> android:background="@color/white_40">
@ -210,10 +211,13 @@
android:textStyle="bold" /> android:textStyle="bold" />
<com.google.android.material.slider.Slider <com.google.android.material.slider.Slider
android:layout_width="390sp" android:layout_width="match_parent"
android:layout_marginLeft="30sp" android:layout_marginLeft="30sp"
android:layout_marginRight="30sp"
android:layout_height="0sp" android:layout_height="0sp"
android:layout_weight="0" android:layout_weight="0"
app:trackColorActive="@color/navy_blue_40"
app:trackColorInactive="@color/navy_blue_40"
android:value="0" android:value="0"
android:valueFrom="-1" android:valueFrom="-1"
android:valueTo="1" /> android:valueTo="1" />

View File

@ -8,7 +8,7 @@
<string name="txt_rudder">Rudder</string> <string name="txt_rudder">Rudder</string>
<string name="disconnect">disconnect</string> <string name="disconnect">disconnect</string>
<string name="alert_dialog_flightgear_connection">FlightGear Connection</string> <string name="alert_dialog_flightgear_connection">FlightGear Connection</string>
<string name="alert_instruction">For connecting to FlightGear App,\nFirst open the app.\nThen, copy these lines to Setting-> Additional Setting:\n\n &#45;&#45;generic=socket,in,10,\'ip\',\'port\',tcp,playback_small \n &#45;&#45;fdm=null\n\n and now just press fly!</string> <string name="alert_instruction">For connecting to FlightGear App,\nFirst open the app.\nThen, copy these lines to Setting-> Additional Setting:\n\n &#45;&#45;telnet=socket,in,10,\'ip\',\'port\',tcp,playback_small \n\n and now just press fly!</string>
<string name="ok_btn">continue</string> <string name="ok_btn">continue</string>
<string name="alert_title">FlightGear Connection</string> <string name="alert_title">FlightGear Connection</string>
<string name="connection_failed">Connection failed!</string> <string name="connection_failed">Connection failed!</string>