diff --git a/app/src/main/java/de/jg_cody/Teraplex/MainActivity.java b/app/src/main/java/de/jg_cody/Teraplex/MainActivity.java index bfd9a9a..49ccc2e 100644 --- a/app/src/main/java/de/jg_cody/Teraplex/MainActivity.java +++ b/app/src/main/java/de/jg_cody/Teraplex/MainActivity.java @@ -48,6 +48,7 @@ import java.io.IOException; import java.io.InputStream; import java.util.Base64; import java.util.Locale; +import java.util.Objects; import de.jg_cody.Teraplex.ui.Credits.CreditsFragment; import de.jg_cody.Teraplex.ui.Einstellungen.EinstellungenFragment; @@ -238,7 +239,7 @@ public class MainActivity extends AppCompatActivity implements AddButtonDialog.A } private void showChooseElement() { - final String[] listItems = {"SINGLE BUTTON", "DOUBLE BUTTON", "OPTION3"}; + final String[] listItems = {"SINGLE BUTTON", "DOUBLE BUTTON", "ÜBERSCHRIFT", "PLATZHALTER"}; AlertDialog.Builder mBuilder = new AlertDialog.Builder(MainActivity.this); mBuilder.setTitle("CHOOSE ELEMENT"); mBuilder.setSingleChoiceItems(listItems, -5, new DialogInterface.OnClickListener() { @@ -250,12 +251,15 @@ public class MainActivity extends AppCompatActivity implements AddButtonDialog.A openDialog2(); } else if (i == 2) { + } else if (i == 3) { + } + dialogInterface.dismiss(); } }); AlertDialog mDialog = mBuilder.create(); - mDialog.getWindow().setBackgroundDrawableResource(R.drawable.button_round); + Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); mDialog.show(); } diff --git a/app/src/main/java/de/jg_cody/Teraplex/ui/Credits/CreditsFragment.java b/app/src/main/java/de/jg_cody/Teraplex/ui/Credits/CreditsFragment.java index 5671d4d..ab2e013 100644 --- a/app/src/main/java/de/jg_cody/Teraplex/ui/Credits/CreditsFragment.java +++ b/app/src/main/java/de/jg_cody/Teraplex/ui/Credits/CreditsFragment.java @@ -31,7 +31,7 @@ public class CreditsFragment extends Fragment { creditsViewModel = new ViewModelProvider(this).get(CreditsViewModel.class); View root = inflater.inflate(R.layout.fragment_credits, container, false); - SharedPreferences p = getContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE); + SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE); String Background = p.getString("Background", null); if (Background != null) { ImageView I = root.findViewById(R.id.Background); diff --git a/app/src/main/java/de/jg_cody/Teraplex/ui/Einstellungen/EinstellungenFragment.java b/app/src/main/java/de/jg_cody/Teraplex/ui/Einstellungen/EinstellungenFragment.java index 068abe4..507236d 100644 --- a/app/src/main/java/de/jg_cody/Teraplex/ui/Einstellungen/EinstellungenFragment.java +++ b/app/src/main/java/de/jg_cody/Teraplex/ui/Einstellungen/EinstellungenFragment.java @@ -28,6 +28,7 @@ import com.rarepebble.colorpicker.ColorPickerView; import java.util.Base64; import java.util.Locale; +import java.util.Objects; import de.jg_cody.Teraplex.MainActivity; import de.jg_cody.Teraplex.R; @@ -44,7 +45,7 @@ public class EinstellungenFragment extends Fragment { einstellungenViewModel = new ViewModelProvider(this).get(EinstellungenViewModel.class); View root = inflater.inflate(R.layout.fragment_einstellungen, container, false); - SharedPreferences p = getContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE); + SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE); String Background = p.getString("Background", null); if (Background != null) { ImageView I = root.findViewById(R.id.Background); @@ -75,10 +76,10 @@ public class EinstellungenFragment extends Fragment { .setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { try { - getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE).edit().clear().commit(); - startActivity(getActivity().getIntent()); - getActivity().finish(); - } catch (Exception e) { + requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE).edit().clear().apply(); + startActivity(requireActivity().getIntent()); + requireActivity().finish(); + } catch (Exception ignored) { } // Continue with delete operation @@ -88,7 +89,7 @@ public class EinstellungenFragment extends Fragment { // A null listener allows the button to dismiss the dialog and take no further action. .setNegativeButton(android.R.string.no, null) .create(); - mDialog.getWindow().setBackgroundDrawableResource(R.drawable.button_round); + Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); mDialog.show(); } @@ -107,11 +108,11 @@ public class EinstellungenFragment extends Fragment { @Override public void onClick(View view) { Toast.makeText(getContext(), "Theme1", Toast.LENGTH_SHORT).show(); - SharedPreferences.Editor editor = getContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); + SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); editor.putString("Theme", "RED_BLUE"); editor.apply(); - startActivity(getActivity().getIntent()); - getActivity().finish(); + startActivity(requireActivity().getIntent()); + requireActivity().finish(); } @@ -121,11 +122,11 @@ public class EinstellungenFragment extends Fragment { @Override public void onClick(View view) { Toast.makeText(getContext(), "Theme2", Toast.LENGTH_SHORT).show(); - SharedPreferences.Editor editor = getContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); + SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); editor.putString("Theme", "GREEN_YELLOW"); editor.apply(); - startActivity(getActivity().getIntent()); - getActivity().finish(); + startActivity(requireActivity().getIntent()); + requireActivity().finish(); } @@ -135,11 +136,11 @@ public class EinstellungenFragment extends Fragment { @Override public void onClick(View view) { Toast.makeText(getContext(), "Theme3", Toast.LENGTH_SHORT).show(); - SharedPreferences.Editor editor = getContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); + SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); editor.putString("Theme", "ORANGE_TURQUOISE"); editor.apply(); - startActivity(getActivity().getIntent()); - getActivity().finish(); + startActivity(requireActivity().getIntent()); + requireActivity().finish(); } @@ -149,11 +150,11 @@ public class EinstellungenFragment extends Fragment { @Override public void onClick(View view) { Toast.makeText(getContext(), "Theme4", Toast.LENGTH_SHORT).show(); - SharedPreferences.Editor editor = getContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); + SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); editor.putString("Theme", "YELLOW_BLUE"); editor.apply(); - startActivity(getActivity().getIntent()); - getActivity().finish(); + startActivity(requireActivity().getIntent()); + requireActivity().finish(); } @@ -163,11 +164,11 @@ public class EinstellungenFragment extends Fragment { @Override public void onClick(View view) { Toast.makeText(getContext(), "Theme5", Toast.LENGTH_SHORT).show(); - SharedPreferences.Editor editor = getContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); + SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); editor.putString("Theme", "PINK_GREEN"); editor.apply(); - startActivity(getActivity().getIntent()); - getActivity().finish(); + startActivity(requireActivity().getIntent()); + requireActivity().finish(); } @@ -185,22 +186,22 @@ public class EinstellungenFragment extends Fragment { public void onClick(DialogInterface dialogInterface, int i) { if (i == 0) { setLocale("de"); - startActivity(getActivity().getIntent()); - getActivity().finish(); + startActivity(requireActivity().getIntent()); + requireActivity().finish(); } else if (i == 1) { setLocale("en"); - startActivity(getActivity().getIntent()); - getActivity().finish(); + startActivity(requireActivity().getIntent()); + requireActivity().finish(); } else if (i == 2) { setLocale("tlh"); - startActivity(getActivity().getIntent()); - getActivity().finish(); + startActivity(requireActivity().getIntent()); + requireActivity().finish(); } dialogInterface.dismiss(); } }); AlertDialog mDialog = mBuilder.create(); - mDialog.getWindow().setBackgroundDrawableResource(R.drawable.button_round); + Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); mDialog.show(); } @@ -222,7 +223,7 @@ public class EinstellungenFragment extends Fragment { } }).create(); - mDialog.getWindow().setBackgroundDrawableResource(R.drawable.button_round); + Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); mDialog.show(); } catch (Exception e) { } @@ -238,25 +239,25 @@ public class EinstellungenFragment extends Fragment { } }).create(); - mDialog.getWindow().setBackgroundDrawableResource(R.drawable.button_round); + Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); mDialog.show(); - } catch (Exception e) { + } catch (Exception ignored) { } } else if (i == 2) { Intent a = new Intent( Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); - getActivity().startActivityForResult(a, MainActivity.RESULT_LOAD_IMAGE); + requireActivity().startActivityForResult(a, MainActivity.RESULT_LOAD_IMAGE); } else if (i == 3) { - getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE).edit().remove("Background").commit(); - startActivity(getActivity().getIntent()); - getActivity().finish(); + requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE).edit().remove("Background").apply(); + startActivity(requireActivity().getIntent()); + requireActivity().finish(); } dialogInterface.dismiss(); } }); AlertDialog mDialog = mBuilder.create(); - mDialog.getWindow().setBackgroundDrawableResource(R.drawable.button_round); + Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); mDialog.show(); } @@ -265,8 +266,8 @@ public class EinstellungenFragment extends Fragment { Locale.setDefault(locale); Configuration config = new Configuration(); config.locale = locale; - getContext().getResources().updateConfiguration(config, getContext().getResources().getDisplayMetrics()); - SharedPreferences.Editor editor = getContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); + requireContext().getResources().updateConfiguration(config, requireContext().getResources().getDisplayMetrics()); + SharedPreferences.Editor editor = requireContext().getSharedPreferences("appsettings", MODE_PRIVATE).edit(); editor.putString("Language", lang); editor.apply(); } diff --git a/app/src/main/java/de/jg_cody/Teraplex/ui/Flur/FlurFragment.java b/app/src/main/java/de/jg_cody/Teraplex/ui/Flur/FlurFragment.java index 678e892..ad4c322 100644 --- a/app/src/main/java/de/jg_cody/Teraplex/ui/Flur/FlurFragment.java +++ b/app/src/main/java/de/jg_cody/Teraplex/ui/Flur/FlurFragment.java @@ -26,6 +26,7 @@ import androidx.lifecycle.ViewModelProvider; import java.util.ArrayList; import java.util.Base64; import java.util.List; +import java.util.Objects; import de.jg_cody.Teraplex.ActivityCricketers; import de.jg_cody.Teraplex.Cricketer; @@ -50,7 +51,7 @@ public class FlurFragment extends Fragment implements View.OnClickListener { flurViewModel = new ViewModelProvider(this).get(FlurViewModel.class); View root = inflater.inflate(R.layout.fragment_flur, container, false); - SharedPreferences p = getContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE); + SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE); String Background = p.getString("Background", null); if (Background != null) { ImageView I = root.findViewById(R.id.Background); @@ -154,7 +155,7 @@ public class FlurFragment extends Fragment implements View.OnClickListener { AppCompatSpinner spinnerTeam = (AppCompatSpinner)cricketerView.findViewById(R.id.spinner_team); ImageView imageClose = (ImageView)cricketerView.findViewById(R.id.image_remove); - ArrayAdapter arrayAdapter = new ArrayAdapter(getContext(),android.R.layout.simple_spinner_item,teamList); + ArrayAdapter arrayAdapter = new ArrayAdapter(requireContext(),android.R.layout.simple_spinner_item,teamList); spinnerTeam.setAdapter(arrayAdapter); imageClose.setOnClickListener(new View.OnClickListener() { diff --git a/app/src/main/java/de/jg_cody/Teraplex/ui/Konsole/KonsoleFragment.java b/app/src/main/java/de/jg_cody/Teraplex/ui/Konsole/KonsoleFragment.java index f95aa0e..561979d 100644 --- a/app/src/main/java/de/jg_cody/Teraplex/ui/Konsole/KonsoleFragment.java +++ b/app/src/main/java/de/jg_cody/Teraplex/ui/Konsole/KonsoleFragment.java @@ -23,6 +23,7 @@ import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; import java.util.Base64; +import java.util.Objects; import de.jg_cody.Teraplex.MainActivity; import de.jg_cody.Teraplex.R; @@ -49,7 +50,7 @@ public class KonsoleFragment extends Fragment { konsoleViewModel = new ViewModelProvider(this).get(KonsoleViewModel.class); View root = inflater.inflate(R.layout.fragment_konsole, container, false); - SharedPreferences p = getContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE); + SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE); String Background = p.getString("Background", null); if (Background != null) { ImageView I = root.findViewById(R.id.Background); @@ -71,7 +72,7 @@ public class KonsoleFragment extends Fragment { Toast.makeText(root.getContext(), command, Toast.LENGTH_SHORT).show(); SSH_connection.executeRemoteCommand(ip, user, password, command); } - } catch (Exception e) { + } catch (Exception ignored) { } } @@ -105,7 +106,7 @@ public class KonsoleFragment extends Fragment { // A null listener allows the button to dismiss the dialog and take no further action. .setNegativeButton(android.R.string.no, null) .create(); - mDialog.getWindow().setBackgroundDrawableResource(R.drawable.button_round); + Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); mDialog.show(); @@ -133,7 +134,7 @@ public class KonsoleFragment extends Fragment { mp.start(); Toast.makeText(getContext(), "Server wird heruntergefahren...", Toast.LENGTH_SHORT).show(); SSH_connection.executeRemoteCommand(ip, user, password, "shutdown now"); - } catch (Exception e) { + } catch (Exception ignored) { } // Continue with delete operation @@ -143,7 +144,7 @@ public class KonsoleFragment extends Fragment { // A null listener allows the button to dismiss the dialog and take no further action. .setNegativeButton(android.R.string.no, null) .create(); - mDialog.getWindow().setBackgroundDrawableResource(R.drawable.button_round); + Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round); mDialog.show(); } diff --git a/app/src/main/java/de/jg_cody/Teraplex/ui/Schlafzimmer/SchlafzimmerFragment.java b/app/src/main/java/de/jg_cody/Teraplex/ui/Schlafzimmer/SchlafzimmerFragment.java index ea7dfbd..3459c66 100644 --- a/app/src/main/java/de/jg_cody/Teraplex/ui/Schlafzimmer/SchlafzimmerFragment.java +++ b/app/src/main/java/de/jg_cody/Teraplex/ui/Schlafzimmer/SchlafzimmerFragment.java @@ -41,7 +41,7 @@ public class SchlafzimmerFragment extends Fragment { @RequiresApi(api = Build.VERSION_CODES.O) public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - SharedPreferences prefs = getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE); + SharedPreferences prefs = requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE); user = prefs.getString("user", null); password = prefs.getString("password", null); ip = prefs.getString("ip", null); @@ -49,7 +49,7 @@ public class SchlafzimmerFragment extends Fragment { schlafzimmerViewModel = new ViewModelProvider(this).get(SchlafzimmerViewModel.class); View root = inflater.inflate(R.layout.fragment_schlafzimmer, container, false); - SharedPreferences p = getContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE); + SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE); String Background = p.getString("Background", null); if (Background != null) { ImageView I = root.findViewById(R.id.Background); @@ -67,7 +67,7 @@ public class SchlafzimmerFragment extends Fragment { try { Toast.makeText(getContext(), "Lampe wird ausgeschaltet...", Toast.LENGTH_SHORT).show(); SSH_connection.executeRemoteCommand(ip, user, password, "sudo /root/raspberry-remote/send 11111 4 0"); - } catch (Exception e) { + } catch (Exception ignored) { } } @@ -80,7 +80,7 @@ public class SchlafzimmerFragment extends Fragment { try { Toast.makeText(getContext(), "Lampe wird angeschaltet...", Toast.LENGTH_SHORT).show(); SSH_connection.executeRemoteCommand(ip, user, password, "sudo /root/raspberry-remote/send 11111 4 1"); - } catch (Exception e) { + } catch (Exception ignored) { } } @@ -93,7 +93,7 @@ public class SchlafzimmerFragment extends Fragment { try { Toast.makeText(getContext(), "Lampe wird ausgeschaltet...", Toast.LENGTH_SHORT).show(); SSH_connection.executeRemoteCommand(ip, user, password, "sudo /root/raspberry-remote/send 11111 2 0"); - } catch (Exception e) { + } catch (Exception ignored) { } } @@ -106,7 +106,7 @@ public class SchlafzimmerFragment extends Fragment { try { Toast.makeText(getContext(), "Lampe wird angeschaltet...", Toast.LENGTH_SHORT).show(); SSH_connection.executeRemoteCommand(ip, user, password, "sudo /root/raspberry-remote/send 11111 2 1"); - } catch (Exception e) { + } catch (Exception ignored) { } } @@ -119,7 +119,7 @@ public class SchlafzimmerFragment extends Fragment { try { Toast.makeText(getContext(), "Lampe wird ausgeschaltet...", Toast.LENGTH_SHORT).show(); SSH_connection.executeRemoteCommand(ip, user, password, "sudo /root/raspberry-remote/send 11111 3 0"); - } catch (Exception e) { + } catch (Exception ignored) { } } @@ -132,7 +132,7 @@ public class SchlafzimmerFragment extends Fragment { try { Toast.makeText(getContext(), "Lampe wird angeschaltet...", Toast.LENGTH_SHORT).show(); SSH_connection.executeRemoteCommand(ip, user, password, "sudo /root/raspberry-remote/send 11111 3 1"); - } catch (Exception e) { + } catch (Exception ignored) { } } diff --git a/app/src/main/java/de/jg_cody/Teraplex/ui/home/HomeFragment.java b/app/src/main/java/de/jg_cody/Teraplex/ui/home/HomeFragment.java index 7f6c108..49b7cac 100644 --- a/app/src/main/java/de/jg_cody/Teraplex/ui/home/HomeFragment.java +++ b/app/src/main/java/de/jg_cody/Teraplex/ui/home/HomeFragment.java @@ -47,7 +47,7 @@ public class HomeFragment extends Fragment { @RequiresApi(api = Build.VERSION_CODES.O) public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - SharedPreferences prefs = getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE); + SharedPreferences prefs = requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE); user = prefs.getString("user", null); password = prefs.getString("password", null); ip = prefs.getString("ip", null); @@ -55,7 +55,7 @@ public class HomeFragment extends Fragment { homeViewModel = new ViewModelProvider(this).get(HomeViewModel.class); View root = inflater.inflate(R.layout.fragment_home, container, false); - SharedPreferences p = getContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE); + SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE); String Background = p.getString("Background", null); if (Background != null) { ImageView I = root.findViewById(R.id.Background); @@ -74,7 +74,7 @@ public class HomeFragment extends Fragment { passwordInput = (EditText) root.findViewById(R.id.loginpasswordInput); ipInput = (EditText) root.findViewById(R.id.ipInput); loginButton = (Button) root.findViewById(R.id.loginButton); - SharedPreferences t = getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE); + SharedPreferences t = requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE); if (user == null || ip == null) { loginButton.setVisibility(View.VISIBLE); } else { @@ -92,7 +92,7 @@ public class HomeFragment extends Fragment { user = userInput.getText().toString(); password = passwordInput.getText().toString(); ip = ipInput.getText().toString(); - SharedPreferences p = getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE); + SharedPreferences p = requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE); p.edit().putString("user", user).putString("password", password).putString("ip", ip).apply(); Toast.makeText(getContext(), getString(R.string.login_saved), Toast.LENGTH_SHORT).show(); if (user == null || ip == null) { @@ -120,9 +120,9 @@ public class HomeFragment extends Fragment { logoutButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - getContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE).edit().remove("ip").remove("user").remove("password").commit(); - startActivity(getActivity().getIntent()); - getActivity().finish(); + requireContext().getSharedPreferences("appsettings", Context.MODE_PRIVATE).edit().remove("ip").remove("user").remove("password").apply(); + startActivity(requireActivity().getIntent()); + requireActivity().finish(); } }); wlan_aus_Button = (Button) root.findViewById(R.id.wlan_aus); diff --git a/app/src/main/java/de/jg_cody/Teraplex/ui/intro/IntroFragment.java b/app/src/main/java/de/jg_cody/Teraplex/ui/intro/IntroFragment.java index b69a90a..0f7c63d 100644 --- a/app/src/main/java/de/jg_cody/Teraplex/ui/intro/IntroFragment.java +++ b/app/src/main/java/de/jg_cody/Teraplex/ui/intro/IntroFragment.java @@ -35,7 +35,7 @@ public class IntroFragment extends Fragment { // Build your video Uri Uri uri = Uri.parse("android.resource://" // First start with this, - + getContext().getPackageName() // then retrieve your package name, + + requireContext().getPackageName() // then retrieve your package name, + "/" // add a slash, + R.raw.intro); // and then finally add your video resource. Make sure it is stored // in the raw folder. diff --git a/app/src/main/java/de/jg_cody/Teraplex/ui/zeitsteuerung/ZeitsteuerungFragment.java b/app/src/main/java/de/jg_cody/Teraplex/ui/zeitsteuerung/ZeitsteuerungFragment.java index 22d8938..b3a23f4 100644 --- a/app/src/main/java/de/jg_cody/Teraplex/ui/zeitsteuerung/ZeitsteuerungFragment.java +++ b/app/src/main/java/de/jg_cody/Teraplex/ui/zeitsteuerung/ZeitsteuerungFragment.java @@ -18,6 +18,7 @@ import androidx.fragment.app.Fragment; import androidx.lifecycle.ViewModelProvider; import java.util.Base64; +import java.util.Objects; import de.jg_cody.Teraplex.MainActivity; import de.jg_cody.Teraplex.R; @@ -33,7 +34,7 @@ public class ZeitsteuerungFragment extends Fragment { zeitsteuerungViewModel = new ViewModelProvider(this).get(ZeitsteuerungViewModel.class); View root = inflater.inflate(R.layout.fragment_zeitsteuerung, container, false); - SharedPreferences p = getContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE); + SharedPreferences p = requireContext().getSharedPreferences("appsettings", Activity.MODE_PRIVATE); String Background = p.getString("Background", null); if (Background != null) { ImageView I = root.findViewById(R.id.Background); diff --git a/app/src/main/res/layout/fragment_home.xml b/app/src/main/res/layout/fragment_home.xml index 2365839..97976a5 100644 --- a/app/src/main/res/layout/fragment_home.xml +++ b/app/src/main/res/layout/fragment_home.xml @@ -6,6 +6,7 @@ android:layout_width="match_parent" android:clickable="true" android:layout_height="match_parent" + android:hapticFeedbackEnabled="true" tools:context=".ui.home.HomeFragment"> @@ -111,7 +112,7 @@ android:textColor="@color/mtrl_btn_text_color_selector" android:textColorHint="@color/mtrl_btn_text_color_selector" app:layout_constraintEnd_toEndOf="@+id/text_home" - app:layout_constraintHorizontal_bias="0.497" + app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toStartOf="@+id/text_home" app:layout_constraintTop_toBottomOf="@+id/ipInput" /> @@ -126,7 +127,7 @@ android:textColor="@color/mtrl_btn_text_color_selector" android:textColorHint="@color/mtrl_btn_text_color_selector" app:layout_constraintEnd_toEndOf="@+id/text_home" - app:layout_constraintHorizontal_bias="0.497" + app:layout_constraintHorizontal_bias="0.5" app:layout_constraintStart_toStartOf="@+id/text_home" app:layout_constraintTop_toBottomOf="@+id/loginuserInput" /> diff --git a/app/src/main/res/values-night/themes.xml b/app/src/main/res/values-night/themes.xml index 2d8ef2c..7606d0c 100644 --- a/app/src/main/res/values-night/themes.xml +++ b/app/src/main/res/values-night/themes.xml @@ -1,4 +1,4 @@ - + \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d87b525..8da752b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -43,17 +43,17 @@ //settings COLORS BACKGROUND - CHOOSE BACKGROUND + "CHOOSE\nBACKGROUND" LANGUAGE RESET SETTINGS RESET COLORSCHEME - RED\nBLUE - GREEN\nYELLOW - ORANGE\nTURQUOISE - YELLOW\nBLUE - PINK\nGREEN - RESET\nAPP + "RED\nBLUE" + "GREEN\nYELLOW" + "ORANGE\nTURQUOISE" + "YELLOW\nBLUE" + "PINK\nGREEN" + RESET APP ARE YOU SURE YOU WANT TO RESET THE APP AND DELETE ALL YOUR SETTINGS? //credits diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index cce32f6..e5f0af1 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -18,6 +18,7 @@ ?attr/colorPrimaryVariant + @drawable/button_round