Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 46a32924 authored by Xavier Ducrohet's avatar Xavier Ducrohet
Browse files

LayoutLib: finish Typeface and unload them in dispose.

Change-Id: I3a48f84678f62d669d303fc73b041bb3fe5f333b
parent 7550ec1d
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -16,6 +16,7 @@

package android.graphics;

import com.android.layoutlib.bridge.Bridge;
import com.android.layoutlib.bridge.impl.DelegateManager;
import com.android.layoutlib.bridge.impl.FontLoader;

@@ -84,7 +85,6 @@ public final class Typeface_Delegate {
        return delegate.mFonts;
    }


    // ---- native methods ----

    /*package*/ static synchronized int nativeCreate(String familyName, int style) {
@@ -125,13 +125,13 @@ public final class Typeface_Delegate {
    }

    /*package*/ static synchronized int nativeCreateFromAsset(AssetManager mgr, String path) {
        // FIXME
        throw new UnsupportedOperationException("Native delegate needed: Typeface_Delegate.nativeCreateFromAsset");
        Bridge.getLog().fidelityWarning(null, "Typeface.createFromAsset() is not supported.", null);
        return 0;
    }

    /*package*/ static synchronized int nativeCreateFromFile(String path) {
        // FIXME
        throw new UnsupportedOperationException("Native delegate needed: Typeface_Delegate.nativeCreateFromFile");
        Bridge.getLog().fidelityWarning(null, "Typeface.createFromFile() is not supported.", null);
        return 0;
    }

    /*package*/ static void nativeUnref(int native_instance) {
+5 −0
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ import com.android.tools.layoutlib.create.MethodAdapter;
import com.android.tools.layoutlib.create.OverrideMethod;

import android.graphics.Bitmap;
import android.graphics.Typeface;
import android.graphics.Typeface_Delegate;
import android.os.Looper;

@@ -283,6 +284,10 @@ public final class Bridge extends com.android.ide.common.rendering.api.Bridge {
    @Override
    public boolean dispose() {
        BridgeAssetManager.clearSystem();

        // dispose of the default typeface.
        Typeface.sDefaults = null;

        return true;
    }

+1 −0
Original line number Diff line number Diff line
@@ -344,6 +344,7 @@ public class RenderSessionImpl {
            info.mHasWindowFocus = true;
            info.mWindowVisibility = View.VISIBLE;
            info.mInTouchMode = false; // this is so that we can display selections.
            info.mHardwareAccelerated = false;
            mViewRoot.dispatchAttachedToWindow(info, 0);

            // get the background drawable