Quellcode durchsuchen

[공통][Bug] 폰트 적용: Bold 적용

hyodong.min vor 7 Jahren
Ursprung
Commit
370761d2a2

+ 13 - 3
app/src/main/java/kr/co/zumo/app/lifeplus/supervisor/TypefaceUtil.java

@@ -6,6 +6,7 @@ package kr.co.zumo.app.lifeplus.supervisor;
 import android.content.Context;
 import android.graphics.Typeface;
 import android.support.v4.content.res.ResourcesCompat;
+import android.util.Log;
 
 import java.lang.reflect.Field;
 import java.util.HashMap;
@@ -35,20 +36,28 @@ public class TypefaceUtil {
   //  private static final String REGULAR_FONT_FILE = "/system/fonts/droid_sans.ttf"; // 사용 가능하지만 없는 유저도 있을 수 있어서 asset 에 임베딩
 
   private static final String FONT_DEFAULT = "DEFAULT";
+  private static final String FONT_DEFAULT_BOLD = "DEFAULT_BOLD";
+  private static final String FONT_SERIF = "SERIF";
+  private static final String FONT_SANS_SERIF = "SANS_SERIF";
+  private static final String FONT_MONOSPACE = "MONOSPACE";
 
   public void init(Context context) {
     try {
 //      Typeface regular = createFont(context, REGULAR_FONT_ASSET_NAME);
 //      Typeface medium = createFont(context, MEDIUM_FONT_ASSET_NAME);
       Typeface regular = ResourcesCompat.getFont(context, R.font.droid_sans);
-      Typeface medium = ResourcesCompat.getFont(context, R.font.bmyeonsung);
+//      Typeface medium = ResourcesCompat.getFont(context, R.font.bmyeonsung);
 
       Map<String, Typeface> fonts = new HashMap<>();
-      fonts.put(context.getString(R.string.lifeplus_font1), regular);
-      fonts.put(context.getString(R.string.lifeplus_font2), medium);
+      fonts.put(context.getString(R.string.lifeplus_font_sans_serif), regular);
+      fonts.put(context.getString(R.string.lifeplus_font_serif), regular);
       overrideFonts(fonts);
 
       overrideFont(FONT_DEFAULT, regular);
+      overrideFont(FONT_SERIF, regular);
+      overrideFont(FONT_SANS_SERIF, regular);
+      overrideFont(FONT_MONOSPACE, regular);
+      overrideFont(FONT_DEFAULT_BOLD, regular);
     } catch (Exception e) {
       e.printStackTrace();
     }
@@ -85,6 +94,7 @@ public class TypefaceUtil {
       Map<String, Typeface> oldFonts = new HashMap<>();
 
       for (Map.Entry<?, ?> entry : tempMap.entrySet()) {
+        Log.w("APP# TypefaceUtil | overrideFonts", "|" + entry.getKey());
         oldFonts.put((String) entry.getKey(), (Typeface) entry.getValue());
       }
 

+ 2 - 0
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/auth/MobileAuthView.java

@@ -149,6 +149,7 @@ public class MobileAuthView extends ConstraintLayout implements IMobileAuthContr
       checkBoxAllDriver.applyCheckAll(b);
       presenter.onAllAgreeCheckedChanged(b);
     });
+//    checkBoxAllAgree.setTypeface(ResourcesCompat.getFont(context, R.font.font1));
 
     // 약관 동의
     int len = 4;
@@ -163,6 +164,7 @@ public class MobileAuthView extends ConstraintLayout implements IMobileAuthContr
         checkBoxAllDriver.check();
         presenter.onAgreeCheckedChanged(index, b);
       });
+//      checkBox.setTypeface(ResourcesCompat.getFont(context, R.font.font1));
 
       button = findViewById(ResourceUtil.getId("button_identify_agree" + (i + 1)));
       button.setOnClickListener(v1 -> {

+ 2 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/view/fragment/signup/SignUpAgreeFragment.java

@@ -7,7 +7,6 @@ import android.util.Log;
 import android.view.LayoutInflater;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.Button;
 import android.widget.CheckBox;
 
 import java.util.List;
@@ -129,6 +128,7 @@ public class SignUpAgreeFragment extends FragmentBase<SignUpAgreePresenter> impl
         checkBoxAllDriver.check();
         notifyAgreeChanged();
       });
+//      checkBox.setTypeface(ResourcesCompat.getFont(getContext(), R.font.font1));
       int index = i;
       view = parent.findViewById(ResourceUtil.getId("agree_detail_button" + i));
       view.setOnClickListener(v -> {
@@ -140,6 +140,7 @@ public class SignUpAgreeFragment extends FragmentBase<SignUpAgreePresenter> impl
     buttonAgree.setOnClickListener(v -> {
       presenter.onEvent(new Event.Builder(Event.SUCCESS).build());
     });
+//    checkBoxAll.setTypeface(ResourcesCompat.getFont(getContext(), R.font.font1));
   }
 
   @Override

+ 20 - 1
app/src/main/res/font/font2.xml

@@ -1,6 +1,26 @@
 <?xml version="1.0" encoding="utf-8"?>
 <font-family xmlns:android="http://schemas.android.com/apk/res/android"
              xmlns:app="http://schemas.android.com/apk/res-auto">
+
+  <!-- normal -->
+  <font
+    android:font="@font/bmyeonsung"
+    android:fontStyle="normal"
+    android:fontWeight="400"
+    app:font="@font/bmyeonsung"
+    app:fontStyle="normal"
+    app:fontWeight="400"/>
+
+  <!-- italic -->
+  <font
+    android:font="@font/bmyeonsung"
+    android:fontStyle="italic"
+    android:fontWeight="400"
+    app:font="@font/bmyeonsung"
+    app:fontStyle="italic"
+    app:fontWeight="400"/>
+
+  <!-- bold -->
   <font
     android:font="@font/bmyeonsung"
     android:fontStyle="normal"
@@ -8,5 +28,4 @@
     app:font="@font/bmyeonsung"
     app:fontStyle="normal"
     app:fontWeight="700"/>
-
 </font-family>

+ 4 - 2
app/src/main/res/values/strings.xml

@@ -4,8 +4,10 @@
   ]>
 
 <resources>
-  <string name="lifeplus_font1" translatable="false">lifeplus_font1</string>
-  <string name="lifeplus_font2" translatable="false">lifeplus_font2</string>
+  <!--<string name="lifeplus_font1" translatable="false">lifeplus_font1</string>-->
+  <!--<string name="lifeplus_font2" translatable="false">lifeplus_font2</string>-->
+  <string name="lifeplus_font_serif" translatable="false">serif</string>
+  <string name="lifeplus_font_sans_serif" translatable="false">sans-serif</string>
 
   <string name="empty_string" translatable="false"/>
   <string name="confirm">확인</string>

+ 1 - 6
app/src/main/res/values/styles.xml

@@ -15,6 +15,7 @@
     <item name="colorPrimary">@color/CFFFFFF</item>
     <item name="colorPrimaryDark">@color/C000000</item>
     <item name="colorAccent">@color/C000000</item>
+    <!--<item name="android:fontFamily">@font/font1</item>--> <!-- Toast 에 적용이 안된다. -->
   </style>
 
   <style name="FullScreenDialog" parent="Theme.AppCompat.Light.Dialog">
@@ -23,7 +24,6 @@
     <item name="android:padding">0dp</item>
     <item name="android:windowIsFloating">false</item>
     <item name="android:windowBackground">@android:color/transparent</item>
-    <item name="android:fontFamily">@string/lifeplus_font2</item>
   </style>
 
   <style name="SignUpButton" parent="@android:style/Widget.DeviceDefault.Button.Borderless">
@@ -40,7 +40,6 @@
     <item name="android:layout_marginStart">2dp</item>
     <item name="android:layout_marginEnd">2dp</item>
     <item name="android:textAllCaps">false</item>
-    <item name="android:fontFamily">@string/lifeplus_font2</item>
   </style>
 
   <style name="PinButton" parent="@android:style/Widget.DeviceDefault.Button.Borderless">
@@ -59,8 +58,4 @@
     <item name="android:gravity">center</item>
     <item name="android:lineSpacingExtra">9sp</item>
   </style>
-
-  <style name="font2">
-    <item name="android:fontFamily">@string/lifeplus_font2</item>
-  </style>
 </resources>