Skip to content

Commit

Permalink
Merge 1301e5a into 6207010
Browse files Browse the repository at this point in the history
  • Loading branch information
jmizv authored Jan 29, 2023
2 parents 6207010 + 1301e5a commit e4633bf
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 25 deletions.
13 changes: 9 additions & 4 deletions app/src/main/java/de/xskat/Translations.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ public class Translations {
// --------------------------------------------------------------------------------------

private final static String[][] TRANSLATIONS = { // DE, EN
{"Null", "Null"}, // XT_Null
{"Null", "Null"}, // XT_Null / 0
{"Karo", "Diamond"}, // XT_Karo
{"Herz", "Heart"}, // XT_Herz
{"Pik", "Spade"}, // XT_Pik
Expand All @@ -16,10 +16,10 @@ public class Translations {
{"Sortiere für Null", "Sort for Null"}, // XT_Sortiere_fuer_Null
{"Sortiere normal", "Sort normally"}, // XT_Sortiere_normal
{"Gereizt bis", "It was bid"}, // XT_Gereizt_bis
{"Androido", "Androido"}, // XT_Androido
{"Androido", "Androido"}, // XT_Androido / 10
{"Androida", "Androida"}, // XT_Androida
{"spielt", "plays"}, // XT_spielt
{"Hand", "Hand"}, // XT_Hand
{"Hand", "Hand"}, // XT_Hand / 13
{"für", "for"}, // XT_fuer
{"Spitze", "Spitze"}, // XT_Spitze
{"Annehmen", "Accept"}, // XT_Annehmen
Expand Down Expand Up @@ -143,6 +143,8 @@ public class Translations {
{"Insgesamt", "Total"}, // XT_Total / 131
{"Normal", "Normal"}, // XT_Normal / 132
{"Ouv. H.", "Ouv. H."}, // XT_Ouvert_Hand / 133
{"Gedrückt", "Cards put down"}, // XT_Gedrueckt / 134
{"Hand gespielt", "Played hand"} // XT_Hand_gespielt / 135
};

public static final int XT_Null = 0;
Expand All @@ -166,7 +168,8 @@ public class Translations {
public static final int XT_Passe = 18;
public static final int XT_Im_Skat = 19;
public static final int XT_war = 20;
public static final int XT_ist = 21;
@Deprecated
private static final int XT_ist = 21;
public static final int XT_Eine_Jungfrau = 22;
public static final int XT_Durchmarsch = 23;
public static final int XT_Ueberreizt = 24;
Expand Down Expand Up @@ -279,6 +282,8 @@ public class Translations {
public static final int XT_Total= 131;
public static final int XT_Normal = 132;
public static final int XT_Ouvert_Hand = 133;
public static final int XT_Gedrueckt = 134;
public static final int XT_Hand_gespielt = 135;

public static String getTranslation(int key, int currentLanguage) {
return TRANSLATIONS[key][currentLanguage];
Expand Down
57 changes: 43 additions & 14 deletions app/src/main/java/de/xskat/XSkat.java
Original file line number Diff line number Diff line change
Expand Up @@ -1789,6 +1789,10 @@ void initDialogs() {
setTextSize(R.id.textImSkatIst2);
setTextSize(R.id.textImSkatIst3);
setTextSize(R.id.textImSkatIst4);
setTextSize(R.id.textGedrueckt1);
setTextSize(R.id.textGedrueckt2);
setTextSize(R.id.textGedrueckt3);
setTextSize(R.id.textGedrueckt4);
setDeselectedAndSize(R.id.buttonProtoListe);
setDeselectedAndSize(R.id.buttonProtoOK);
setDeselectedAndSize(R.id.buttonProtoPfeil);
Expand Down Expand Up @@ -7791,26 +7795,51 @@ void prot_fun(int sn) {
}
}
}
im_skat(protsort[sn] ? 0 : 1);
String textInSkatWas = getTranslation(Translations.XT_Im_Skat) + " " + getTranslation(Translations.XT_war) + ": ";
im_skat(textInSkatWas, 0, R.id.textImSkatIst1, R.id.textImSkatIst2, R.id.textImSkatIst4);
if (prot1.handsp) {
// DRY: Don't repeat yourself
TextView tv = findViewById(R.id.textGedrueckt1);
tv.setText(getTranslation(Translations.XT_Hand_gespielt));
tv = findViewById(R.id.textGedrueckt2);
tv.setText("");
tv = findViewById(R.id.textGedrueckt3);
tv.setText("");
tv = findViewById(R.id.textGedrueckt4);
tv.setText("");
} else if (GameType.isRamsch(prot1.trumpf)) {
// don't show the info when Ramsch
TextView tv = findViewById(R.id.textGedrueckt1);
tv.setText("");
tv = findViewById(R.id.textGedrueckt2);
tv.setText("");
tv = findViewById(R.id.textGedrueckt3);
tv.setText("");
tv = findViewById(R.id.textGedrueckt4);
tv.setText("");
} else {
String textCardsPutDown = getTranslation(Translations.XT_Gedrueckt) + ": ";
im_skat(textCardsPutDown, 1, R.id.textGedrueckt1, R.id.textGedrueckt2, R.id.textGedrueckt4);
TextView tv = findViewById(R.id.textGedrueckt3);
tv.setText(", ");
}
}

void im_skat(int i) {
String s = getTranslation(Translations.XT_Im_Skat) + " " + (i == 0 ? getTranslation(Translations.XT_war) : getTranslation(Translations.XT_ist))
+ ": ";
TextView tv = (TextView) findViewById(R.id.textImSkatIst1);
tv.setText(s);
s = gameName(prot1.skat[i][0] >> 3);
void im_skat(String text, int mode, int elem1, int elem2, int elem4) {
TextView tv = findViewById(elem1);
tv.setText(text);
String s = gameName(prot1.skat[mode][0] >> 3);
s += " ";
s += cardVal(prot1.skat[i][0] & 7);
tv = (TextView) findViewById(R.id.textImSkatIst2);
s += cardVal(prot1.skat[mode][0] & 7);
tv = findViewById(elem2);
tv.setText(s);
tv.setTextColor(Color.parseColor(suitCol(prot1.skat[i][0] >> 3)));
s = gameName(prot1.skat[i][1] >> 3);
tv.setTextColor(Color.parseColor(suitCol(prot1.skat[mode][0] >> 3)));
s = gameName(prot1.skat[mode][1] >> 3);
s += " ";
s += cardVal(prot1.skat[i][1] & 7);
tv = (TextView) findViewById(R.id.textImSkatIst4);
s += cardVal(prot1.skat[mode][1] & 7);
tv = findViewById(elem4);
tv.setText(s);
tv.setTextColor(Color.parseColor(suitCol(prot1.skat[i][1] >> 3)));
tv.setTextColor(Color.parseColor(suitCol(prot1.skat[mode][1] >> 3)));
}

void di_proto(int sn, boolean ini, boolean log) {
Expand Down
46 changes: 39 additions & 7 deletions app/src/main/res/layout/dialogproto.xml
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,7 @@
android:layout_height="0dp"
android:layout_weight="2" >

<Button
android:layout_width="0dp"
<Button android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="clickedSpace"
Expand All @@ -353,27 +352,60 @@
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="#Im Skat ist: " />

<TextView
android:id="@+id/textImSkatIst2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Kreuz 7" />

<TextView
android:id="@+id/textImSkatIst3"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text=", " />

<TextView
android:id="@+id/textImSkatIst4"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Pik 8" />

<Button
android:layout_width="0dp"
<Button android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="clickedSpace"
android:visibility="invisible" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2" >
<Button android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="clickedSpace"
android:visibility="invisible" />

<TextView
android:id="@+id/textGedrueckt1"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="#Gedrueckt war: " />
<TextView
android:id="@+id/textGedrueckt2"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Kreuz 7" />
<TextView
android:id="@+id/textGedrueckt3"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text=", " />
<TextView
android:id="@+id/textGedrueckt4"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:text="Pik 8" />

<Button android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:onClick="clickedSpace"
Expand Down

0 comments on commit e4633bf

Please sign in to comment.