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

Commit c0c4243e authored by Deepanshu Gupta's avatar Deepanshu Gupta Committed by Android (Google) Code Review
Browse files

Merge "Fix layoutlib by avoiding Java7 calls"

parents b2e0733f 857ba4af
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -1625,7 +1625,7 @@ public class Resources {

            String locale = null;
            if (mConfiguration.locale != null) {
                locale = mConfiguration.locale.toLanguageTag();
                locale = localeToLanguageTag(mConfiguration.locale);
            }
            int width, height;
            if (mMetrics.widthPixels >= mMetrics.heightPixels) {
@@ -1706,6 +1706,12 @@ public class Resources {
        }
    }

    // Locale.toLanguageTag() is not available in Java6. LayoutLib overrides
    // this method to enable users to use Java6.
    private String localeToLanguageTag(Locale locale) {
        return locale.toLanguageTag();
    }

    /**
     * Update the system resources configuration if they have previously
     * been initialized.
+1 −1
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ public final class BridgeTypedArray extends TypedArray {

    public BridgeTypedArray(BridgeResources resources, BridgeContext context, int len,
            boolean platformFile) {
        super(null, null, null, 0);
        super(resources, null, null, 0);
        mBridgeResources = resources;
        mContext = context;
        mPlatformFile = platformFile;
+37 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2014 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.content.res;

import java.util.Locale;

import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
import com.ibm.icu.util.ULocale;

/**
 * Delegate used to provide new implementation of a select few methods of {@link Resources}
 *
 * Through the layoutlib_create tool, the original  methods of Resources have been replaced
 * by calls to methods of the same name in this delegate class.
 *
 */
public class Resources_Delegate {

    @LayoutlibDelegate
    /*package*/ static String localeToLanguageTag(Resources res, Locale locale)  {
        return ULocale.forLocale(locale).toLanguageTag();
    }
}
+1 −0
Original line number Diff line number Diff line
@@ -125,6 +125,7 @@ public final class CreateInfo implements ICreateInfo {
        "android.app.Fragment#instantiate", //(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;)Landroid/app/Fragment;",
        "android.content.res.Resources$Theme#obtainStyledAttributes",
        "android.content.res.Resources$Theme#resolveAttribute",
        "android.content.res.Resources#localeToLanguageTag",
        "android.content.res.TypedArray#getValueAt",
        "android.graphics.BitmapFactory#finishDecode",
        "android.os.Handler#sendMessageAtTime",