Browse Source

IP-Adresse etc. in der app

master
Baran Yasar 1 year ago
parent
commit
ff7cc62f6a

+ 17
- 0
MobileApp/.idea/deploymentTargetDropDown.xml View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="deploymentTargetDropDown">
<targetSelectedWithDropDown>
<Target>
<type value="QUICK_BOOT_TARGET" />
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\baran\.android\avd\Nexus_5_API_R.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-01-11T18:53:15.217760700Z" />
</component>
</project>

+ 1
- 0
MobileApp/.idea/misc.xml View File

@@ -13,6 +13,7 @@
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/activity_main.xml" value="0.16666666666666666" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_automatik.xml" value="0.3333333333333333" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_dashboard.xml" value="0.14666666666666667" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_einstellungen.xml" value="0.25" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_home.xml" value="0.16666666666666666" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_manuell.xml" value="0.22" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/layout/fragment_notifications.xml" value="0.16666666666666666" />

+ 5
- 0
MobileApp/app/src/main/AndroidManifest.xml View File

@@ -3,6 +3,9 @@
xmlns:tools="http://schemas.android.com/tools"
package="com.example.lfrmobileapp">

<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.INTERNET" />

<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
@@ -25,4 +28,6 @@
</activity>
</application>



</manifest>

+ 22
- 2
MobileApp/app/src/main/java/com/example/lfrmobileapp/Communication.java View File

@@ -1,2 +1,22 @@
package com.example.lfrmobileapp;public class Communication {
}
package com.example.lfrmobileapp;

import android.accounts.NetworkErrorException;

import java.io.DataOutputStream;
import java.io.IOException;
import java.net.Socket;

public class Communication {
public boolean sendData(String data) {
try {
Socket socket = new Socket("192.168.0.1", 1755);
DataOutputStream DOS = new DataOutputStream(socket.getOutputStream());
DOS.writeUTF(data);
socket.close();
} catch (Exception e) {
e.printStackTrace();
}
return true;
}

}

+ 1
- 0
MobileApp/app/src/main/java/com/example/lfrmobileapp/MainActivity.java View File

@@ -34,4 +34,5 @@ public class MainActivity extends AppCompatActivity {
NavigationUI.setupWithNavController(binding.navView, navController);
}


}

+ 3
- 0
MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/home/HomeFragment.java View File

@@ -13,6 +13,7 @@ import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;

import com.example.lfrmobileapp.Communication;
import com.example.lfrmobileapp.databinding.FragmentManuellBinding;

import io.github.controlwear.virtual.joystick.android.JoystickView;
@@ -33,10 +34,12 @@ public class HomeFragment extends Fragment {
homeViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);

JoystickView joystick = (JoystickView) binding.joystick;
Communication com = new Communication();
joystick.setOnMoveListener(new JoystickView.OnMoveListener() {
@Override
public void onMove(int angle, int strength) {
homeViewModel.setText(Integer.toString(angle), Integer.toString(strength));
com.sendData("Vanessa stinkt, Baran nicht");
}
});


+ 0
- 2
MobileApp/app/src/main/java/com/example/lfrmobileapp/ui/notifications/NotificationsFragment.java View File

@@ -24,8 +24,6 @@ public class NotificationsFragment extends Fragment {
binding = FragmentEinstellungenBinding.inflate(inflater, container, false);
View root = binding.getRoot();

final TextView textView = binding.textNotifications;
notificationsViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);
return root;
}


+ 1
- 1
MobileApp/app/src/main/res/layout/fragment_automatik.xml View File

@@ -15,7 +15,7 @@
android:layout_marginEnd="16dp"
android:checked="false"
android:fontFamily="sans-serif-medium"
android:text="Roboter aktivieren "
android:text="Roboter losfahren "
android:textSize="16sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"

+ 22
- 10
MobileApp/app/src/main/res/layout/fragment_einstellungen.xml View File

@@ -6,16 +6,28 @@
android:layout_height="match_parent"
tools:context=".ui.notifications.NotificationsFragment">

<TextView
android:id="@+id/text_notifications"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="20sp"
app:layout_constraintBottom_toBottomOf="parent"
<EditText
android:id="@+id/ipAdress"
android:layout_width="269dp"
android:layout_height="38dp"
android:layout_marginTop="64dp"
android:hint="IP-Adresse"
android:digits="0123456789."
android:textColor="#000000"
android:inputType="number|numberDecimal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<EditText
android:id="@+id/port"
android:layout_width="269dp"
android:layout_height="38dp"
android:layout_marginTop="120dp"
android:hint="Port"
android:digits="0123456789"
android:textColor="#000000"
android:inputType="number|numberDecimal"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

+ 6
- 8
MobileApp/app/src/main/res/layout/fragment_manuell.xml View File

@@ -8,16 +8,15 @@

<io.github.controlwear.virtual.joystick.android.JoystickView
android:id="@+id/joystick"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:JV_backgroundColor="@color/THblue"
app:JV_borderColor="#000000"
app:JV_borderWidth="2dp"
android:layout_width="308dp"
android:layout_height="317dp"
android:layout_marginTop="12dp"
android:background="@mipmap/kreis"
app:JV_buttonColor="#FFFFFF"
app:JV_buttonSizeRatio="13%"
app:JV_buttonSizeRatio="11%"
app:JV_fixedCenter="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.0"
app:layout_constraintHorizontal_bias="0.481"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

@@ -26,7 +25,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="8dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="15sp"

BIN
MobileApp/app/src/main/res/layout/fragment_manuell.xml~ View File


Loading…
Cancel
Save