Behebung von diversen Fehlern

This commit is contained in:
m_broelemann 2020-12-14 12:11:02 +01:00
parent 1a10d16b7b
commit 3f55ebce81
24 changed files with 253 additions and 135 deletions

16
APED/.idea/checkstyle-idea.xml generated Normal file
View File

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CheckStyle-IDEA">
<option name="configuration">
<map>
<entry key="checkstyle-version" value="8.37" />
<entry key="copy-libs" value="true" />
<entry key="location-0" value="BUNDLED:(bundled):Sun Checks" />
<entry key="location-1" value="BUNDLED:(bundled):Google Checks" />
<entry key="scan-before-checkin" value="false" />
<entry key="scanscope" value="JavaOnly" />
<entry key="suppress-errors" value="false" />
</map>
</option>
</component>
</project>

View File

@ -0,0 +1,6 @@
This folder contains libraries copied from the "APED" project.
It is managed by the CheckStyle-IDEA IDE plugin.
Do not modify this folder while the IDE is running.
When the IDE is stopped, you may delete this folder at any time. It will be recreated as needed.
In order to prevent the CheckStyle-IDEA IDE plugin from creating this folder,
uncheck the "Copy libraries from project directory" option in the CheckStyle-IDEA settings dialog.

117
APED/.idea/codeStyles/Project.xml generated Normal file
View File

@ -0,0 +1,117 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<codeStyleSettings language="XML">
<option name="FORCE_REARRANGE_MODE" value="1" />
<indentOptions>
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</indentOptions>
<arrangement>
<rules>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:android</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>xmlns:.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:id</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*:name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>name</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>style</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>^$</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>http://schemas.android.com/apk/res/android</XML_NAMESPACE>
</AND>
</match>
<order>ANDROID_ATTRIBUTE_ORDER</order>
</rule>
</section>
<section>
<rule>
<match>
<AND>
<NAME>.*</NAME>
<XML_ATTRIBUTE />
<XML_NAMESPACE>.*</XML_NAMESPACE>
</AND>
</match>
<order>BY_NAME</order>
</rule>
</section>
</rules>
</arrangement>
</codeStyleSettings>
</code_scheme>
</component>

View File

@ -0,0 +1,5 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View File

@ -2,13 +2,12 @@ package com.example.aped;
import android.os.Bundle; import android.os.Bundle;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.View;
import android.view.Menu; import android.view.Menu;
import android.widget.Button;
import android.widget.Toast; import android.widget.Toast;
import com.google.android.material.floatingactionbutton.FloatingActionButton; import com.example.aped.communication.IXML;
import com.google.android.material.snackbar.Snackbar; import com.example.aped.communication.TestXML;
import com.google.android.material.navigation.NavigationView; import com.google.android.material.navigation.NavigationView;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
@ -21,9 +20,10 @@ import androidx.appcompat.app.AppCompatActivity;
import androidx.appcompat.widget.Toolbar; import androidx.appcompat.widget.Toolbar;
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
/** was soll angezeigt werden in Navigation.*/
private AppBarConfiguration mAppBarConfiguration; private AppBarConfiguration mAppBarConfiguration;
/** zur Verwendung von xml anstatt der direkten Einbindung.*/
private IXML xml;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
@ -36,13 +36,16 @@ public class MainActivity extends AppCompatActivity {
// Passing each menu ID as a set of Ids because each // Passing each menu ID as a set of Ids because each
// menu should be considered as top level destinations. // menu should be considered as top level destinations.
mAppBarConfiguration = new AppBarConfiguration.Builder( mAppBarConfiguration = new AppBarConfiguration.Builder(
R.id.nav_all_IOs, R.id.nav_your_IOs, R.id.nav_slideshow) R.id.nav_all_IOs, R.id.nav_your_IOs)
.setDrawerLayout(drawer) .setDrawerLayout(drawer)
.build(); .build();
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); NavController navController = Navigation.findNavController(this,
NavigationUI.setupActionBarWithNavController(this, navController, mAppBarConfiguration); R.id.nav_host_fragment);
NavigationUI.setupActionBarWithNavController(this,
navController, mAppBarConfiguration);
NavigationUI.setupWithNavController(navigationView, navController); NavigationUI.setupWithNavController(navigationView, navController);
xml = new TestXML();
} }
@Override @Override
@ -54,29 +57,35 @@ public class MainActivity extends AppCompatActivity {
@Override @Override
public boolean onSupportNavigateUp() { public boolean onSupportNavigateUp() {
NavController navController = Navigation.findNavController(this, R.id.nav_host_fragment); NavController navController = Navigation.findNavController(this,
R.id.nav_host_fragment);
return NavigationUI.navigateUp(navController, mAppBarConfiguration) return NavigationUI.navigateUp(navController, mAppBarConfiguration)
|| super.onSupportNavigateUp(); || super.onSupportNavigateUp();
} }
/**was sollbeit click auf den jeweiligen itembutton passieren.*/
@Override @Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) { public boolean onOptionsItemSelected(@NonNull MenuItem item) {
switch (item.getItemId()){ switch (item.getItemId()) {
case R.id.action_settings: case R.id.action_settings:
Toast.makeText(this,"Settings",Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Settings",
Toast.LENGTH_SHORT).show();
return true; return true;
case R.id.action_adjust_xml: case R.id.action_adjust_xml:
Toast.makeText(this,"Adjust .xml",Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Adjust .xml",
Toast.LENGTH_SHORT).show();
return true; return true;
case R.id.action_download_xml: case R.id.action_download_xml:
Toast.makeText(this,"Download .xml",Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Download .xml",
Toast.LENGTH_SHORT).show();
return true; return true;
case R.id.action_upload_xml: case R.id.action_upload_xml:
Toast.makeText(this,"Upload .xml",Toast.LENGTH_SHORT).show(); Toast.makeText(this, "Upload .xml",
Toast.LENGTH_SHORT).show();
xml.upload();
return true; return true;
default: default:
return super.onOptionsItemSelected(item); return super.onOptionsItemSelected(item);
} }
} }
} }

View File

@ -0,0 +1,9 @@
package com.example.aped.communication;
public interface IXML {
/** dowload er XML.*/
int download();
/** upload er XML.*/
int upload();
}

View File

@ -0,0 +1,14 @@
package com.example.aped.communication;
public class TestXML implements IXML {
/** was soll bei download getan werden.*/
@Override
public int download() {
return 0;
}
/** was soll bei upload getan werden.*/
@Override
public int upload() {
return 0;
}
}

View File

@ -0,0 +1,4 @@
/**
* package for the communication.
* */
package com.example.aped.communication;

View File

@ -0,0 +1,5 @@
/**
* Package communication ui and main.
* */
package com.example.aped;

View File

@ -14,17 +14,19 @@ import androidx.lifecycle.ViewModelProvider;
import com.example.aped.R; import com.example.aped.R;
public class All_IOs_Fragment extends Fragment { public class AllIOsFragment extends Fragment {
private All_IOs_ViewModel allIOsViewModel; private AllIOsViewModel allIOsViewModel;
public View onCreateView(@NonNull LayoutInflater inflater, public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) { ViewGroup container, Bundle savedInstanceState) {
allIOsViewModel = allIOsViewModel =
new ViewModelProvider(this).get(All_IOs_ViewModel.class); new ViewModelProvider(this).get(AllIOsViewModel.class);
View root = inflater.inflate(R.layout.fragment_all_ios, container, false); View root = inflater.inflate(R.layout.fragment_all_ios, container,
false);
final TextView textView = root.findViewById(R.id.text_all_IOs); final TextView textView = root.findViewById(R.id.text_all_IOs);
allIOsViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() { allIOsViewModel.getText().observe(getViewLifecycleOwner(),
new Observer<String>() {
@Override @Override
public void onChanged(@Nullable String s) { public void onChanged(@Nullable String s) {
textView.setText(s); textView.setText(s);
@ -32,4 +34,4 @@ public class All_IOs_Fragment extends Fragment {
}); });
return root; return root;
} }
} }

View File

@ -4,16 +4,17 @@ import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel; import androidx.lifecycle.ViewModel;
public class All_IOs_ViewModel extends ViewModel { public class AllIOsViewModel extends ViewModel {
/** .*/
private MutableLiveData<String> mText; private MutableLiveData<String> mText;
/** Text Ausgabe.*/
public All_IOs_ViewModel() { public AllIOsViewModel() {
mText = new MutableLiveData<>(); mText = new MutableLiveData<>();
mText.setValue("Anzeige aller Mess & Sollwertvorgaben bestimmt durch die xml"); mText.setValue("Anzeige aller Mess & Sollwertvorgaben bestimmt durch"
+ " die xml");
} }
/** Rückgabe des Textes.*/
public LiveData<String> getText() { public LiveData<String> getText() {
return mText; return mText;
} }
} }

View File

@ -0,0 +1,5 @@
/**
* Package for the IO user interface.
* */
package com.example.aped.ui.all_IOs;

View File

@ -0,0 +1,4 @@
/**
* Package for the user interface.
* */
package com.example.aped.ui;

View File

@ -1,35 +0,0 @@
package com.example.aped.ui.slideshow;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProvider;
import com.example.aped.R;
public class SlideshowFragment extends Fragment {
private SlideshowViewModel slideshowViewModel;
public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) {
slideshowViewModel =
new ViewModelProvider(this).get(SlideshowViewModel.class);
View root = inflater.inflate(R.layout.fragment_slideshow, container, false);
final TextView textView = root.findViewById(R.id.text_slideshow);
slideshowViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() {
@Override
public void onChanged(@Nullable String s) {
textView.setText(s);
}
});
return root;
}
}

View File

@ -1,19 +0,0 @@
package com.example.aped.ui.slideshow;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;
public class SlideshowViewModel extends ViewModel {
private MutableLiveData<String> mText;
public SlideshowViewModel() {
mText = new MutableLiveData<>();
mText.setValue("wird vorraussichtlich nicht benötigt");
}
public LiveData<String> getText() {
return mText;
}
}

View File

@ -14,17 +14,19 @@ import androidx.lifecycle.ViewModelProvider;
import com.example.aped.R; import com.example.aped.R;
public class Your_IOs_Fragment extends Fragment { public class YourIOsFragment extends Fragment {
private Your_IOs_ViewModel your_IOs_ViewModel; private YourIOsViewModel yourIOsViewModel;
public View onCreateView(@NonNull LayoutInflater inflater, public View onCreateView(@NonNull LayoutInflater inflater,
ViewGroup container, Bundle savedInstanceState) { ViewGroup container, Bundle savedInstanceState) {
your_IOs_ViewModel = yourIOsViewModel =
new ViewModelProvider(this).get(Your_IOs_ViewModel.class); new ViewModelProvider(this).get(YourIOsViewModel.class);
View root = inflater.inflate(R.layout.fragment_your_ios, container, false); View root = inflater.inflate(R.layout.fragment_your_ios, container,
false);
final TextView textView = root.findViewById(R.id.text_your_IOs); final TextView textView = root.findViewById(R.id.text_your_IOs);
your_IOs_ViewModel.getText().observe(getViewLifecycleOwner(), new Observer<String>() { yourIOsViewModel.getText().observe(getViewLifecycleOwner(),
new Observer<String>() {
@Override @Override
public void onChanged(@Nullable String s) { public void onChanged(@Nullable String s) {
textView.setText(s); textView.setText(s);
@ -32,4 +34,4 @@ public class Your_IOs_Fragment extends Fragment {
}); });
return root; return root;
} }
} }

View File

@ -4,16 +4,16 @@ import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData; import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel; import androidx.lifecycle.ViewModel;
public class Your_IOs_ViewModel extends ViewModel { public class YourIOsViewModel extends ViewModel {
/** .*/
private MutableLiveData<String> mText; private MutableLiveData<String> mText;
/** Text Ausgabe.*/
public Your_IOs_ViewModel() { public YourIOsViewModel() {
mText = new MutableLiveData<>(); mText = new MutableLiveData<>();
mText.setValue("Personalisierte Anzeige der Mess- & Sollwerte"); mText.setValue("Personalisierte Anzeige der Mess- & Sollwerte");
} }
/** Rückgabe des Textes.*/
public LiveData<String> getText() { public final LiveData<String> getText() {
return mText; return mText;
} }
} }

View File

@ -0,0 +1,5 @@
/**
* Package for the IO user interface.
* */
package com.example.aped.ui.your_IOs;

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.all_IOs.All_IOs_Fragment"> tools:context=".ui.all_IOs.AllIOsFragment">
<TextView <TextView
android:id="@+id/text_all_IOs" android:id="@+id/text_all_IOs"

View File

@ -1,22 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".ui.slideshow.SlideshowFragment">
<TextView
android:id="@+id/text_slideshow"
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"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -4,7 +4,7 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.your_IOs.Your_IOs_Fragment"> tools:context=".ui.your_IOs.YourIOsFragment">
<TextView <TextView
android:id="@+id/text_your_IOs" android:id="@+id/text_your_IOs"

View File

@ -11,10 +11,6 @@
<item <item
android:id="@+id/nav_your_IOs" android:id="@+id/nav_your_IOs"
android:icon="@drawable/ic_menu_gallery" android:icon="@drawable/ic_menu_gallery"
android:title="@string/menu_all_IOs" /> android:title="@string/menu_your_IOs" />
<item
android:id="@+id/nav_slideshow"
android:icon="@drawable/ic_menu_slideshow"
android:title="@string/menu_slideshow" />
</group> </group>
</menu> </menu>

View File

@ -7,19 +7,14 @@
<fragment <fragment
android:id="@+id/nav_all_IOs" android:id="@+id/nav_all_IOs"
android:name="com.example.aped.ui.all_IOs.All_IOs_Fragment" android:name="com.example.aped.ui.all_IOs.AllIOsFragment"
android:label="@string/menu_all_IOs" android:label="@string/menu_all_IOs"
tools:layout="@layout/fragment_all_ios" /> tools:layout="@layout/fragment_all_ios" />
<fragment <fragment
android:id="@+id/nav_your_IOs" android:id="@+id/nav_your_IOs"
android:name="com.example.aped.ui.your_IOs.Your_IOs_Fragment" android:name="com.example.aped.ui.your_IOs.YourIOsFragment"
android:label="@string/menu_your_IOs" android:label="@string/menu_your_IOs"
tools:layout="@layout/fragment_your_ios" /> tools:layout="@layout/fragment_your_ios" />
<fragment
android:id="@+id/nav_slideshow"
android:name="com.example.aped.ui.slideshow.SlideshowFragment"
android:label="@string/menu_slideshow"
tools:layout="@layout/fragment_slideshow" />
</navigation> </navigation>

View File

@ -12,5 +12,4 @@
<string name="menu_all_IOs">all IOs</string> <string name="menu_all_IOs">all IOs</string>
<string name="menu_your_IOs">your IOs</string> <string name="menu_your_IOs">your IOs</string>
<string name="menu_slideshow">noch zu entfernen</string>
</resources> </resources>