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

@ -51,8 +51,8 @@
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"
@ -69,8 +69,8 @@
android:id="@+id/themes"
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"
@ -88,8 +88,8 @@
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"
@ -125,8 +125,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_round"
android:text="@string/button_reset"
app:backgroundTint="@null"
@ -138,8 +138,8 @@
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"
@ -207,8 +207,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_round"
android:text="@string/language"
app:backgroundTint="@null"
@ -221,8 +221,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_round"
android:text="@string/button_choose_background"
app:backgroundTint="@null"