mirror of
https://github.com/geometer/FBReaderJ.git
synced 2025-10-03 01:39:18 +02:00
toasts typeface
This commit is contained in:
parent
f9238179e6
commit
7f4ae72a1d
3 changed files with 14 additions and 1 deletions
|
@ -26,7 +26,9 @@ import android.os.Bundle;
|
|||
import com.github.johnpersano.supertoasts.SuperActivityToast;
|
||||
|
||||
import org.geometerplus.zlibrary.core.options.ZLIntegerOption;
|
||||
import org.geometerplus.zlibrary.core.options.ZLStringOption;
|
||||
import org.geometerplus.zlibrary.ui.android.library.*;
|
||||
import org.geometerplus.zlibrary.ui.android.view.AndroidFontUtil;
|
||||
|
||||
import org.geometerplus.android.fbreader.dict.DictionaryUtil;
|
||||
|
||||
|
@ -87,6 +89,11 @@ public abstract class FBReaderMainActivity extends Activity {
|
|||
final int dpFontSize = fontSize * 160 / dpi;
|
||||
toast.setTextSize(dpFontSize);
|
||||
toast.setButtonTextSize(dpFontSize * 7 / 8);
|
||||
|
||||
final String fontFamily =
|
||||
new ZLStringOption("Style", "Base:fontFamily", "sans-serif").getValue();
|
||||
toast.setTypeface(AndroidFontUtil.systemTypeface(fontFamily, false, false));
|
||||
|
||||
runOnUiThread(new Runnable() {
|
||||
public void run() {
|
||||
toast.show();
|
||||
|
|
|
@ -175,7 +175,7 @@ public final class AndroidFontUtil {
|
|||
}
|
||||
}
|
||||
|
||||
private static Typeface systemTypeface(String family, boolean bold, boolean italic) {
|
||||
public static Typeface systemTypeface(String family, boolean bold, boolean italic) {
|
||||
family = realFontFamilyName(family);
|
||||
final int style = (bold ? Typeface.BOLD : 0) | (italic ? Typeface.ITALIC : 0);
|
||||
Typeface[] typefaces = ourTypefaces.get(family);
|
||||
|
|
|
@ -336,6 +336,12 @@ public class SuperActivityToast {
|
|||
|
||||
}
|
||||
|
||||
public void setTypeface(Typeface typeface) {
|
||||
if (typeface != null) {
|
||||
mMessageTextView.setTypeface(typeface);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the message typeface style of the {@value #TAG}.
|
||||
*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue