TerminalView: Make theming work for non-activities

This commit is contained in:
Fredrik Fornwall
2015-12-20 14:37:00 +01:00
parent b0f4efb0bc
commit f153a72592

View File

@@ -717,10 +717,10 @@ public final class TerminalView extends View {
@Override @Override
public void run() { public void run() {
try { try {
File fontFile = new File(getContext().getFilesDir().getPath() + "/home/.termux/font.ttf"); File fontFile = new File("/data/data/com.termux/files/home/.termux/font.ttf");
final Typeface newTypeface = fontFile.exists() ? Typeface.createFromFile(fontFile) : Typeface.MONOSPACE; final Typeface newTypeface = fontFile.exists() ? Typeface.createFromFile(fontFile) : Typeface.MONOSPACE;
if (newTypeface != mRenderer.mTypeface) { if (newTypeface != mRenderer.mTypeface) {
((Activity) getContext()).runOnUiThread(new Runnable() { post(new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {
@@ -745,14 +745,14 @@ public final class TerminalView extends View {
@Override @Override
public void run() { public void run() {
try { try {
File colorsFile = new File(getContext().getFilesDir().getPath() + "/home/.termux/colors.properties"); File colorsFile = new File("/data/data/com.termux/files/home/.termux/colors.properties");
final Properties props = colorsFile.isFile() ? new Properties() : null; final Properties props = colorsFile.isFile() ? new Properties() : null;
if (props != null) { if (props != null) {
try (InputStream in = new FileInputStream(colorsFile)) { try (InputStream in = new FileInputStream(colorsFile)) {
props.load(in); props.load(in);
} }
} }
((Activity) getContext()).runOnUiThread(new Runnable() { post(new Runnable() {
@Override @Override
public void run() { public void run() {
try { try {