e4aae1ae21c762f2499bb144769d6141c22db080
[platform/framework/web/crosswalk.git] / src / xwalk / app / android / runtime_client / src / org / xwalk / app / runtime / XWalkRuntimeApplication.java
1 // Copyright (c) 2014 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 package org.xwalk.app.runtime;
6
7 import android.app.Application;
8 import android.content.res.Resources;
9
10 /**
11  * XWalkRuntimeApplication is to support cross package resource loading.
12  * It provides method to allow overriding getResources() behavior.
13  */
14 public class XWalkRuntimeApplication extends Application {
15     private Resources mRes = null;
16
17     @Override
18     public Resources getResources() {
19         return mRes == null ? super.getResources() : mRes;
20     }
21
22     void addResource(Resources res) {
23         if (mRes != null) return;
24         mRes = new XWalkMixedResources(super.getResources(), res);
25     }
26 }