some more bugfixes, cleanup and translation

This commit is contained in:
JG-Cody 2021-07-10 18:49:00 +02:00
parent 18c5e2f0ed
commit d129f43c33
4 changed files with 106 additions and 96 deletions

View File

@ -63,6 +63,7 @@ import java.util.Map;
import java.util.Objects;
import java.util.Set;
import de.jg_cody.Teraplex.ui.Credits.CreditsFragment;
import de.jg_cody.Teraplex.ui.Einstellungen.EinstellungenFragment;
import de.jg_cody.Teraplex.ui.Tabs.TabsFragment;
import de.jg_cody.Teraplex.ui.rooms.ListAdapter;
@ -385,7 +386,7 @@ public class MainActivity extends AppCompatActivity {
public void menurighttopabout(MenuItem i) {
Fragment currentFragment = getSupportFragmentManager().findFragmentById(R.id.nav_host_fragment);
NavHostFragment nhf = (NavHostFragment) currentFragment;
nhf.getChildFragmentManager().beginTransaction().replace(R.id.nav_host_fragment, new EinstellungenFragment()).commit();
nhf.getChildFragmentManager().beginTransaction().replace(R.id.nav_host_fragment, new CreditsFragment()).commit();
Objects.requireNonNull(getSupportActionBar()).setTitle(R.string.menu_about);
}

View File

@ -171,10 +171,10 @@ public class EinstellungenFragment extends Fragment {
}
private void showChangeLanguageDialog() {
final String[] listItems = {"GERMAN", "ENGLISCH", "KLINGONISCH"};
final String[] listItems = {"GERMAN", "ENGLISCH"};
AlertDialog.Builder mBuilder = new AlertDialog.Builder(getContext());
mBuilder.setTitle("CHOOSE LANGUAGE");
mBuilder.setSingleChoiceItems(listItems, -5, new DialogInterface.OnClickListener() {
mBuilder.setSingleChoiceItems(listItems, -1, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
if (i == 0) {
@ -185,10 +185,6 @@ public class EinstellungenFragment extends Fragment {
setLocale("en");
startActivity(requireActivity().getIntent());
requireActivity().finish();
} else if (i == 2) {
setLocale("tlh");
startActivity(requireActivity().getIntent());
requireActivity().finish();
}
dialogInterface.dismiss();
}

View File

@ -65,7 +65,20 @@ public class KonsoleFragment extends Fragment {
public void onClick(View v) {
try {
if (befehlInput.getText().toString().trim().length() == 0) {
Toast.makeText(getContext(), "Feld darf nicht leer sein!", Toast.LENGTH_SHORT).show();
MediaPlayer mp = MediaPlayer.create(getContext(), R.raw.state_change_confirm_up);
mp.start();
AlertDialog mDialog = new AlertDialog.Builder(getContext())
.setTitle("UNGÜLTIGE EINGABE")
.setMessage("EINGABEFELDER DÜRFEN NICHT LEER SEIN")
// Specifying a listener allows you to take an action before dismissing the dialog.
// The dialog is automatically dismissed when a dialog button is clicked.
.setPositiveButton(android.R.string.yes, null )
.create();
Objects.requireNonNull(mDialog.getWindow()).setBackgroundDrawableResource(R.drawable.button_round);
mDialog.getWindow().getAttributes().windowAnimations = R.style.DialogAnimation; //style id
mDialog.show();
return;
} else {
command = befehlInput.getText().toString();
Toast.makeText(getContext(), "Kommando gesendet...", Toast.LENGTH_SHORT).show();

View File

@ -29,30 +29,30 @@
android:clickable="true"
tools:context=".ui.Credits.CreditsFragment">
<ImageView
android:id="@drawable/backgroundoverlay"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="-25dp"
android:layout_marginLeft="-25dp"
android:layout_marginTop="-25dp"
android:layout_marginEnd="-25dp"
android:layout_marginRight="-25dp"
android:layout_marginBottom="-25dp"
android:scaleType="centerCrop"
android:src="@drawable/backgroundoverlay"
app:layout_constraintBottom_toBottomOf="@+id/button_reset"
app:layout_constraintEnd_toEndOf="@+id/button_theme_red_blue"
app:layout_constraintStart_toStartOf="@+id/themes"
app:layout_constraintTop_toTopOf="@+id/button_theme_red_blue"
app:layout_constraintVertical_bias="0.0" />
<ImageView
android:id="@drawable/backgroundoverlay"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="-25dp"
android:layout_marginLeft="-25dp"
android:layout_marginTop="-25dp"
android:layout_marginEnd="-25dp"
android:layout_marginRight="-25dp"
android:layout_marginBottom="-25dp"
android:scaleType="centerCrop"
android:src="@drawable/backgroundoverlay"
app:layout_constraintBottom_toBottomOf="@+id/button_reset"
app:layout_constraintEnd_toEndOf="@+id/button_theme_red_blue"
app:layout_constraintStart_toStartOf="@+id/themes"
app:layout_constraintTop_toTopOf="@+id/button_theme_red_blue"
app:layout_constraintVertical_bias="0.0" />
<TextView
android:id="@+id/background"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginLeft="50dp"
android:layout_marginStart="35dp"
android:layout_marginLeft="35dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:gravity="center_horizontal|left"
@ -65,31 +65,31 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/button_pickimage" />
<TextView
android:id="@+id/themes"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginLeft="50dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:gravity="center_horizontal|left"
android:text="@string/themes"
android:textAlignment="center"
android:textColor="@color/mtrl_btn_text_color_selector"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@+id/button_theme_pink_green"
app:layout_constraintEnd_toStartOf="@+id/button_theme_red_blue"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/button_theme_red_blue" />
<TextView
android:id="@+id/themes"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="35dp"
android:layout_marginLeft="35dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:gravity="center_horizontal|left"
android:text="@string/themes"
android:textAlignment="center"
android:textColor="@color/mtrl_btn_text_color_selector"
android:textSize="18sp"
app:layout_constraintBottom_toBottomOf="@+id/button_theme_pink_green"
app:layout_constraintEnd_toStartOf="@+id/button_theme_red_blue"
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/button_theme_red_blue" />
<TextView
android:id="@+id/sprache"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginLeft="50dp"
android:layout_marginStart="35dp"
android:layout_marginLeft="35dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:gravity="center_horizontal|left"
@ -106,8 +106,8 @@
android:id="@+id/reset_settings"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="50dp"
android:layout_marginLeft="50dp"
android:layout_marginStart="35dp"
android:layout_marginLeft="35dp"
android:layout_marginEnd="10dp"
android:layout_marginRight="10dp"
android:gravity="center_horizontal|left"
@ -120,26 +120,26 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/button_reset" />
<Button
android:id="@+id/button_reset"
android:layout_width="140dp"
android:layout_height="55dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:background="@drawable/button_round"
android:text="@string/button_reset"
app:backgroundTint="@null"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider3" />
<Button
android:id="@+id/button_reset"
android:layout_width="140dp"
android:layout_height="55dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_round"
android:text="@string/button_reset"
app:backgroundTint="@null"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider3" />
<Button
android:id="@+id/button_theme_red_blue"
android:layout_width="140dp"
android:layout_height="55dp"
android:layout_marginTop="125dp"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_theme_red_blue"
android:text="@string/red_blue"
app:backgroundTint="@null"
@ -152,8 +152,8 @@
android:layout_width="140dp"
android:layout_height="55dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_theme_orange_turquoise"
android:text="@string/orange_turquoise"
app:backgroundTint="@null"
@ -166,8 +166,8 @@
android:layout_width="140dp"
android:layout_height="55dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_theme_yellow_blue"
android:text="@string/yellow_blue"
app:backgroundTint="@null"
@ -180,8 +180,8 @@
android:layout_width="140dp"
android:layout_height="55dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_theme_pink_green"
android:text="@string/pink_green"
app:backgroundTint="@null"
@ -193,8 +193,8 @@
android:layout_width="140dp"
android:layout_height="55dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_theme_green_yellow"
android:text="@string/green_yellow"
app:backgroundTint="@null"
@ -203,32 +203,32 @@
app:layout_constraintTop_toBottomOf="@+id/button_theme_red_blue" />
<Button
android:id="@+id/button_language"
android:layout_width="140dp"
android:layout_height="55dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:background="@drawable/button_round"
android:text="@string/language"
app:backgroundTint="@null"
app:layout_constraintBottom_toTopOf="@+id/divider3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider" />
android:id="@+id/button_language"
android:layout_width="140dp"
android:layout_height="55dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_round"
android:text="@string/language"
app:backgroundTint="@null"
app:layout_constraintBottom_toTopOf="@+id/divider3"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider" />
<Button
android:id="@+id/button_pickimage"
android:layout_width="140dp"
android:layout_height="55dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="50dp"
android:layout_marginRight="50dp"
android:background="@drawable/button_round"
android:text="@string/button_choose_background"
app:backgroundTint="@null"
app:layout_constraintBottom_toTopOf="@+id/divider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider2" />
<Button
android:id="@+id/button_pickimage"
android:layout_width="140dp"
android:layout_height="55dp"
android:layout_marginTop="10dp"
android:layout_marginEnd="35dp"
android:layout_marginRight="35dp"
android:background="@drawable/button_round"
android:text="@string/button_choose_background"
app:backgroundTint="@null"
app:layout_constraintBottom_toTopOf="@+id/divider"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/divider2" />
<View
android:id="@+id/divider"