Compare commits

..

No commits in common. "ea33e0b065bee87c8eb2f108910363fdf26a281f" and "d7fc54cfd0625d8bf40952f4162c4c5617db8148" have entirely different histories.

61 changed files with 17 additions and 127 deletions

View File

@ -7,11 +7,11 @@
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="C:\Users\baran\.android\avd\Pixel_2_API_R.avd" />
<value value="C:\Users\baran\.android\avd\Nexus_5_API_R.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2023-01-12T21:16:30.648959800Z" />
<timeTargetWasSelectedWithDropDown value="2023-01-11T18:53:15.217760700Z" />
</component>
</project>

View File

@ -5,13 +5,11 @@
<map>
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/drawable-anydpi/manuell.xml" value="0.1" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.1" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/drawable/ic_baseline_rotate_left_24.xml" value="0.1" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/drawable/ic_dashboard_black_24dp.xml" value="0.1" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/drawable/ic_home_black_24dp.xml" value="0.1" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/drawable/ic_launcher_background.xml" value="0.1" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/drawable/ic_notifications_black_24dp.xml" value="0.1" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/drawable/my_btn_toggle.xml" value="0.1" />
<entry key="..\:/Line-Following-Robot/MobileApp/app/src/main/res/drawable/vorwarts.xml" value="0.1" />
<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" />

Binary file not shown.

Before

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 81 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 83 KiB

View File

@ -7,15 +7,14 @@ import java.io.IOException;
import java.net.Socket;
public class Communication {
public boolean sendData(String data, String ip, int port) {
public boolean sendData(String data) {
try {
Socket socket = new Socket(ip, port);
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; //ToDo: change to false to test connection - currently always true is delivered
}
return true;
}

View File

@ -1,7 +1,5 @@
package com.example.lfrmobileapp;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import com.google.android.material.bottomnavigation.BottomNavigationView;
@ -14,8 +12,6 @@ import androidx.navigation.ui.NavigationUI;
import com.example.lfrmobileapp.databinding.ActivityMainBinding;
public class MainActivity extends AppCompatActivity {
private ActivityMainBinding binding;

View File

@ -1,7 +1,6 @@
package com.example.lfrmobileapp.ui.home;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
@ -15,20 +14,12 @@ import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import com.example.lfrmobileapp.Communication;
import com.example.lfrmobileapp.R;
import com.example.lfrmobileapp.databinding.FragmentManuellBinding;
import com.example.lfrmobileapp.ui.notifications.NotificationsFragment;
import io.github.controlwear.virtual.joystick.android.JoystickView;
public class HomeFragment extends Fragment {
String ipKey = "ipkey";
String portKey = "portkey";
String ipAddress = "192.168.0.1";
int port = 8000;
private FragmentManuellBinding binding;
public View onCreateView(@NonNull LayoutInflater inflater,
@ -39,12 +30,6 @@ public class HomeFragment extends Fragment {
binding = FragmentManuellBinding.inflate(inflater, container, false);
View root = binding.getRoot();
SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
ipAddress = sharedPref.getString(ipKey, "");
port = sharedPref.getInt(portKey, 0);
final TextView textView = binding.textHome;
homeViewModel.getText().observe(getViewLifecycleOwner(), textView::setText);
@ -54,28 +39,7 @@ public class HomeFragment extends Fragment {
@Override
public void onMove(int angle, int strength) {
homeViewModel.setText(Integer.toString(angle), Integer.toString(strength));
if((angle >= 338 || angle < 22) && strength != 0){
joystick.setBackgroundResource(R.mipmap.right);
}else if((angle >= 22 && angle < 67) && strength != 0){
joystick.setBackgroundResource(R.mipmap.right_forward);
}else if((angle >=67 && angle < 112) && strength != 0){
joystick.setBackgroundResource(R.mipmap.forward);
}else if((angle >=112 && angle < 157) && strength != 0){
joystick.setBackgroundResource(R.mipmap.left_forward);
}else if((angle >=157 && angle < 202) && strength != 0){
joystick.setBackgroundResource(R.mipmap.left);
}else if((angle >=202 && angle < 247) && strength != 0){
joystick.setBackgroundResource(R.mipmap.left_back);
}else if((angle >=247 && angle < 292) && strength != 0){
joystick.setBackgroundResource(R.mipmap.back);
}else if((angle >=292 && angle < 337) && strength != 0){
joystick.setBackgroundResource(R.mipmap.right_back);
}
else{
joystick.setBackgroundResource(R.mipmap.blank);
}
com.sendData("Vanessa stinkt, Baran nicht", ipAddress, port);
com.sendData("Vanessa stinkt, Baran nicht");
}
});

View File

@ -1,37 +1,19 @@
package com.example.lfrmobileapp.ui.notifications;
import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import androidx.annotation.NonNull;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.ViewModelProvider;
import com.example.lfrmobileapp.Communication;
import com.example.lfrmobileapp.R;
import com.example.lfrmobileapp.databinding.FragmentEinstellungenBinding;
public class NotificationsFragment extends Fragment {
String ipKey = "ipkey";
String portKey = "portkey";
String connectionFailed = "Verbindung fehlgeschlagen.";
String connectionSuccessful = "Verbindung erfolgreich.";
String ipAddress = "192.168.0.1";
int port = 8000;
int duration = Toast.LENGTH_LONG;
private FragmentEinstellungenBinding binding;
public View onCreateView(@NonNull LayoutInflater inflater,
@ -42,40 +24,6 @@ public class NotificationsFragment extends Fragment {
binding = FragmentEinstellungenBinding.inflate(inflater, container, false);
View root = binding.getRoot();
Communication com = new Communication();
SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPref.edit();
ipAddress = sharedPref.getString(ipKey, "");
binding.ipAdress.setText(ipAddress);
port = sharedPref.getInt(portKey, -1);
if(port != -1){
binding.port.setText(Integer.toString(port));
}else{
binding.port.setText("");
}
final Button button = binding.connect;
button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
ipAddress = String.valueOf(binding.ipAdress.getText());
port = Integer.parseInt(String.valueOf(binding.port.getText()));
if(com.sendData("", ipAddress, port)){
editor.putString(ipKey, ipAddress);
editor.putInt(portKey, port);
editor.apply();
Toast toast = Toast.makeText(v.getContext(), connectionSuccessful, duration);
toast.show();
}else{
Toast toast = Toast.makeText(v.getContext(), connectionFailed, duration);
toast.show();
}
}
});
return root;
}

View File

@ -9,8 +9,8 @@
<EditText
android:id="@+id/ipAdress"
android:layout_width="269dp"
android:layout_height="wrap_content"
android:layout_marginTop="60dp"
android:layout_height="38dp"
android:layout_marginTop="64dp"
android:hint="IP-Adresse"
android:digits="0123456789."
android:textColor="#000000"
@ -22,9 +22,8 @@
<EditText
android:id="@+id/port"
android:layout_width="269dp"
android:layout_height="wrap_content"
android:layout_height="38dp"
android:layout_marginTop="120dp"
android:ems="10"
android:hint="Port"
android:digits="0123456789"
android:textColor="#000000"
@ -32,17 +31,4 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<Button
android:id="@+id/connect"
android:layout_width="269dp"
android:layout_height="wrap_content"
android:layout_marginTop="180dp"
android:text="Verbinden"
android:background="@color/THblue"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"></Button>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -10,13 +10,13 @@
android:id="@+id/joystick"
android:layout_width="308dp"
android:layout_height="317dp"
android:layout_marginTop="68dp"
android:background="@mipmap/blank"
android:layout_marginTop="12dp"
android:background="@mipmap/kreis"
app:JV_buttonColor="#FFFFFF"
app:JV_buttonSizeRatio="11%"
app:JV_fixedCenter="false"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.495"
app:layout_constraintHorizontal_bias="0.481"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@ -25,7 +25,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginTop="5dp"
android:layout_marginEnd="8dp"
android:textAlignment="center"
android:textSize="15sp"
@ -38,9 +37,9 @@
<Button
android:id="@+id/rotateLeft"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="350dp"
android:layout_width="140dp"
android:layout_height="140dp"
android:layout_marginTop="325dp"
android:background="@drawable/ic_baseline_rotate_left_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.150"
@ -49,9 +48,9 @@
<Button
android:id="@+id/rotateRight"
android:layout_width="120dp"
android:layout_height="120dp"
android:layout_marginTop="350dp"
android:layout_width="140dp"
android:layout_height="140dp"
android:layout_marginTop="325dp"
android:background="@drawable/ic_baseline_rotate_right_24"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.85"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB