Merge "LayoutLib: finish Typeface and unload them in dispose." into honeycomb

This commit is contained in:
Xavier Ducrohet
2011-01-09 11:05:20 -08:00
committed by Android (Google) Code Review
3 changed files with 11 additions and 5 deletions

View File

@@ -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) {

View File

@@ -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;
}

View File

@@ -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