Skip to content

Commit 034d1fd

Browse files
authored
Merge pull request #108 from dlyongemallo/master
Add {qolqoS} as a Klingon font option.
2 parents 4727dfb + 87fc79f commit 034d1fd

File tree

5 files changed

+20
-8
lines changed

5 files changed

+20
-8
lines changed
15.7 KB
Binary file not shown.

app/src/main/java/org/tlhInganHol/android/klingonassistant/KlingonAssistant.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public class KlingonAssistant extends BaseActivity {
5555
// These holds the {pIqaD} typefaces.
5656
private static Typeface mTNGKlingonFontTypeface = null;
5757
private static Typeface mDSCKlingonFontTypeface = null;
58+
private static Typeface mCoreKlingonFontTypeface = null;
5859

5960
// The two main views in app's main screen.
6061
private TextView mTextView;
@@ -147,13 +148,22 @@ private void handleIntent(Intent intent) {
147148
}
148149

149150
public static Typeface getKlingonFontTypeface(Context context) {
150-
if (Preferences.useDSCKlingonFont(context)) {
151+
String klingonFontCode = Preferences.getKlingonFontCode(context);
152+
if (klingonFontCode.equals("CORE")) {
153+
if (mCoreKlingonFontTypeface == null) {
154+
mCoreKlingonFontTypeface =
155+
Typeface.createFromAsset(context.getAssets(), "fonts/qolqoS-pIqaD.ttf");
156+
}
157+
return mCoreKlingonFontTypeface;
158+
} else if (klingonFontCode.equals("DSC")) {
151159
if (mDSCKlingonFontTypeface == null) {
152160
mDSCKlingonFontTypeface =
153161
Typeface.createFromAsset(context.getAssets(), "fonts/DSC-pIqaD.ttf");
154162
}
155163
return mDSCKlingonFontTypeface;
156164
} else {
165+
// Return TNG-style as the default as that's how we want to display the app name
166+
// when Latin is chosen.
157167
if (mTNGKlingonFontTypeface == null) {
158168
mTNGKlingonFontTypeface =
159169
Typeface.createFromAsset(context.getAssets(), "fonts/TNG-pIqaD.ttf");

app/src/main/java/org/tlhInganHol/android/klingonassistant/Preferences.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,14 +128,13 @@ public static boolean useKlingonUI(Context context) {
128128
public static boolean useKlingonFont(Context context) {
129129
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
130130
String value = sharedPrefs.getString(KEY_KLINGON_FONT_LIST_PREFERENCE, /* default */ "LATIN");
131-
return value.equals("TNG") || value.equals("DSC");
131+
return value.equals("TNG") || value.equals("DSC") || value.equals("CORE");
132132
}
133133

134-
// Whether the DSC font should be used instead of the TNG one.
135-
public static boolean useDSCKlingonFont(Context context) {
134+
// Returns which font should be used for Klingon: returns one of "LATIN", "TNG", "DSC", or "CORE".
135+
public static String getKlingonFontCode(Context context) {
136136
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
137-
String value = sharedPrefs.getString(KEY_KLINGON_FONT_LIST_PREFERENCE, /* default */ "LATIN");
138-
return value.equals("DSC");
137+
return sharedPrefs.getString(KEY_KLINGON_FONT_LIST_PREFERENCE, /* default */ "LATIN");
139138
}
140139

141140
@Override

app/src/main/res/values/arrays.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@
2424
<item>@string/font_latin</item>
2525
<item>@string/font_tng</item>
2626
<item>@string/font_dsc</item>
27+
<item>@string/font_core</item>
2728
</string-array>
2829

2930
<string-array name="klingonFontChoicesValues">
3031
<item>LATIN</item>
3132
<item>TNG</item>
3233
<item>DSC</item>
34+
<item>CORE</item>
3335
</string-array>
3436

3537
<!-- Note: These are sorted by completeness (languages in beta come after completed ones). -->

app/src/main/res/values/strings.xml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -182,8 +182,9 @@
182182

183183
<!-- Choices for showing Klingon text using {pIqaD}. -->
184184
<string name="font_latin">Off</string>
185-
<string name="font_tng">TNG {pIqaD}</string>
186-
<string name="font_dsc">DSC {pIqaD}</string>
185+
<string name="font_tng">TNG-style</string>
186+
<string name="font_dsc">DSC-style</string>
187+
<string name="font_core">{qolqoS}</string>
187188

188189
<!-- Choices for secondary languages. -->
189190
<string name="secondary_language_none">None</string>

0 commit comments

Comments
 (0)